Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Maintenance phase of placement driver is the management of already existing leases by the placement driver's active actor.
Describing in words, there should be a worker triggered once in a period of time equal to leaseInterval/10, that makes following:
- it iterates over all partition groups managed by placement driver, and either extends their leases or chooses new, if there is no lease for group for some reason (it can be because leaseholder was never chosen, or actual leaseholder left the cluster, etc.);
- if there is no lease, it should be assigned using lease candidates balancer, see IGNITE-18879 , otherwise the placement driver should define if the existing lease is goind to expire;
- new timestamp (let's name it leaseValidUntil) until which the lease will be valid, should be calculated as currentTime + leaseInterval;
- after that, placement driver should invoke meta storage to refresh data about leases, lease candidates and their new leaseValidUntil timestamps;
- if invoke is successful (it can be not if there are two nodes considering themselves as the placement driver's active actors), LeaseGrantMessage containing leaseValidUntil should be sent to leases and lease candidates.
Pseudocode:
scheduleAtFixedRate(leaseInterval / 10) { for (group in replicationGroups) { leaseExpirationTime = now() + leaseInterval // getting timestamp until leases are prolonged lease = lease(group) if (lease == null) { // it can be null if these is no lease at all, or active lease left the cluster lease = leaseBalancer.get(group) // in this case lease is just a candidate } if (invokeMetaStorage(grantLease(lease, leaseExpirationTime))) { sendLeaseGrantMessage(lease, leaseExpirationTime) // send message to replica, response is handled by onLeaseGrantResponse } } }
Attachments
Attachments
Issue Links
- links to