mirror of
https://github.com/restic/restic.git
synced 2026-10-20 00:08:11 +00:00
repository: Properly set id for finalized index
As MergeFinalIndex and index uploads can occur concurrently, it is necessary for MergeFinalIndex to check whether the IDs for an index were already set before merging it. Otherwise, we'd loose the ID of an index which is set _after_ uploading it.
This commit is contained in:
1 parent
e0a7852b8b
commit
bf81bf0795
4 files changed
+24
-26
No files matched your search
@@ -132,3 +132,13 @@ func BenchmarkAllVersions(b *testing.B, bench VersionedBenchmark) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergeIndex(t testing.TB, mi *MasterIndex) ([]*Index, int) {
|
||||
finalIndexes := mi.FinalizeNotFinalIndexes()
|
||||
for _, idx := range finalIndexes {
|
||||
test.OK(t, idx.SetID(restic.NewRandomID()))
|
||||
}
|
||||
|
||||
test.OK(t, mi.MergeFinalIndexes())
|
||||
return finalIndexes, len(mi.idx)
|
||||
}
|
||||
Reference in new issue
Block a user