mirror of
https://github.com/octoleo/restic.git
synced 2024-11-27 15:26:37 +00:00
check: treat legacy index format as errors
This commit is contained in:
parent
98a6817d01
commit
69ca12d2eb
@ -231,12 +231,17 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args
|
|||||||
|
|
||||||
errorsFound := false
|
errorsFound := false
|
||||||
suggestIndexRebuild := false
|
suggestIndexRebuild := false
|
||||||
|
suggestLegacyIndexRebuild := false
|
||||||
mixedFound := false
|
mixedFound := false
|
||||||
for _, hint := range hints {
|
for _, hint := range hints {
|
||||||
switch hint.(type) {
|
switch hint.(type) {
|
||||||
case *checker.ErrDuplicatePacks, *checker.ErrOldIndexFormat:
|
case *checker.ErrDuplicatePacks:
|
||||||
Printf("%v\n", hint)
|
Printf("%v\n", hint)
|
||||||
suggestIndexRebuild = true
|
suggestIndexRebuild = true
|
||||||
|
case *checker.ErrOldIndexFormat:
|
||||||
|
Warnf("error: %v\n", hint)
|
||||||
|
suggestLegacyIndexRebuild = true
|
||||||
|
errorsFound = true
|
||||||
case *checker.ErrMixedPack:
|
case *checker.ErrMixedPack:
|
||||||
Printf("%v\n", hint)
|
Printf("%v\n", hint)
|
||||||
mixedFound = true
|
mixedFound = true
|
||||||
@ -247,7 +252,10 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args
|
|||||||
}
|
}
|
||||||
|
|
||||||
if suggestIndexRebuild {
|
if suggestIndexRebuild {
|
||||||
Printf("Duplicate packs/old indexes are non-critical, you can run `restic repair index' to correct this.\n")
|
Printf("Duplicate packs are non-critical, you can run `restic repair index' to correct this.\n")
|
||||||
|
}
|
||||||
|
if suggestLegacyIndexRebuild {
|
||||||
|
Warnf("Found indexes using the legacy format, you must run `restic repair index' to correct this.\n")
|
||||||
}
|
}
|
||||||
if mixedFound {
|
if mixedFound {
|
||||||
Printf("Mixed packs with tree and data blobs are non-critical, you can run `restic prune` to correct this.\n")
|
Printf("Mixed packs with tree and data blobs are non-critical, you can run `restic prune` to correct this.\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user