Rev 3841: Create a 127-way split out that splits all the way across. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/hack

John Arbash Meinel john at arbash-meinel.com
Fri Feb 27 15:26:37 GMT 2009


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

------------------------------------------------------------
revno: 3841
revision-id: john at arbash-meinel.com-20090227152634-k4katg68qd42xkje
parent: john at arbash-meinel.com-20090226204848-gjq2caly2vzi2fc9
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hack
timestamp: Fri 2009-02-27 09:26:34 -0600
message:
  Create a 127-way split out that splits all the way across.
-------------- next part --------------
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-02-26 20:48:48 +0000
+++ b/bzrlib/bzrdir.py	2009-02-27 15:26:34 +0000
@@ -3345,9 +3345,20 @@
     hidden=True,
     experimental=True,
     )
-format_registry.register_metadir('development5-hash127',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash127',
-    help='1.9 with CHK inventories with parent_id index and 127-way hash trie. '
+format_registry.register_metadir('development5-hash127a',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash127a',
+    help='1.9 with CHK inventories with parent_id index and 127a-way hash trie. '
+        'Please read '
+        'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+        'before use.',
+    branch_format='bzrlib.branch.BzrBranchFormat7',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat5',
+    hidden=True,
+    experimental=True,
+    )
+format_registry.register_metadir('development5-hash127b',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash127b',
+    help='1.9 with CHK inventories with parent_id index and 127b-way hash trie. '
         'Please read '
         'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
         'before use.',

=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py	2009-02-26 20:48:48 +0000
+++ b/bzrlib/chk_map.py	2009-02-27 15:26:34 +0000
@@ -117,7 +117,20 @@
     return bytes.replace('\n', '_')
 
 
-def _search_key_127(key):
+def _search_key_127a(key):
+    """This starts out with a 127-way split all.
+
+    The idea is to balance root-page changes with total internal tree depth.
+    The root changes on every commit, so making it small is good. However,
+    making it too small will cause the tree depth to increase, which increases
+    total bytes again.
+    """
+    bytes = '\x00'.join([struct.pack('>L', zlib.crc32(bit) & 0x7F7F7F7F)
+                         for bit in key])
+    return bytes.replace('\n', '_')
+
+
+def _search_key_127b(key):
     """This starts out with a 127-way split on the root, then 255-way.
 
     The idea is to balance root-page changes with total internal tree depth.
@@ -130,12 +143,14 @@
     return bytes.replace('\n', '_')
 
 
+
 search_key_registry = registry.Registry()
 search_key_registry.register('plain', _search_key_plain)
 search_key_registry.register('hash-16-way', _search_key_16)
 search_key_registry.register('hash-16b-way', _search_key_16b)
 search_key_registry.register('hash-63-way', _search_key_63)
-search_key_registry.register('hash-127-way', _search_key_127)
+search_key_registry.register('hash-127a-way', _search_key_127a)
+search_key_registry.register('hash-127b-way', _search_key_127b)
 search_key_registry.register('hash-255-way', _search_key_255)
 
 

=== modified file 'bzrlib/chk_serializer.py'
--- a/bzrlib/chk_serializer.py	2009-02-26 20:48:48 +0000
+++ b/bzrlib/chk_serializer.py	2009-02-27 15:26:34 +0000
@@ -74,5 +74,6 @@
 chk_serializer_16_parent_id = CHKSerializer(4096, True, 'hash-16-way')
 chk_serializer_16b_parent_id = CHKSerializer(4096, True, 'hash-16b-way')
 chk_serializer_63_parent_id = CHKSerializer(4096, True, 'hash-63-way')
-chk_serializer_127_parent_id = CHKSerializer(4096, True, 'hash-127-way')
+chk_serializer_127a_parent_id = CHKSerializer(4096, True, 'hash-127a-way')
+chk_serializer_127b_parent_id = CHKSerializer(4096, True, 'hash-127b-way')
 chk_serializer_255_parent_id = CHKSerializer(4096, True, 'hash-255-way')

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2009-02-26 20:48:48 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2009-02-27 15:26:34 +0000
@@ -3248,41 +3248,81 @@
         pass
 
 
-class RepositoryFormatPackDevelopment5Hash127(RepositoryFormatPack):
-    """A no-subtrees development repository.
-
-    This format should be retained until the second release after bzr 1.13.
-
-    This is pack-1.9 with CHKMap based inventories with 127-way hash tries.
-    """
-
-    repository_class = CHKInventoryRepository
-    _commit_builder_class = PackCommitBuilder
-    _serializer = chk_serializer.chk_serializer_127_parent_id
-    supports_external_lookups = True
-    # What index classes to use
-    index_builder_class = BTreeBuilder
-    index_class = BTreeGraphIndex
-    supports_chks = True
-    _commit_inv_deltas = True
-
-    def _get_matching_bzrdir(self):
-        return bzrdir.format_registry.make_bzrdir('development5-hash127')
-
-    def _ignore_setting_bzrdir(self, format):
-        pass
-
-    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
-
-    def get_format_string(self):
-        """See RepositoryFormat.get_format_string()."""
-        return ("Bazaar development format 5 hash 127"
-                " (needs bzr.dev from before 1.13)\n")
-
-    def get_format_description(self):
-        """See RepositoryFormat.get_format_description()."""
-        return ("Development repository format, currently the same as"
-                " 1.9 with B+Trees and chk support and 127-way hash tries\n")
+class RepositoryFormatPackDevelopment5Hash127a(RepositoryFormatPack):
+    """A no-subtrees development repository.
+
+    This format should be retained until the second release after bzr 1.13.
+
+    This is pack-1.9 with CHKMap based inventories with 127a-way hash tries.
+    """
+
+    repository_class = CHKInventoryRepository
+    _commit_builder_class = PackCommitBuilder
+    _serializer = chk_serializer.chk_serializer_127a_parent_id
+    supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = BTreeBuilder
+    index_class = BTreeGraphIndex
+    supports_chks = True
+    _commit_inv_deltas = True
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir('development5-hash127a')
+
+    def _ignore_setting_bzrdir(self, format):
+        pass
+
+    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return ("Bazaar development format 5 hash 127a"
+                " (needs bzr.dev from before 1.13)\n")
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format, currently the same as"
+                " 1.9 with B+Trees and chk support and 127a-way hash tries\n")
+
+    def check_conversion_target(self, target_format):
+        pass
+
+
+class RepositoryFormatPackDevelopment5Hash127b(RepositoryFormatPack):
+    """A no-subtrees development repository.
+
+    This format should be retained until the second release after bzr 1.13.
+
+    This is pack-1.9 with CHKMap based inventories with 127b-way hash tries.
+    """
+
+    repository_class = CHKInventoryRepository
+    _commit_builder_class = PackCommitBuilder
+    _serializer = chk_serializer.chk_serializer_127b_parent_id
+    supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = BTreeBuilder
+    index_class = BTreeGraphIndex
+    supports_chks = True
+    _commit_inv_deltas = True
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir('development5-hash127b')
+
+    def _ignore_setting_bzrdir(self, format):
+        pass
+
+    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return ("Bazaar development format 5 hash 127b"
+                " (needs bzr.dev from before 1.13)\n")
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format, currently the same as"
+                " 1.9 with B+Trees and chk support and 127b-way hash tries\n")
 
     def check_conversion_target(self, target_format):
         pass

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2009-02-26 20:48:48 +0000
+++ b/bzrlib/repository.py	2009-02-27 15:26:34 +0000
@@ -2637,10 +2637,17 @@
     )
 format_registry.register_lazy(
     # merge-bbc-dev4-to-bzr.dev
-    ('Bazaar development format 5 hash 127'
-     ' (needs bzr.dev from before 1.13)\n'),
-    'bzrlib.repofmt.pack_repo',
-    'RepositoryFormatPackDevelopment5Hash127',
+    ('Bazaar development format 5 hash 127a'
+     ' (needs bzr.dev from before 1.13)\n'),
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment5Hash127a',
+    )
+format_registry.register_lazy(
+    # merge-bbc-dev4-to-bzr.dev
+    ('Bazaar development format 5 hash 127b'
+     ' (needs bzr.dev from before 1.13)\n'),
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment5Hash127b',
     )
 format_registry.register_lazy(
     # merge-bbc-dev4-to-bzr.dev



More information about the bazaar-commits mailing list