Rev 3798: Turns out that the LeafNode split code needs to be aware of having a key in http://bzr.arbash-meinel.com/branches/bzr/brisbane/chk_map

John Arbash Meinel john at arbash-meinel.com
Tue Dec 2 20:43:26 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/brisbane/chk_map

------------------------------------------------------------
revno: 3798
revision-id: john at arbash-meinel.com-20081202204314-uwfpn7zplj4muwm7
parent: john at arbash-meinel.com-20081202190056-1d7abe90mtf0kkag
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: chk_map
timestamp: Tue 2008-12-02 14:43:14 -0600
message:
  Turns out that the LeafNode split code needs to be aware of having a key
  that will fit in the '\x00' location.
-------------- next part --------------
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py	2008-12-02 18:57:28 +0000
+++ b/bzrlib/chk_map.py	2008-12-02 20:43:14 +0000
@@ -509,6 +509,13 @@
             for key, value in self._items.iteritems():
                 serialised_key = self._serialised_key(key)
                 prefix = serialised_key[:split_at]
+                # TODO: Generally only 1 key can be exactly the right length,
+                #       which means we can only have 1 key in the node pointed
+                #       at by the 'prefix\0' key. We might want to consider
+                #       folding it into the containing InternalNode rather than
+                #       having a fixed length-1 node.
+                if len(prefix) < split_at:
+                    prefix += '\x00'*(split_at - len(prefix))
                 if prefix not in result:
                     node = LeafNode()
                     node.set_maximum_size(self._maximum_size)



More information about the bazaar-commits mailing list