From: Daira Hopwood Date: Fri, 17 Apr 2015 17:59:20 +0000 (+0100) Subject: Remove support for [storage]debug_discard option. X-Git-Url: https://git.rkrishnan.org/tahoe_css?a=commitdiff_plain;h=2b8841208955847b0097dbb5f97f4144e6d14bbf;p=tahoe-lafs%2Ftahoe-lafs.git Remove support for [storage]debug_discard option. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index bb6dce23..6e9cadc7 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -272,8 +272,8 @@ class Client(node.Node, pollmixin.PollMixin): raise if reserved is None: reserved = 0 - discard = self.get_config("storage", "debug_discard", False, - boolean=True) + if self.get_config("storage", "debug_discard", False, boolean=True): + raise OldConfigOptionError("[storage]debug_discard = True is no longer supported.") expire = self.get_config("storage", "expire.enabled", False, boolean=True) if expire: @@ -299,7 +299,6 @@ class Client(node.Node, pollmixin.PollMixin): ss = StorageServer(storedir, self.nodeid, reserved_space=reserved, - discard_storage=discard, readonly_storage=readonly, stats_provider=self.stats_provider, expiration_enabled=expire, diff --git a/src/allmydata/storage/server.py b/src/allmydata/storage/server.py index 1de4b22f..9e7ea15b 100644 --- a/src/allmydata/storage/server.py +++ b/src/allmydata/storage/server.py @@ -39,7 +39,7 @@ class StorageServer(service.MultiService, Referenceable): LeaseCheckerClass = LeaseCheckingCrawler def __init__(self, storedir, nodeid, reserved_space=0, - discard_storage=False, readonly_storage=False, + readonly_storage=False, stats_provider=None, expiration_enabled=False, expiration_mode="age", @@ -58,7 +58,6 @@ class StorageServer(service.MultiService, Referenceable): self.corruption_advisory_dir = os.path.join(storedir, "corruption-advisories") self.reserved_space = int(reserved_space) - self.no_storage = discard_storage self.readonly_storage = readonly_storage self.stats_provider = stats_provider if self.stats_provider: @@ -298,8 +297,6 @@ class StorageServer(service.MultiService, Referenceable): # ok! we need to create the new share file. bw = BucketWriter(self, incominghome, finalhome, max_space_per_bucket, lease_info, canary) - if self.no_storage: - bw.throw_out_all_data = True bucketwriters[shnum] = bw self._active_writers[bw] = 1 if limited: diff --git a/src/allmydata/test/check_memory.py b/src/allmydata/test/check_memory.py index 8ee18c73..8b992c30 100644 --- a/src/allmydata/test/check_memory.py +++ b/src/allmydata/test/check_memory.py @@ -192,17 +192,13 @@ class SystemFramework(pollmixin.PollMixin): "shares.happy = 1\n" "[storage]\n" % (self.introducer_furl,)) - # the only tests for which we want the internal nodes to actually - # retain shares are the ones where somebody's going to download - # them. - if self.mode in ("download", "download-GET", "download-GET-slow"): - # retain shares - pass - else: - # for these tests, we tell the storage servers to pretend to - # accept shares, but really just throw them out, since we're - # only testing upload and not download. - f.write("debug_discard = true\n") + + # We used to set the [storage]debug_discard option to discard + # shares when they will not be needed, i.e. when self.mode not in + # ("download", "download-GET", "download-GET-slow"). + # But debug_discard is no longer supported. It should be OK to + # retain the shares anyway. + if self.mode in ("receive",): # for this mode, the client-under-test gets all the shares, # so our internal nodes can refuse requests @@ -253,8 +249,7 @@ this file are ignored. else: # don't accept any shares f.write("readonly = true\n") - ## also, if we do receive any shares, throw them away - #f.write("debug_discard = true") + if self.mode == "upload-self": pass f.close() diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index d6cd7d0d..aa3ad411 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -242,6 +242,16 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase): "port = tcp:0:interface=127.0.0.1\n")) self.failUnlessRaises(NeedRootcapLookupScheme, client.Client, basedir) + def test_debug_discard_true_unsupported(self): + basedir = "client.Basic.test_debug_discard_true_unsupported" + os.mkdir(basedir) + fileutil.write(os.path.join(basedir, "tahoe.cfg"), \ + BASECONFIG + \ + "[storage]\n" + \ + "enabled = true\n" + \ + "debug_discard = true\n") + self.failUnlessRaises(OldConfigOptionError, client.Client, basedir) + def _permute(self, sb, key): return [ s.get_longname() for s in sb.get_servers_for_psi(key) ] diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py index c63323ad..5fcb0208 100644 --- a/src/allmydata/test/test_storage.py +++ b/src/allmydata/test/test_storage.py @@ -709,28 +709,9 @@ class Server(unittest.TestCase): # But if there are stats, readonly_storage means disk_avail=0 self.failUnlessEqual(stats["storage_server.disk_avail"], 0) - def test_discard(self): - # discard is really only used for other tests, but we test it anyways - workdir = self.workdir("test_discard") - ss = StorageServer(workdir, "\x00" * 20, discard_storage=True) - ss.setServiceParent(self.sparent) - - already,writers = self.allocate(ss, "vid", [0,1,2], 75) - self.failUnlessEqual(already, set()) - self.failUnlessEqual(set(writers.keys()), set([0,1,2])) - for i,wb in writers.items(): - wb.remote_write(0, "%25d" % i) - wb.remote_close() - # since we discard the data, the shares should be present but sparse. - # Since we write with some seeks, the data we read back will be all - # zeros. - b = ss.remote_get_buckets("vid") - self.failUnlessEqual(set(b.keys()), set([0,1,2])) - self.failUnlessEqual(b[0].remote_read(0, 25), "\x00" * 25) - def test_advise_corruption(self): workdir = self.workdir("test_advise_corruption") - ss = StorageServer(workdir, "\x00" * 20, discard_storage=True) + ss = StorageServer(workdir, "\x00" * 20) ss.setServiceParent(self.sparent) si0_s = base32.b2a("si0")