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

Preconditions of apply_pack #455

Open
unixod opened this issue Aug 9, 2023 · 1 comment
Open

Preconditions of apply_pack #455

unixod opened this issue Aug 9, 2023 · 1 comment

Comments

@unixod
Copy link
Contributor

unixod commented Aug 9, 2023

Hi,

Could you help to clarify preconditions which apply_pack may rely on? In particular I'm wondering which of cases listed below are possible.

(In the list below by index I refer to first parameter of apply_pack)

  1. index < log_store::start_index()
  2. index > log_store::next_slot()
  3. index + number_of_logs(pack) < log_store::next_slot()

If 3rd case is possible then may we truncate log entries which go after index + number_of_logs(pack) as part of apply_pack execution?

@greensky00
Copy link
Contributor

pack is invoked in leader's side when below conditions are met. Let's say S1 is leader (pack) and S2 is follower (apply_pack).

  • params->log_sync_stop_gap_ > 0. AND
  • S2's next_slot() < S1's start_index(). AND
  • S1's committed index > S2's next_slot() + params->log_sync_stop_gap_.

Then apply_pack's first parameter (index you referred to) will always be S2's next_slot(). Leader always sends the log starting from next_slot() of the follower, so none of three can be possible, unless follower's log store is changed before receiving the pack message from the leader.

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

No branches or pull requests

2 participants