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

What does non-runtime-atomicity of Marble::write_batch imply? #9

Open
vi opened this issue Nov 30, 2022 · 1 comment
Open

What does non-runtime-atomicity of Marble::write_batch imply? #9

vi opened this issue Nov 30, 2022 · 1 comment

Comments

@vi
Copy link

vi commented Nov 30, 2022

This function is crash-atomic but NOT runtime atomic. If you are concurrently serving reads, and require atomic batch semantics, you should serve reads out of an in-memory cache until this function returns.

  • Does it still guarantee that value returned from Marble::read for any key during Marble::write_batch would be either pre-write_batch or post-write_batch one, not an "out-of-thin-air" value or a "teared" value with a first half of the buffer old and second half of the buffer new?
  • If yes, can a value intermittently turn None before switching to the post-write_batch one?
  • If no, can it also temporarily disturb unrelated keys (not mentioned in write_match)? What worst can happen from an attempt to read an entry that is being modified?
@spacejam
Copy link
Member

previous db:
1: a
2: b

write batch sets these to:
1: x
2: y

then it is conceivable that reads concurrent to that write batch could observe either a or x for 1, or b or y for 2. but no tears. no unrelated keys are impacted. None can not be returned for reads that begin after the initial values are written.

that said, I'm hacking on a simple MVCC implementation today that might avoid this confusion completely.

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

No branches or pull requests

2 participants