Skip to content

Commit

Permalink
Properly fallback if executing unsupported case
Browse files Browse the repository at this point in the history
Summary: In most cases bypass parser `select_parser` should identify unsupported case and fallback to regular query. However, there are a few checks that are expensive and is done as part of execution, and we should properly fallback in those case as well. In a future version maybe we should refactor it so that those are another phase of parsing as well, which would also help bypass RPC.

Reviewed By: Pushapgl

Differential Revision: D26033752

fbshipit-source-id: 54e1ce844bf
  • Loading branch information
yizhang82 authored and facebook-github-bot committed Feb 19, 2021
1 parent 3bfd0f9 commit 5452df8
Show file tree
Hide file tree
Showing 3 changed files with 272 additions and 72 deletions.
168 changes: 148 additions & 20 deletions mysql-test/suite/rocksdb/r/bypass_select_unsupported.result
Original file line number Diff line number Diff line change
Expand Up @@ -162,30 +162,138 @@ QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` = ? OR `pk` = ? Unsupported WHERE: should be expr [(AND expr)*] where expr only contains >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` Unsupported WHERE: should be expr [(AND expr)*] where expr only contains >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` USE INDEX ( PRIMARY ) WHERE `pk` = ? Index hint must be FORCE INDEX
SELECT /*+ bypass */ pk from t1 WHERE pk<=>1;
ERROR 42000: SELECT statement pattern not supported: Unsupported WHERE - needs to be >, >=, <, <=, =, IN
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk > 2 AND pk > 3;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 12
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` <=> ? Unsupported WHERE - needs to be >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` > ? AND `pk` > ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` = ? OR `pk` = ? Unsupported WHERE: should be expr [(AND expr)*] where expr only contains >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` Unsupported WHERE: should be expr [(AND expr)*] where expr only contains >, >=, <, <=, =, IN
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk > 2;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 13
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` > ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` > ? AND `pk` > ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` = ? OR `pk` = ? Unsupported WHERE: should be expr [(AND expr)*] where expr only contains >, >=, <, <=, =, IN
SELECT /*+ bypass */ pk from t1 WHERE pk < 1 AND pk < 2;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 14
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` < ? AND `pk` < ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` > ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` > ? AND `pk` > ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk <= 1 AND pk <= 2;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 15
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` <= ? AND `pk` <= ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` < ? AND `pk` < ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` > ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk >= 1 AND pk >= 2;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 16
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` >= ? AND `pk` >= ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` <= ? AND `pk` <= ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` < ? AND `pk` < ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk >= 2;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 17
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` >= ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` >= ? AND `pk` >= ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` <= ? AND `pk` <= ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk >= 1 AND pk > 2;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 18
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` >= ? AND `pk` > ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` >= ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` >= ? AND `pk` >= ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk < 1 AND pk <= 2;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 19
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` < ? AND `pk` <= ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` >= ? AND `pk` > ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` > ? AND `pk` >= ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk <= 1 AND pk < 2;
ERROR 42000: SELECT statement pattern not supported: Unsupported range query pattern
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 20
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` <= ? AND `pk` < ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` < ? AND `pk` <= ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` >= ? AND `pk` > ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk<=>1;
ERROR 42000: SELECT statement pattern not supported: Unsupported WHERE - needs to be >, >=, <, <=, =, IN
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 21
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` <=> ? Unsupported WHERE - needs to be >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` WHERE `pk` <= ? AND `pk` < ? Unsupported range query pattern
SELECT `pk` FROM `t1` WHERE `pk` < ? AND `pk` <= ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk=(1,2,3);
ERROR 42000: SELECT statement pattern not supported: Unsupported WHERE - operand should be int/string/real/varbinary
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 13
rocksdb_select_bypass_rejected 22
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` = (...) Unsupported WHERE - operand should be int/string/real/varbinary
SELECT `pk` FROM `t1` WHERE `pk` <=> ? Unsupported WHERE - needs to be >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` WHERE `pk` = ? OR `pk` = ? Unsupported WHERE: should be expr [(AND expr)*] where expr only contains >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` WHERE `pk` <= ? AND `pk` < ? Unsupported range query pattern
set global rocksdb_select_bypass_rejected_query_history_size=4;
SELECT @@rocksdb_select_bypass_rejected_query_history_size;
@@rocksdb_select_bypass_rejected_query_history_size
Expand All @@ -196,20 +304,20 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 14
rocksdb_select_bypass_rejected 23
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` = DATE ? Unsupported WHERE - operand should be int/string/real/varbinary
SELECT `pk` FROM `t1` WHERE `pk` = (...) Unsupported WHERE - operand should be int/string/real/varbinary
SELECT `pk` FROM `t1` WHERE `pk` <=> ? Unsupported WHERE - needs to be >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` WHERE `pk` = ? OR `pk` = ? Unsupported WHERE: should be expr [(AND expr)*] where expr only contains >, >=, <, <=, =, IN
SELECT `pk` FROM `t1` WHERE `pk` <= ? AND `pk` < ? Unsupported range query pattern
SELECT /*+ bypass */ pk from t1 WHERE pk=TIME '18:01:00';
ERROR 42000: SELECT statement pattern not supported: Unsupported WHERE - operand should be int/string/real/varbinary
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 15
rocksdb_select_bypass_rejected 24
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` = TIME ? Unsupported WHERE - operand should be int/string/real/varbinary
Expand All @@ -222,7 +330,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 16
rocksdb_select_bypass_rejected 25
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` = TIMESTAMP ? Unsupported WHERE - operand should be int/string/real/varbinary
Expand All @@ -235,7 +343,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 16
rocksdb_select_bypass_rejected 25
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` = TIMESTAMP ? Unsupported WHERE - operand should be int/string/real/varbinary
Expand All @@ -248,7 +356,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 16
rocksdb_select_bypass_rejected 25
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `pk` FROM `t1` WHERE `pk` = TIMESTAMP ? Unsupported WHERE - operand should be int/string/real/varbinary
Expand All @@ -261,7 +369,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 17
rocksdb_select_bypass_rejected 26
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT DISTINCTROW `a` FROM `t1` SELECT options not supported (such as SELECT DISTINCT)
Expand All @@ -274,7 +382,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 18
rocksdb_select_bypass_rejected 27
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT ALL `a` , `b` FROM `t1` SELECT options not supported (such as SELECT DISTINCT)
Expand All @@ -294,7 +402,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 18
rocksdb_select_bypass_rejected 27
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT ALL `a` , `b` FROM `t1` SELECT options not supported (such as SELECT DISTINCT)
Expand All @@ -305,7 +413,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 18
rocksdb_select_bypass_rejected 27
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT ALL `a` , `b` FROM `t1` SELECT options not supported (such as SELECT DISTINCT)
Expand All @@ -315,7 +423,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 18
rocksdb_select_bypass_rejected 27
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT ALL `a` , `b` FROM `t1` SELECT options not supported (such as SELECT DISTINCT)
Expand All @@ -329,7 +437,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 18
rocksdb_select_bypass_rejected 27
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT ALL `a` , `b` FROM `t1` SELECT options not supported (such as SELECT DISTINCT)
Expand All @@ -355,7 +463,7 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 26
rocksdb_select_bypass_rejected 35
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;
QUERY ERROR_MSG
SELECT `a` , `b` , `c` FROM `t3` FORCE INDEX ( `a` ) WHERE `a` = ? ORDER BY `b` , `b` only utf8_bin, latin1_bin is supported for varchar field
Expand All @@ -367,14 +475,14 @@ SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 28
rocksdb_select_bypass_rejected 37
SELECT /*+ bypass */ a from t1 WHERE a=1 INTO DUMPFILE 'datadir/select.dump';
ERROR 42000: SELECT statement pattern not supported: SELECT INTO/DUMP not supported
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Variable_name Value
rocksdb_select_bypass_executed 0
rocksdb_select_bypass_failed 0
rocksdb_select_bypass_rejected 29
rocksdb_select_bypass_rejected 38
SELECT /*+ bypass */ a, b, c FROM t3 WHERE pk=1 FOR UPDATE;
ERROR 42000: SELECT statement pattern not supported: Only SELECT with default READ lock is supported
SELECT /*+ bypass */ a, b, c FROM t3 WHERE pk=1 FOR UPDATE SKIP LOCKED;
Expand Down Expand Up @@ -430,6 +538,26 @@ SELECT @@rocksdb_select_bypass_fail_unsupported;
0
SELECT /*+ bypass */ * from t1;
pk a b c
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk > 2 AND pk > 3;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk > 2;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk >= 1 AND pk >= 2;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk >= 2;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk >= 1 AND pk > 2;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk >= 2;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk < 1 AND pk < 2;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk <= 1 AND pk <= 2;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk < 1 AND pk <= 2;
pk
SELECT /*+ bypass */ pk from t1 WHERE pk <= 1 AND pk < 2;
pk
SELECT @@rocksdb_select_bypass_fail_unsupported;
@@rocksdb_select_bypass_fail_unsupported
0
Expand Down
57 changes: 57 additions & 0 deletions mysql-test/suite/rocksdb/t/bypass_select_unsupported.test
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,51 @@ SELECT /*+ bypass */ pk from t1 WHERE pk=1 or pk=2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk > 2 AND pk > 3;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk > 2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk < 1 AND pk < 2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk <= 1 AND pk <= 2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk >= 1 AND pk >= 2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk >= 2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk >= 1 AND pk > 2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk < 1 AND pk <= 2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk <= 1 AND pk < 2;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
SELECT QUERY, ERROR_MSG from information_schema.ROCKSDB_BYPASS_REJECTED_QUERY_HISTORY;

--error ER_NOT_SUPPORTED_YET
SELECT /*+ bypass */ pk from t1 WHERE pk<=>1;
SHOW STATUS LIKE 'rocksdb_select_bypass%';
Expand Down Expand Up @@ -275,6 +320,18 @@ SELECT @@rocksdb_select_bypass_fail_unsupported;

SELECT /*+ bypass */ * from t1;

# Unsupported range query patterns
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk > 2 AND pk > 3;
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk > 2;
SELECT /*+ bypass */ pk from t1 WHERE pk >= 1 AND pk >= 2;
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk >= 2;
SELECT /*+ bypass */ pk from t1 WHERE pk >= 1 AND pk > 2;
SELECT /*+ bypass */ pk from t1 WHERE pk > 1 AND pk >= 2;
SELECT /*+ bypass */ pk from t1 WHERE pk < 1 AND pk < 2;
SELECT /*+ bypass */ pk from t1 WHERE pk <= 1 AND pk <= 2;
SELECT /*+ bypass */ pk from t1 WHERE pk < 1 AND pk <= 2;
SELECT /*+ bypass */ pk from t1 WHERE pk <= 1 AND pk < 2;

SELECT @@rocksdb_select_bypass_fail_unsupported;
set global rocksdb_select_bypass_fail_unsupported=@save_fail_unsupported;
SELECT @@rocksdb_select_bypass_fail_unsupported;
Expand Down
Loading

0 comments on commit 5452df8

Please sign in to comment.