Skip to content

refactor: rewrite managed to support panic rollback#136

Merged
xujiajun merged 1 commit intonutsdb:masterfrom
ag9920:managed_panic_rollback
Apr 2, 2022
Merged

refactor: rewrite managed to support panic rollback#136
xujiajun merged 1 commit intonutsdb:masterfrom
ag9920:managed_panic_rollback

Conversation

@ag9920
Copy link
Copy Markdown
Contributor

@ag9920 ag9920 commented Apr 2, 2022

View and Update internally depend on managed function to ensure a block of codes were contained in a transaction.
Currently NutsDB will check the err returned by fn and Commit, if any of them is not nil, tx.Rollback() will be called.

But if a panic occurred within managed, we could not rollback the transaction. This PR rewrite managed with defer check to make sure tx.Rollback() gets called.

@ag9920 ag9920 changed the title WIP refactor: rewrite managed to support panic rollback refactor: rewrite managed to support panic rollback Apr 2, 2022
@ag9920 ag9920 force-pushed the managed_panic_rollback branch from 2de09f3 to fe65852 Compare April 2, 2022 11:27
@xujiajun xujiajun self-requested a review April 2, 2022 14:21
Copy link
Copy Markdown
Member

@xujiajun xujiajun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @ag9920 👍

@xujiajun xujiajun merged commit ac1dab0 into nutsdb:master Apr 2, 2022
@xujiajun xujiajun mentioned this pull request Jun 17, 2022
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 this pull request may close these issues.

2 participants