mark some file to been opensource for ce-farm

This commit is contained in:
niyuhang
2023-11-15 11:44:43 +00:00
committed by ob-robot
parent 4900683cff
commit c8ace58297
685 changed files with 1080566 additions and 111051 deletions

View File

@ -0,0 +1,440 @@
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;
drop table if exists t1;
create table t1(pk int primary key, c1 int);
set autocommit=0;
set autocommit=0;
insert into t1 values(1,1);
insert into t1 values(2,2);
select * from t1;
pk c1
2 2
update t1 set c1=c1+1 where pk=1;
select * from t1;
pk c1
2 2
insert into t1 values(2,2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
update t1 set c1=c1+2 where pk=2;
commit;
select * from t1;
pk c1
1 1
2 4
commit;

View File

@ -0,0 +1,66 @@
set global ob_max_read_stale_time = -1;
show global variables like '%stale_time%';
Variable_name Value
ob_max_read_stale_time -1
set @@session.ob_max_read_stale_time = -1;
select @@session.ob_max_read_stale_time;
@@session.ob_max_read_stale_time
-1
set global ob_max_read_stale_time = -1;
show global variables like '%stale_time%';
Variable_name Value
ob_max_read_stale_time -1
alter system set weak_read_version_refresh_interval="6s";
alter system set weak_read_version_refresh_interval="3s";
set global ob_max_read_stale_time = -1;
show global variables like '%stale_time%';
Variable_name Value
ob_max_read_stale_time -1
set @@session.ob_max_read_stale_time = -1;
select @@session.ob_max_read_stale_time;
@@session.ob_max_read_stale_time
-1
alter system set weak_read_version_refresh_interval="6s";
alter system set weak_read_version_refresh_interval="3s";
set global ob_max_read_stale_time = 5000000;
set @@session.ob_max_read_stale_time = 5000000;
alter system set weak_read_version_refresh_interval="8s";
ERROR HY000: Incorrect arguments to weak_read_version_refresh_interval is larger than ob_max_read_stale_time
alter system set weak_read_version_refresh_interval="1s";
set global ob_max_read_stale_time = 2000000;
show global variables like '%stale_time%';
Variable_name Value
ob_max_read_stale_time 2000000
alter system set weak_read_version_refresh_interval="3s";
ERROR HY000: Incorrect arguments to weak_read_version_refresh_interval is larger than ob_max_read_stale_time
set global ob_max_read_stale_time = 5000000;
show global variables like '%stale_time%';
Variable_name Value
ob_max_read_stale_time 5000000
alter system set weak_read_version_refresh_interval="3s";
set global ob_max_read_stale_time = 3000000;
show global variables like '%stale_time%';
Variable_name Value
ob_max_read_stale_time 3000000
alter system set weak_read_version_refresh_interval="4s";
ERROR HY000: Incorrect arguments to weak_read_version_refresh_interval is larger than ob_max_read_stale_time
alter system set weak_read_version_refresh_interval="3001ms";
ERROR HY000: Incorrect arguments to weak_read_version_refresh_interval is larger than ob_max_read_stale_time
alter system set weak_read_version_refresh_interval="3000ms";
set global ob_max_read_stale_time = -1;
show global variables like '%stale_time%';
Variable_name Value
ob_max_read_stale_time -1
alter system set weak_read_version_refresh_interval="4999ms";
alter system set weak_read_version_refresh_interval="100ms";
set global ob_max_read_stale_time = 100000;
set global ob_max_read_stale_time = 99999;
ERROR HY000: Incorrect arguments to max_read_stale_time is smaller than weak_read_version_refresh_interval
set @@session.ob_max_read_stale_time = 100000;
set @@session.ob_max_read_stale_time = 99999;
ERROR HY000: Incorrect arguments to max_read_stale_time is smaller than weak_read_version_refresh_interval
set global ob_max_read_stale_time = 5000000;
set @@session.ob_max_read_stale_time = 5000000;
show global variables like '%stale_time%';
Variable_name Value
ob_max_read_stale_time 5000000

View File

@ -0,0 +1,355 @@
change mysql tenant primary_zone from zone1;zone2 to RANDOM
alter tenant mysql set primary_zone = 'RANDOM';
drop table if exists t;
create table t(id int primary key) partition by range(id)
(partition p0 values less than (10000), partition p1 values less than (3000000000));
"-------------- 1 - basic in txn free route -----------------"
set autocommit=1;
"CASE 1.1"
begin;
insert into t values(10);
insert into t values(10001);
rollback;
select "txn rollback atomic", count(1) from t where id in (10,10001);
txn rollback atomic count(1)
txn rollback atomic 0
begin;
insert into t values(10002);
insert into t values(11);
commit;
select "txn commit atomic", count(2) from t where id in (11,10002);
txn commit atomic count(2)
txn commit atomic 2
"CASE 1.2"
begin;
insert into t values(20);
insert into t values(10003);
"implicit commit prev txn and start new one"
begin;
insert into t values(10004);
begin;
commit;
"------------- 2 - implicit start txn ----------------------"
"CASE 2.1"
set autocommit=0;
insert into t values(12);
insert into t values(1000000003);
rollback;
select "implicit txn rollback atomic", count(1) from t where id in (12,1000000003);
implicit txn rollback atomic count(1)
implicit txn rollback atomic 0
insert into t values(1000000004);
insert into t values(13);
commit;
select "implicit txn commit atomic", count(1) from t where id in (13,1000000004);
implicit txn commit atomic count(1)
implicit txn commit atomic 2
"CASE 2.2"
set autocommit=0;
insert into t values(14);
select * from t where id = 1000000003;
id
select * from t where id = 14;
id
14
select * from t where id = 1000000004;
id
1000000004
rollback;
"------------- 3 - serializable read only txn ----------------------"
set autocommit=0;
"CASE 3.1"
set session transaction isolation level serializable;
select * from t where id = 14;
id
select * from t where id = 1000000005;
id
commit;
"commit a txn to promise max commit ts was advanced"
set autocommit=0;
insert into t values(100),(20000);
delete from t where id in (100,20000);
commit;
"continue second read only txn"
select * from t where id = 1000000006;
id
select * from t where id = 15;
id
commit;
"CASE 3.2"
select * from t where id = 16;
id
insert into t values(10000016);
commit;
"CASE 3.3"
select * from t where id = 17;
id
select * from t where id = 10000017;
id
insert into t values(18);
commit;
"CASE 3.4"
insert into t values(19);
select * from t where id = 10000018;
id
commit;
"recovery isolation level to RC"
set session transaction isolation level read committed;
"------------- 4 - savepoint leading txn ----------------------"
set autocommit=0;
"CASE 4.1"
savepoint sp0;
select * from t where id = 105;
id
select * from t where id = 1000005;
id
savepoint sp1;
"CASE 4.2"
set session transaction isolation level SERIALIZABLE;
select * from t where id = 1000006;
id
"CASE 4.3"
select * from t where id = 101;
id
insert into t values(1000006);
savepoint sp2;
insert into t values(1000007);
insert into t values(1007);
select * from t where id in (1007, 1000007, 1000006) order by id asc;
id
1007
1000006
1000007
"CASE 4.4"
rollback to sp2;
select * from t where id in (1007, 1000007, 1000006) order by id asc;
id
1000006
commit;
"CASE 4.5"
savepoint sp3;
select * from t where id = 106;
id
select * from t where id = 1000007;
id
commit;
"CASE 4.6"
begin;
insert into t values(108);
insert into t values(1000008);
commit;
"CASE 4.7"
savepoint sp4;
select * from t where id = 109;
id
select * from t where id = 1000009;
id
commit;
"CASE 4.8"
savepoint sp5;
select * from t where id = 110;
id
select * from t where id = 1000010;
id
commit;
"------------- 5 - change session auto_commit ----------------------"
"CASE 5.1"
delete from t;
commit;
set autocommit=0;
insert into t values(100);
insert into t values(1000001);
set autocommit=1;
insert into t values(1000002);
set autocommit=0;
insert into t values(200);
insert into t values(1000003);
select * from t order by id asc;
id
100
200
1000001
1000002
1000003
rollback;
select * from t order by id asc;
id
100
1000001
1000002
"CASE 5.2"
begin;
insert into t values(300);
insert into t values(1000004);
commit;
set autocommit=1;
select * from t where id = 1000004;
id
1000004
"CASE 5.3"
select * from t where id = 1;
id
set autocommit=0;
savepoint s52;
insert into t values(1000005);
set autocommit=1;
rollback to s52;
ERROR 42000: savepoint does not exist
select * from t where id = 1000005;
id
1000005
"------------- 6 - switch on/off ----------------------"
"CASE 6.1"
connection conn1
alter system set _enable_transaction_internal_routing = false;
drop view if exists check__enable_transaction_internal_routing;
create view check__enable_transaction_internal_routing as select Value from oceanbase.gv$ob_parameters where name = '_enable_transaction_internal_routing';
commit;
delete from t;
commit;
set autocommit=0;
insert into t values(1);
insert into t values(10001);
select * from t where id = 1;
id
1
select * from t where id = 10001;
id
10001
commit;
"CASE 6.2"
insert into t values(2);
alter system set _enable_transaction_internal_routing = true;
insert into t values(10002);
select * from t where id = 2;
id
2
select * from t where id = 10002;
id
10002
commit;
insert into t values(3);
insert into t values(10003);
select * from t where id = 3;
id
3
select * from t where id = 10003;
id
10003
commit;
"CASE 6.3"
insert into t values(4);
alter system set _enable_transaction_internal_routing = false;
insert into t values(10004);
select * from t where id = 4;
id
4
select * from t where id = 10004;
id
10004
commit;
insert into t values(5);
insert into t values(10005);
select * from t where id = 5;
id
5
select * from t where id = 10005;
id
10005
commit;
"reset _enable_transaction_internal_routing=true"
alter system set _enable_transaction_internal_routing = true;
"------------- 6 - in txn DDL ----------------------"
delete from t;
commit;
begin;
insert into t values(1);
insert into t values(10001);
create table tx(id int);
select * from t where id in (1, 10001) order by id asc;
id
1
10001
drop table tx;
"------------- 7 - multi-stmt route ----------------------"
delete from t;
commit;
begin /
insert into t values(1) /
insert into t values(10001);insert into t values(10002);/
insert into t values(10003) /
select * from t order by id asc /
id
1
10001
10002
10003
"------------- 8 - sync session var set autocommit=1 ----------------------"
delete from t;
commit;
set global autocommit=0;
"CASE 8.1"
select * from t where id = 1;
id
set autocommit=1;
begin;
insert into t values(1);
insert into t values(10001);
rollback;
select * from t order by id asc;
id
"CASE 8.2"
begin;
insert into t values(2);
insert into t values(10002);
set autocommit=1;
rollback;
select * from t order by id asc;
id
2
10002
set global autocommit=1;
"------------- 9 - error-packet caused proxy duplicate sync etc ----------------------"
delete from t;
commit;
begin;
insert into t values(1);
insert into t values(10001,1);
ERROR 21S01: Column count doesn't match value count at row 1
insert into t values(10001);
insert into t values(2, 1);
ERROR 21S01: Column count doesn't match value count at row 1
update t set id = id + 1 where id = 10002;
insert into t values(2);
select * from t order by id asc;
id
1
2
10001
commit;
select * from t order by id asc;
id
1
2
10001
"------------- 10 - readonly tx with serializable snapshot swtich txn----------------------"
delete from t;
commit;
drop outline tx_route_test_ot_4;
create outline tx_route_test_ot_4 on select * from (select * FROM t) a left join t b on a.id = b.id;
set session transaction ISOLATION LEVEL SERIALIZABLE;
set autocommit = 0;
select * from t where id = 1;
id
select * from t where id = 10001;
id
create outline tx_route_test_ot_4 on select * from (select * FROM t) a left join t b on a.id = b.id;
ERROR HY000: Outline 'tx_route_test_ot_4' already exists
select * from t where id = 10001;
id
drop outline tx_route_test_ot_4;
"------------- X - special query types ----------------------"
"CLEANUP"
drop table t;
recovery primary_zone settings for mysql tenant to : zone1;zone2
alter tenant mysql set primary_zone = "zone1;zone2";