denis-chudov commented on code in PR #7769:
URL: https://github.com/apache/ignite-3/pull/7769#discussion_r2935404710
##########
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java:
##########
@@ -486,11 +486,33 @@ private void updateLeaseBatchInternal() {
: lease.proposedCandidate();
InternalClusterNode candidate =
nextLeaseHolder(stableAssignments, pendingAssignments, grpId,
proposedLeaseholder);
+ boolean leaseholderIdIsInLogicalTopology =
lease.getLeaseholderId() != null
+ &&
topologyTracker.containsNodeId(lease.getLeaseholderId());
+ boolean hasStaleLeaseholderId = lease.isAccepted() &&
!leaseholderIdIsInLogicalTopology;
boolean canBeProlonged = lease.isAccepted()
&& lease.isProlongable()
+ && !hasStaleLeaseholderId
&& candidate != null &&
candidate.id().equals(lease.getLeaseholderId());
+ if (hasStaleLeaseholderId) {
+ LOG.info("Leaseholder has left the logical topology,
creating a new lease [groupId={}, lease={}, candidate={}]",
+ grpId, lease, candidate);
+
+ if (candidate == null) {
+ logGroupWithoutCandidateOnce(grpId, true,
stableAssignments, pendingAssignments);
+ continue;
+ }
+
+ Lease newLease = writeNewLease(grpId, candidate,
renewedLeases);
+
+ boolean force = Objects.equals(lease.getLeaseholder(),
candidate.name());
+
+ toBeNegotiated.put(grpId, new LeaseAgreement(newLease,
force));
+
+ continue;
+ }
+
Review Comment:
actually, all you need is to exclude the outcome when
`tryToFindCandidateAmongAssignments` returns stale candidate, that would be
much more simple
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]