Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
fix: plog may be lost on going duplicating when replica re-open and t…
Browse files Browse the repository at this point in the history
…hen learn (#838)
  • Loading branch information
foreverneverer authored Jun 17, 2021
1 parent e70d406 commit 60769c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/replica/replica_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void replica::on_config_proposal(configuration_update_request &proposal)
}
}

_app_info.__set_duplicating(proposal.info.duplicating);
switch (proposal.type) {
case config_type::CT_ASSIGN_PRIMARY:
case config_type::CT_UPGRADE_TO_PRIMARY:
Expand Down
24 changes: 13 additions & 11 deletions src/replica/replica_learn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,16 +1476,16 @@ void replica::on_learn_completion_notification_reply(error_code err,

void replica::on_add_learner(const group_check_request &request)
{
ddebug("%s: process add learner, primary = %s, ballot = %" PRId64
", status = %s, last_committed_decree = %" PRId64,
name(),
request.config.primary.to_string(),
request.config.ballot,
enum_to_string(request.config.status),
request.last_committed_decree);
ddebug_replica("process add learner, primary = {}, ballot ={}, status ={}, "
"last_committed_decree = {}, duplicating = {}",
request.config.primary.to_string(),
request.config.ballot,
enum_to_string(request.config.status),
request.last_committed_decree,
request.app.duplicating);

if (request.config.ballot < get_ballot()) {
dwarn("%s: on_add_learner ballot is old, skipped", name());
dwarn_replica("on_add_learner ballot is old, skipped");
return;
}

Expand All @@ -1494,9 +1494,11 @@ void replica::on_add_learner(const group_check_request &request)
if (!update_local_configuration(request.config, true))
return;

dassert(partition_status::PS_POTENTIAL_SECONDARY == status(),
"invalid partition_status, status = %s",
enum_to_string(status()));
dassert_replica(partition_status::PS_POTENTIAL_SECONDARY == status(),
"invalid partition_status, status = {}",
enum_to_string(status()));

_duplicating = request.app.duplicating;
init_learn(request.config.learner_signature);
}
}
Expand Down

0 comments on commit 60769c4

Please sign in to comment.