Skip to content

Commit 112db4e

Browse files
authored
Fix: Accept greater leaseId primary unconditionally (#902)
Signed-off-by: dorjesinpo <[email protected]>
1 parent 3942094 commit 112db4e

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.cpp

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,25 +1573,38 @@ void ClusterOrchestrator::processPrimaryStatusAdvisory(
15731573
// 'StorageMgr::processPrimaryStatusAdvisoryDispatched' as well.
15741574

15751575
if (pinfo.primaryNode()) {
1576-
if (pinfo.primaryNode() != source) {
1576+
if (pinfo.primaryLeaseId() > primaryAdv.primaryLeaseId()) {
15771577
BALL_LOG_ERROR
15781578
<< d_clusterData_p->identity().description()
15791579
<< ": Partition [" << primaryAdv.partitionId()
15801580
<< "]: received primary status advisory: " << primaryAdv
1581-
<< " from: " << source->nodeDescription()
1582-
<< ", but current primary is: "
1583-
<< pinfo.primaryNode()->nodeDescription();
1581+
<< " from perceived primary: " << source->nodeDescription()
1582+
<< ", but with a lesser leaseId. Self perceived leaseId: "
1583+
<< pinfo.primaryLeaseId() << ". Will ignore the advisory.";
15841584
return; // RETURN
15851585
}
1586+
else if (pinfo.primaryLeaseId() < primaryAdv.primaryLeaseId()) {
1587+
BALL_LOG_WARN
1588+
<< d_clusterData_p->identity().description()
1589+
<< ": Partition [" << primaryAdv.partitionId()
1590+
<< "]: received primary status advisory: " << primaryAdv
1591+
<< " from perceived primary: " << source->nodeDescription()
1592+
<< ", with a greater leaseId. Self perceived leaseId: "
1593+
<< pinfo.primaryLeaseId()
1594+
<< ". Will follow the advisory unconditionally.";
1595+
}
1596+
else if (pinfo.primaryNodeId() != source->nodeId()) {
1597+
BSLS_ASSERT_SAFE(pinfo.primaryLeaseId() ==
1598+
primaryAdv.primaryLeaseId());
15861599

1587-
if (pinfo.primaryLeaseId() != primaryAdv.primaryLeaseId()) {
15881600
BALL_LOG_ERROR
15891601
<< d_clusterData_p->identity().description()
15901602
<< ": Partition [" << primaryAdv.partitionId()
15911603
<< "]: received primary status advisory: " << primaryAdv
1592-
<< " from perceived primary: " << source->nodeDescription()
1593-
<< ", but with different leaseId. Self perceived "
1594-
<< "leaseId: " << pinfo.primaryLeaseId();
1604+
<< " from: " << source->nodeDescription()
1605+
<< ", but current primary is: "
1606+
<< pinfo.primaryNode()->nodeDescription()
1607+
<< ". Will ignore the advisory.";
15951608
return; // RETURN
15961609
}
15971610
}

0 commit comments

Comments
 (0)