Rev 3815: Start getting _copy_revision_texts to retry. in http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/pack_retry_153786
John Arbash Meinel
john at arbash-meinel.com
Sun Oct 26 15:13:42 GMT 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/pack_retry_153786
------------------------------------------------------------
revno: 3815
revision-id: john at arbash-meinel.com-20081026151330-rbwnhhrup7wg60kf
parent: john at arbash-meinel.com-20081025153055-u56eg6vkslmzx6qs
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: pack_retry_153786
timestamp: Sun 2008-10-26 10:13:30 -0500
message:
Start getting _copy_revision_texts to retry.
There seems to be something weird, where reloading the pack names does get
the correct value for self._names, but still has the old packs in self._packs.
-------------- next part --------------
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2008-10-25 15:30:55 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2008-10-26 15:13:30 +0000
@@ -624,15 +624,33 @@
revision_keys = [(revision_id,) for revision_id in self.revision_ids]
else:
revision_keys = None
- # select revision keys
- revision_index_map = self._pack_collection._packs_list_to_pack_map_and_index_list(
- self.packs, 'revision_index')[0]
- revision_nodes = self._pack_collection._index_contents(revision_index_map, revision_keys)
- # copy revision keys and adjust values
- self.pb.update("Copying revision texts", 1)
- total_items, readv_group_iter = self._revision_node_readv(revision_nodes)
- list(self._copy_nodes_graph(revision_index_map, self.new_pack._writer,
- self.new_pack.revision_index, readv_group_iter, total_items))
+ completed_keys = []
+ while True:
+ try:
+ # select revision keys
+ revision_index_map = self._pack_collection._packs_list_to_pack_map_and_index_list(
+ self.packs, 'revision_index')[0]
+ revision_nodes = list(self._pack_collection._index_contents(revision_index_map,
+ revision_keys))
+ # copy revision keys and adjust values
+ self.pb.update("Copying revision texts", 1)
+ total_items, readv_group_iter = self._revision_node_readv(revision_nodes)
+ list(self._copy_nodes_graph(revision_index_map, self.new_pack._writer,
+ self.new_pack.revision_index, readv_group_iter,
+ total_items, completed_keys=completed_keys))
+ break
+ except errors.NoSuchFile:
+ # A pack file went missing, try reloading in case it was just
+ # someone else repacking the repo.
+ import pdb; pdb.set_trace()
+ if not self._pack_collection.reload_pack_names():
+ raise
+ # If we got to here, that means we can retry, but we don't want
+ # to copy the same nodes twice
+ if revision_keys is None:
+ revision_keys = [node[1] for node in revision_nodes]
+ # Filter out the revisions which we have already copied
+
if 'pack' in debug.debug_flags:
mutter('%s: create_pack: revisions copied: %s%s %d items t+%6.3fs',
time.ctime(), self._pack_collection._upload_transport.base,
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py 2008-10-25 15:30:55 +0000
+++ b/bzrlib/tests/test_repository.py 2008-10-26 15:13:30 +0000
@@ -1062,6 +1062,7 @@
# bit, but that runs into concurrancy issues depending on the
# platform
print 'activating'
+ import pdb; pdb.set_trace()
call_obj()
for count, val in enumerate(orig_readv(relpath, *args, **kwargs)):
yield val
More information about the bazaar-commits
mailing list