Ticket #1212: 1212.patch

File 1212.patch, 2.7 KB (added by eurekafag, at 2010-09-28T07:28:07Z)
  • immutable/repairer.py

    diff -ur allmydata_orig/immutable/repairer.py allmydata/immutable/repairer.py
    old new  
    5757            vcap = self._filenode.get_verify_cap()
    5858            k = vcap.needed_shares
    5959            N = vcap.total_shares
    60             happy = upload.BaseUploadable.default_encoding_param_happy
     60            # Per ticket #1212
     61            # (http://tahoe-lafs.org/trac/tahoe-lafs/ticket/1212)
     62            happy = 0
    6163            self._encodingparams = (k, happy, N, segsize)
    6264            ul = upload.CHKUploader(self._storage_broker, self._secret_holder)
    6365            return ul.start(self) # I am the IEncryptedUploadable
  • test/test_repairer.py

    diff -ur allmydata_orig/test/test_repairer.py allmydata/test/test_repairer.py
    old new  
    516516                      self.failUnlessEqual(newdata, common.TEST_DATA))
    517517        return d
    518518
     519    def test_repairer_servers_of_happiness(self):
     520        # The repairer is supposed to generate and place as many of the
     521        # missing shares as possible without caring about how they are
     522        # distributed.
     523        self.basedir = "repairer/Repairer/repairer_servers_of_happiness"
     524        self.set_up_grid(num_clients=2, num_servers=10)
     525        d = self.upload_and_stash()
     526        # Now delete some servers. We want to leave 3 servers, which
     527        # will allow us to restore the file to a healthy state without
     528        # distributing the shares widely enough to satisfy the default
     529        # happiness setting.
     530        def _delete_some_servers(ignored):
     531            for i in xrange(7):
     532                self.g.remove_server(self.g.servers_by_number[i].my_nodeid)
     533
     534            assert len(self.g.servers_by_number) == 3
     535
     536        d.addCallback(_delete_some_servers)
     537        # Now try to repair the file.
     538        d.addCallback(lambda ignored:
     539            self.c0_filenode.check_and_repair(Monitor(), verify=False))
     540        def _check_results(crr):
     541            self.failUnlessIsInstance(crr,
     542                                      check_results.CheckAndRepairResults)
     543            pre = crr.get_pre_repair_results()
     544            post = crr.get_post_repair_results()
     545            for p in (pre, post):
     546                self.failUnlessIsInstance(p, check_results.CheckResults)
     547
     548            self.failIf(pre.is_healthy())
     549            self.failUnless(post.is_healthy())
     550
     551        d.addCallback(_check_results)
     552        return d
     553
    519554    # why is test_repair_from_corruption_of_1 disabled? Read on:
    520555    #
    521556    # As recently documented in NEWS for the 1.3.0 release, the current