-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
storage: investigate whether facebook/rocksdb#6973 should be backported #50182
Comments
Hi @petermattis, I've guessed the C-ategory of your issue and suitably labeled it. Please re-label if inaccurate. While you're here, please consider adding an A- label to help keep our repository tidy. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
It looks like a very unlikely race but worthwhile to backport. I think the crux of the race is that if you grab a sequence number before grabbing the superversion/readState, some keys visible at the sequence number you grabbed may have already been overwritten with more recent sequence numbers, causing you to think they didn't exist at all at your sequence number.
Pebble doesn’t have the same problem for |
Yeah, I think there is a problem here. I think we need to grab the sequence number atomically with adding the snapshot, which means grabbing the sequence number while holding |
Fix a race in NewSnapshot that could cause recently-written keys to be missing. Previously, NewSnapshot's reading of the current sequence number and appending to the database's snapshot list was not atomic. This meant that a concurrent write and flush or compaction might cause keys at the snapshot number to be dropped. This commit locks d.mu before reading the current sequence number, which prevents flushes and compactions from reading d.mu.snapshots before we've updated it. Also, this commit adds a new test case to exercise this race. The test case doesn't reliably fail before the fix, but run under `stress` it fails within the first batch of runs. Discovered as a part of investigating cockroachdb/cockroach#50182.
Fix a race in NewSnapshot that could cause recently-written keys to be missing. Previously, NewSnapshot's reading of the current sequence number and appending to the database's snapshot list was not atomic. This meant that a concurrent write and flush or compaction might cause keys at the snapshot number to be dropped. This commit locks d.mu before reading the current sequence number, which prevents flushes and compactions from reading d.mu.snapshots before we've updated it. Also, this commit adds a new test case to exercise this race. The test case doesn't reliably fail before the fix, but run under `stress` it fails within the first batch of runs. Discovered as a part of investigating cockroachdb/cockroach#50182.
Fix a race in NewSnapshot that could cause recently-written keys to be missing. Previously, NewSnapshot's reading of the current sequence number and appending to the database's snapshot list was not atomic. This meant that a concurrent write and flush or compaction might cause keys at the snapshot number to be dropped. This commit locks d.mu before reading the current sequence number, which prevents flushes and compactions from reading d.mu.snapshots before we've updated it. Also, this commit adds a new test case to exercise this race. The test case doesn't reliably fail before the fix, but run under `stress` it fails within the first batch of runs. Discovered as a part of investigating cockroachdb/cockroach#50182.
Fix a race in NewSnapshot that could cause recently-written keys to be missing. Previously, NewSnapshot's reading of the current sequence number and appending to the database's snapshot list was not atomic. This meant that a concurrent write and flush or compaction might cause keys at the snapshot number to be dropped. This commit locks d.mu before reading the current sequence number, which prevents flushes and compactions from reading d.mu.snapshots before we've updated it. Also, this commit adds a new test case to exercise this race. The test case doesn't reliably fail before the fix, but run under `stress` it fails within the first batch of runs. Discovered as a part of investigating cockroachdb/cockroach#50182.
Fix a race in NewSnapshot that could cause recently-written keys to be missing. Previously, NewSnapshot's reading of the current sequence number and appending to the database's snapshot list was not atomic. This meant that a concurrent write and flush or compaction might cause keys at the snapshot number to be dropped. This commit locks d.mu before reading the current sequence number, which prevents flushes and compactions from reading d.mu.snapshots before we've updated it. Also, this commit adds a new test case to exercise this race. The test case doesn't reliably fail before the fix, but run under `stress` it fails within the first batch of runs. Discovered as a part of investigating cockroachdb/cockroach#50182.
@petermattis How far back do you think we should backport the RocksDB bug? |
Responded verbally already. Responding here for posterity: 19.1, 19.2, and 20.1. |
facebook/rocksdb#6973
The text was updated successfully, but these errors were encountered: