Details
-
Improvement
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
None
-
None
Description
Motivation
Let's assume that we have a component named LeaseTracker that locally stores leases in a map though meta storage updates
public class LeaseTracker implements PlacementDriver { /** Leases cache. */ private final Map<ReplicationGroupId, Lease> leases; ... private class UpdateListener implements WatchListener { @Override public CompletableFuture<Void> onUpdate(WatchEvent event) { for (EntryEvent entry : event.entryEvents()) { ... Lease lease = fromBytes(msEntry.value()); leases.put(grpId, lease); ... return completedFuture(null); } } ...
and we want to await lease in a meta storage safe time bounded way.
public CompletableFuture<LeaseMeta> getPrimaryReplica(ReplicationGroupId replicationGroupId, HybridTimestamp timestamp) { ... return msManager.clusterTime().waitFor(timestamp).thenApply(() -> { ... Lease lease0 = leases.get(replicationGroupId); if (lease.getExpirationTime().after(timestamp)) { return lease0; } else { return null; } ... } }
Currently that won't work properly
because
msManager.clusterTime().waitFor(timestamp)
will be completed before local leases will be populated with data through meta storage events.
Thus it'll be nice to complete clusterTime().waitFor(timestamp) futute (and generally speaking publish safe time) after all corresponding ms listeners are completed.
Attachments
Issue Links
- blocks
-
IGNITE-18856 Switch primary replica calls from Raft leader to primary replica
- Resolved
- fixes
-
IGNITE-19271 Persist revision-safeTime mapping in meta-storage
- Resolved
- links to