From: David-Sarah Hopwood Date: Sat, 17 Nov 2012 19:46:20 +0000 (+0000) Subject: Remove support for [storage]debug_discard option. X-Git-Url: https://git.rkrishnan.org/class-simplejson.JSONDecoder.html?a=commitdiff_plain;h=91c66e88670a12a986ab11684fdc35442230458a;p=tahoe-lafs%2Ftahoe-lafs.git Remove support for [storage]debug_discard option. (BucketWriter.throw_out_all_data is kept because it might still be useful.) Signed-off-by: David-Sarah Hopwood --- diff --git a/src/allmydata/client.py b/src/allmydata/client.py index 217a7b47..27f146da 100644 --- a/src/allmydata/client.py +++ b/src/allmydata/client.py @@ -267,8 +267,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: @@ -294,7 +294,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 9c0397c0..bd1b47b8 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: @@ -297,8 +296,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 b9d79014..e540f85e 100644 --- a/src/allmydata/test/check_memory.py +++ b/src/allmydata/test/check_memory.py @@ -188,17 +188,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 @@ -249,8 +245,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 796971b2..5b6183c1 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -150,6 +150,16 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase): "reserved_space = bogus\n") self.failUnlessRaises(ValueError, 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 5c5e2c7c..82bbc716 100644 --- a/src/allmydata/test/test_storage.py +++ b/src/allmydata/test/test_storage.py @@ -703,28 +703,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")