From 1a8bf358f1ea7b6903ad76da6e31f3f01be0eb04 Mon Sep 17 00:00:00 2001 From: Michael Eischer <michael.eischer@fau.de> Date: Sat, 9 Mar 2024 18:20:52 +0100 Subject: [PATCH 1/4] index: deprecate legacy index format --- .../repo-restore-permissions-test.tar.gz | Bin 4174 -> 4256 bytes internal/feature/registry.go | 6 ++++-- internal/index/index.go | 6 ++++++ internal/index/index_test.go | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cmd/restic/testdata/repo-restore-permissions-test.tar.gz b/cmd/restic/testdata/repo-restore-permissions-test.tar.gz index 36aa62dbfb0ad52d5c0cafab528cfee393d388a2..dc8e9bc80e992fca9a59632cbb89344dcd870869 100644 GIT binary patch literal 4256 zcmV;R5MS>fiwFP!000001MS**I92<<2XI0~DaUEfl*r6p(;k${tZkmh6MI<OHnTT- zn`ap+oa88!kfOmHks_5uI*Eu(nTit8DDhMGcb{|5dG7gj&;8w;^W3vv|Ey=Py`Ja0 z_Ij`H=d*^*K)t<GxV|mSA{++uc?sZ<e=eaf%m2g$zz7Zk02qsbxiA0*1~6O_$T!}v zFZ`IkB!+|p7mbSf%62G&xfDCJv>2cBcS8f1-|!^(ALS1s2#f$20REgm03kR|{!8JP z`~f^nfXD!i0FkH!3>izNpg5EYk!U0W1Q8I@;x`zSfCp%clM_ZL7zjlO2%fU|J&2+Z zME?CTJ_ii{i~O-T+^_QoK?nx9B>r_E|407j`3Ff-7%0gXrAn$wf*1f%!r+uZ*a8Gp zK~NO{lnHnQgW&N51q`T)!AL4fem)MKBoB0P`^7`HxPtD*^!?`wHxkpu!-cW9(v3=6 z{LG{<0=#_}KN?A@Vi5$wDoQdWRq=|F-jb?-q9l{#?z^}Zq-$ei3X&+g-V8%c3#N;O zjW5|#J<yo$W#x_psu=6K7-=e?gg`fE4S;CGq_MSCm}H!VZ6HHI+frLk!4Fl}vM|%K zVfdQ5xN6aTy=brss;;KCI4+gsOIjSk+?kCxC6XvcDl{DEqOZfCSqJ(-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zc9D7eQ;cVxactKpm zmhNMZz3#Q*%@o&kRpKd>@bt8xbLyvZ{TXjt!cL^<1P<ICX{0nnras<zJ}lY1KY(3f z_C@r1e_3&Soi@&yuI)W^QNT&GBD7NMR!e5@?ezgOuhd&_9bj&%M>B((-6{hl{ZzZ0 z4w_vUSi7HZB7)SX_m1C9#;;)VhqE&sp(}c?DOTrxZVqM_UNJCi#yge>vc_abOHDq? z&exUX&2P^xDVM&5C)E?gePkV7FPUH5;ykWB9y2FeM%bR*H$EZXKXI|*ilOvQzGE|K z`*WH^<F-c06Lx6GD{DVXRrI|u&SC#F)8ANjTcTr`vhH5NqwNDfqy%SvNV3-s-YnnQ zlqGwF@_x=(fe<{V3-NJgt#nl2J9?*$OLZ~YpSx;>L&Nl`ts?O9#!;npO4(K`<nXUD zS~EvPQ%jpjO?u5|`o6>#IIQMehz>P<9b}jna82;bt{+$0WI4atNorZCcCztG?TaPn zA)f=(>s~Ku2EO8ABB%mQ&QNRMgF4xn#2v&<#oMgkcR8%ce%3uZsiNOg;~j3}GS;vH zI}uSgm>(5rzf}WwJArDvB&fc3AN9#4lYIWLix;x@wT5UDKgDRZ&qeNuub|7wZDPN9 zIZ+Y*lA_yWoKqIFexx;HY3iT>X{T;*sL(b@HuUiD#8tfgmo3b+eYU5YKbrZ?UHv(- zFQt)l5c~QTZ8oropz`MH^jx&j{F1tnhJ&Y`Xar`*Lzmmi+8jgjyIL=ptvOgzJlk+@ z!~UM3mK>ug8HwFp99yf=HyMnigGGfNe{~Y%!Gi}69z1yP;K73j4<0;t@ZiCN2M-=R Yc<|uCg9i^DJpPaKUr7c%#{f_O02$#w+W-In diff --git a/internal/feature/registry.go b/internal/feature/registry.go index 7a9cbf560..620c9ec35 100644 --- a/internal/feature/registry.go +++ b/internal/feature/registry.go @@ -5,11 +5,13 @@ var Flag = New() // flag names are written in kebab-case const ( - ExampleFeature FlagName = "example-feature" + ExampleFeature FlagName = "example-feature" + DeprecateLegacyIndex FlagName = "deprecate-legacy-index" ) func init() { Flag.SetFlags(map[FlagName]FlagDesc{ - ExampleFeature: {Type: Alpha, Description: "just for testing"}, + ExampleFeature: {Type: Alpha, Description: "just for testing"}, + DeprecateLegacyIndex: {Type: Beta, Description: "disable support for index format used by restic 0.1.0. Use `restic repair index` to update the index if necessary."}, }) } diff --git a/internal/index/index.go b/internal/index/index.go index ecd481594..b571c55eb 100644 --- a/internal/index/index.go +++ b/internal/index/index.go @@ -3,12 +3,14 @@ package index import ( "context" "encoding/json" + "fmt" "io" "sync" "time" "github.com/restic/restic/internal/crypto" "github.com/restic/restic/internal/errors" + "github.com/restic/restic/internal/feature" "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/debug" @@ -515,6 +517,10 @@ func DecodeIndex(buf []byte, id restic.ID) (idx *Index, oldFormat bool, err erro debug.Log("Error %v", err) if isErrOldIndex(err) { + if feature.Flag.Enabled(feature.DeprecateLegacyIndex) { + return nil, false, fmt.Errorf("index seems to use the legacy format. update it using `restic repair index`") + } + debug.Log("index is probably old format, trying that") idx, err = decodeOldIndex(buf) return idx, err == nil, err diff --git a/internal/index/index_test.go b/internal/index/index_test.go index 4f0dbd2a0..78e4800ca 100644 --- a/internal/index/index_test.go +++ b/internal/index/index_test.go @@ -8,6 +8,7 @@ import ( "sync" "testing" + "github.com/restic/restic/internal/feature" "github.com/restic/restic/internal/index" "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" @@ -427,6 +428,8 @@ func BenchmarkEncodeIndex(b *testing.B) { } func TestIndexUnserializeOld(t *testing.T) { + defer feature.TestSetFlag(t, feature.Flag, feature.DeprecateLegacyIndex, false)() + idx, oldFormat, err := index.DecodeIndex(docOldExample, restic.NewRandomID()) rtest.OK(t, err) rtest.Assert(t, oldFormat, "old index format recognized as new format") From f8852f0eb6f63d08fddbabf19609fb530c67bb5e Mon Sep 17 00:00:00 2001 From: Michael Eischer <michael.eischer@fau.de> Date: Sat, 9 Mar 2024 18:21:22 +0100 Subject: [PATCH 2/4] repair index: fix deletion of legacy indexes --- internal/index/index.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/index/index.go b/internal/index/index.go index b571c55eb..1fb2c155e 100644 --- a/internal/index/index.go +++ b/internal/index/index.go @@ -523,6 +523,7 @@ func DecodeIndex(buf []byte, id restic.ID) (idx *Index, oldFormat bool, err erro debug.Log("index is probably old format, trying that") idx, err = decodeOldIndex(buf) + idx.ids = append(idx.ids, id) return idx, err == nil, err } From 98a6817d013a96898718514132a752c95f81eebe Mon Sep 17 00:00:00 2001 From: Michael Eischer <michael.eischer@fau.de> Date: Sat, 9 Mar 2024 18:35:00 +0100 Subject: [PATCH 3/4] add changelog for legacy index deprecation --- changelog/unreleased/issue-4602 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 changelog/unreleased/issue-4602 diff --git a/changelog/unreleased/issue-4602 b/changelog/unreleased/issue-4602 new file mode 100644 index 000000000..3cba63876 --- /dev/null +++ b/changelog/unreleased/issue-4602 @@ -0,0 +1,13 @@ +Change: Deprecate legacy index format + +Support for the legacy index format used by restic before version 0.2.0 has +been depreacted and will be removed in the next minor restic version. You can +use `restic repair index` to update the index to the current format. + +It is possible to temporarily reenable support for the legacy index format by +setting the environment variable +`RESTIC_FEATURES=deprecate-legacy-index=false`. Note that this feature flag +will be removed in the next minor restic version. + +https://github.com/restic/restic/issues/4602 +https://github.com/restic/restic/pull/4724 From 69ca12d2eba28b0744e30c5a367fddb607980b23 Mon Sep 17 00:00:00 2001 From: Michael Eischer <michael.eischer@fau.de> Date: Sat, 9 Mar 2024 18:36:33 +0100 Subject: [PATCH 4/4] check: treat legacy index format as errors --- cmd/restic/cmd_check.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/restic/cmd_check.go b/cmd/restic/cmd_check.go index 990702b61..cbe388877 100644 --- a/cmd/restic/cmd_check.go +++ b/cmd/restic/cmd_check.go @@ -231,12 +231,17 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args errorsFound := false suggestIndexRebuild := false + suggestLegacyIndexRebuild := false mixedFound := false for _, hint := range hints { switch hint.(type) { - case *checker.ErrDuplicatePacks, *checker.ErrOldIndexFormat: + case *checker.ErrDuplicatePacks: Printf("%v\n", hint) suggestIndexRebuild = true + case *checker.ErrOldIndexFormat: + Warnf("error: %v\n", hint) + suggestLegacyIndexRebuild = true + errorsFound = true case *checker.ErrMixedPack: Printf("%v\n", hint) mixedFound = true @@ -247,7 +252,10 @@ func runCheck(ctx context.Context, opts CheckOptions, gopts GlobalOptions, args } 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 { Printf("Mixed packs with tree and data blobs are non-critical, you can run `restic prune` to correct this.\n")