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
storageccl: don't clear existing data in AddSSTable #17079
Conversation
The first commit is in another PR and I need to rewrite TestAddSSTableMVCCStats but the rest of this is ready for review. |
It previously errored, but when two iterators each have an entry with the same key and timestamp, we need it to prefer one in a deterministic way. Also add some test cases for metadata keys. There was previous a bug here, which wasn't caught because the only current user doesn't enounter metadata keys.
Review status: 0 of 7 files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
Reviewed 2 of 2 files at r1, 2 of 2 files at r2, 3 of 3 files at r3. pkg/ccl/storageccl/add_sstable.go, line 49 at r3 (raw file):
Misplaced pkg/ccl/storageccl/add_sstable.go, line 59 at r3 (raw file):
This is cheap when there isn't any data, right? pkg/ccl/storageccl/add_sstable.go, line 116 at r3 (raw file):
Perhaps add a comment about the importance of the ordering pkg/ccl/storageccl/writebatch.go, line 83 at r3 (raw file):
Is this still called? pkg/ccl/storageccl/engineccl/multi_iterator.go, line 29 at r2 (raw file):
Not suggesting that you necessarily should, but could you remove Comments from Reviewable |
10f2938
to
883cb74
Compare
Thanks for the reviews! Finished the test. RFAL Review status: 2 of 7 files reviewed at latest revision, 5 unresolved discussions, some commit checks pending. pkg/ccl/storageccl/add_sstable.go, line 49 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Really? Where? Why? pkg/ccl/storageccl/add_sstable.go, line 59 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Added a note pkg/ccl/storageccl/add_sstable.go, line 116 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. pkg/ccl/storageccl/writebatch.go, line 83 at r3 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Yeah, in WriteBatch. I haven't worked through how the migration for it would work (and won't before 1.1) pkg/ccl/storageccl/engineccl/multi_iterator.go, line 29 at r2 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
I think that would work Comments from Reviewable |
Reviewed 3 of 3 files at r4, 5 of 5 files at r5. pkg/ccl/storageccl/add_sstable.go, line 49 at r3 (raw file): Previously, danhhz (Daniel Harrison) wrote…
The comment isn't here any more. pkg/ccl/storageccl/add_sstable_test.go, line 195 at r5 (raw file):
Probably want to log the seed because if it fails, then what? pkg/ccl/storageccl/add_sstable_test.go, line 236 at r5 (raw file):
Make this pkg/ccl/storageccl/writebatch.go, line 83 at r3 (raw file): Previously, danhhz (Daniel Harrison) wrote…
Gotcha. Seems like you might be able to toss this out for free when 1.1->1.2 happens (I suppose we don't allow upgrades from 1.0 to 1.2). Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, all commit checks successful. pkg/ccl/storageccl/writebatch.go, line 83 at r3 (raw file):
Correct. We'll require that you are running 1.1 and have set the cluster's "use version" setting (or whatever that ends up being called) to 1.1 before beginning the process to upgrade to 1.2. Comments from Reviewable |
Any given AddSSTable command needs to be idempotent, so we can retry it (in the face of AmbiguousResultError, etc). Previously, this was accomplished by clearing the request span before ingest. This meant that when the request completed successfully, the affected span contained exactly the data in the payload sstable. Instead, ingest the file and adjust MVCCStats as appropriate. Motivations: - An unlikely race condition in the upcoming resumable RESTORE coordinator work. It will be possible that one half of a split-brain RESTORE will finish and expose the table publicly for writes before the other half gets off one last AddSSTable. This would destroy user data in a subtle, non-transactional way. - Adding a range tombstone basically guarantees that the ingested sstable will be placed in L0 instead of some lower level, increasing read amplification. Also sneak in a fix (and test) for a bug that prevented SSTIterator from working when Seek was called on it more than once.
883cb74
to
db604c3
Compare
Review status: 6 of 7 files reviewed at latest revision, 4 unresolved discussions. pkg/ccl/storageccl/add_sstable_test.go, line 195 at r5 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Whoops, yep. Meant to do this and forgot. Thanks pkg/ccl/storageccl/add_sstable_test.go, line 236 at r5 (raw file): Previously, tschottdorf (Tobias Schottdorf) wrote…
Done. Comments from Reviewable |
Any given AddSSTable command needs to be idempotent, so we can retry it
(in the face of AmbiguousResultError, etc). Previously, this was
accomplished by clearing the request span before ingest. This meant that
when the request completed successfully, the affected span contained
exactly the data in the payload sstable.
Instead, ingest the file and adjust MVCCStats as appropriate. Motivations:
An unlikely race condition in the upcoming resumable RESTORE
coordinator work. It will be possible that one half of a split-brain
RESTORE will finish and expose the table publicly for writes before
the other half gets off one last AddSSTable. This would destroy user
data in a subtle, non-transactional way.
Adding a range tombstone basically guarantees that the ingested
sstable will be placed in L0 instead of some lower level, increasing
read amplification.