Skip to content

ccl/storageccl/engineccl: properly handle intents which straddle sstables#31290

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
petermattis:pmattis/mvcc-incremental-iterator
Oct 12, 2018
Merged

ccl/storageccl/engineccl: properly handle intents which straddle sstables#31290
craig[bot] merged 1 commit intocockroachdb:masterfrom
petermattis:pmattis/mvcc-incremental-iterator

Conversation

@petermattis
Copy link
Copy Markdown
Collaborator

@petermattis petermattis commented Oct 11, 2018

An intent which straddles an sstable can lead an incremental iterator to
incorrectly ignore an sstable. In order to fix this, when an intent
straddles an sstable (i.e. the metadata key is the last key in the
sstable) we need to include the intent's timestamp in the timestamp
bounds. We don't need to do this for interior intents because we'll
already be including the intent's timestamp as it is contained in the
next key following the intent. Add
TestMVCCIncrementalIteratorIntentStraddlesSStables which demonstrates
the problem.

Fixes #28358

Release note (bug fix): Fix a rare scenario where a backup could
incorrectly include a key for a transaction which was aborted.

@petermattis petermattis requested a review from a team October 11, 2018 22:43
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@petermattis petermattis requested review from benesch and danhhz October 11, 2018 22:43
@petermattis
Copy link
Copy Markdown
Collaborator Author

See #28358. I think this reproduces the scenario described in that bug. No comments yet, but the code is relatively straightforward. Getting this out for review as I'm going to be offline for the rest of the night.

@petermattis petermattis force-pushed the pmattis/mvcc-incremental-iterator branch from 486db4c to ff0dc90 Compare October 12, 2018 12:23
@petermattis petermattis changed the title [WIP] ccl/storageccl/engineccl: add TestMVCCIncrementalIteratorIntentStraddlesSStables Oct 12, 2018
@petermattis
Copy link
Copy Markdown
Collaborator Author

Added some comments to the tests and made it detect the success vs failure condition. The test currently fails (as expected), and passes if I disable TimeBoundTblPropCollector::AddUserKey so that time bounds are not added to any sstable. I'll get to the fix after breakfast.

Copy link
Copy Markdown
Contributor

@danhhz danhhz left a comment

Choose a reason for hiding this comment

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

test looks good!

@petermattis petermattis force-pushed the pmattis/mvcc-incremental-iterator branch from ff0dc90 to 379d9f4 Compare October 12, 2018 15:22
@petermattis petermattis requested a review from a team October 12, 2018 15:22
@petermattis petermattis changed the title ccl/storageccl/engineccl: add TestMVCCIncrementalIteratorIntentStraddlesSStables ccl/storageccl/engineccl: properly handle intents which straddle sstables Oct 12, 2018
@petermattis
Copy link
Copy Markdown
Collaborator Author

Implemented the suggested fix to TimeBoundTblPropCollector and the test now passes. I think this PR is good to go. PTAL.

Copy link
Copy Markdown
Contributor

@danhhz danhhz left a comment

Choose a reason for hiding this comment

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

Thanks!

…bles

An intent which straddles an sstable can lead an incremental iterator to
incorrectly ignore an sstable. In order to fix this, when an intent
straddles an sstable (i.e. the metadata key is the last key in the
sstable) we need to include the intent's timestamp in the timestamp
bounds. We don't need to do this for interior intents because we'll
already be including the intent's timestamp as it is contained in the
next key following the intent. Add
`TestMVCCIncrementalIteratorIntentStraddlesSStables` which demonstrates
the problem.

Fixes cockroachdb#28358

Release note (bug fix): Fix a rare scenario where a backup could
incorrectly include a key for a transaction which was aborted.
@petermattis petermattis force-pushed the pmattis/mvcc-incremental-iterator branch from 379d9f4 to 33e2ecf Compare October 12, 2018 16:43
@petermattis
Copy link
Copy Markdown
Collaborator Author

bors r=danhhz

craig bot pushed a commit that referenced this pull request Oct 12, 2018
31290: ccl/storageccl/engineccl: properly handle intents which straddle sstables r=danhhz a=petermattis

An intent which straddles an sstable can lead an incremental iterator to
incorrectly ignore an sstable. In order to fix this, when an intent
straddles an sstable (i.e. the metadata key is the last key in the
sstable) we need to include the intent's timestamp in the timestamp
bounds. We don't need to do this for interior intents because we'll
already be including the intent's timestamp as it is contained in the
next key following the intent. Add
`TestMVCCIncrementalIteratorIntentStraddlesSStables` which demonstrates
the problem.

Fixes #28358

Release note (bug fix): Fix a rare scenario where a backup could
incorrectly include a key for a transaction which was aborted.

Co-authored-by: Peter Mattis <petermattis@gmail.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Oct 12, 2018

Build succeeded

@craig craig bot merged commit 33e2ecf into cockroachdb:master Oct 12, 2018
@petermattis petermattis deleted the pmattis/mvcc-incremental-iterator branch October 12, 2018 17:31
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.

libroach: timebound iterator metadata doesn't consider intents

3 participants