Ticket #1118: debugging-1118-2.dpatch.txt

File debugging-1118-2.dpatch.txt, 18.8 KB (added by zooko, at 2010-07-18T22:19:01Z)
Line 
1Sun Jul 18 16:03:56 MDT 2010  zooko@zooko.com
2  * immutable: use PrefixingLogMixin to organize logging in Tahoe2PeerSelector and add more detailed messages about peer
3
4New patches:
5
6[immutable: use PrefixingLogMixin to organize logging in Tahoe2PeerSelector and add more detailed messages about peer
7zooko@zooko.com**20100718220356
8 Ignore-this: f0ff7ac3345ff269b7f5bedbbea208e
9] {
10hunk ./src/allmydata/immutable/upload.py 77
11 # TODO: actual extensions are closer to 419 bytes, so we can probably lower
12 # this.
13 
14+def pretty_print_shnum_to_servers(s):
15+    return ', '.join([ "sh%s: %s" % (k, '+'.join([idlib.shortnodeid_b2a(x) for x in v])) for k, v in s.iteritems() ])
16+
17 class PeerTracker:
18     def __init__(self, peerid, storage_server,
19                  sharesize, blocksize, num_segments, num_share_hashes,
20hunk ./src/allmydata/immutable/upload.py 150
21         for writer in self.buckets.itervalues(): writer.abort()
22 
23 
24-class Tahoe2PeerSelector:
25+class Tahoe2PeerSelector(PrefixingLogMixin):
26 
27     def __init__(self, upload_id, logparent=None, upload_status=None):
28         self.upload_id = upload_id
29hunk ./src/allmydata/immutable/upload.py 161
30         self.num_peers_contacted = 0
31         self.last_failure_msg = None
32         self._status = IUploadStatus(upload_status)
33-        self._log_parent = log.msg("%s starting" % self, parent=logparent)
34+        PrefixingLogMixin.__init__(self, 'tahoe.immutable.upload', logparent, prefix=upload_id)
35+        self.log("starting", level=log.OPERATIONAL)
36 
37     def __repr__(self):
38         return "<Tahoe2PeerSelector for upload %s>" % self.upload_id
39hunk ./src/allmydata/immutable/upload.py 267
40             ds.append(d)
41             self.num_peers_contacted += 1
42             self.query_count += 1
43-            log.msg("asking peer %s for any existing shares for "
44-                    "upload id %s"
45-                    % (idlib.shortnodeid_b2a(peer.peerid), self.upload_id),
46-                    level=log.NOISY, parent=self._log_parent)
47+            self.log("asking peer %s for any existing shares" %
48+                     (idlib.shortnodeid_b2a(peer.peerid),),
49+                    level=log.NOISY)
50         dl = defer.DeferredList(ds)
51         dl.addCallback(lambda ign: self._loop())
52         return dl
53hunk ./src/allmydata/immutable/upload.py 281
54         Tahoe2PeerSelector._existing_shares.
55         """
56         if isinstance(res, failure.Failure):
57-            log.msg("%s got error during existing shares check: %s"
58+            self.log("%s got error during existing shares check: %s"
59                     % (idlib.shortnodeid_b2a(peer), res),
60hunk ./src/allmydata/immutable/upload.py 283
61-                    level=log.UNUSUAL, parent=self._log_parent)
62+                    level=log.UNUSUAL)
63             self.error_count += 1
64             self.bad_query_count += 1
65         else:
66hunk ./src/allmydata/immutable/upload.py 290
67             buckets = res
68             if buckets:
69                 self.peers_with_shares.add(peer)
70-            log.msg("response from peer %s: alreadygot=%s"
71+            self.log("response to get_buckets() from peer %s: alreadygot=%s"
72                     % (idlib.shortnodeid_b2a(peer), tuple(sorted(buckets))),
73hunk ./src/allmydata/immutable/upload.py 292
74-                    level=log.NOISY, parent=self._log_parent)
75+                    level=log.NOISY)
76             for bucket in buckets:
77                 self.preexisting_shares.setdefault(bucket, set()).add(peer)
78                 if self.homeless_shares and bucket in self.homeless_shares:
79hunk ./src/allmydata/immutable/upload.py 326
80             merged = merge_peers(self.preexisting_shares, self.use_peers)
81             effective_happiness = servers_of_happiness(merged)
82             if self.servers_of_happiness <= effective_happiness:
83-                msg = ("peer selection successful for %s: %s" % (self,
84-                            self._get_progress_message()))
85-                log.msg(msg, parent=self._log_parent)
86+                msg = ("peer selection successful for %s: %s: %s" % (self,
87+                            self._get_progress_message(), pretty_print_shnum_to_servers(merged)))
88+                self.log(msg, level=log.OPERATIONAL)
89                 return (self.use_peers, self.preexisting_shares)
90             else:
91                 # We're not okay right now, but maybe we can fix it by
92hunk ./src/allmydata/immutable/upload.py 370
93                                           self.needed_shares,
94                                           self.servers_of_happiness,
95                                           effective_happiness)
96+                    self.log("server selection unsuccessful for %s: %s: %s" % (self, msg, self._get_progress_message(), pretty_print_shnum_to_servers(merged)), level=log.UNUSUAL)
97                     return self._failed("%s (%s)" % (msg, self._get_progress_message()))
98 
99         if self.uncontacted_peers:
100hunk ./src/allmydata/immutable/upload.py 393
101         elif self.contacted_peers:
102             # ask a peer that we've already asked.
103             if not self._started_second_pass:
104-                log.msg("starting second pass", parent=self._log_parent,
105+                self.log("starting second pass",
106                         level=log.NOISY)
107                 self._started_second_pass = True
108             num_shares = mathutil.div_ceil(len(self.homeless_shares),
109hunk ./src/allmydata/immutable/upload.py 431
110                                 self._get_progress_message()))
111                 if self.last_failure_msg:
112                     msg += " (%s)" % (self.last_failure_msg,)
113-                log.msg(msg, level=log.UNUSUAL, parent=self._log_parent)
114+                self.log(msg, level=log.UNUSUAL)
115                 return self._failed(msg)
116             else:
117                 # we placed enough to be happy, so we're done
118hunk ./src/allmydata/immutable/upload.py 443
119         if isinstance(res, failure.Failure):
120             # This is unusual, and probably indicates a bug or a network
121             # problem.
122-            log.msg("%s got error during peer selection: %s" % (peer, res),
123-                    level=log.UNUSUAL, parent=self._log_parent)
124+            self.log("%s got error during peer selection: %s" % (peer, res),
125+                    level=log.UNUSUAL)
126             self.error_count += 1
127             self.bad_query_count += 1
128             self.homeless_shares = list(shares_to_ask) + self.homeless_shares
129hunk ./src/allmydata/immutable/upload.py 463
130                 self.last_failure_msg = msg
131         else:
132             (alreadygot, allocated) = res
133-            log.msg("response from peer %s: alreadygot=%s, allocated=%s"
134+            self.log("response to allocate_buckets() from peer %s: alreadygot=%s, allocated=%s"
135                     % (idlib.shortnodeid_b2a(peer.peerid),
136                        tuple(sorted(alreadygot)), tuple(sorted(allocated))),
137hunk ./src/allmydata/immutable/upload.py 466
138-                    level=log.NOISY, parent=self._log_parent)
139+                    level=log.NOISY)
140             progress = False
141             for s in alreadygot:
142                 self.preexisting_shares.setdefault(s, set()).add(peer.peerid)
143hunk ./src/allmydata/storage/server.py 8
144 
145 from zope.interface import implements
146 from allmydata.interfaces import RIStorageServer, IStatsProducer
147-from allmydata.util import fileutil, log, time_format
148+from allmydata.util import fileutil, idlib, log, time_format
149 import allmydata # for __full_version__
150 
151 from allmydata.storage.common import si_b2a, si_a2b, storage_index_to_dir
152hunk ./src/allmydata/storage/server.py 109
153                                    expiration_sharetypes)
154         self.lease_checker.setServiceParent(self)
155 
156+    def __repr__(self):
157+        return "<StorageServer %s>" % (idlib.shortnodeid_b2a(self.my_nodeid),)
158+
159     def add_bucket_counter(self):
160         statefile = os.path.join(self.storedir, "bucket_counter.state")
161         self.bucket_counter = BucketCountingCrawler(self, statefile)
162hunk ./src/allmydata/test/test_upload.py 736
163     def _add_server(self, server_number, readonly=False):
164         assert self.g, "I tried to find a grid at self.g, but failed"
165         ss = self.g.make_server(server_number, readonly)
166+        log.msg("just created a server, number: %s => %s" % (server_number, ss,))
167         self.g.add_server(server_number, ss)
168 
169hunk ./src/allmydata/test/test_upload.py 739
170-
171     def _add_server_with_share(self, server_number, share_number=None,
172                                readonly=False):
173         self._add_server(server_number, readonly)
174hunk ./src/allmydata/test/test_upload.py 799
175         d.addCallback(_store_shares)
176         return d
177 
178-
179     def test_configure_parameters(self):
180         self.basedir = self.mktemp()
181         hooks = {0: self._set_up_nodes_extra_config}
182}
183
184Context:
185
186[trivial: fix unused import (sorry about that, pyflakes)
187zooko@zooko.com**20100718215133
188 Ignore-this: c2414e443405072b51d552295f2c0e8c
189]
190[tests, NEWS, CREDITS re: #1117
191zooko@zooko.com**20100718203225
192 Ignore-this: 1f08be2c692fb72cc0dd023259f11354
193 Give Brian and Kevan promotions, move release date in NEWS to the 18th, commit Brian's test for #1117.
194 fixes #1117
195]
196[test/test_upload.py: test to see that aborted buckets are ignored by the storage server
197Kevan Carstensen <kevan@isnotajoke.com>**20100716001046
198 Ignore-this: cc075c24b1c86d737f3199af894cc780
199]
200[test/test_storage.py: test for the new remote_abort semantics.
201Kevan Carstensen <kevan@isnotajoke.com>**20100715232148
202 Ignore-this: d3d6491f17bf670e770ca4b385007515
203]
204[storage/immutable.py: make remote_abort btell the storage server about aborted buckets.
205Kevan Carstensen <kevan@isnotajoke.com>**20100715232105
206 Ignore-this: 16ab0090676355abdd5600ed44ff19c9
207]
208[test/test_upload.py: changes to test plumbing for #1117 tests
209Kevan Carstensen <kevan@isnotajoke.com>**20100715231820
210 Ignore-this: 78a6d359d7bf8529d283e2815bf1e2de
211 
212     - Add a callRemoteOnly method to FakeBucketWriter.
213     - Change the abort method in FakeBucketWriter to not return a
214       RuntimeError.
215]
216[immutable/upload.py: abort buckets if peer selection fails
217Kevan Carstensen <kevan@isnotajoke.com>**20100715231714
218 Ignore-this: 2a0b643a22284df292d8ed9d91b1fd37
219]
220[test_encodingutil: correct an error in the previous patch to StdlibUnicode.test_open_representable.
221david-sarah@jacaranda.org**20100718151420
222 Ignore-this: af050955f623fbc0e4d78e15a0a8a144
223]
224[NEWS: Forward-compatibility improvements for non-ASCII caps (#1051).
225david-sarah@jacaranda.org**20100718143622
226 Ignore-this: 1edfebc4bd38a3b5c35e75c99588153f
227]
228[test_dirnode and test_web: don't use failUnlessReallyEqual in cases where the return type from simplejson.loads can vary between unicode and str. Use to_str when comparing URIs parsed from JSON.
229david-sarah@jacaranda.org**20100718142915
230 Ignore-this: c4e78ef4b1478dd400da71cf077ffa4a
231]
232[test_encodingutil: StdlibUnicode.test_open_representable no longer uses a mock.
233david-sarah@jacaranda.org**20100718125412
234 Ignore-this: 4bf373a5e2dfe4209e5e364124af29a3
235]
236[docs: add comment clarifying #1051
237zooko@zooko.com**20100718053250
238 Ignore-this: 6cfc0930434cbdbbc262dabb58f1505d
239]
240[docs: update NEWS
241zooko@zooko.com**20100718053225
242 Ignore-this: 63d5c782ef84812e6d010f0590866831
243]
244[Add tests of caps from the future that have non-ASCII characters in them (encoded as UTF-8). The changes to test_uri.py, test_client.py, and test_dirnode.py add tests of non-ASCII future caps in addition to the current tests. The changes to test_web.py just replace the tests of all-ASCII future caps with tests of non-ASCII future caps. We also change uses of failUnlessEqual to failUnlessReallyEqual, in order to catch cases where the type of a string is not as expected.
245david-sarah@jacaranda.org**20100711200252
246 Ignore-this: c2f193352369d32e06865f8f3e951894
247]
248[Debian documentation update
249jacob@appelbaum.net**20100305003004]
250[debian-docs-patch-final
251jacob@appelbaum.net**20100304085955]
252[M-x whitespace-cleanup
253zooko@zooko.com**20100718032739
254 Ignore-this: babfd4af6ad2fc885c957fd5c8b10c3f
255]
256[docs: tidy up NEWS a little
257zooko@zooko.com**20100718032434
258 Ignore-this: 54f2820fd1a37c8967609f6bfc4e5e18
259]
260[benchmarking: update bench_dirnode.py to reflect the new directory interfaces
261zooko@zooko.com**20100718031710
262 Ignore-this: 368ba523dd3de80d9da29cd58afbe827
263]
264[test_encodingutil: fix test_open_representable, which is only valid when run on a platform for which we know an unrepresentable filename.
265david-sarah@jacaranda.org**20100718030333
266 Ignore-this: c114d92c17714a5d4ae005c15267d60c
267]
268[iputil.py: Add support for FreeBSD 7,8 and 9
269francois@ctrlaltdel.ch**20100718022832
270 Ignore-this: 1829b4cf4b91107f4cf87841e6167e99
271 committed by: zooko@zooko.com
272 date: 2010-07-17
273 and I also patched: NEWS and CREDITS
274]
275[NEWS: add snippet about #1083
276zooko@zooko.com**20100718020653
277 Ignore-this: d353a9d93cbc5a5e6ba4671f78d1e22b
278]
279[fileutil: docstrings for non-obvious usage restrictions on methods of EncryptedTemporaryFile.
280david-sarah@jacaranda.org**20100717054647
281 Ignore-this: 46d8fc10782fa8ec2b6c5b168c841943
282]
283[Move EncryptedTemporaryFile from SFTP frontend to allmydata.util.fileutil, and make the FTP frontend also use it (fixing #1083).
284david-sarah@jacaranda.org**20100711213721
285 Ignore-this: e452e8ca66391aa2a1a49afe0114f317
286]
287[NEWS: reorder NEWS snippets to be in descending order of interestingness
288zooko@zooko.com**20100718015929
289 Ignore-this: 146c42e88a9555a868a04a69dd0e5326
290]
291[Correct stringutils->encodingutil patch to be the newer version, rather than the old version that was committed in error.
292david-sarah@jacaranda.org**20100718013435
293 Ignore-this: c8940c4e1aa2e9acc80cd4fe54753cd8
294]
295[test_cli.py: fix error that crept in when rebasing the patch for #1072.
296david-sarah@jacaranda.org**20100718000123
297 Ignore-this: 3e8f6cc3a27b747c708221dd581934f4
298]
299[stringutils: add test for when sys.stdout has no encoding attribute (fixes #1099).
300david-sarah@jacaranda.org**20100717045816
301 Ignore-this: f28dce6940e909f12f354086d17db54f
302]
303[CLI: add 'tahoe unlink' as an alias to 'tahoe rm', for forward-compatibility.
304david-sarah@jacaranda.org**20100717220411
305 Ignore-this: 3ecdde7f2d0498514cef32e118e0b855
306]
307[minor code clean-up in dirnode.py
308zooko@zooko.com**20100714060255
309 Ignore-this: bb0ab2783203e605024b3e2f798256a1
310 Impose micro-POLA by passing only the writekey instead of the whole node object to {{{_encrypt_rw_uri()}}}. Remove DummyImmutableFileNode in nodemaker.py, which is obviated by this. Add micro-optimization by precomputing the netstring of the empty string and branching on whether the writekey is present or not outside of {{{_encrypt_rw_uri()}}}. Add doc about writekey to docstring.
311 fixes #967
312]
313[Rename stringutils to encodingutil, and drop listdir_unicode and open_unicode (since the Python stdlib functions work fine with Unicode paths). Also move some utility functions to fileutil.
314david-sarah@jacaranda.org**20100712003015
315 Ignore-this: 103b809d180df17a7283077c3104c7be
316]
317[Allow URIs passed in the initial JSON for t=mkdir-with-children, t=mkdir-immutable to be Unicode. Also pass the name of each child into nodemaker.create_from_cap for error reporting.
318david-sarah@jacaranda.org**20100711195525
319 Ignore-this: deac32d8b91ba26ede18905d3f7d2b93
320]
321[docs: CREDITS and NEWS
322zooko@zooko.com**20100714060150
323 Ignore-this: dc83e612f77d69e50ee975f07f6b16fe
324]
325[CREDITS: more creds for Kevan, plus utf-8 BOM
326zooko@zooko.com**20100619045503
327 Ignore-this: 72d02bdd7a0f324f1cee8cd399c7c6de
328]
329[cli.py: make command descriptions consistently end with a full stop.
330david-sarah@jacaranda.org**20100714014538
331 Ignore-this: 9ee7fa29ca2d1631db4049c2a389a97a
332]
333[SFTP: address some of the comments in zooko's review (#1106).
334david-sarah@jacaranda.org**20100712025537
335 Ignore-this: c3921638a2d4f1de2a776ae78e4dc37e
336]
337[docs/logging.txt: note that setting flogging vars might affect tests with race conditions.
338david-sarah@jacaranda.org**20100712050721
339 Ignore-this: fc1609d215fcd5561a57fd1226206f27
340]
341[test_storage.py: potential fix for failures when logging is enabled.
342david-sarah@jacaranda.org**19700713040546
343 Ignore-this: 5815693a0df3e64c52c3c6b7be2846c7
344]
345[upcase_since_on_welcome
346terrellrussell@gmail.com**20100708193903]
347[server_version_on_welcome_page.dpatch.txt
348freestorm77@gmail.com**20100605191721
349 Ignore-this: b450c76dc875f5ac8cca229a666cbd0a
350 
351 
352 - The storage server version is 0 for all storage nodes in the Welcome Page
353 
354 
355]
356[NEWS: add NEWS snippets about two recent patches
357zooko@zooko.com**20100708162058
358 Ignore-this: 6c9da6a0ad7351a960bdd60f81532899
359]
360[directory_html_top_banner.dpatch
361freestorm77@gmail.com**20100622205301
362 Ignore-this: 1d770d975e0c414c996564774f049bca
363 
364 The div tag with the link "Return to Welcome page" on the directory.xhtml page is not correct
365 
366]
367[tahoe_css_toolbar.dpatch
368freestorm77@gmail.com**20100622210046
369 Ignore-this: 5b3ebb2e0f52bbba718a932f80c246c0
370 
371 CSS modification to be correctly diplayed with Internet Explorer 8
372 
373 The links on the top of page directory.xhtml are not diplayed in the same line as display with Firefox.
374 
375]
376[runnin_test_tahoe_css.dpatch
377freestorm77@gmail.com**20100622214714
378 Ignore-this: e0db73d68740aad09a7b9ae60a08c05c
379 
380 Runnin test for changes in tahoe.css file
381 
382]
383[runnin_test_directory_xhtml.dpatch
384freestorm77@gmail.com**20100622201403
385 Ignore-this: f8962463fce50b9466405cb59fe11d43
386 
387 Runnin test for diretory.xhtml top banner
388 
389]
390[stringutils.py: tolerate sys.stdout having no 'encoding' attribute.
391david-sarah@jacaranda.org**20100626040817
392 Ignore-this: f42cad81cef645ee38ac1df4660cc850
393]
394[quickstart.html: python 2.5 -> 2.6 as recommended version
395david-sarah@jacaranda.org**20100705175858
396 Ignore-this: bc3a14645ea1d5435002966ae903199f
397]
398[SFTP: don't call .stopProducing on the producer registered with OverwriteableFileConsumer (which breaks with warner's new downloader).
399david-sarah@jacaranda.org**20100628231926
400 Ignore-this: 131b7a5787bc85a9a356b5740d9d996f
401]
402[docs/how_to_make_a_tahoe-lafs_release.txt: trivial correction, install.html should now be quickstart.html.
403david-sarah@jacaranda.org**20100625223929
404 Ignore-this: 99a5459cac51bd867cc11ad06927ff30
405]
406[setup: in the Makefile, refuse to upload tarballs unless someone has passed the environment variable "BB_BRANCH" with value "trunk"
407zooko@zooko.com**20100619034928
408 Ignore-this: 276ddf9b6ad7ec79e27474862e0f7d6
409]
410[trivial: tiny update to in-line comment
411zooko@zooko.com**20100614045715
412 Ignore-this: 10851b0ed2abfed542c97749e5d280bc
413 (I'm actually committing this patch as a test of the new eager-annotation-computation of trac-darcs.)
414]
415[docs: about.html link to home page early on, and be decentralized storage instead of cloud storage this time around
416zooko@zooko.com**20100619065318
417 Ignore-this: dc6db03f696e5b6d2848699e754d8053
418]
419[docs: update about.html, especially to have a non-broken link to quickstart.html, and also to comment out the broken links to "for Paranoids" and "for Corporates"
420zooko@zooko.com**20100619065124
421 Ignore-this: e292c7f51c337a84ebfeb366fbd24d6c
422]
423[TAG allmydata-tahoe-1.7.0
424zooko@zooko.com**20100619052631
425 Ignore-this: d21e27afe6d85e2e3ba6a3292ba2be1
426]
427Patch bundle hash:
428907c4692228657ec5455679c0a22c438f3ccba86