#3773 closed task (fixed)

Merge adding lease with renewing lease

Reported by: itamarst Owned by: itamarst
Priority: normal Milestone: HTTP Storage Protocol
Component: unknown Version: n/a
Keywords: Cc:
Launchpad Bug:

Description (last modified by itamarst)

  1. From a client perspective, the goal is just to have a lease, whether it's a new lease or renewing a lease is irrelevant; renewing is essentially an optimization detail on server side.
  2. Cancelling leases is not actually supported.
  3. The way lease renewal secrets are generated is likely to change in the switchover from foolscap to HTTP.
  4. Internally, the server _already_ treats adding a lease as potentially just renewing a lease.

As such, the distinction between adding a lease and renewing a lease is unnecessary (presuming item 4 is actually correct!). We would like to simplify HTTP protocol by removing it, and we need to make sure server can gracefully handle clients switching their renewal secret.

Therefore, we should merge the two into a single operation:

  1. Validate item 4 above, since it's critical requirement for the rest of this.
  2. In Foolscap client, switch to only using add lease code path.
  3. Make sure server creating renews lease in add path.
  4. On server-side, leave new lease Foolscap endpoint in place for backwards compat.
  5. In new GBS HTTP protocol spec, switch to a single end point for lease creation/renewal, and remove all references to lease cancellation secret.
  6. Clients should continue to try to pass in the same renewal secret, the way they do now.

Change History (7)

comment:1 Changed at 2021-08-18T15:14:15Z by itamarst

  • Description modified (diff)

comment:2 Changed at 2021-08-18T15:20:51Z by exarkun

Regarding item 4 from the first list:

Here is the implementation of add_lease from allmydata/storage/server.py:

    def remote_add_lease(self, storage_index, renew_secret, cancel_secret,
                         owner_num=1):
        start = time.time()
        self.count("add-lease")
        new_expire_time = time.time() + 31*24*60*60
        lease_info = LeaseInfo(owner_num,
                               renew_secret, cancel_secret,
                               new_expire_time, self.my_nodeid)
        for sf in self._iter_share_files(storage_index):
            sf.add_or_renew_lease(lease_info)
        self.add_latency("add-lease", time.time() - start)
        return None

And here is the implementation of MutableShareFile.add_or_renew_lease from `allmydata/storage/mutable.py:

    def add_or_renew_lease(self, lease_info):
        precondition(lease_info.owner_num != 0) # 0 means "no lease here"                                                                                                                     
        try:
            self.renew_lease(lease_info.renew_secret,
                             lease_info.expiration_time)
        except IndexError:
            self.add_lease(lease_info)

And here is the implementation of ShareFile.add_or_renew_lease from `allmydata/storage/immutable.py:

    def add_or_renew_lease(self, lease_info):
        try:
            self.renew_lease(lease_info.renew_secret,
                             lease_info.expiration_time)
        except IndexError:
            self.add_lease(lease_info)

(woops nice divergence in safety properties there)

comment:3 Changed at 2021-08-18T15:27:15Z by itamarst

  • Description modified (diff)
  • Summary changed from Merge adding lease with renewing lease (for immutables) to Merge adding lease with renewing lease

comment:4 Changed at 2021-08-18T15:32:20Z by itamarst

  • Description modified (diff)

comment:5 Changed at 2021-08-18T15:36:01Z by itamarst

  • Description modified (diff)

comment:6 Changed at 2021-08-19T16:57:41Z by itamarst

  • Description modified (diff)

comment:7 Changed at 2021-09-01T14:44:46Z by GitHub <noreply@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 056ee58/trunk:

Merge pull request #1110 from tahoe-lafs/3773.just-add-lease

Get rid of renew_lease client code, in order to simplify the protocol

Fixes ticket:3773

Note: See TracTickets for help on using tickets.