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

Simplify the prepare/commit phases to just try_commit #350

Closed
aakoshh opened this issue Feb 10, 2023 · 0 comments · Fixed by consensus-shipyard/fendermint#26
Closed

Simplify the prepare/commit phases to just try_commit #350

aakoshh opened this issue Feb 10, 2023 · 0 comments · Fixed by consensus-shipyard/fendermint#26

Comments

@aakoshh
Copy link
Contributor

aakoshh commented Feb 10, 2023

A followup on #287

According to the RocksDB documentation, for OptimisticTransactionDB:

  • commit: will commit changes unless there is a conflict, in which case it will return Busy
  • prepare: writes to the WAL, so commit is simple, as the cost of making rollback more costly; it doesn't say that it would return Busy if there are conflicts

See:

If commit is the one which returns Busy then this is at odds with how STM expects it to work. Also, in STM we do the database prepare first, and the in-memory key checks second. We could do the other way around, though:

  1. locks the keys in the STM transaction first, detect conflicts there
  2. if a conflict is found, rollback the DB
  3. if there are no conflicts, then try_commit the database
  4. if try_commit returned true, write to the locked in-memory places
  5. if try_commit returned false, release the locks and try again
@jsoares jsoares transferred this issue from consensus-shipyard/fendermint Dec 19, 2023
@jsoares jsoares closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants