Changeset 9acf5be in trunk
- Timestamp:
- 2012-05-16T23:55:09Z (13 years ago)
- Branches:
- master
- Children:
- cc36690
- Parents:
- 5ec2076
- git-author:
- Brian Warner <warner@…> (2012-05-16 23:50:43)
- git-committer:
- Brian Warner <warner@…> (2012-05-16 23:55:09)
- Location:
- src/allmydata
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/allmydata/immutable/checker.py ¶
r5ec2076 r9acf5be 748 748 corruptshare_locators = [] # (serverid, storageindex, sharenum) 749 749 incompatibleshare_locators = [] # (serverid, storageindex, sharenum) 750 servers_responding = set() # serverid 750 751 751 752 for verified, server, corrupt, incompatible, responded in results: … … 758 759 for sharenum in incompatible: 759 760 incompatibleshare_locators.append((server_id, SI, sharenum)) 761 if responded: 762 servers_responding.add(server_id) 760 763 761 764 d['count-shares-good'] = len(verifiedshares) … … 781 784 d['count-unrecoverable-versions'] = 1 782 785 783 d['servers-responding'] = list(servers )786 d['servers-responding'] = list(servers_responding) 784 787 d['sharemap'] = verifiedshares 785 788 # no such thing as wrong shares of an immutable file -
TabularUnified src/allmydata/immutable/filenode.py ¶
r5ec2076 r9acf5be 120 120 sm.update(ur.sharemap) 121 121 servers_responding = set(prr.data['servers-responding']) 122 servers_responding.union(ur.sharemap.iterkeys()) 123 prr.data['servers-responding'] = list(servers_responding) 122 for shnum, serverids in ur.sharemap.items(): 123 servers_responding.update(serverids) 124 servers_responding = sorted(servers_responding) 125 prr.data['servers-responding'] = servers_responding 124 126 prr.data['count-shares-good'] = len(sm) 125 127 good_hosts = len(reduce(set.union, sm.itervalues(), set())) -
TabularUnified src/allmydata/test/no_network.py ¶
r5ec2076 r9acf5be 68 68 def _call(): 69 69 if self.broken: 70 if self.broken is not True: # a counter, not boolean 71 self.broken -= 1 70 72 raise IntentionalError("I was asked to break") 71 73 if self.hung_until: … … 300 302 return ss 301 303 302 def break_server(self, serverid ):304 def break_server(self, serverid, count=True): 303 305 # mark the given server as broken, so it will throw exceptions when 304 # asked to hold a share or serve a share 305 self.wrappers_by_id[serverid].broken = True 306 # asked to hold a share or serve a share. If count= is a number, 307 # throw that many exceptions before starting to work again. 308 self.wrappers_by_id[serverid].broken = count 306 309 307 310 def hang_server(self, serverid): -
TabularUnified src/allmydata/test/test_repairer.py ¶
r5ec2076 r9acf5be 171 171 self.failUnless(data['count-shares-expected'] == 10, data) 172 172 self.failUnless(data['count-good-share-hosts'] == 9, data) 173 self.failUnless(len(data['servers-responding']) == 10, data)173 self.failUnless(len(data['servers-responding']) == 9, data) 174 174 self.failUnless(len(data['list-corrupt-shares']) == 0, data) 175 175 … … 707 707 return d 708 708 709 def test_servers_responding(self): 710 self.basedir = "repairer/Repairer/servers_responding" 711 self.set_up_grid(num_clients=2) 712 d = self.upload_and_stash() 713 # now cause one of the servers to not respond during the pre-repair 714 # filecheck, but then *do* respond to the post-repair filecheck 715 def _then(ign): 716 ss = self.g.servers_by_number[0] 717 self.g.break_server(ss.my_nodeid, count=1) 718 self.delete_shares_numbered(self.uri, [9]) 719 return self.c0_filenode.check_and_repair(Monitor()) 720 d.addCallback(_then) 721 def _check(rr): 722 # this exercises a bug in which the servers-responding list did 723 # not include servers that responded to the Repair, but which did 724 # not respond to the pre-repair filecheck 725 prr = rr.get_post_repair_results() 726 expected = set(self.g.get_all_serverids()) 727 self.failUnlessEqual(expected, set(prr.data["servers-responding"])) 728 d.addCallback(_check) 729 return d 709 730 710 731 # XXX extend these tests to show that the checker detects which specific
Note: See TracChangeset
for help on using the changeset viewer.