patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -4,11 +4,10 @@ alter system flush plan cache global;
drop table if exists t1;
create table t1(c1 int);
begin;
select * from t1;
select * from t1 where c1 = 1;select * from t1 where c1 = 1;select * from t1 where c1 = 1;//
commit;
// expected hit_count 2
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like "select * from t1 where c1 = ?;";
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like "select * from t1 where c1 = ?;";
hit_count
2
drop table t1;

View File

@ -33,7 +33,7 @@ select substr('hey', 2), cast(3 as char(20)), concat('', 'h2'), 1 is NULL, abs(-
+------------------+---------------------+------------------+-----------+---------+-------------+
// expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select substr(?, 2), cast(? as char(20)), concat(?, ?), ? is NULL, abs(?), floor(?) from dual';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select substr(?, 2), cast(? as char(20)), concat(?, ?), ? is NULL, abs(?), floor(?) from dual';
+-----------+
| hit_count |
+-----------+
@ -63,7 +63,7 @@ select a, a as test_a, b + 3 as test_b, a + 2, b + 3 from test_t;
+------+--------+--------+-------+-------+
// expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select a, a as test_a, b + ? as test_b, a + ?, b + ? from test_t';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select a, a as test_a, b + ? as test_b, a + ?, b + ? from test_t';
+-----------+
| hit_count |
+-----------+
@ -85,7 +85,7 @@ select * from (select 2, 3, 4 from dual);
+---+---+---+
// expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select * from (select ?, ?, ? from dual)';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select * from (select ?, ?, ? from dual)';
+-----------+
| hit_count |
+-----------+
@ -114,7 +114,7 @@ select * from (select 2 as c1, a, b + 2 from test_t);
+----+------+-------+
// expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select * from (select ? as c1, a, b + ? from test_t)';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select * from (select ? as c1, a, b + ? from test_t)';
+-----------+
| hit_count |
+-----------+
@ -198,7 +198,7 @@ select -2, -3, -2-1, 1-3 from dual;
| -2 | -3 | -2-1 | 1-3 |
+----+----+------+-----+
| -2 | -3 | -3 | -2 |
+----+----+------+-----+
+----+----+------+-----+
// expect hit_count = 1
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select ?, ?, ?-?, ?-? from dual';
@ -287,7 +287,7 @@ select 2 from dual union select 3 from dual;
+------+
| 2 |
| 3 |
+------+
+------+
// expect hit_count = 1
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select ? from dual union select ? from dual';
@ -328,7 +328,7 @@ select 'abd' as 'a' from dual;
+-----+
| a |
+-----+
| abd |
| abd |
+-----+
// expect hit_count = 1
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like "select ? as 'a' from dual";
@ -349,7 +349,7 @@ select 'adb' 'b' from dual;
| adb |
+------+
| adbb |
+------+
+------+
// expect hit_count = 1
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select ? from dual';

View File

@ -24,19 +24,17 @@ create table proxy_mock_table_for_pc(a int);
drop table if exists t1;
--enable_warnings
create table t1(c1 int);
--sleep 3
begin;
--source mysql_test/include/proxy_route_to_c.inc
delimiter //;
--disable_result_log
select * from t1;
select * from t1 where c1 = 1;select * from t1 where c1 = 1;select * from t1 where c1 = 1;//
delimiter ;//
commit;
--echo // expected hit_count 2
--enable_result_log
--disable_warnings
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like "select * from t1 where c1 = ?;";
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like "select * from t1 where c1 = ?;";
--enable_warnings
drop table t1;

View File

@ -39,14 +39,14 @@ select 3, 4, 5, 'hi' from dual;
--echo // expect hit_count = 1
--disable_warnings
#select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select ?, ?, ?, ? from dual';
#select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select ?, ?, ?, ? from dual';
--echo
select substr('hello', 2), cast(2 as char(20)), concat('h', '2'), 1 is NULL, abs(-1), floor(1.23) from dual;
select substr('hey', 2), cast(3 as char(20)), concat('', 'h2'), 1 is NULL, abs(-2), floor(2.23) from dual;
--echo // expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select substr(?, 2), cast(? as char(20)), concat(?, ?), ? is NULL, abs(?), floor(?) from dual';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select substr(?, 2), cast(? as char(20)), concat(?, ?), ? is NULL, abs(?), floor(?) from dual';
--enable_warnings
commit;
@ -69,7 +69,7 @@ select a, a as test_a, b + 3 as test_b, a + 2, b + 3 from test_t;
--echo // expect hit_count = 1
--disable_warnings
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select a, a as test_a, b + ? as test_b, a + ?, b + ? from test_t';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select a, a as test_a, b + ? as test_b, a + ?, b + ? from test_t';
--echo // >>>>>>>>>> Test#2 Subquery
@ -77,7 +77,7 @@ select * from (select 1, 2, 3 from dual);
select * from (select 2, 3, 4 from dual);
--echo // expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select * from (select ?, ?, ? from dual)';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select * from (select ?, ?, ? from dual)';
--echo // expect error
--error 1060
@ -87,7 +87,7 @@ select * from (select 1 as c1, a, b + 1 from test_t);
select * from (select 2 as c1, a, b + 2 from test_t);
--echo // expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select * from (select ? as c1, a, b + ? from test_t)';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select * from (select ? as c1, a, b + ? from test_t)';
--enable_warnings
commit;
@ -111,7 +111,7 @@ select -2, -3, -2-1, 1-3 from dual;
--echo // expect hit_count = 1
--disable_warnings
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select ?, ?, ?-?, ?-? from dual';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select ?, ?, ?-?, ?-? from dual';
--enable_warnings
commit;
@ -146,25 +146,25 @@ select 2 from dual union select 3 from dual;
--echo // expect hit_count = 1
--disable_warnings
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select ? from dual union select ? from dual';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select ? from dual union select ? from dual';
select * from (select 1, 2 + 3, 4 as c0, a, b + 1 from test_t union select 1, 2, 3, 4, 6 from dual);
select * from (select 2, 3 + 4, 5 as c0, a, b + 2 from test_t union select 2, 3, 4, 5, 6 from dual);
--echo // expect hit_count = 1
#select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select * from (select ?, ? + ?, ? as c0, a, b + ? from test_t union select ?, ?, ?, ?, ? from dual)';
#select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select * from (select ?, ? + ?, ? as c0, a, b + ? from test_t union select ?, ?, ?, ?, ? from dual)';
--echo // >>>>>>>>>> Test#7 `select str as str` and `select str str`
select 'abc' as 'a' from dual;
select 'abd' as 'a' from dual;
--echo // expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like "select ? as 'a' from dual";
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like "select ? as 'a' from dual";
select 'abc' 'a' from dual;
select 'adb' 'b' from dual;
--echo // expect hit_count = 1
select hit_count from oceanbase.gv$plan_cache_plan_stat where statement like 'select ? from dual';
select hit_count from oceanbase.GV$OB_PLAN_CACHE_PLAN_STAT where statement like 'select ? from dual';
--enable_warnings
commit;