worker: remove automatic migration of legacy v1 cache#6509
worker: remove automatic migration of legacy v1 cache#6509thaJeztah wants to merge 1 commit intomoby:masterfrom
Conversation
tonistiigi
left a comment
There was a problem hiding this comment.
We can remove this migration code, but we should still leave in error if the old state dir is used.
|
@tonistiigi you mean if That would be in a situation where a user upgrades from either Docker 19.03 -> latest, or BuildKit v0.6.0 -> latest; is that supported? |
|
@thaJeztah Yes, I think in that case we can just give an error. So if this ever happens, users can clear the state manually or run a version with the migrate before updating to the latest version. |
97bf000 to
13bc686
Compare
| // Check for legacy (v1) cache state. | ||
| // | ||
| // Automatic migration was removed in https://github.com/moby/buildkit/pull/6509 | ||
| if _, err := os.Stat(filepath.Join(dbPath)); os.IsNotExist(err) { | ||
| legacyMetadata := filepath.Join(filepath.Dir(dbPath), "metadata.db") | ||
| if _, err := os.Stat(legacyMetadata); err == nil { | ||
| return nil, errors.Errorf( | ||
| "legacy (v1) cache metadata found at %q and needs to be removed or migrated; downgrade BuildKit to v0.27.1 to perform automatic migration or remove the existing cache", | ||
| legacyMetadata, | ||
| ) | ||
| } | ||
| } |
There was a problem hiding this comment.
Decided to roll the check into the constructor here, so that BuildKit can remove it when we're comfortable; could use some input on the error-message though (not sure if it's just the metadata.db to look for, or if the user has to remove (or migrate) state elsewhere.
cache/metadata/metadata.go
Outdated
| // Check for legacy (v1) cache state. | ||
| // | ||
| // Automatic migration was removed in https://github.com/moby/buildkit/pull/6509 | ||
| if _, err := os.Stat(filepath.Join(dbPath)); os.IsNotExist(err) { |
There was a problem hiding this comment.
cache/metadata/metadata.go:35:23: badCall: suspicious Join on 1 argument (gocritic)
There was a problem hiding this comment.
Doh! I initially had it in a separate function; the filepath.Join is no longer needed here.
Updated; should be good now!
(I also tweaked the PR and commit title to be a bit more descriptive for the change-log)
This removes the MigrateV2 function, which was added in BuildKit v0.7.0 (Docker v20.10.0) in 31a9aee. That was in 2019, which is now over 6 Years ago, so it's very unlikely for old files to be still present. Removing this code would impact users migrating from Docker 19.03 or older, which are versions that reached EOL many years ago, so very unlikely. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
13bc686 to
1a05836
Compare
worker: remove automatic migration of legacy v1 cache
This removes the MigrateV2 function, which was added in BuildKit v0.7.0 (Docker v20.10.0) in 31a9aee. That was in 2019, which is now over 6 Years ago, so it's very unlikely for old files to be still present.
Removing this code would impact users migrating from Docker 19.03 or older, which are versions that reached EOL many years ago, so very unlikely.