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

feat(log-store): log store support truncates at given offset #12263

Merged
merged 11 commits into from
Sep 20, 2023

Conversation

wenym1
Copy link
Contributor

@wenym1 wenym1 commented Sep 13, 2023

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

What's changed and what's your intention?

In this PR, we support log store truncate at a given offset. Previously, a truncate call means all previous item has been consumed, which lacks the ability to receive more data before previous batches of data have been consumed.

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 Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Merging #12263 (6e2bc9b) into main (869ef90) will increase coverage by 0.02%.
The diff coverage is 86.26%.

@@            Coverage Diff             @@
##             main   #12263      +/-   ##
==========================================
+ Coverage   69.64%   69.66%   +0.02%     
==========================================
  Files        1422     1422              
  Lines      235747   236089     +342     
==========================================
+ Hits       164186   164478     +292     
- Misses      71561    71611      +50     
Flag Coverage Δ
rust 69.66% <86.26%> (+0.02%) ⬆️

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

Files Changed Coverage Δ
src/stream/src/executor/sink.rs 91.44% <71.42%> (-0.25%) ⬇️
src/stream/src/common/log_store/in_mem.rs 83.26% <75.00%> (-4.71%) ⬇️
...stream/src/common/log_store/kv_log_store/reader.rs 84.84% <80.45%> (-6.46%) ⬇️
src/stream/src/common/log_store/mod.rs 83.51% <85.39%> (+83.51%) ⬆️
.../stream/src/common/log_store/kv_log_store/serde.rs 89.94% <91.30%> (+0.30%) ⬆️
...stream/src/common/log_store/kv_log_store/buffer.rs 87.30% <94.87%> (+0.84%) ⬆️
...rc/stream/src/common/log_store/kv_log_store/mod.rs 92.13% <95.49%> (+0.65%) ⬆️

... and 5 files with indirect coverage changes

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

inner.consumed_stream_chunk_count = 0;
}
if let Some(offset) = latest_offset {
inner.updated_truncation = Some(offset);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We use the largest flushed offset <= the provided truncate offset for truncation. Will there be an issue if we blindly use the provided truncate offset for truncation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The provided truncate offset is truncate at a provided chunk id, while in the state store we will truncate at seq id. The code above is to turn the chunk id offset into the seq id offset.

Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

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

LGTM

@wenym1 wenym1 enabled auto-merge September 19, 2023 11:37
@wenym1 wenym1 added this pull request to the merge queue Sep 20, 2023
Merged via the queue into main with commit 8c05180 Sep 20, 2023
6 of 7 checks passed
@wenym1 wenym1 deleted the yiming/log-store-truncate branch September 20, 2023 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants