Merge pull request #3244 from MichaelEischer/better-damage-reports

Print more details about possible repository damages
This commit is contained in:
Alexander Neumann 2021-01-29 11:45:45 +01:00 committed by GitHub
commit a16ce65295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View File

@ -394,7 +394,6 @@ func (f *Finder) findIDs(ctx context.Context, sn *restic.Snapshot) error {
delete(f.blobIDs, idStr[:shortStr]) delete(f.blobIDs, idStr[:shortStr])
} }
f.out.PrintObject("blob", idStr, nodepath, parentTreeID.String(), sn) f.out.PrintObject("blob", idStr, nodepath, parentTreeID.String(), sn)
break
} }
} }

View File

@ -245,8 +245,9 @@ func prune(opts PruneOptions, gopts GlobalOptions, repo restic.Repository, usedB
// Check if all used blobs have been found in index // Check if all used blobs have been found in index
if len(usedBlobs) != 0 { if len(usedBlobs) != 0 {
Warnf("%v not found in the index\n"+ Warnf("%v not found in the index\n\n"+
"Data blobs seem to be missing, aborting prune to prevent further data loss!\n"+ "Integrity check failed: Data seems to be missing.\n"+
"Will not start prune to prevent (additional) data loss!\n"+
"Please report this error (along with the output of the 'prune' run) at\n"+ "Please report this error (along with the output of the 'prune' run) at\n"+
"https://github.com/restic/restic/issues/new/choose", usedBlobs) "https://github.com/restic/restic/issues/new/choose", usedBlobs)
return errorIndexIncomplete return errorIndexIncomplete
@ -378,7 +379,10 @@ func prune(opts PruneOptions, gopts GlobalOptions, repo restic.Repository, usedB
return errorPacksMissing return errorPacksMissing
} }
if len(ignorePacks) != 0 { if len(ignorePacks) != 0 {
Verbosef("missing but unneded pack files are referenced in the index, will be repaired\n") Warnf("Missing but unneeded pack files are referenced in the index, will be repaired\n")
for id := range ignorePacks {
Warnf("will forget missing pack file %v\n", id)
}
} }
repackAllPacksWithDuplicates := true repackAllPacksWithDuplicates := true

View File

@ -88,6 +88,11 @@ func rebuildIndex(opts RebuildIndexOptions, gopts GlobalOptions, repo *repositor
packSizeFromList[id] = packSize packSizeFromList[id] = packSize
removePacks.Insert(id) removePacks.Insert(id)
} }
if !ok {
Warnf("adding pack file to index %v\n", id)
} else if size != packSize {
Warnf("reindexing pack file %v with unexpected size %v instead of %v\n", id, packSize, size)
}
delete(packSizeFromIndex, id) delete(packSizeFromIndex, id)
return nil return nil
}) })
@ -98,6 +103,7 @@ func rebuildIndex(opts RebuildIndexOptions, gopts GlobalOptions, repo *repositor
// forget pack files that are referenced in the index but do not exist // forget pack files that are referenced in the index but do not exist
// when rebuilding the index // when rebuilding the index
removePacks.Insert(id) removePacks.Insert(id)
Warnf("removing not found pack file %v\n", id)
} }
if len(packSizeFromList) > 0 { if len(packSizeFromList) > 0 {