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

Add compaction order check and data block cache check #195

Merged
merged 4 commits into from
Oct 10, 2020

Conversation

Connor1996
Copy link
Member

Add checks to avoid wrongly mapping block cache populating get and iterator further., for more information of the wrongly mapping block cache, see facebook#7405

Add check logic:

  • check key order of compaction output
  • compare data block's first key with the block index handle's key when retrieving data block

Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Copy link
Collaborator

@yiwu-arbug yiwu-arbug left a comment

Choose a reason for hiding this comment

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

For the table reader change, are all the index iterator being valid when index_iter->key() is used?

table/block_based/block_based_table_builder.cc Outdated Show resolved Hide resolved
table/block_based/block_based_table_reader.cc Outdated Show resolved Hide resolved
@yiwu-arbug
Copy link
Collaborator

btw CI looks like real failure.

Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@@ -2959,10 +2978,10 @@ bool BlockBasedTableIterator<TBlockIter, TValue>::InitDataBlock() {
/*get_context=*/nullptr, &lookup_context_, s, prefetch_buffer_.get(),
/*for_compaction=*/lookup_context_.caller ==
TableReaderCaller::kCompaction);
if (!block_iter_.Valid()) {
block_iter_points_to_real_block_ = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why reset block_iter_points_to_real_block_?

Copy link
Member Author

Choose a reason for hiding this comment

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

we invalidate the block iter when corruption detected. If not set block_iter_points_to_real_block_ = true, upper place will check the status of index iter instead of block iter.

@yiwu-arbug
Copy link
Collaborator

CI is still failing.

Signed-off-by: Connor1996 <zbk602423539@gmail.com>
Copy link
Collaborator

@yiwu-arbug yiwu-arbug left a comment

Choose a reason for hiding this comment

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

LGTM

@yiwu-arbug
Copy link
Collaborator

cherry-pick 3.0 and 4.0?

@Connor1996
Copy link
Member Author

@yiwu-arbug Not sure if it would be false positive. Let's enable it in master for a while and cherry pick to 4.0 later?

@Connor1996 Connor1996 merged commit 953f8b2 into tikv:6.4.tikv Oct 10, 2020
yiwu-arbug pushed a commit to tikv/rust-rocksdb that referenced this pull request Oct 11, 2020
update rocksdb to include tikv/rocksdb#195 for master

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Connor1996 added a commit to Connor1996/rocksdb that referenced this pull request Nov 11, 2020
* add compaction order check and data block cache check

Signed-off-by: Connor1996 <zbk602423539@gmail.com>
yiwu-arbug pushed a commit that referenced this pull request Nov 11, 2020
* add compaction order check and data block cache check

Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@tabokie tabokie mentioned this pull request May 9, 2022
39 tasks
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.

2 participants