Skip to content

cache: fix content hash leak for removed records - #7264

Open
janwaleed09 wants to merge 1 commit into
moby:masterfrom
janwaleed09:fix-contenthash-orphans
Open

janwaleed09 wants to merge 1 commit into
moby:masterfrom
janwaleed09:fix-contenthash-orphans

Conversation

@janwaleed09

Copy link
Copy Markdown

Fixes #7263

The content hash tree is saved in the background. If the record is removed before that, for example by finalize(), SetExternal creates _external/<id> again and nothing deletes it later.

  • SetExternal checks in the same transaction that the record still exists.
  • init() removes _external entries without a record, so data left by older versions is cleaned up.

TestNoPersistenceAfterRecordRemoval fails without this change. TestExternalData wrote external data without a record, so it now creates the record first.

Also tested with the build pattern from #7263 on a dockerd built with this change: _external stays empty after a full prune, and old entries are removed on the first start.

Signed-off-by: Jan Mohr <jan.mohr.1@web.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

metadata_v2.db keeps content hash data of removed cache records

1 participant