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

Flush log store meta when compacting log #633

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

yuwmao
Copy link
Contributor

@yuwmao yuwmao commented Jan 22, 2025

In baseline resync scenario, log truncation won't flush the truncate result immediately(periodically flushed by resource manager), thus if durable_commit_lsn has been flushed but start_lsn of the logstore hasn't been flushed, it will trigger the issue6.
Add a flush meta function in logstore, and manually trigger flush in log truncation.

@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 66.10%. Comparing base (1a0cef8) to head (dbb30c0).
Report is 125 commits behind head on master.

Files with missing lines Patch % Lines
...rc/lib/replication/repl_dev/raft_state_machine.cpp 0.00% 2 Missing ⚠️
src/lib/replication/repl_dev/raft_repl_dev.cpp 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #633      +/-   ##
==========================================
+ Coverage   56.51%   66.10%   +9.58%     
==========================================
  Files         108      109       +1     
  Lines       10300    10986     +686     
  Branches     1402     1505     +103     
==========================================
+ Hits         5821     7262    +1441     
+ Misses       3894     3005     -889     
- Partials      585      719     +134     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@JacksonYao287 JacksonYao287 left a comment

Choose a reason for hiding this comment

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

LGTM. only a minor comment

REPL_STORE_LOG(DEBUG, "Simulating log compaction with delay, delay:{}", delay.get());
std::this_thread::sleep_for(std::chrono::milliseconds(delay.get()));
}
#endif
m_log_store->truncate(to_store_lsn(compact_lsn));
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, we can change this line to

m_log_store->truncate(to_store_lsn(compact_lsn), false);

this will be enough.

home_raft_log_store will have one seperate logdev, and there will be only one logstore on this logdev.

this line will change in_memory_truncate_only to false and as result it will trigger logdev truncation, where the metadata of logstore will be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, that make it even simpler!

@yuwmao yuwmao changed the title Add flush meta for single log store Flush log store meta when compacting log Jan 23, 2025
Copy link
Contributor

@JacksonYao287 JacksonYao287 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants