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

Commit

Permalink
fix(duplication): reset confirmed_decree to delete secondary private …
Browse files Browse the repository at this point in the history
…log after remove duplication (#860)
  • Loading branch information
foreverneverer authored Jul 23, 2021
1 parent 31ad7e9 commit 3858fdc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/replica/duplication/replica_duplicator_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,13 @@ void replica_duplicator_manager::update_confirmed_decree_if_secondary(decree con

zauto_lock l(_lock);
remove_all_duplications();
if (confirmed >= 0) {
if (confirmed >= 0) { // duplication ongoing
// confirmed decree never decreases
if (_primary_confirmed_decree < confirmed) {
_primary_confirmed_decree = confirmed;
}
} else { // duplication add with freeze but no start or no duplication(include removed)
_primary_confirmed_decree = confirmed;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class replica_duplicator_manager_test : public duplication_test_base
ASSERT_EQ(d._primary_confirmed_decree, 101);
d.update_confirmed_decree_if_secondary(1);
ASSERT_EQ(d._primary_confirmed_decree, 101);

// duplication removed and the confimed_decree = -1
d.update_confirmed_decree_if_secondary(-1);
ASSERT_EQ(d._primary_confirmed_decree, -1);
}

void test_get_duplication_confirms()
Expand Down
5 changes: 2 additions & 3 deletions src/replica/replica_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ void replica::on_group_check(const group_check_request &request,
} else if (is_same_ballot_status_change_allowed(status(), request.config.status)) {
update_local_configuration(request.config, true);
}
if (request.__isset.confirmed_decree) {
_duplication_mgr->update_confirmed_decree_if_secondary(request.confirmed_decree);
}

_duplication_mgr->update_confirmed_decree_if_secondary(request.confirmed_decree);

switch (status()) {
case partition_status::PS_INACTIVE:
Expand Down

0 comments on commit 3858fdc

Please sign in to comment.