Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misuse of IPersistencePlugin #631

Closed
Qiao-Jin opened this issue Aug 18, 2021 · 0 comments · Fixed by #632
Closed

Misuse of IPersistencePlugin #631

Qiao-Jin opened this issue Aug 18, 2021 · 0 comments · Fixed by #632

Comments

@Qiao-Jin
Copy link
Contributor

IPersistencePlugin is invented to allow plugins to observe the persisted blocks. There are currently several plugins implementing this interface. However, misuses exist within them.

According to neo-project/neo#568:

If there are multiple persistence plugins loaded and one of them throws an exception, then none of them should actually commit anything to a persistent store. To facilitate this behavior, I added an OnCommit method to be called after all plugins have had a chance to process results from OnPersist and throw if something was wrong.
A persistence plugin implementing IPersistencePlugin should do any processing needed to stage data to persist in its OnPersist method, and then perform actual persistence in its OnCommit method. In this way database integrity is maximized.

IPersistencePlugin should not persist data directly in OnPersist. But such practises do exist in LogReader & StatePlugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant