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

db: scan a readState during format major version upgrades #2186

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

jbowens
Copy link
Collaborator

@jbowens jbowens commented Dec 12, 2022

During a format major version, some version migrations must scan the LSM. These migrations require that the files they examine are not deleted before or while they're reading them. A previous attempt (#2020) at avoiding these unexpected deletions accidentally left an opening for the acquired versions' files to be deleted while waiting for file deletions to be disabled (sleeping on a condition variable).

A different fix with less subtlety is applied here. The format major version upgrade path acquires a readState, which refs the versions it acquires, preventing deletion of the referenced files. This requires the format major version upgrade in Open to be moved later within the Open routine, after the current read state is initialized.

Fix #2143.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@nicktrav nicktrav left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jbowens)

During a format major version, some version migrations must scan the
LSM. These migrations require that the files they examine are not
deleted before or while they're reading them. A previous attempt (cockroachdb#2020)
at avoiding these unexpected deletions accidentally left an
opening for the acquired versions' files to be deleted while waiting for
file deletions to be disabled (sleeping on a condition variable).

A different fix with less subtlety is applied here. The format major
version upgrade path acquires a readState, which refs the versions it
acquires, preventing deletion of the referenced files. This requires the
format major version upgrade in Open to be moved later within the Open
routine, after the current read state is initialized.

Fix cockroachdb#2143.
@jbowens
Copy link
Collaborator Author

jbowens commented Jan 12, 2023

TFTR!

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.

internal/metamorphic/crossversion/crossversion_test: TestMetaCrossVersion failed
3 participants