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

fix: workaround decode error caused by large key #8064

Merged
merged 3 commits into from
Feb 21, 2023

Conversation

hzxa21
Copy link
Collaborator

@hzxa21 hzxa21 commented Feb 20, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

This is a hotfix to workaround decode error caused by store key larger than 64KB. In the future, we may come up with a better way to prevent large key from occuring in the storage (e.g. limit the state table primary key size).

Note that this change breaks the format compatibility but in a very limited manner (only if there are keys with exact len=64KB written prior to this PR).

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
    - [] I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features).
    - [] I have demonstrated that backward compatibility is not broken by breaking changes and created issues to track deprecated features to be removed in the future. (Please refer to the issue)
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

  • My PR DOES NOT contain user-facing changes.
Click here for Documentation

Types of user-facing changes

Please keep the types that apply to your changes, and remove the others.

  • Installation and deployment
  • Connector (sources & sinks)
  • SQL commands, functions, and operators
  • RisingWave cluster configuration changes
  • Other (please specify in the release note below)

Release note

@hzxa21 hzxa21 requested a review from Li0k February 20, 2023 14:43
@github-actions github-actions bot added the type/fix Bug fix label Feb 20, 2023
@codecov
Copy link

codecov bot commented Feb 20, 2023

Codecov Report

Merging #8064 (e869edb) into main (7c844d9) will increase coverage by 0.01%.
The diff coverage is 84.52%.

@@            Coverage Diff             @@
##             main    #8064      +/-   ##
==========================================
+ Coverage   71.32%   71.33%   +0.01%     
==========================================
  Files        1128     1128              
  Lines      181576   181648      +72     
==========================================
+ Hits       129514   129584      +70     
- Misses      52062    52064       +2     
Flag Coverage Δ
rust 71.33% <84.52%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/storage/hummock_sdk/src/key.rs 94.57% <ø> (ø)
src/storage/src/hummock/sstable/builder.rs 91.80% <41.66%> (-1.72%) ⬇️
src/storage/src/hummock/compactor/iterator.rs 96.68% <76.00%> (-1.27%) ⬇️
src/storage/src/hummock/sstable/block.rs 95.73% <100.00%> (+0.60%) ⬆️
src/storage/src/hummock/sstable/utils.rs 68.67% <100.00%> (ø)
src/object_store/src/object/mod.rs 48.65% <0.00%> (-0.21%) ⬇️
src/object_store/src/object/mem.rs 86.87% <0.00%> (ø)
src/storage/src/hummock/sstable_store.rs 64.77% <0.00%> (ø)
... and 1 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@soundOfDestiny soundOfDestiny left a comment

Choose a reason for hiding this comment

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

rest LGTM

src/storage/src/hummock/sstable/block.rs Show resolved Hide resolved
Copy link
Contributor

@soundOfDestiny soundOfDestiny left a comment

Choose a reason for hiding this comment

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

rest LGTM

src/storage/src/hummock/sstable/block.rs Show resolved Hide resolved
…g change

add more logs for large key

address comments

fmt
@hzxa21 hzxa21 force-pushed the patrick/workaround-large-key.pr branch from d4327d0 to 11cb540 Compare February 21, 2023 05:16
Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

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

Rest LGTM

src/storage/src/hummock/sstable/builder.rs Show resolved Hide resolved
@@ -25,6 +25,8 @@ use crate::HummockEpoch;

pub const EPOCH_LEN: usize = std::mem::size_of::<HummockEpoch>();
pub const TABLE_PREFIX_LEN: usize = std::mem::size_of::<u32>();
// Max length for key overlap and diff length. See KeyPrefix::encode.
pub const MAX_KEY_LEN: usize = u16::MAX as usize;
Copy link
Contributor

Choose a reason for hiding this comment

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

entry (kv pair): | overlap len (2B) | diff len (2B) | value len(4B) | diff key | value |

Would it be more intuitive to add format to the comment?

Copy link
Contributor

@Li0k Li0k left a comment

Choose a reason for hiding this comment

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

Rest LGTM, thanks for the PR

@mergify mergify bot merged commit fef9939 into main Feb 21, 2023
@mergify mergify bot deleted the patrick/workaround-large-key.pr branch February 21, 2023 06:23
lmatz pushed a commit that referenced this pull request Feb 24, 2023
This is a hotfix to workaround decode error caused by store key larger than 64KB. In the future, we may come up with a better way to prevent large key from occuring in the storage (e.g. limit the state table primary key size).

Note that this change breaks the format compatibility but in a very limited manner (only if there are keys with exact len=64KB written prior to this PR).

Approved-By: soundOfDestiny
Approved-By: wcy-fdu
Approved-By: wenym1
Approved-By: Li0k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants