2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-29 08:14:03 +00:00

index: fix blocklist size

This commit is contained in:
Michael Eischer 2023-06-02 19:39:12 +02:00
parent 9a7056a479
commit ac1dfc99bb

View File

@ -204,14 +204,14 @@ func (h *hashedArrayTree) grow() {
idx, subIdx := h.index(h.size) idx, subIdx := h.index(h.size)
if int(idx) == len(h.blockList) { if int(idx) == len(h.blockList) {
// blockList is too small -> double list and block size // blockList is too small -> double list and block size
oldBlocks := h.blockList
h.blockList = make([][]indexEntry, h.blockSize)
h.blockSize *= 2 h.blockSize *= 2
h.mask = h.mask*2 + 1 h.mask = h.mask*2 + 1
h.maskShift++ h.maskShift++
idx = idx / 2 idx = idx / 2
oldBlocks := h.blockList
h.blockList = make([][]indexEntry, h.blockSize)
// pairwise merging of blocks // pairwise merging of blocks
for i := 0; i < len(oldBlocks); i += 2 { for i := 0; i < len(oldBlocks); i += 2 {
block := make([]indexEntry, 0, h.blockSize) block := make([]indexEntry, 0, h.blockSize)