-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
schemachanger: Fixed bug incorrect InvertedColumnKinds in the inverte… #138043
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @Dedej-Bergin)
pkg/sql/logictest/testdata/logic_test/show_create
line 247 at r1 (raw file):
statement ok CREATE TABLE roaches (id UUID PRIMARY KEY, x STRING, y STRING);
Logic tests have a hook that adds random column families to CREATE TABLE statements. That's why the SHOW CREATE output below has extra lines for FAMILY. To make the test stable, we need to add an explicit column family definition here. The test cases above this one do that too.
So this should be:
CREATE TABLE roaches (id UUID PRIMARY KEY, x STRING, y STRING, FAMILY f1 (id, x, y));
pkg/sql/logictest/testdata/logic_test/show_create
line 248 at r1 (raw file):
statement ok CREATE TABLE roaches (id UUID PRIMARY KEY, x STRING, y STRING); CREATE INDEX ON roaches USING GIN (x, y gin_trgm_ops);
I ran this test with your change in pkg/sql/schemachanger/scexec/scmutationexec/index.go reverted, and it still passed
i think it's because the statements are sent as a batch, which causes them all the run in one transaction, which means the legacy schema changer will be used. so we need to separate them:
statement ok
CREATE TABLE roaches (id UUID PRIMARY KEY, x STRING, y STRING, FAMILY f1 (id, x, y));
statement ok
CREATE INDEX ON roaches USING GIN (x, y gin_trgm_ops);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @Dedej-Bergin)
pkg/sql/logictest/testdata/logic_test/show_create
line 248 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
I ran this test with your change in pkg/sql/schemachanger/scexec/scmutationexec/index.go reverted, and it still passed
i think it's because the statements are sent as a batch, which causes them all the run in one transaction, which means the legacy schema changer will be used. so we need to separate them:
statement ok CREATE TABLE roaches (id UUID PRIMARY KEY, x STRING, y STRING, FAMILY f1 (id, x, y)); statement ok CREATE INDEX ON roaches USING GIN (x, y gin_trgm_ops);
As a more general tip, whenever you make a bug fix and add a test for it, you should always make sure the test fails without your bug fix.
…d index Previously the `SHOW CREATE TABLE` statement would lose index information. The fix now allows `SHOW CREATE TABLE` to show the correct information that can be repeatedly entered back into crdb to recreate the same table. Fixes: cockroachdb#136410 Release note (bug fix): Previously `SHOW CREATE TABLE` was showing incorrect data with regards to inverted indexes. It now shows the correct data that can be repeatedly entered back into crdb to recreate the same table.
60bd9e4
to
c902275
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)
pkg/sql/logictest/testdata/logic_test/show_create
line 247 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
Logic tests have a hook that adds random column families to CREATE TABLE statements. That's why the SHOW CREATE output below has extra lines for FAMILY. To make the test stable, we need to add an explicit column family definition here. The test cases above this one do that too.
So this should be:
CREATE TABLE roaches (id UUID PRIMARY KEY, x STRING, y STRING, FAMILY f1 (id, x, y));
Thanks Rafi! Just made this change.
pkg/sql/logictest/testdata/logic_test/show_create
line 248 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
As a more general tip, whenever you make a bug fix and add a test for it, you should always make sure the test fails without your bug fix.
Thanks Rafi! I went ahead and made this change, thanks for the tip!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @Dedej-Bergin)
TFTR! bors r+ |
blathers backport 24.3 24.2 24.1 23.2 |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from c902275 to blathers/backport-release-24.1-138043: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 24.1 failed. See errors above. error creating merge commit from c902275 to blathers/backport-release-23.2-138043: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 23.2 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
…d index
Previously the
SHOW CREATE TABLE
statement would lose index information. The fix now allowsSHOW CREATE TABLE
to show the correct information that can be repeatedly entered back into crdb to recreate the same table.Fixes: #136410
Release note (bug fix): Previously
SHOW CREATE TABLE
was showing incorrect data with regards to inverted indexes. It now shows the correct data that can be repeatedly entered back into crdb to recreate the same table.