Rev 16: Reset the current bloom, when we add a new internal node. in http://bzr.arbash-meinel.com/plugins/index2

John Arbash Meinel john at arbash-meinel.com
Wed Jul 2 16:56:59 BST 2008


At http://bzr.arbash-meinel.com/plugins/index2

------------------------------------------------------------
revno: 16
revision-id: john at arbash-meinel.com-20080702155655-z77lyi16cvfkpwn6
parent: john at arbash-meinel.com-20080702145412-3qulu1g2k4cm3r57
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: index2
timestamp: Wed 2008-07-02 10:56:55 -0500
message:
  Reset the current bloom, when we add a new internal node.
-------------- next part --------------
=== modified file 'btree_index.py'
--- a/btree_index.py	2008-07-02 14:54:12 +0000
+++ b/btree_index.py	2008-07-02 15:56:55 +0000
@@ -96,7 +96,7 @@
             raise AssertionError("Not enough space for bloom filter.")
         if 'index' in debug.debug_flags:
             trace.mutter_callsite(3,
-                "Finished node with bloom filter %r." % self.bloom)
+                "Finished node with bloom filter %r.", self.bloom)
         _BuilderRow.finish_node(self)
 
 
@@ -174,6 +174,14 @@
                             internal_row.writer.write(_INTERNAL_FLAG)
                             internal_row.writer.write(_INTERNAL_OFFSET +
                                 str(self.rows[pos + 1].nodes) + "\n")
+                            # We reset the bloom at this point, because we are
+                            # starting a new set of child nodes
+                            if 'index' in debug.debug_flags:
+                                trace.mutter('Creating new writer and bloom at'
+                                             ' %s, %s, old bloom: %r',
+                                             pos, internal_row.nodes,
+                                             internal_row.bloom)
+                            internal_row.bloom = BloomSHA1(256 * 8)
                     # add a new leaf
                     length = _PAGE_SIZE
                     if self.rows[-1].nodes == 0:
@@ -199,6 +207,8 @@
                     # division point, then we need a new root:
                     if new_row:
                         # We need a new row
+                        if 'index' in debug.debug_flags:
+                            trace.mutter('Inserting new global row.')
                         new_row = _InternalBuilderRow(global_bloom)
                         self.rows.insert(0, new_row)
                         # This will be padded, hence the -100



More information about the bazaar-commits mailing list