move test folder

This commit is contained in:
wangzelin.wzl
2022-08-12 19:29:16 +08:00
parent 29e0cb7475
commit d5269307a9
419 changed files with 275972 additions and 77007 deletions

View File

@ -0,0 +1,228 @@
use test;
drop table if exists pg_trans_test;
create tablegroup tg1 binding true;
create table pg_trans_test1_1(id1 int, id2 int) tablegroup tg1;
create table pg_trans_test1_2(id1 int, id2 int) tablegroup tg1;
create index i1 on pg_trans_test1_1(id2) local;
desc pg_trans_test1_1;
Field Type Null Key Default Extra
id1 int(11) YES NULL
id2 int(11) YES MUL NULL
desc pg_trans_test1_2;
Field Type Null Key Default Extra
id1 int(11) YES NULL
id2 int(11) YES NULL
insert into pg_trans_test1_1 values(1, 1);
insert into pg_trans_test1_2 values(2, 2);
begin;
insert into pg_trans_test1_1 values(3, 3);
insert into pg_trans_test1_2 values(4, 4);
commit;
select * from pg_trans_test1_1;
id1 id2
1 1
3 3
select * from pg_trans_test1_2;
id1 id2
2 2
4 4
create tablegroup tg2 binding true partition by hash partitions 2;
create table pg_trans_test2_1(id1 int, id2 int) tablegroup tg2 partition by hash(id1 % 2) partitions 2;
create index i1 on pg_trans_test2_1(id2) local;
create table pg_trans_test2_2(id1 int, id2 int) tablegroup tg2 partition by hash(id1 % 2) partitions 2;
desc pg_trans_test2_1;
Field Type Null Key Default Extra
id1 int(11) YES NULL
id2 int(11) YES MUL NULL
desc pg_trans_test2_2;
Field Type Null Key Default Extra
id1 int(11) YES NULL
id2 int(11) YES NULL
insert into pg_trans_test2_1 values(5, 5);
insert into pg_trans_test2_2 values(6, 6);
select * from pg_trans_test2_1;
id1 id2
5 5
select * from pg_trans_test2_2;
id1 id2
6 6
begin;
insert into pg_trans_test2_1 values(7, 7);
insert into pg_trans_test2_2 values(8, 8);
commit;
select * from pg_trans_test2_1;
id1 id2
5 5
7 7
select * from pg_trans_test2_2;
id1 id2
6 6
8 8
begin;
insert into pg_trans_test2_1 values(7, 7);
insert into pg_trans_test2_1 values(8, 8);
insert into pg_trans_test2_2 values(9, 9);
insert into pg_trans_test2_2 values(10, 10);
commit;
select * from pg_trans_test2_1;
id1 id2
8 8
5 5
7 7
7 7
select * from pg_trans_test2_2;
id1 id2
6 6
8 8
10 10
9 9
create tablegroup tg3 binding true partition by range columns 1 (partition p0 values less than (10), partition p1 values less than(20));
create table pg_trans_test3_1(id1 int, id2 int) tablegroup tg3 partition by range columns(id1) (partition p0 values less than (10), partition p1 values less than(20));
create table pg_trans_test3_2(id1 int, id2 int) tablegroup tg3 partition by range columns(id1) (partition p0 values less than (10), partition p1 values less than(20));
desc pg_trans_test3_1;
Field Type Null Key Default Extra
id1 int(11) YES NULL
id2 int(11) YES NULL
desc pg_trans_test3_2;
Field Type Null Key Default Extra
id1 int(11) YES NULL
id2 int(11) YES NULL
insert into pg_trans_test3_1 values(5, 5);
insert into pg_trans_test3_2 values(15, 15);
select * from pg_trans_test3_1;
id1 id2
5 5
select * from pg_trans_test3_2;
id1 id2
15 15
begin;
insert into pg_trans_test3_1 values(6, 6);
insert into pg_trans_test3_2 values(8, 8);
commit;
begin;
insert into pg_trans_test3_1 values(11, 11);
insert into pg_trans_test3_2 values(12, 12);
commit;
select * from pg_trans_test3_1;
id1 id2
5 5
6 6
11 11
select * from pg_trans_test3_2;
id1 id2
8 8
12 12
15 15
begin;
insert into pg_trans_test3_1 values(1, 1);
insert into pg_trans_test3_1 values(13, 13);
insert into pg_trans_test3_2 values(2, 2);
insert into pg_trans_test3_2 values(14, 14);
commit;
select * from pg_trans_test3_1;
id1 id2
1 1
5 5
6 6
11 11
13 13
select * from pg_trans_test3_2;
id1 id2
2 2
8 8
12 12
14 14
15 15
create tablegroup tg4 binding true partition by list columns 1 (
partition p0 values in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
partition p1 values in (11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
);
create table pg_trans_test4_1(id1 int, id2 int) tablegroup tg4 partition by list columns(id1) (
partition p0 values in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
partition p1 values in (11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
);
create table pg_trans_test4_2(id1 int, id2 int) tablegroup tg4 partition by list columns(id1) (
partition p0 values in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
partition p1 values in (11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
);
desc pg_trans_test4_1;
Field Type Null Key Default Extra
id1 int(11) YES NULL
id2 int(11) YES NULL
desc pg_trans_test4_2;
Field Type Null Key Default Extra
id1 int(11) YES NULL
id2 int(11) YES NULL
insert into pg_trans_test4_1 values(5, 5);
insert into pg_trans_test4_2 values(15, 15);
select * from pg_trans_test4_1;
id1 id2
5 5
select * from pg_trans_test4_2;
id1 id2
15 15
begin;
insert into pg_trans_test4_1 values(6, 6);
insert into pg_trans_test4_2 values(8, 8);
commit;
begin;
insert into pg_trans_test4_1 values(11, 11);
insert into pg_trans_test4_2 values(12, 12);
commit;
select * from pg_trans_test4_1;
id1 id2
5 5
6 6
11 11
select * from pg_trans_test4_2;
id1 id2
8 8
12 12
15 15
begin;
insert into pg_trans_test4_1 values(1, 1);
insert into pg_trans_test4_1 values(13, 13);
insert into pg_trans_test4_2 values(2, 2);
insert into pg_trans_test4_2 values(14, 14);
commit;
select * from pg_trans_test4_1;
id1 id2
1 1
5 5
6 6
11 11
13 13
select * from pg_trans_test4_2;
id1 id2
2 2
8 8
12 12
14 14
15 15
create tablegroup tg5 binding true;
create table pg_trans_test5_1 (pk int) tablegroup tg5;
create table pg_trans_test5_2 (pk int) tablegroup tg5;
insert into pg_trans_test5_1 values (1), (2), (3), (4);
insert into pg_trans_test5_2 values (1), (2), (3), (4);
select * from pg_trans_test5_1 as l join pg_trans_test5_2 as r where l.pk = r.pk;
pk pk
1 1
2 2
3 3
4 4
drop table if exists pg_trans_test1_1;
drop table if exists pg_trans_test1_2;
drop table if exists pg_trans_test2_1;
drop table if exists pg_trans_test2_2;
drop table if exists pg_trans_test3_1;
drop table if exists pg_trans_test3_2;
drop table if exists pg_trans_test4_1;
drop table if exists pg_trans_test4_2;
drop table if exists pg_trans_test5_1;
drop table if exists pg_trans_test5_2;
purge recyclebin;
drop tablegroup tg1;
drop tablegroup tg2;
drop tablegroup tg3;
drop tablegroup tg4;
drop tablegroup tg5;

View File

@ -0,0 +1,169 @@
drop database if exists xm_test;
drop database if exists xm_test_db1;
create database xm_test;
use xm_test;
set tx_isolation = 'SERIALIZABLE';
set autocommit = 1;
set tx_isolation = 'SERIALIZABLE';
set autocommit = 1;
create table xm_test_t1 (c1 int primary key, c2 int);
create table xm_test_t2 (c1 int primary key, c2 int);
insert into xm_test_t1 values(1,1);
insert into xm_test_t1 values(2,1);
insert into xm_test_t2 values(2,1);
begin;
select * from xm_test_t1;
c1 c2
1 1
2 1
insert into xm_test_t1 values (3, 1);
insert into xm_test_t1 values (4, 1);
select * from xm_test_t1;
c1 c2
1 1
2 1
4 1
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
commit;
begin;
select /*+read_consistency(weak) */ * from xm_test_t1;
ERROR 0A000: weak consistency under SERIALIZABLE isolation level not supported
commit;
begin;
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
4 1
insert into xm_test_t1 values (5, 1);
show databases like 'xm_%';
Database (xm_%)
xm_test
create database xm_test_db1;
show databases like 'xm_%';
Database (xm_%)
xm_test
xm_test_db1
insert into xm_test_t1 values (6, 1);
show databases like 'xm_%';
Database (xm_%)
xm_test
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
4 1
5 1
commit;
create table t_global_index (pk int primary key) partition by hash(pk) partitions 10;
insert into t_global_index values (1), (2), (3);
create index index1 on t_global_index (pk) global;
show index from t_global_index;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible
t_global_index 0 PRIMARY 1 pk A NULL NULL NULL BTREE available YES
t_global_index 1 index1 1 pk A NULL NULL NULL BTREE available YES
begin;
insert into xm_test_t1 values (7, 1);
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
4 1
5 1
6 1
7 1
select table_name from oceanbase.__all_table_v2 as t, oceanbase.__all_database as d where d.database_name='xm_test' and d.database_id = t.database_id and (t.table_name='xm_test_t1' or t.table_name='xm_test_t4');
table_name
xm_test_t1
create table xm_test_t4 (pk int primary key);
insert into xm_test_t1 values (8, 1);
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
4 1
5 1
6 1
8 1
select table_name from oceanbase.__all_table_v2 as t, oceanbase.__all_database as d where d.database_name='xm_test' and d.database_id = t.database_id and (t.table_name='xm_test_t1' or t.table_name='xm_test_t4');
table_name
xm_test_t1
select /*+read_consistency(weak) */ table_name from oceanbase.__all_table_v2 as t, oceanbase.__all_database as d where d.database_name='xm_test' and d.database_id = t.database_id and (t.table_name='xm_test_t1' or t.table_name='xm_test_t4');
table_name
xm_test_t1
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
4 1
5 1
6 1
7 1
commit;
begin;
insert into xm_test_t1 values (9, 1);
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
select t.table_name from oceanbase.gv$table as t where t.database_name='xm_test' and t.table_type=3;
table_name
xm_test_t1
xm_test_t2
t_global_index
xm_test_t4
create table xm_test_t5 (pk int primary key);
insert into xm_test_t1 values (10, 1);
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
10 1
select t.table_name from oceanbase.gv$table as t where t.database_name='xm_test' and t.table_type=3;
table_name
xm_test_t1
xm_test_t2
t_global_index
xm_test_t4
xm_test_t5
select /*+read_consistency(weak) */ t.table_name from oceanbase.gv$table as t where t.database_name='xm_test' and t.table_type=3;
table_name
xm_test_t1
xm_test_t2
t_global_index
xm_test_t4
xm_test_t5
select * from xm_test_t1;
c1 c2
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
commit;

View File

@ -0,0 +1,172 @@
drop table if exists t1;
drop table if exists t2;
create table t1 (c1 int primary key, c2 int);
create table t2 (c1 int primary key, c2 int);
desc t1;
Field Type Null Key Default Extra
c1 int(11) NO PRI NULL
c2 int(11) YES NULL
desc t2;
Field Type Null Key Default Extra
c1 int(11) NO PRI NULL
c2 int(11) YES NULL
insert into t1 values(1,1);
insert into t1 values(2,1);
insert into t2 values(2,1);
select * from t1;
c1 c2
1 1
2 1
select * from t2;
c1 c2
2 1
set autocommit=1;
select /*+read_consistency(weak)+*/ * from t1;
c1 c2
1 1
2 1
select /*+read_consistency(weak)+*/ * from t1 where c1 = 1;
c1 c2
1 1
select /*+read_consistency(weak)+*/ * from t2;
c1 c2
2 1
select /*+read_consistency(weak)+*/ * from t2 where c1 = 2;
c1 c2
2 1
select /*+read_consistency(weak)+*/ * from t1 as l join t1 as r where l.c1 = r.c1;
c1 c2 c1 c2
1 1 1 1
2 1 2 1
select /*+read_consistency(weak)+*/ * from t1 join t2 where t1.c1 = t2.c1;
c1 c2 c1 c2
2 1 2 1
set autocommit=0;
select /*+read_consistency(weak)+*/ * from t1 as l join t1 as r where l.c1 = r.c1;
c1 c2 c1 c2
1 1 1 1
2 1 2 1
select /*+read_consistency(weak)+*/ * from t1 join t2 where t1.c1 = t2.c1;
c1 c2 c1 c2
2 1 2 1
select /*+read_consistency(weak)+*/* from t1;
c1 c2
1 1
2 1
select /*+read_consistency(weak)+*/* from t2;
c1 c2
2 1
commit;
begin;
insert into t1 values(3, 1);
insert into t2 values(3, 1);
select /*+read_consistency(weak)+*/* from t1;
c1 c2
1 1
2 1
3 1
select /*+read_consistency(weak)+*/* from t2;
c1 c2
2 1
3 1
commit;
begin;
select /*+read_consistency(weak)+*/* from t1;
c1 c2
1 1
2 1
3 1
select /*+read_consistency(weak)+*/* from t2;
c1 c2
2 1
3 1
insert into t1 values(4, 1);
ERROR 0A000: different consistency type in one transaction not supported
select * from t1;
c1 c2
1 1
2 1
3 1
insert into t2 values(4, 1);
ERROR 0A000: different consistency type in one transaction not supported
select * from t2;
c1 c2
2 1
3 1
commit;
begin;
select /*+read_consistency(weak)+*/* from t1 for update;
c1 c2
1 1
2 1
3 1
select /*+read_consistency(weak)+*/* from t2;
c1 c2
2 1
3 1
insert into t1 values(5, 1);
select * from t1;
c1 c2
1 1
2 1
3 1
5 1
insert into t2 values(5, 1);
select * from t2;
c1 c2
2 1
3 1
5 1
commit;
begin;
select /*+read_consistency(weak)+*/* from t2;
c1 c2
2 1
3 1
5 1
select /*+read_consistency(weak)+*/* from t1 for update;
ERROR 0A000: different consistency type in one transaction not supported
insert into t1 values(6, 1);
ERROR 0A000: different consistency type in one transaction not supported
select * from t1;
c1 c2
1 1
2 1
3 1
5 1
insert into t2 values(6, 1);
ERROR 0A000: different consistency type in one transaction not supported
select * from t2;
c1 c2
2 1
3 1
5 1
commit;
begin;
select /*+read_consistency(strong)*/* from t1;
c1 c2
1 1
2 1
3 1
5 1
select /*+read_consistency(weak)*/* from t1;
c1 c2
1 1
2 1
3 1
5 1
commit;
begin;
select /*+read_consistency(weak)*/* from t1;
c1 c2
1 1
2 1
3 1
5 1
select * from t1;
c1 c2
1 1
2 1
3 1
5 1
commit;

View File

@ -0,0 +1,28 @@
show global variables like 'ob_timestamp_service';
Variable_name Value
ob_timestamp_service LTS
set global ob_timestamp_service='GTS';
ERROR 42000: Variable 'ob_timestamp_service' can't be set to the value of 'GTS'
show global variables like 'ob_timestamp_service';
Variable_name Value
ob_timestamp_service LTS
show global variables like 'ob_timestamp_service';
Variable_name Value
ob_timestamp_service LTS
show global variables like 'ob_timestamp_service';
Variable_name Value
ob_timestamp_service GTS
set global ob_timestamp_service='LTS';
show global variables like 'ob_timestamp_service';
Variable_name Value
ob_timestamp_service LTS
show global variables like 'ob_timestamp_service';
Variable_name Value
ob_timestamp_service LTS
set global ob_timestamp_service='GTS';
show global variables like 'ob_timestamp_service';
Variable_name Value
ob_timestamp_service GTS
show global variables like 'ob_timestamp_service';
Variable_name Value
ob_timestamp_service GTS