Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-18742

Implement initial lease granting on placement driver side

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0
    • 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

        1. screenshot-1.png
          17 kB
          Denis Chudov

        Issue Links

          Activity

            People

              v.pyatkov Vladislav Pyatkov
              alapin Alexander Lapin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h 50m
                  4h 50m