-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[YCQL] Failed to SELECT from TABLE with Secondary INDEX when upgrading to 2.0.5.4 #3281
Comments
nocaway
added a commit
that referenced
this issue
Jan 8, 2020
Summary: After upgrade server of 2.0 and later versions did not process the existing pre-2.0.5 indexes in the database correctly. - INDEXes that were created before 2.0 releases does not contain column_names. - Newer server uses column names to determine if an expression is covered by the index. The fix - For existing INDEXes, we continue to use column IDs when checking for covering. - Also, when checking for covering, to be safe, the predicate `column_name.empty()` is used. The function "string::find(str, substr)" will return TRUE if "substr" is empty. Test Plan: Test manually. ``` CREATE TABLE test.bbb ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'false'}; CREATE INDEX bbb_height ON test.bbb (height, k) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'false', 'consistency_level': 'user_enforced'}; cqlsh:test> EXPLAIN SELECT * FROM bbb WHERE height = 1; QUERY PLAN ---------------------------------------------- Index Scan using test.bbb_height on test.bbb Key Conditions: (height = 1) cqlsh:test> describe bbb1; CREATE TABLE test.bbb1 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'false'}; CREATE INDEX bbb_height1 ON test.bbb1 (height, k) INCLUDE (time) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'false', 'consistency_level': 'user_enforced'}; cqlsh:test> EXPLAIN SELECT * FROM bbb1 WHERE height = 1; QUERY PLAN ----------------------------------------------------- Index Only Scan using test.bbb_height1 on test.bbb1 Key Conditions: (height = 1) cqlsh:test> describe bbb2; CREATE TABLE test.bbb2 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'true'}; CREATE INDEX bbb_height2 ON test.bbb2 (height, k) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'true'}; cqlsh:test> EXPLAIN SELECT * FROM bbb2 WHERE height = 1; QUERY PLAN ------------------------------------------------ Index Scan using test.bbb_height2 on test.bbb2 Key Conditions: (height = 1) cqlsh:test> describe bbb3; CREATE TABLE test.bbb3 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'true'}; CREATE INDEX bbb_height3 ON test.bbb3 (height, k) INCLUDE (time) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'true'}; cqlsh:test> EXPLAIN SELECT * FROM bbb3 WHERE height = 1; QUERY PLAN ----------------------------------------------------- Index Only Scan using test.bbb_height3 on test.bbb3 Key Conditions: (height = 1) ``` Reviewers: amitanand, mihnea Reviewed By: mihnea Subscribers: yql Differential Revision: https://phabricator.dev.yugabyte.com/D7768
This has been fixed in the master branch. |
nocaway
added a commit
that referenced
this issue
Jan 9, 2020
Summary: After upgrade server of 2.0 and later versions did not process the existing pre-2.0.5 indexes in the database correctly. - INDEXes that were created before 2.0 releases does not contain column_names. - Newer server uses column names to determine if an expression is covered by the index. The fix - For existing INDEXes, we continue to use column IDs when checking for covering. - Also, when checking for covering, to be safe, the predicate `column_name.empty()` is used. The function "string::find(str, substr)" will return TRUE if "substr" is empty. Test Plan: Test manually. ``` CREATE TABLE test.bbb ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'false'}; CREATE INDEX bbb_height ON test.bbb (height, k) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'false', 'consistency_level': 'user_enforced'}; cqlsh:test> EXPLAIN SELECT * FROM bbb WHERE height = 1; QUERY PLAN ---------------------------------------------- Index Scan using test.bbb_height on test.bbb Key Conditions: (height = 1) cqlsh:test> describe bbb1; CREATE TABLE test.bbb1 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'false'}; CREATE INDEX bbb_height1 ON test.bbb1 (height, k) INCLUDE (time) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'false', 'consistency_level': 'user_enforced'}; cqlsh:test> EXPLAIN SELECT * FROM bbb1 WHERE height = 1; QUERY PLAN ----------------------------------------------------- Index Only Scan using test.bbb_height1 on test.bbb1 Key Conditions: (height = 1) cqlsh:test> describe bbb2; CREATE TABLE test.bbb2 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'true'}; CREATE INDEX bbb_height2 ON test.bbb2 (height, k) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'true'}; cqlsh:test> EXPLAIN SELECT * FROM bbb2 WHERE height = 1; QUERY PLAN ------------------------------------------------ Index Scan using test.bbb_height2 on test.bbb2 Key Conditions: (height = 1) cqlsh:test> describe bbb3; CREATE TABLE test.bbb3 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'true'}; CREATE INDEX bbb_height3 ON test.bbb3 (height, k) INCLUDE (time) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'true'}; cqlsh:test> EXPLAIN SELECT * FROM bbb3 WHERE height = 1; QUERY PLAN ----------------------------------------------------- Index Only Scan using test.bbb_height3 on test.bbb3 Key Conditions: (height = 1) ``` Reviewers: amitanand, mihnea Reviewed By: mihnea Subscribers: yql Differential Revision: https://phabricator.dev.yugabyte.com/D7768
This fix has been backported to 2.0.5 branch. |
carlos-username
pushed a commit
to carlos-username/yugabyte-db
that referenced
this issue
Mar 11, 2020
…ed Table Summary: After upgrade server of 2.0 and later versions did not process the existing pre-2.0.5 indexes in the database correctly. - INDEXes that were created before 2.0 releases does not contain column_names. - Newer server uses column names to determine if an expression is covered by the index. The fix - For existing INDEXes, we continue to use column IDs when checking for covering. - Also, when checking for covering, to be safe, the predicate `column_name.empty()` is used. The function "string::find(str, substr)" will return TRUE if "substr" is empty. Test Plan: Test manually. ``` CREATE TABLE test.bbb ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'false'}; CREATE INDEX bbb_height ON test.bbb (height, k) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'false', 'consistency_level': 'user_enforced'}; cqlsh:test> EXPLAIN SELECT * FROM bbb WHERE height = 1; QUERY PLAN ---------------------------------------------- Index Scan using test.bbb_height on test.bbb Key Conditions: (height = 1) cqlsh:test> describe bbb1; CREATE TABLE test.bbb1 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'false'}; CREATE INDEX bbb_height1 ON test.bbb1 (height, k) INCLUDE (time) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'false', 'consistency_level': 'user_enforced'}; cqlsh:test> EXPLAIN SELECT * FROM bbb1 WHERE height = 1; QUERY PLAN ----------------------------------------------------- Index Only Scan using test.bbb_height1 on test.bbb1 Key Conditions: (height = 1) cqlsh:test> describe bbb2; CREATE TABLE test.bbb2 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'true'}; CREATE INDEX bbb_height2 ON test.bbb2 (height, k) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'true'}; cqlsh:test> EXPLAIN SELECT * FROM bbb2 WHERE height = 1; QUERY PLAN ------------------------------------------------ Index Scan using test.bbb_height2 on test.bbb2 Key Conditions: (height = 1) cqlsh:test> describe bbb3; CREATE TABLE test.bbb3 ( k int PRIMARY KEY, time int, height bigint ) WITH default_time_to_live = 0 AND transactions = {'enabled': 'true'}; CREATE INDEX bbb_height3 ON test.bbb3 (height, k) INCLUDE (time) WITH CLUSTERING ORDER BY (k ASC) AND transactions = {'enabled': 'true'}; cqlsh:test> EXPLAIN SELECT * FROM bbb3 WHERE height = 1; QUERY PLAN ----------------------------------------------------- Index Only Scan using test.bbb_height3 on test.bbb3 Key Conditions: (height = 1) ``` Reviewers: amitanand, mihnea Reviewed By: mihnea Subscribers: yql Differential Revision: https://phabricator.dev.yugabyte.com/D7768
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After upgrading to 2.0.5.4, a column is missing when selecting from a table that has secondary index.
The text was updated successfully, but these errors were encountered: