Skip to content
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

Preserve TOC item IDs when cloning memory metadata reader. #843

Merged
merged 2 commits into from
Jul 8, 2022

Conversation

vadimberezniker
Copy link
Contributor

@vadimberezniker vadimberezniker commented Jul 7, 2022

As the IDs are used for computing cache keys, it's important that they
do not change. Prior to this change, background fetching would clone the
reader and populate the cache with entries using possibly incorrect keys.

This patch changes the clone behavior to copy over the original ID
mappings.

Note that I also removed the locks around the ID maps as these maps are
never updated after the reader is created.

Fixes #842

@vadimberezniker vadimberezniker force-pushed the preserve_ids branch 2 times, most recently from db20b2c to b061f47 Compare July 7, 2022 23:59
@vadimberezniker
Copy link
Contributor Author

@ktock FYI

As the IDs are used for computing cache keys, it's important that they
do not change. Prior to this change, background fetching would clone the
reader and populate the cache with entries using possibly incorrect keys.

This patch changes the clone behavior to copy over the original ID
mappings.

Note that I also removed the locks around the ID maps as these maps are
never updated after the reader is created.

Fixes containerd#842

Signed-off-by: Vadim Berezniker <vadim@berezniker.com>
Signed-off-by: Vadim Berezniker <vadim@berezniker.com>
Copy link
Member

@ktock ktock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM.
I'll post following-up PRs for this.

@ktock ktock merged commit f03e7f7 into containerd:main Jul 8, 2022
@ktock ktock mentioned this pull request Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

background fetching can cause data corruption
2 participants