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

sql: fix index-id does not exist when ADD/DROP COLUMN #28803

Merged
merged 1 commit into from
Aug 20, 2018

Conversation

vivekmenezes
Copy link
Contributor

this was being caused by pitfall:
https://play.golang.org/p/H8Rzb3_rywr

fixes #27402

Release note (sql change): Fix ADD/DROP COLUMN
index-id does not exist error

this was being caused by pitfall:
https://play.golang.org/p/H8Rzb3_rywr

fixes cockroachdb#27402

Release note (sql change): Fix ADD/DROP COLUMN
index-id does not exist error
@vivekmenezes vivekmenezes requested review from knz and a team August 19, 2018 00:48
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@benesch benesch left a comment

Choose a reason for hiding this comment

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

:lgtm:

Nice find! That can't have been fun to track down.

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/sql/backfill/backfill.go, line 149 at r1 (raw file):

	)
	for i, fkTableDesc := range otherTables {
		found, ok := fkTables[fkTableDesc.ID]

One other pattern I've seen to prevent accidents is:

for i := range otherTables {
    fkTableDesc := &otherTables[i]
}

That way you don't ever have to think about whether you're using the "correct" reference to fkTableDesc in the body of the loop.

Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

:lgtm: yeah that was a serious bit of investigation

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (and 1 stale)

@vivekmenezes
Copy link
Contributor Author

TFTR!

@vivekmenezes
Copy link
Contributor Author

bors r+

craig bot pushed a commit that referenced this pull request Aug 20, 2018
28803: sql: fix index-id does not exist when ADD/DROP COLUMN r=vivekmenezes a=vivekmenezes

this was being caused by pitfall:
https://play.golang.org/p/H8Rzb3_rywr

fixes #27402

Release note (sql change): Fix ADD/DROP COLUMN
index-id does not exist error

Co-authored-by: Vivek Menezes <vivek@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Aug 20, 2018

Build succeeded

@craig craig bot merged commit 5a13a7b into cockroachdb:master Aug 20, 2018
@vivekmenezes vivekmenezes deleted the indexnotfound branch August 20, 2018 02:03
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.

sql: add column on 30k row table never completes
4 participants