mirror of
https://github.com/restic/restic.git
synced 2025-10-10 08:33:01 +00:00
index: reduce size of compressed indexes
use the same index size for compressed and uncompressed indexes. Otherwise, decoding the index of a compressed repository requires significantly more memory.
This commit is contained in:
@@ -588,19 +588,11 @@ func (r *Repository) ListPacksFromIndex(ctx context.Context, packs restic.IDSet)
|
||||
// SetIndex instructs the repository to use the given index.
|
||||
func (r *Repository) SetIndex(i restic.MasterIndex) error {
|
||||
r.idx = i.(*index.MasterIndex)
|
||||
r.configureIndex()
|
||||
return r.prepareCache()
|
||||
}
|
||||
|
||||
func (r *Repository) clearIndex() {
|
||||
r.idx = index.NewMasterIndex()
|
||||
r.configureIndex()
|
||||
}
|
||||
|
||||
func (r *Repository) configureIndex() {
|
||||
if r.cfg.Version >= 2 {
|
||||
r.idx.MarkCompressed()
|
||||
}
|
||||
}
|
||||
|
||||
// LoadIndex loads all index files from the backend in parallel and stores them
|
||||
|
@@ -376,7 +376,7 @@ func TestRepositoryIncrementalIndex(t *testing.T) {
|
||||
func testRepositoryIncrementalIndex(t *testing.T, version uint) {
|
||||
repo, _ := repository.TestRepositoryWithVersion(t, version)
|
||||
|
||||
index.IndexFull = func(*index.Index, bool) bool { return true }
|
||||
index.IndexFull = func(*index.Index) bool { return true }
|
||||
|
||||
// add a few rounds of packs
|
||||
for j := 0; j < 5; j++ {
|
||||
|
Reference in New Issue
Block a user