]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
change RIStorageServer.remote_add_lease to exit silently in case of no-such-bucket...
authorBrian Warner <warner@lothar.com>
Wed, 18 Feb 2009 02:30:53 +0000 (19:30 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 18 Feb 2009 02:30:53 +0000 (19:30 -0700)
src/allmydata/interfaces.py
src/allmydata/storage.py
src/allmydata/test/test_storage.py

index b92e919dbef6ef8a5e57cf373a7cbe50a25034bc..bab8ed915364a3ecacaddeb9fa7938c1d7bff62a 100644 (file)
@@ -123,7 +123,9 @@ class RIStorageServer(RemoteInterface):
         """
         Add a new lease on the given bucket. If the renew_secret matches an
         existing lease, that lease will be renewed instead. If there is no
-        bucket for the given storage_index, IndexError will be raised.
+        bucket for the given storage_index, return silently. (note that in
+        tahoe-1.3.0 and earlier, IndexError was raised if there was no
+        bucket)
         """
         return None
 
index ac6de53c76282235a1b829b712c0fa923751f861..29bce1d462e8bcfd667daf32e94e2d87523c4c96 100644 (file)
@@ -1074,17 +1074,10 @@ class StorageServer(service.MultiService, Referenceable):
         lease_info = LeaseInfo(owner_num,
                                renew_secret, cancel_secret,
                                new_expire_time, self.my_nodeid)
-        found_buckets = False
         for sf in self._iter_share_files(storage_index):
-            found_buckets = True
-            # note: if the share has been migrated, the renew_lease()
-            # call will throw an exception, with information to help the
-            # client update the lease.
             sf.add_or_renew_lease(lease_info)
         self.add_latency("add-lease", time.time() - start)
-        if not found_buckets:
-            raise IndexError("no such storage index to do add-lease")
-
+        return None
 
     def remote_renew_lease(self, storage_index, renew_secret):
         start = time.time()
index 96d1c4103506f918eb12f462b545992cf9546bd8..4c0544433680b985d50d49b4e32f5fff9e61b052 100644 (file)
@@ -502,8 +502,8 @@ class Server(unittest.TestCase):
         self.failUnlessEqual(len(leases), 3)
         self.failUnlessEqual(set([l.renew_secret for l in leases]), set([rs1, rs2, rs2a]))
 
-        # add-lease on a missing storage index is an error
-        self.failUnlessRaises(IndexError, ss.remote_add_lease, "si18", "", "")
+        # add-lease on a missing storage index is silently ignored
+        self.failUnlessEqual(ss.remote_add_lease("si18", "", ""), None)
 
         # check that si0 is readable
         readers = ss.remote_get_buckets("si0")
@@ -1062,8 +1062,8 @@ class MutableServer(unittest.TestCase):
         s0 = MutableShareFile(os.path.join(bucket_dir, "0"))
         self.failUnlessEqual(len(s0.debug_get_leases()), 1)
 
-        # add-lease on a missing storage index is an error
-        self.failUnlessRaises(IndexError, ss.remote_add_lease, "si18", "", "")
+        # add-lease on a missing storage index is silently ignored
+        self.failUnlessEqual(ss.remote_add_lease("si18", "", ""), None)
 
         # re-allocate the slots and use the same secrets, that should update
         # the lease