Rev 3864: (jam) Avoid extracting revision texts. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Nov 27 07:40:18 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3864
revision-id: pqm at pqm.ubuntu.com-20081127074015-oigcdk8r4oxi1qse
parent: pqm at pqm.ubuntu.com-20081127070711-wvjuwbgk18345dek
parent: andrew.bennetts at canonical.com-20081127063734-8bdgt0ugf7kqw82a
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-11-27 07:40:15 +0000
message:
(jam) Avoid extracting revision texts.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
------------------------------------------------------------
revno: 3849.3.3
revision-id: andrew.bennetts at canonical.com-20081127063734-8bdgt0ugf7kqw82a
parent: andrew.bennetts at canonical.com-20081127061708-z6md6mi66iw1z1ww
parent: pqm at pqm.ubuntu.com-20081127052415-9hb2n5pppt7imsb3
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: revision_stream
timestamp: Thu 2008-11-27 17:37:34 +1100
message:
Merge bzr.dev, fixing NEWS conflict.
added:
bzrlib/foreign.py foreign.py-20081112170002-olsxmandkk8qyfuq-1
bzrlib/tests/test_foreign.py test_foreign.py-20081125004048-ywb901edgp9lluxo-1
contrib/convert_to_1.9.py convert_to_dev2.py-20081014130524-z1ydl3mq9b4ehlvv-1
tools/win32/build_release.py build_release.py-20081105204355-2ghh5cv01v1x4rzz-1
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/__init__.py __init__.py-20050309040759-33e65acf91bbcd5d
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/btree_index.py index.py-20080624222253-p0x5f92uyh5hw734-7
bzrlib/config.py config.py-20051011043216-070c74f4e9e338e8
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/log.py log.py-20050505065812-c40ce11702fe5fb1
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
bzrlib/tests/per_repository/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
bzrlib/tests/per_repository/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
bzrlib/tests/per_repository/test_revision.py testrevprops.py-20051013073044-92bc3c68302ce1bf
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_sftp_transport.py testsftp.py-20051027032739-247570325fec7e7e
------------------------------------------------------------
revno: 3849.3.2
revision-id: andrew.bennetts at canonical.com-20081127061708-z6md6mi66iw1z1ww
parent: john at arbash-meinel.com-20081125203957-6ru90u67o1x07prb
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: revision_stream
timestamp: Thu 2008-11-27 17:17:08 +1100
message:
Expand a comment inside insert_record_stream slightly.
modified:
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
------------------------------------------------------------
revno: 3849.3.1
revision-id: john at arbash-meinel.com-20081125203957-6ru90u67o1x07prb
parent: pqm at pqm.ubuntu.com-20081125152232-c22rycit2dfzm11f
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: revision_stream
timestamp: Tue 2008-11-25 14:39:57 -0600
message:
Part of bug #300289, stop requiring plain fulltexts for revisions.
The generic fetch code was always extracting the fulltext for revisions as part of
the fix for bug #261339, however insert_record_stream is currently perfectly
capable of upcasting to a fulltext on-the-fly.
So we restore the behavior of copying knit-ft-gz without extracting it,
and add another test that ensures if the source has a delta it gets expanded
to a fulltext in the target.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/tests/test_fetch.py testfetch.py-20050825090644-f73e07e7dfb1765a
=== modified file 'NEWS'
--- a/NEWS 2008-11-27 06:32:37 +0000
+++ b/NEWS 2008-11-27 07:40:15 +0000
@@ -24,6 +24,12 @@
history just to set the last revision info.
(Andrew Bennetts, John Arbash Meinel)
+ * The generic fetch code can once again copy revisions and signatures
+ without extracting them completely to fulltexts and then serializing
+ them back down into byte strings. This is a significant performance
+ improvement when fetching from a stacked branch.
+ (John Arbash Meinel, #300289)
+
* When making a large readv() request over ``bzr+ssh``, break up the
request into more manageable chunks. Because the RPC is not yet able
to stream, this helps keep us from buffering too much information at
=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py 2008-11-21 20:24:15 +0000
+++ b/bzrlib/fetch.py 2008-11-25 20:39:57 +0000
@@ -256,22 +256,19 @@
to_sf.insert_record_stream(filter_absent(from_sf.get_record_stream(
[(rev_id,) for rev_id in revs],
self.to_repository._fetch_order,
- True)))
- # Bug #261339, some knit repositories accidentally had deltas in their
- # revision stream, when you weren't ever supposed to have deltas.
- # So we now *force* fulltext copying for signatures and revisions
+ not self.to_repository._fetch_uses_deltas)))
self._fetch_just_revision_texts(revs)
def _fetch_just_revision_texts(self, version_ids):
to_rf = self.to_repository.revisions
from_rf = self.from_repository.revisions
+ # If a revision has a delta, this is actually expanded inside the
+ # insert_record_stream code now, which is an alternate fix for
+ # bug #261339
to_rf.insert_record_stream(from_rf.get_record_stream(
[(rev_id,) for rev_id in version_ids],
self.to_repository._fetch_order,
- True))
- # Bug #261339, some knit repositories accidentally had deltas in their
- # revision stream, when you weren't ever supposed to have deltas.
- # So we now *force* fulltext copying for signatures and revisions
+ not self.to_repository._fetch_uses_deltas))
def _generate_root_texts(self, revs):
"""This will be called by __fetch between fetching weave texts and
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py 2008-11-21 21:21:06 +0000
+++ b/bzrlib/knit.py 2008-11-27 06:17:08 +0000
@@ -1401,8 +1401,10 @@
split_lines(record.get_bytes_as('fulltext')))
else:
# Not a fulltext, and not suitable for direct insertion as a
- # delta, either because it's not the right format, or because
- # it depends on a base only present in the fallback kvfs.
+ # delta, either because it's not the right format, or this
+ # KnitVersionedFiles doesn't permit deltas (_max_delta_chain ==
+ # 0) or because it depends on a base only present in the
+ # fallback kvfs.
adapter_key = record.storage_kind, 'fulltext'
adapter = get_adapter(adapter_key)
lines = split_lines(adapter.get_bytes(
=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py 2008-08-29 02:05:22 +0000
+++ b/bzrlib/tests/test_fetch.py 2008-11-25 20:39:57 +0000
@@ -374,12 +374,8 @@
self.assertEqual(('get_record_stream', [('rev-one',)],
target._fetch_order, False),
self.find_get_record_stream(source.inventories.calls))
- # Because of bugs in the old fetch code, revisions could accidentally
- # have deltas present in knits. However, it was never intended, so we
- # always for include_delta_closure=True, to make sure we get fulltexts.
- # bug #261339
self.assertEqual(('get_record_stream', [('rev-one',)],
- target._fetch_order, True),
+ target._fetch_order, False),
self.find_get_record_stream(source.revisions.calls))
# XXX: Signatures is special, and slightly broken. The
# standard item_keys_introduced_by actually does a lookup for every
@@ -390,7 +386,7 @@
# we care about.
signature_calls = source.signatures.calls[-1:]
self.assertEqual(('get_record_stream', [('rev-one',)],
- target._fetch_order, True),
+ target._fetch_order, False),
self.find_get_record_stream(signature_calls))
def test_fetch_no_deltas_with_delta_closure(self):
@@ -432,6 +428,37 @@
target._fetch_order, True),
self.find_get_record_stream(signature_calls))
+ def test_fetch_revisions_with_deltas_into_pack(self):
+ # See BUG #261339, dev versions of bzr could accidentally create deltas
+ # in revision texts in knit branches (when fetching from packs). So we
+ # ensure that *if* a knit repository has a delta in revisions, that it
+ # gets properly expanded back into a fulltext when stored in the pack
+ # file.
+ tree = self.make_branch_and_tree('source', format='dirstate')
+ target = self.make_repository('target', format='pack-0.92')
+ self.build_tree(['source/file'])
+ tree.set_root_id('root-id')
+ tree.add('file', 'file-id')
+ tree.commit('one', rev_id='rev-one')
+ # Hack the KVF for revisions so that it "accidentally" allows a delta
+ tree.branch.repository.revisions._max_delta_chain = 200
+ tree.commit('two', rev_id='rev-two')
+ source = tree.branch.repository
+ # Ensure that we stored a delta
+ source.lock_read()
+ self.addCleanup(source.unlock)
+ record = source.revisions.get_record_stream([('rev-two',)],
+ 'unordered', False).next()
+ self.assertEqual('knit-delta-gz', record.storage_kind)
+ target.fetch(tree.branch.repository, revision_id='rev-two')
+ # The record should get expanded back to a fulltext
+ target.lock_read()
+ self.addCleanup(target.unlock)
+ record = target.revisions.get_record_stream([('rev-two',)],
+ 'unordered', False).next()
+ self.assertEqual('knit-ft-gz', record.storage_kind)
+
+
class Test1To2Fetch(TestCaseWithTransport):
"""Tests for Model1To2 failure modes"""
More information about the bazaar-commits
mailing list