mirror of https://github.com/borgbackup/borg.git
ArchiveChecker: use MAX_LOAD_FACTOR constant
This commit is contained in:
parent
197552526f
commit
be3616b6b3
|
@ -853,8 +853,9 @@ class ArchiveChecker:
|
||||||
"""Fetch a list of all object keys from repository
|
"""Fetch a list of all object keys from repository
|
||||||
"""
|
"""
|
||||||
# Explicitly set the initial hash table capacity to avoid performance issues
|
# Explicitly set the initial hash table capacity to avoid performance issues
|
||||||
# due to hash table "resonance"
|
# due to hash table "resonance".
|
||||||
capacity = int(len(self.repository) * 1.35 + 1) # > len * 1.0 / HASH_MAX_LOAD (see _hashindex.c)
|
# Since reconstruction of archive items can add some new chunks, add 10 % headroom
|
||||||
|
capacity = int(len(self.repository) / ChunkIndex.MAX_LOAD_FACTOR * 1.1)
|
||||||
self.chunks = ChunkIndex(capacity)
|
self.chunks = ChunkIndex(capacity)
|
||||||
marker = None
|
marker = None
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -279,5 +279,5 @@ def test_nsindex_segment_limit():
|
||||||
|
|
||||||
|
|
||||||
def test_max_load_factor():
|
def test_max_load_factor():
|
||||||
assert NSIndex.MAX_LOAD_FACTOR < 1
|
assert NSIndex.MAX_LOAD_FACTOR < 1.0
|
||||||
assert ChunkIndex.MAX_LOAD_FACTOR < 1
|
assert ChunkIndex.MAX_LOAD_FACTOR < 1.0
|
||||||
|
|
Loading…
Reference in New Issue