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

Implement get_next_batch_size_hint_in_bytes() #599

Merged

Conversation

xiaoxichen
Copy link
Collaborator

we use the byte as cnt as of now.

Also update the log_entries_ext() which will be called on leader,

if hint < 0 means follower want nothing, return an empty vector so that an empty append_entries_req will be sent, to carry the commit_index update and trigger the follower to commit.

if hint > 0, respect the cnt that the follower want, this is useful when two logs within same batch has dependency, we can exclude the dependent one.

if hint = 0 means control by leader.

@xiaoxichen xiaoxichen force-pushed the get_next_batch_size_hint_in_bytes branch from 8425adf to 497356b Compare December 3, 2024 05:14
@xiaoxichen xiaoxichen changed the title Impleemtn get_next_batch_size_hint_in_bytes() Implement get_next_batch_size_hint_in_bytes() Dec 3, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2024

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

Codecov Report

Attention: Patch coverage is 33.33333% with 16 lines in your changes missing coverage. Please review.

Project coverage is 66.45%. Comparing base (1a0cef8) to head (bdd0981).
Report is 98 commits behind head on master.

Files with missing lines Patch % Lines
.../lib/replication/log_store/home_raft_log_store.cpp 33.33% 7 Missing and 1 partial ⚠️
...rc/lib/replication/repl_dev/raft_state_machine.cpp 40.00% 5 Missing and 1 partial ⚠️
src/lib/replication/repl_dev/raft_repl_dev.cpp 0.00% 1 Missing and 1 partial ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #599      +/-   ##
==========================================
+ Coverage   56.51%   66.45%   +9.93%     
==========================================
  Files         108      109       +1     
  Lines       10300    10829     +529     
  Branches     1402     1479      +77     
==========================================
+ Hits         5821     7196    +1375     
+ Misses       3894     2932     -962     
- Partials      585      701     +116     

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

@xiaoxichen xiaoxichen force-pushed the get_next_batch_size_hint_in_bytes branch 2 times, most recently from d5bef77 to 853ac2e Compare December 3, 2024 08:53
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.

this tcp-like traffic(log sending) control looks good to me

@xiaoxichen xiaoxichen force-pushed the get_next_batch_size_hint_in_bytes branch 2 times, most recently from 78afe42 to 8fa4f6b Compare December 4, 2024 01:48
@xiaoxichen
Copy link
Collaborator Author

thanks @JacksonYao287 , addressed.

we use the `byte` as `cnt` as of now.

Also update the log_entries_ext() which will be called on leader,

if hint < 0 means follower want nothing, return an empty vector
so that an empty append_entries_req will be sent, to carry the
commit_index update and trigger the follower to commit.

if hint > 0, respect the cnt that the follower want,  this is useful
when two logs within same batch has dependency, we can exclude the
dependent one.

if hint = 0 means control by leader.

Signed-off-by: Xiaoxi Chen <[email protected]>
@xiaoxichen xiaoxichen force-pushed the get_next_batch_size_hint_in_bytes branch from 8fa4f6b to bdd0981 Compare December 4, 2024 02:08
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.

@xiaoxichen xiaoxichen merged commit e03a7fd into eBay:master Dec 4, 2024
21 checks passed
// limit to original end
new_end = std::min(new_end, end);
}
DEBUG_ASSERT(new_end <= end, "new end {} should be <= original end {}", new_end, end);
Copy link
Contributor

@yamingk yamingk Dec 10, 2024

Choose a reason for hiding this comment

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

nit: DEBUG_ASSERT_LE(new_ned, end); and let macro to print it is value when assert fail

// We are rejecting this log entry, meaning we can accept previous log entries.
// If there is nothing we can accept(i==0), that maens we are waiting for commit
// of previous lsn, set it to 1 in this case.
m_state_machine->reset_next_batch_size_hint(std::max(1ul, i));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you help me understand if we are setting 1 here, how can we get batch_size_hint_cnt to be set as -1 at HomeRaftLogStore::log_entries_ext, so that we can apply empty append entries and only send commit to the follower?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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.

4 participants