Rev 3904: Handle when our current packing is sub-optimal. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/gc_delta_index_room

John Arbash Meinel john at arbash-meinel.com
Thu Mar 19 14:42:02 GMT 2009


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

------------------------------------------------------------
revno: 3904
revision-id: john at arbash-meinel.com-20090319144153-y4m58rs011omd0g3
parent: john at arbash-meinel.com-20090319062205-cy7f49htv3vet8g2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: gc_delta_index_room
timestamp: Thu 2009-03-19 09:41:53 -0500
message:
  Handle when our current packing is sub-optimal.
  
  It happens somtimes that our estimated hsize is too big, so
  that the next estimate tries to shrink it. However the code
  like pack_delta_index only copes with growing, and that is
  honestly all we really care about.
-------------- next part --------------
=== modified file 'bzrlib/diff-delta.c'
--- a/bzrlib/diff-delta.c	2009-03-19 06:22:05 +0000
+++ b/bzrlib/diff-delta.c	2009-03-19 14:41:53 +0000
@@ -300,6 +300,10 @@
     index->hash_mask = hmask;
     index->num_entries = num_entries;
     if (old_index) {
+        if (hmask < old_index->hash_mask) {
+            fprintf(stderr, "hash mask was shrunk %x => %x\n",
+                            old_index->hash_mask, hmask);
+        }
         assert(hmask >= old_index->hash_mask);
     }
 
@@ -389,6 +393,10 @@
     for (i = 4; (1u << i) < hsize && i < 31; i++);
     hsize = 1 << i;
     hmask = hsize - 1;
+    if (old && old->hash_mask < hmask) {
+        hmask = old->hash_mask;
+        hsize = hmask + 1;
+    }
 
     /* allocate lookup index */
     memsize = sizeof(*hash) * hsize +



More information about the bazaar-commits mailing list