vldpyatkov commented on code in PR #4707: URL: https://github.com/apache/ignite-3/pull/4707#discussion_r1841696820
########## modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java: ########## @@ -443,8 +443,19 @@ private void updateLeaseBatchInternal() { ? lease.getLeaseholder() : lease.proposedCandidate(); - ClusterNode candidate = nextLeaseHolder(assignments, grpId, proposedLeaseholder); + ClusterNode candidate = nextLeaseHolder(stableAssignments, grpId, proposedLeaseholder); + // If there wasn't a candidate among stable assignments set then make attempt to select a candidate among pending set + if (candidate == null) { Review Comment: This part has to be packed to the nextLeaseHolder method. ########## modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java: ########## @@ -389,19 +389,19 @@ private void updateLeaseBatchInternal() { Map<ReplicationGroupId, Boolean> toBeNegotiated = new HashMap<>(); Map<ReplicationGroupId, Lease> renewedLeases = new HashMap<>(leasesCurrent.leaseByGroupId()); - Map<ReplicationGroupId, TokenizedAssignments> currentAssignments = assignmentsTracker.assignments(); - Set<ReplicationGroupId> currentAssignmentsReplicationGroupIds = currentAssignments.keySet(); + Map<ReplicationGroupId, TokenizedAssignments> currentStableAssignments = assignmentsTracker.stableAssignments(); + Set<ReplicationGroupId> currentStableAssignmentsReplicationGroupIds = currentStableAssignments.keySet(); // Remove all expired leases that are no longer present in assignments. renewedLeases.entrySet().removeIf(e -> clockService.before(e.getValue().getExpirationTime(), now) - && !currentAssignmentsReplicationGroupIds.contains(e.getKey())); + && !currentStableAssignmentsReplicationGroupIds.contains(e.getKey())); - int currentAssignmentsSize = currentAssignments.size(); + int currentStableAssignmentsSize = currentStableAssignments.size(); int activeLeasesCount = 0; - for (Map.Entry<ReplicationGroupId, TokenizedAssignments> entry : currentAssignments.entrySet()) { + for (Map.Entry<ReplicationGroupId, TokenizedAssignments> entry : currentStableAssignments.entrySet()) { Review Comment: Why do you think all entries are in stable assignment? As I understand it, we are using pending assessment because it might be that the stable assignment does not exist for a specific group. ########## modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java: ########## @@ -389,19 +389,19 @@ private void updateLeaseBatchInternal() { Map<ReplicationGroupId, Boolean> toBeNegotiated = new HashMap<>(); Map<ReplicationGroupId, Lease> renewedLeases = new HashMap<>(leasesCurrent.leaseByGroupId()); - Map<ReplicationGroupId, TokenizedAssignments> currentAssignments = assignmentsTracker.assignments(); - Set<ReplicationGroupId> currentAssignmentsReplicationGroupIds = currentAssignments.keySet(); + Map<ReplicationGroupId, TokenizedAssignments> currentStableAssignments = assignmentsTracker.stableAssignments(); + Set<ReplicationGroupId> currentStableAssignmentsReplicationGroupIds = currentStableAssignments.keySet(); // Remove all expired leases that are no longer present in assignments. renewedLeases.entrySet().removeIf(e -> clockService.before(e.getValue().getExpirationTime(), now) - && !currentAssignmentsReplicationGroupIds.contains(e.getKey())); + && !currentStableAssignmentsReplicationGroupIds.contains(e.getKey())); Review Comment: Is it enough to check only stable assignment here? -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org