-
Notifications
You must be signed in to change notification settings - Fork 1.3k
add cache key debuginfo lookup #6061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This allows opt-in to cache key debug database on daemon startup. If enabled, all cache keys generated by builds are saved into this database together with the plaintexts of the original data so a reverse lookup can be performed later to compare two checksums and find out their original difference. If checksum contains other checksums internally then these are saved as well. For storage constraints, the plaintext of file content is not saved but the metadata portion can be still looked up. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
99ffe37
to
4c9d94f
Compare
These endpoints show the contents of current boltdb cache database together with debug plaintexts if they have been saved. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Fixed a bug where |
@@ -225,6 +226,10 @@ func main() { | |||
Name: "cdi-spec-dir", | |||
Usage: "list of directories to scan for CDI spec files", | |||
}, | |||
cli.BoolFlag{ | |||
Name: "save-cache-debug", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name: "save-cache-debug", | |
Name: "debug-save-cache", |
If more debug-*
flags are to come
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--debug-save-cache
would mean something about storing the cache itself. Atm it means "save-cache-debuginfo". If we want --debug
prefix, then it should be smth like --debug-save-cache-plaintexts
util/cachedigest/digest.go
Outdated
TypeStringArray Type = "string-array" | ||
TypeDigestArray Type = "digest-array" | ||
TypeFileList Type = "file-list" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be consistent? Maybe -list
instead of array?
TypeStringArray Type = "string-array" | |
TypeDigestArray Type = "digest-array" | |
TypeFileList Type = "file-list" | |
TypeStringList Type = "string-list" | |
TypeDigestList Type = "digest-list" | |
TypeFileList Type = "file-list" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change this but logically these are different. File-list is a special format for file headers and checksum per file, not delimiter-separated.
if d.db == nil { | ||
return "", nil, errors.WithStack(ErrNotFound) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrNotFound
might be misleading if db not set. Maybe ErrNoDB
would be more accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is modeled so that DB can be called all the time. In the future, there may be other implementations. So the internals of whether the plaintext is not found because it was not saved for a specific record or for the whole database shouldn't matter. Note that because lookup and store happen at different times, it may be that one of them had DB configured and another one did not.
Is it related to https://github.com/moby/buildkit/pull/6061/files#diff-d44a0b2b1649ed2262e65d607ac40667f9e287a289484f2b26e22c96297f9ebaR43 ? |
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This allows opt-in to cache key debug database on
daemon startup.
If enabled, all cache keys generated by builds are saved into this database together with the plaintexts of the original data so a reverse lookup can be performed later to compare two checksums and find out their original difference. If checksum contains other checksums internally then these are saved as well. For storage constraints, the plaintext of file content is not saved but the metadata portion can be still looked up.