ソースを参照

Merge pull request #4968 from ThomasWaldmann/fix-hashindex-set-1.0

fix bug in hashindex_set on resize, fixes #4829 (1.0-maint backport)
TW 5 年 前
コミット
387646864f
1 ファイル変更10 行追加0 行削除
  1. 10 0
      borg/_hashindex.c

+ 10 - 0
borg/_hashindex.c

@@ -449,6 +449,16 @@ hashindex_set(HashIndex *index, const void *key, const void *value)
                 if(!hashindex_resize(index, index->num_buckets)) {
                     return 0;
                 }
+                /* we have just built a fresh hashtable and removed all tombstones,
+                 * so we only have EMPTY or USED buckets, but no DELETED ones any more.
+                 */
+                idx = hashindex_index(index, key);
+                while(!BUCKET_IS_EMPTY(index, idx)) {
+                    idx++;
+                    if (idx >= index->num_buckets){
+                        idx -= index->num_buckets;
+                    }
+                }
             }
         }
         ptr = BUCKET_ADDR(index, idx);