From: david-sarah Date: Mon, 19 Jul 2010 04:46:55 +0000 (-0700) Subject: upload.py: fix #1118 by aborting newly-homeless buckets when reassignment runs. This... X-Git-Tag: allmydata-tahoe-1.7.1~5 X-Git-Url: https://git.rkrishnan.org/specifications/components?a=commitdiff_plain;h=461f9464579f244230b585a9d8df298e1a234ae8;p=tahoe-lafs%2Ftahoe-lafs.git upload.py: fix #1118 by aborting newly-homeless buckets when reassignment runs. This makes a previously failing assert correct. This version refactors 'abort' into two methods, rather than using a default argument. --- diff --git a/src/allmydata/immutable/upload.py b/src/allmydata/immutable/upload.py index 60e1078f..dc468004 100644 --- a/src/allmydata/immutable/upload.py +++ b/src/allmydata/immutable/upload.py @@ -137,11 +137,19 @@ class PeerTracker: def abort(self): """ - I abort the remote bucket writers for the share numbers in - sharenums. This is a good idea to conserve space on the storage - server. + I abort the remote bucket writers for all shares. This is a good idea + to conserve space on the storage server. """ - for writer in self.buckets.itervalues(): writer.abort() + self.abort_some_buckets(self.buckets.keys()) + + def abort_some_buckets(self, sharenums): + """ + I abort the remote bucket writers for the share numbers in sharenums. + """ + for sharenum in sharenums: + if sharenum in self.buckets: + self.buckets[sharenum].abort() + del self.buckets[sharenum] class Tahoe2PeerSelector: @@ -356,6 +364,8 @@ class Tahoe2PeerSelector: if not self.preexisting_shares[share]: del self.preexisting_shares[share] items.append((server, sharelist)) + for writer in self.use_peers: + writer.abort_some_buckets(self.homeless_shares) return self._loop() else: # Redistribution won't help us; fail. @@ -364,6 +374,8 @@ class Tahoe2PeerSelector: self.needed_shares, self.servers_of_happiness, effective_happiness) + log.msg("server selection unsuccessful for %r: %s (%s), merged=%r" + % (self, msg, self._get_progress_message(), merged), level=log.INFREQUENT) return self._failed("%s (%s)" % (msg, self._get_progress_message())) if self.uncontacted_peers: