You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "denis-chudov (via GitHub)" <gi...@apache.org> on 2023/07/24 12:19:17 UTC
[GitHub] [ignite-3] denis-chudov commented on a diff in pull request #2348: IGNITE-20031 NPE on the lease updater
denis-chudov commented on code in PR #2348:
URL: https://github.com/apache/ignite-3/pull/2348#discussion_r1272185751
##########
modules/placement-driver/src/main/java/org/apache/ignite/internal/placementdriver/LeaseUpdater.java:
##########
@@ -286,87 +299,102 @@ private class Updater implements Runnable {
@Override
public void run() {
while (updaterTread != null && !updaterTread.isInterrupted()) {
- long outdatedLeaseThreshold = clock.now().getPhysical() + LEASE_INTERVAL / 2;
+ if (!active() || !stateChangingLock.enterBusy()) {
+ return;
+ }
- IgniteBiTuple<Map<ReplicationGroupId, Lease>, byte[]> leasesCurrent = leaseTracker.leasesCurrent();
- Map<ReplicationGroupId, Boolean> toBeNegotiated = new HashMap<>();
- Map<ReplicationGroupId, Lease> renewedLeases = new HashMap<>(leasesCurrent.getKey());
+ try {
+ updateLeaseBatchInternal();
+ } finally {
+ stateChangingLock.leaveBusy();
+ }
- for (Map.Entry<ReplicationGroupId, Set<Assignment>> entry : assignmentsTracker.assignments().entrySet()) {
- ReplicationGroupId grpId = entry.getKey();
+ try {
+ Thread.sleep(UPDATE_LEASE_MS);
+ } catch (InterruptedException e) {
+ LOG.warn("Lease updater is interrupted");
+ }
+ }
+ }
- Lease lease = leaseTracker.getLease(grpId);
+ /**
+ * Updates leases in Meta storage. This method is supposed to be used on the busy lock.
Review Comment:
```suggestion
* Updates leases in Meta storage. This method is supposed to be used in the busy lock.
```
--
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-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org