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

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

Merged
merged 1 commit into from Oct 12, 2018

Conversation

Projects
None yet
3 participants
@petermattis
Contributor

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 cockroachdb/sql-bulk-prs as a code owner Oct 11, 2018

@cockroach-teamcity

This comment has been minimized.

Show comment
Hide comment
@cockroach-teamcity

cockroach-teamcity Oct 11, 2018

Member

This change is Reviewable

Member

cockroach-teamcity commented Oct 11, 2018

This change is Reviewable

@petermattis petermattis requested review from benesch and danhhz Oct 11, 2018

@petermattis

This comment has been minimized.

Show comment
Hide comment
@petermattis

petermattis Oct 11, 2018

Contributor

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.

Contributor

petermattis commented Oct 11, 2018

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 changed the title from [WIP] to ccl/storageccl/engineccl: add TestMVCCIncrementalIteratorIntentStraddlesSStables Oct 12, 2018

@petermattis

This comment has been minimized.

Show comment
Hide comment
@petermattis

petermattis Oct 12, 2018

Contributor

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.

Contributor

petermattis commented Oct 12, 2018

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.

@danhhz

test looks good!

@petermattis petermattis requested a review from cockroachdb/core-prs as a code owner Oct 12, 2018

@petermattis petermattis changed the title from ccl/storageccl/engineccl: add TestMVCCIncrementalIteratorIntentStraddlesSStables to ccl/storageccl/engineccl: properly handle intents which straddle sstables Oct 12, 2018

@petermattis

This comment has been minimized.

Show comment
Hide comment
@petermattis

petermattis Oct 12, 2018

Contributor

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

Contributor

petermattis commented Oct 12, 2018

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

@danhhz

danhhz approved these changes Oct 12, 2018

Thanks!

ccl/storageccl/engineccl: properly handle intents which straddle ssta…
…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 #28358

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

This comment has been minimized.

Show comment
Hide comment
@petermattis

petermattis Oct 12, 2018

Contributor

bors r=danhhz

Contributor

petermattis commented Oct 12, 2018

bors r=danhhz

craig bot pushed a commit that referenced this pull request Oct 12, 2018

Merge #31290
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

This comment has been minimized.

Show comment
Hide comment
@craig

craig bot commented Oct 12, 2018

Build succeeded

@craig craig bot merged commit 33e2ecf into cockroachdb:master Oct 12, 2018

3 checks passed

GitHub CI (Cockroach) TeamCity build finished
Details
bors Build succeeded
Details
license/cla Contributor License Agreement is signed.
Details

@petermattis petermattis deleted the petermattis:pmattis/mvcc-incremental-iterator branch Oct 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment