-
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
sql: add voting_replicas, non_voting_replicas columns to SHOW RANGES #93513
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.
Assuming the powers who decide what columns are added to SHOW RANGES
are happy with this, the change itself looks sane.
Reviewed 3 of 4 files at r1, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner, @ecwall, @knz, and @rafiss)
pkg/sql/show_ranges_test.go
line 148 at r1 (raw file):
} func TestShowRangesColumns(t *testing.T) {
Could we write this using a LogicTest instead?
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 @ajwerner, @arulajmani, @knz, and @rafiss)
pkg/sql/show_ranges_test.go
line 148 at r1 (raw file):
Previously, arulajmani (Arul Ajmani) wrote…
Could we write this using a LogicTest instead?
Done.
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 r3, 1 of 2 files at r4, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner, @ecwall, @knz, and @rafiss)
pkg/sql/logictest/logic.go
line 3410 at r5 (raw file):
for i, v := range vals { colT := query.colTypes[i] // Ignore column - useful for non-deterministic output
Do we need this? Could we not instead construct the query such that the column isn't included?
pkg/sql/sqltestutils/sql_test_utils.go
line 129 at r5 (raw file):
} func ArrayStringToSlice(t *testing.T, array string, message ...string) []string {
nit: comment
pkg/sql/logictest/testdata/logic_test/ranges
line 155 at r5 (raw file):
ALTER INDEX d.c@c_i_idx SPLIT AT VALUES (0) # hex encode start_key, end_key so that text is UTF-8 compatible
What's the motivation behind this?
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 @ajwerner, @arulajmani, @knz, and @rafiss)
pkg/sql/logictest/logic.go
line 3410 at r5 (raw file):
Previously, arulajmani (Arul Ajmani) wrote…
Do we need this? Could we not instead construct the query such that the column isn't included?
I think it is useful to have the tests I added in this PR fail if columns are added/removed to indicate that the existing test case should be updated instead of adding something new.
pkg/sql/sqltestutils/sql_test_utils.go
line 129 at r5 (raw file):
Previously, arulajmani (Arul Ajmani) wrote…
nit: comment
Added.
Code quote:
ArrayStringToSlice
pkg/sql/logictest/testdata/logic_test/ranges
line 155 at r5 (raw file):
Previously, arulajmani (Arul Ajmani) wrote…
What's the motivation behind this?
git
(including GitHub) can't diff this file because it has non-UTF-8 characters in it (these don't render in reviewable, but you can see them in GoLand). The problem still exists in this PR because the "before" file still contains these characters, but it will be fixed going forward.
diff --git a/pkg/sql/logictest/testdata/logic_test/ranges b/pkg/sql/logictest/testdata/logic_test/ranges
index b1b1342c71..9b4fb03bbd 100644
Binary files a/pkg/sql/logictest/testdata/logic_test/ranges and b/pkg/sql/logictest/testdata/logic_test/ranges differ
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 @ajwerner, @arulajmani, @knz, and @rafiss)
pkg/sql/logictest/testdata/logic_test/ranges
line 155 at r5 (raw file):
Previously, ecwall (Evan Wall) wrote…
git
(including GitHub) can't diff this file because it has non-UTF-8 characters in it (these don't render in reviewable, but you can see them in GoLand). The problem still exists in this PR because the "before" file still contains these characters, but it will be fixed going forward.diff --git a/pkg/sql/logictest/testdata/logic_test/ranges b/pkg/sql/logictest/testdata/logic_test/ranges index b1b1342c71..9b4fb03bbd 100644 Binary files a/pkg/sql/logictest/testdata/logic_test/ranges and b/pkg/sql/logictest/testdata/logic_test/ranges differ
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 @ajwerner, @ecwall, @knz, and @rafiss)
pkg/sql/logictest/logic.go
line 3410 at r5 (raw file):
Previously, ecwall (Evan Wall) wrote…
I think it is useful to have the tests I added in this PR fail if columns are added/removed to indicate that the existing test case should be updated instead of adding something new.
Even then, if all you want to do is verify column names, couldn't you achieve the same thing by doing something like:
SELECT * FROM [SHOW RANGES FROM TABLE tbl;] LIMIT 0;
pkg/sql/logictest/testdata/logic_test/ranges
line 155 at r5 (raw file):
I see, thanks for making the change! Consider saying the same in the comment, given it's not completely obvious why we're doing this.
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 @ajwerner, @arulajmani, @knz, and @rafiss)
pkg/sql/logictest/logic.go
line 3410 at r5 (raw file):
Previously, arulajmani (Arul Ajmani) wrote…
Even then, if all you want to do is verify column names, couldn't you achieve the same thing by doing something like:
SELECT * FROM [SHOW RANGES FROM TABLE tbl;] LIMIT 0;
I thought it would be useful to have a row also to make sure it is populated.
For some reason SHOW RANGES FROM DATABASE
does not show any rows even if a table is added to it so I left it as is. There is a comment above that it is populated async so I don't think it should be verified here.
pkg/sql/logictest/testdata/logic_test/ranges
line 155 at r5 (raw file):
Previously, arulajmani (Arul Ajmani) wrote…
I see, thanks for making the change! Consider saying the same in the comment, given it's not completely obvious why we're doing this.
Good idea, added.
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 @ajwerner, @ecwall, @knz, and @rafiss)
pkg/sql/logictest/logic.go
line 3410 at r5 (raw file):
For some reason SHOW RANGES FROM DATABASE does not show any rows even if a table is added to it so I left it as is.
Isn't that because there's no table inside the database?
There is a comment above that it is populated async so I don't think it should be verified here.
Yeah, given this, I'm not sure it's worth adding this new "_" symbol to the logic test grammar. It doesn't seem generally valuable, given one could just decide to omit columns they're not interested in fetching.
For our particular test case, all we're deterministically testing is the column names, which we can do using a LIMIT 0
. If all we care about is this command returns rows, then we should just do a count(*).
If you feel strongly about adding this '_' symbol however, I won't stand in your way. Just add a comment about it up top in logic.go
where the other symbols are described.
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 @ajwerner, @arulajmani, and @rafiss)
pkg/sql/logictest/logic.go
line 3410 at r5 (raw file):
Previously, arulajmani (Arul Ajmani) wrote…
For some reason SHOW RANGES FROM DATABASE does not show any rows even if a table is added to it so I left it as is.
Isn't that because there's no table inside the database?
There is a comment above that it is populated async so I don't think it should be verified here.
Yeah, given this, I'm not sure it's worth adding this new "_" symbol to the logic test grammar. It doesn't seem generally valuable, given one could just decide to omit columns they're not interested in fetching.
For our particular test case, all we're deterministically testing is the column names, which we can do using a
LIMIT 0
. If all we care about is this command returns rows, then we should just do a count(*).If you feel strongly about adding this '_' symbol however, I won't stand in your way. Just add a comment about it up top in
logic.go
where the other symbols are described.
SHOW RANGES FROM DATABASE is broken currently. I'm working on it.
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 @ajwerner, @arulajmani, and @rafiss)
pkg/sql/logictest/logic.go
line 3410 at r5 (raw file):
Isn't that because there's no table inside the database?
Even after I added a table it did not have any records until I added a split to the table. SHOW RANGES FROM TABLE
shows a record for a table even without a split.
If you feel strongly about adding this '_' symbol however, I won't stand in your way. Just add a comment about it up top in logic.go where the other symbols are described.
Comment added.
Fixes #93508 Some of the multitenant admin functions accept VOTERS, NONVOTERS as input. Add voting_replicas, non_voting_replicas columns to SHOW RANGE(S) to make working with the admin functions easier. Release note (sql change): Add voting_replicas, non_voting_replicas columns to output of SHOW RANGE(S) statements.
Build failed (retrying...): |
Build failed (retrying...): |
Build failed (retrying...): |
bors r=arulajmani |
Already running a review |
Build succeeded: |
Fixes #93508
Some of the multitenant admin functions accept VOTERS, NONVOTERS as input.
Add voting_replicas, non_voting_replicas columns to SHOW RANGE(S) to make working with the admin functions easier.
Release note (sql change): Add voting_replicas, non_voting_replicas columns to output of SHOW RANGE(S) statements.