Rev 4498: Only add the prefix + ref, don't bother with an empty 'key' setting. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-chk-multilevel
John Arbash Meinel
john at arbash-meinel.com
Fri Jun 26 20:04:16 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.17-chk-multilevel
------------------------------------------------------------
revno: 4498
revision-id: john at arbash-meinel.com-20090626190348-ohwhug9ox54fpkk8
parent: john at arbash-meinel.com-20090626190038-od1qd6psjqoco61a
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-chk-multilevel
timestamp: Fri 2009-06-26 14:03:48 -0500
message:
Only add the prefix + ref, don't bother with an empty 'key' setting.
This is only for the _uninteresting_queue.
-------------- next part --------------
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py 2009-06-26 19:00:38 +0000
+++ b/bzrlib/chk_map.py 2009-06-26 19:03:48 +0000
@@ -1524,7 +1524,7 @@
if not_interesting:
# This prefix is not part of the remaining 'interesting set'
continue
- heapq.heappush(self._uninteresting_queue, (prefix, None, ref))
+ heapq.heappush(self._uninteresting_queue, (prefix, ref))
def _flush_interesting_queue(self):
# TODO: this could really be done as a series of big batches of reading
@@ -1556,18 +1556,13 @@
(prefix, None, ref))
def _process_next_uninteresting(self):
- prefix, key, value = heapq.heappop(self._uninteresting_queue)
- # We don't queue up uininteresting items, just add them to the
- # set
- assert key is None
- # Node
+ prefix, ref = heapq.heappop(self._uninteresting_queue)
for record, node, prefix_refs, items in \
- self._read_nodes_from_store([value]):
+ self._read_nodes_from_store([ref]):
self._all_uninteresting_items.update(items)
for prefix, ref in prefix_refs:
self._all_uninteresting_chks.add(ref)
- heapq.heappush(self._uninteresting_queue,
- (prefix, None, ref))
+ heapq.heappush(self._uninteresting_queue, (prefix, ref))
def _process_queues(self):
# Finish processing all of the items in the queue, for simplicity, we
@@ -1582,7 +1577,7 @@
for record, items in self._flush_interesting_queue():
yield record, items
return
- # (prefix, key, value)
+ # (prefix, key?, value)
next_interesting_prefix = self._interesting_queue[0][0]
next_uninteresting_prefix = self._uninteresting_queue[0][0]
if next_uninteresting_prefix <= next_interesting_prefix:
@@ -1598,7 +1593,7 @@
if item not in self._all_uninteresting_items:
yield None, [item]
else:
- # Node
+ # Node, value == ref
# if value in self._all_uninteresting_chks:
# continue
for record, node, prefix_refs, items in \
=== modified file 'bzrlib/tests/test_chk_map.py'
--- a/bzrlib/tests/test_chk_map.py 2009-06-26 19:00:38 +0000
+++ b/bzrlib/tests/test_chk_map.py 2009-06-26 19:03:48 +0000
@@ -2153,7 +2153,7 @@
# At this point, we should have queued up only the 'a' Leaf on both
# sides, both 'c' and 'd' are known to not have changed on both sides
self.assertEqual([('a', None, key2_a)], iterator._interesting_queue)
- self.assertEqual([('a', None, key1_a)], iterator._uninteresting_queue)
+ self.assertEqual([('a', key1_a)], iterator._uninteresting_queue)
def test__read_all_roots_multi_interesting_prepares_queues(self):
c_map = self.make_one_deep_map(chk_map._search_key_plain)
@@ -2179,7 +2179,7 @@
self.assertEqual([('a', None, key2_a), ('c', None, key3_c)],
iterator._interesting_queue)
# And we should have queued up both a and c for the uninteresting set
- self.assertEqual([('a', None, key1_a), ('c', None, key1_c)],
+ self.assertEqual([('a', key1_a), ('c', key1_c)],
iterator._uninteresting_queue)
def test__read_all_roots_different_depths(self):
@@ -2201,7 +2201,7 @@
self.assertEqual([key2], root_results)
# Only the 'a' subset should be queued up, since 'c' and 'd' cannot be
# present
- self.assertEqual([('a', None, key1_a)], iterator._uninteresting_queue)
+ self.assertEqual([('a', key1_a)], iterator._uninteresting_queue)
self.assertEqual([('aa', None, key2_aa), ('ad', None, key2_ad)],
iterator._interesting_queue)
@@ -2209,7 +2209,7 @@
root_results = [record.key for record in iterator._read_all_roots()]
self.assertEqual([key1], root_results)
- self.assertEqual([('aa', None, key2_aa), ('ad', None, key2_ad)],
+ self.assertEqual([('aa', key2_aa), ('ad', key2_ad)],
iterator._uninteresting_queue)
self.assertEqual([('a', None, key1_a), ('c', None, key1_c),
('d', None, key1_d),
@@ -2247,7 +2247,7 @@
# However, even though we have yielded the root node to be fetched,
# we should have enqued all of the chk pages to be walked, so that we
# can find the keys if they are present
- self.assertEqual([('a', None, key1_a)], iterator._uninteresting_queue)
+ self.assertEqual([('a', key1_a)], iterator._uninteresting_queue)
self.assertEqual([('acc', ('acc',), 'initial acc content'),
('ace', ('ace',), 'initial ace content'),
], iterator._interesting_queue)
More information about the bazaar-commits
mailing list