Skip to content

sqlbase: upgrade method can deal with mixed upgraded/old descriptors #39451

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

Merged
merged 1 commit into from
Aug 8, 2019

Conversation

jordanlewis
Copy link
Member

Previously, the maybeUpgradeFK method assumed that all on-disk
descriptors were old-style. This is not always the case, because we
might have written some upgraded ones after the 19.2 version bump had
completely finished.

Release note: None

@jordanlewis jordanlewis requested a review from thoszhang August 8, 2019 14:38
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@jordanlewis jordanlewis force-pushed the fk-mixed-upgrade branch 2 times, most recently from 23df67d to 5891ee2 Compare August 8, 2019 21:15
Copy link
Contributor

@thoszhang thoszhang left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @lucy-zhang)


pkg/sql/sqlbase/structured.go, line 824 at r1 (raw file):

		// or it's new (already upgraded).
		var inFK ForeignKeyConstraint
		if originIndex.ForeignKey.Table == 0 {

Should this just be if originIndex.ForeignKey.IsSet() for clarity (since I assume the intent is just to check that the FK is unset)?


pkg/sql/sqlbase/structured.go, line 869 at r1 (raw file):

		} else {
			// We have an old (not upgraded yet) table.
			if !originIndex.ForeignKey.IsSet() {

(as discussed offline) this case can't happen since we already check that the FK is set in the if statement.

Previously, the maybeUpgradeFK method assumed that all on-disk
descriptors were old-style. This is not always the case, because we
might have written some upgraded ones after the 19.2 version bump had
completely finished.

Release note: None
@jordanlewis
Copy link
Member Author

TFTR!

bors r+

craig bot pushed a commit that referenced this pull request Aug 8, 2019
39451: sqlbase: upgrade method can deal with mixed upgraded/old descriptors r=jordanlewis a=jordanlewis

Previously, the maybeUpgradeFK method assumed that all on-disk
descriptors were old-style. This is not always the case, because we
might have written some upgraded ones after the 19.2 version bump had
completely finished.

Release note: None

Co-authored-by: Jordan Lewis <[email protected]>
@craig
Copy link
Contributor

craig bot commented Aug 8, 2019

Build succeeded

@craig craig bot merged commit caa8a62 into cockroachdb:master Aug 8, 2019
@jordanlewis jordanlewis deleted the fk-mixed-upgrade branch August 9, 2019 14:17
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.

3 participants