]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Remove the [storage]expire.{mutable,immutable} options.
authorDaira Hopwood <daira@jacaranda.org>
Fri, 10 Jul 2015 03:06:08 +0000 (04:06 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Fri, 10 Jul 2015 03:06:08 +0000 (04:06 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
docs/configuration.rst
docs/garbage-collection.rst
src/allmydata/client.py
src/allmydata/test/test_client.py
src/allmydata/test/test_storage.py
src/allmydata/web/storage.py

index ac75cca76cbbe476cd736f620e303a36b782988e..7e47f4a268164b5a389e9d61cce57875d45edf50 100644 (file)
@@ -491,10 +491,6 @@ Storage Server Configuration
 
 ``expire.cutoff_date =``
 
-``expire.immutable =``
-
-``expire.mutable =``
-
     These settings control garbage collection, in which the server will
     delete shares that no longer have an up-to-date lease on them. Please see
     garbage-collection.rst_ for full details.
index 3e8b4e5d94dab2929cc7fd328ddccd7a834f0069..2078fdcc35b48657f880c74cf6056835815e2051 100644 (file)
@@ -203,17 +203,10 @@ The ``tahoe.cfg`` file uses the following keys to control lease expiration:
     "expire.mode = cutoff-date"). It will be rejected if age-based expiration
     is in use.
 
-  expire.immutable = (boolean, optional)
-
-    If this is False, then immutable shares will never be deleted, even if
-    their leases have expired. This can be used in special situations to
-    perform GC on mutable files but not immutable ones. The default is True.
-
-  expire.mutable = (boolean, optional)
-
-    If this is False, then mutable shares will never be deleted, even if
-    their leases have expired. This can be used in special situations to
-    perform GC on immutable files but not mutable ones. The default is True.
+In previous versions, the ``expire.immutable`` and ``expire.mutable`` keys
+could be used to selectively expire only mutable or only immutable shares.
+As of Tahoe-LAFS v1.11.0, these are no longer supported and will cause an
+error if set to ``False``.
 
 Expiration Progress
 ===================
index 6e9cadc73bf3c2e3321b3cde1923475c96cb8586..88530dcd096a6ab0aae12bec9843a8b8f9ec08dc 100644 (file)
@@ -290,12 +290,11 @@ class Client(node.Node, pollmixin.PollMixin):
             cutoff_date = self.get_config("storage", "expire.cutoff_date")
             cutoff_date = parse_date(cutoff_date)
 
-        sharetypes = []
-        if self.get_config("storage", "expire.immutable", True, boolean=True):
-            sharetypes.append("immutable")
-        if self.get_config("storage", "expire.mutable", True, boolean=True):
-            sharetypes.append("mutable")
-        expiration_sharetypes = tuple(sharetypes)
+        if not self.get_config("storage", "expire.immutable", True, boolean=True):
+            raise OldConfigOptionError("[storage]expire.immutable = False is no longer supported.")
+        if not self.get_config("storage", "expire.mutable", True, boolean=True):
+            raise OldConfigOptionError("[storage]expire.mutable = False is no longer supported.")
+        expiration_sharetypes = ('mutable', 'immutable')
 
         ss = StorageServer(storedir, self.nodeid,
                            reserved_space=reserved,
index aa3ad411db7be75f6d96994c9945bf9391119ea7..f28ba01725535a8991c8c384cafdea9d3aba8a1f 100644 (file)
@@ -242,6 +242,26 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase):
                         "port = tcp:0:interface=127.0.0.1\n"))
         self.failUnlessRaises(NeedRootcapLookupScheme, client.Client, basedir)
 
+    def test_expire_mutable_false_unsupported(self):
+        basedir = "client.Basic.test_expire_mutable_false_unsupported"
+        os.mkdir(basedir)
+        fileutil.write(os.path.join(basedir, "tahoe.cfg"), \
+                       BASECONFIG + \
+                       "[storage]\n" + \
+                       "enabled = true\n" + \
+                       "expire.mutable = False\n")
+        self.failUnlessRaises(OldConfigOptionError, client.Client, basedir)
+
+    def test_expire_immutable_false_unsupported(self):
+        basedir = "client.Basic.test_expire_immutable_false_unsupported"
+        os.mkdir(basedir)
+        fileutil.write(os.path.join(basedir, "tahoe.cfg"), \
+                       BASECONFIG + \
+                       "[storage]\n" + \
+                       "enabled = true\n" + \
+                       "expire.immutable = False\n")
+        self.failUnlessRaises(OldConfigOptionError, client.Client, basedir)
+
     def test_debug_discard_true_unsupported(self):
         basedir = "client.Basic.test_debug_discard_true_unsupported"
         os.mkdir(basedir)
index 5fcb02081f18a24f5b2ed06adca8ebcd575858f8..b63f28df0d462811a02bf4f8f349709b36c413a3 100644 (file)
@@ -3564,119 +3564,6 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin):
         d.addCallback(_check_html)
         return d
 
-    def test_only_immutable(self):
-        basedir = "storage/LeaseCrawler/only_immutable"
-        fileutil.make_dirs(basedir)
-        now = time.time()
-        then = int(now - 2000)
-        ss = StorageServer(basedir, "\x00" * 20,
-                           expiration_enabled=True,
-                           expiration_mode="cutoff-date",
-                           expiration_cutoff_date=then,
-                           expiration_sharetypes=("immutable",))
-        lc = ss.lease_checker
-        lc.slow_start = 0
-        webstatus = StorageStatus(ss)
-
-        self.make_shares(ss)
-        [immutable_si_0, immutable_si_1, mutable_si_2, mutable_si_3] = self.sis
-        # set all leases to be expirable
-        new_expiration_time = now - 3000 + 31*24*60*60
-
-        def count_shares(si):
-            return len(list(ss._iter_share_files(si)))
-        def _get_sharefile(si):
-            return list(ss._iter_share_files(si))[0]
-        def count_leases(si):
-            return len(list(_get_sharefile(si).get_leases()))
-
-        sf0 = _get_sharefile(immutable_si_0)
-        self.backdate_lease(sf0, self.renew_secrets[0], new_expiration_time)
-        sf1 = _get_sharefile(immutable_si_1)
-        self.backdate_lease(sf1, self.renew_secrets[1], new_expiration_time)
-        self.backdate_lease(sf1, self.renew_secrets[2], new_expiration_time)
-        sf2 = _get_sharefile(mutable_si_2)
-        self.backdate_lease(sf2, self.renew_secrets[3], new_expiration_time)
-        sf3 = _get_sharefile(mutable_si_3)
-        self.backdate_lease(sf3, self.renew_secrets[4], new_expiration_time)
-        self.backdate_lease(sf3, self.renew_secrets[5], new_expiration_time)
-
-        ss.setServiceParent(self.s)
-        def _wait():
-            return bool(lc.get_state()["last-cycle-finished"] is not None)
-        d = self.poll(_wait)
-
-        def _after_first_cycle(ignored):
-            self.failUnlessEqual(count_shares(immutable_si_0), 0)
-            self.failUnlessEqual(count_shares(immutable_si_1), 0)
-            self.failUnlessEqual(count_shares(mutable_si_2), 1)
-            self.failUnlessEqual(count_leases(mutable_si_2), 1)
-            self.failUnlessEqual(count_shares(mutable_si_3), 1)
-            self.failUnlessEqual(count_leases(mutable_si_3), 2)
-        d.addCallback(_after_first_cycle)
-        d.addCallback(lambda ign: self.render1(webstatus))
-        def _check_html(html):
-            s = remove_tags(html)
-            self.failUnlessIn("The following sharetypes will be expired: immutable.", s)
-        d.addCallback(_check_html)
-        return d
-
-    def test_only_mutable(self):
-        basedir = "storage/LeaseCrawler/only_mutable"
-        fileutil.make_dirs(basedir)
-        now = time.time()
-        then = int(now - 2000)
-        ss = StorageServer(basedir, "\x00" * 20,
-                           expiration_enabled=True,
-                           expiration_mode="cutoff-date",
-                           expiration_cutoff_date=then,
-                           expiration_sharetypes=("mutable",))
-        lc = ss.lease_checker
-        lc.slow_start = 0
-        webstatus = StorageStatus(ss)
-
-        self.make_shares(ss)
-        [immutable_si_0, immutable_si_1, mutable_si_2, mutable_si_3] = self.sis
-        # set all leases to be expirable
-        new_expiration_time = now - 3000 + 31*24*60*60
-
-        def count_shares(si):
-            return len(list(ss._iter_share_files(si)))
-        def _get_sharefile(si):
-            return list(ss._iter_share_files(si))[0]
-        def count_leases(si):
-            return len(list(_get_sharefile(si).get_leases()))
-
-        sf0 = _get_sharefile(immutable_si_0)
-        self.backdate_lease(sf0, self.renew_secrets[0], new_expiration_time)
-        sf1 = _get_sharefile(immutable_si_1)
-        self.backdate_lease(sf1, self.renew_secrets[1], new_expiration_time)
-        self.backdate_lease(sf1, self.renew_secrets[2], new_expiration_time)
-        sf2 = _get_sharefile(mutable_si_2)
-        self.backdate_lease(sf2, self.renew_secrets[3], new_expiration_time)
-        sf3 = _get_sharefile(mutable_si_3)
-        self.backdate_lease(sf3, self.renew_secrets[4], new_expiration_time)
-        self.backdate_lease(sf3, self.renew_secrets[5], new_expiration_time)
-
-        ss.setServiceParent(self.s)
-        def _wait():
-            return bool(lc.get_state()["last-cycle-finished"] is not None)
-        d = self.poll(_wait)
-
-        def _after_first_cycle(ignored):
-            self.failUnlessEqual(count_shares(immutable_si_0), 1)
-            self.failUnlessEqual(count_leases(immutable_si_0), 1)
-            self.failUnlessEqual(count_shares(immutable_si_1), 1)
-            self.failUnlessEqual(count_leases(immutable_si_1), 2)
-            self.failUnlessEqual(count_shares(mutable_si_2), 0)
-            self.failUnlessEqual(count_shares(mutable_si_3), 0)
-        d.addCallback(_after_first_cycle)
-        d.addCallback(lambda ign: self.render1(webstatus))
-        def _check_html(html):
-            s = remove_tags(html)
-            self.failUnlessIn("The following sharetypes will be expired: mutable.", s)
-        d.addCallback(_check_html)
-        return d
 
     def test_bad_mode(self):
         basedir = "storage/LeaseCrawler/bad_mode"
index 24d769bb79f2b80f930e3d0fa540be8ab65391b0..6bb2785010ef17edf44676a82277c2fd2777627c 100644 (file)
@@ -151,9 +151,6 @@ class StorageStatus(rend.Page):
             isoutcdate = time_format.iso_utc_date(lc.cutoff_date)
             ctx.tag["Leases created or last renewed before %s (%s) UTC "
                     "will be considered expired." % (isoutcdate, localizedutcdate, )]
-        if len(lc.mode) > 2:
-            ctx.tag[" The following sharetypes will be expired: ",
-                    " ".join(sorted(lc.sharetypes_to_expire)), "."]
         return ctx.tag
 
     def format_recovered(self, sr, a):