mark some file to been opensource for ce-farm
This commit is contained in:
@ -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;
|
||||
@ -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
|
||||
@ -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";
|
||||
@ -0,0 +1,46 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: xiaoyi.xy
|
||||
# owner group: SQL3
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
####test:one trx can not read dirty data;when commit,another trx can read
|
||||
connect (conn0,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn1,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
|
||||
let $cnt=20;
|
||||
while($cnt)
|
||||
{
|
||||
connection conn0;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(pk int primary key, c1 int);
|
||||
|
||||
connection conn1;
|
||||
set autocommit=0;
|
||||
|
||||
connection conn2;
|
||||
set autocommit=0;
|
||||
|
||||
connection conn1;
|
||||
insert into t1 values(1,1);
|
||||
|
||||
connection conn2;
|
||||
insert into t1 values(2,2);
|
||||
select * from t1;
|
||||
update t1 set c1=c1+1 where pk=1;
|
||||
select * from t1;
|
||||
--error 1062
|
||||
insert into t1 values(2,2);
|
||||
update t1 set c1=c1+2 where pk=2;
|
||||
|
||||
connection conn1;
|
||||
commit;
|
||||
connection conn2;
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
dec $cnt;
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: liangjinrong.ljr
|
||||
#owner group: transaction
|
||||
#description: 测试弱读配置项的检查能力,通过错误注入测试弱读功能的防御能力
|
||||
|
||||
connect (conn1,$OBMYSQL_MS0,root@sys,,test,$OBMYSQL_PORT);
|
||||
connection conn1;
|
||||
|
||||
# 0. 禁用ob_max_read_stale_time
|
||||
set global ob_max_read_stale_time = -1;
|
||||
show global variables like '%stale_time%';
|
||||
set @@session.ob_max_read_stale_time = -1;
|
||||
select @@session.ob_max_read_stale_time;
|
||||
|
||||
connect (conn2,$OBMYSQL_MS0,$OBMYSQL_USR,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection conn2;
|
||||
set global ob_max_read_stale_time = -1;
|
||||
show global variables like '%stale_time%';
|
||||
|
||||
connection conn1;
|
||||
alter system set weak_read_version_refresh_interval="6s";
|
||||
alter system set weak_read_version_refresh_interval="3s";
|
||||
--sleep 2
|
||||
|
||||
# 0. 禁用ob_max_read_stale_time
|
||||
set global ob_max_read_stale_time = -1;
|
||||
show global variables like '%stale_time%';
|
||||
set @@session.ob_max_read_stale_time = -1;
|
||||
select @@session.ob_max_read_stale_time;
|
||||
alter system set weak_read_version_refresh_interval="6s";
|
||||
alter system set weak_read_version_refresh_interval="3s";
|
||||
--sleep 2
|
||||
|
||||
# 1. refresh_interval 不能大于当前租户的 ob_max_read_stale_time
|
||||
set global ob_max_read_stale_time = 5000000;
|
||||
set @@session.ob_max_read_stale_time = 5000000;
|
||||
--error 1210
|
||||
alter system set weak_read_version_refresh_interval="8s";
|
||||
alter system set weak_read_version_refresh_interval="1s";
|
||||
--sleep 2
|
||||
set global ob_max_read_stale_time = 2000000;
|
||||
show global variables like '%stale_time%';
|
||||
--error 1210
|
||||
alter system set weak_read_version_refresh_interval="3s";
|
||||
set global ob_max_read_stale_time = 5000000;
|
||||
show global variables like '%stale_time%';
|
||||
alter system set weak_read_version_refresh_interval="3s";
|
||||
|
||||
# 2. refresh_interval 不能大于其他租户的 ob_max_read_stale_time
|
||||
connection conn2;
|
||||
set global ob_max_read_stale_time = 3000000;
|
||||
show global variables like '%stale_time%';
|
||||
|
||||
connection conn1;
|
||||
--error 1210
|
||||
alter system set weak_read_version_refresh_interval="4s";
|
||||
--error 1210
|
||||
alter system set weak_read_version_refresh_interval="3001ms";
|
||||
alter system set weak_read_version_refresh_interval="3000ms";
|
||||
|
||||
connection conn2;
|
||||
set global ob_max_read_stale_time = -1;
|
||||
show global variables like '%stale_time%';
|
||||
disconnect conn2;
|
||||
|
||||
connection conn1;
|
||||
alter system set weak_read_version_refresh_interval="4999ms";
|
||||
alter system set weak_read_version_refresh_interval="100ms";
|
||||
--sleep 2
|
||||
|
||||
# 3. ob_max_read_stale_time 不能小于 weak_read_version_refresh_interval
|
||||
# 全局变量
|
||||
set global ob_max_read_stale_time = 100000;
|
||||
--error 1210
|
||||
set global ob_max_read_stale_time = 99999;
|
||||
# session级别变量
|
||||
set @@session.ob_max_read_stale_time = 100000;
|
||||
--error 1210
|
||||
set @@session.ob_max_read_stale_time = 99999;
|
||||
|
||||
set global ob_max_read_stale_time = 5000000;
|
||||
set @@session.ob_max_read_stale_time = 5000000;
|
||||
show global variables like '%stale_time%';
|
||||
881
tools/deploy/mysql_test/test_suite/trx/t/tx_free_route.test
Normal file
881
tools/deploy/mysql_test/test_suite/trx/t/tx_free_route.test
Normal file
@ -0,0 +1,881 @@
|
||||
#owner: yunxing.cyx
|
||||
#owner group: trans
|
||||
#tags: trx, tx_free_route
|
||||
|
||||
connect (sys,$OBMYSQL_MS0,root,"",oceanbase,$OBMYSQL_PORT);
|
||||
connect (conn0,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connect (conn1,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection sys;
|
||||
let $saved_primary_zone=`select primary_zone from oceanbase.__all_tenant where tenant_name = 'mysql'`;
|
||||
--echo change mysql tenant primary_zone from $saved_primary_zone to RANDOM
|
||||
alter tenant mysql set primary_zone = 'RANDOM';
|
||||
let $tenant_id=`select tenant_id from oceanbase.__all_tenant where tenant_name = 'mysql'`;
|
||||
let $break_loop=0;
|
||||
let $i=0;
|
||||
while ($break_loop == 0)
|
||||
{
|
||||
--inc $i
|
||||
let $ls_cnt=`select count(ls_id) from oceanbase.__all_virtual_ls where tenant_id = $tenant_id and ls_id != 1 and status = "NORMAL" and flag not like "%DUPLICATE%"`;
|
||||
if ($ls_cnt > 1) {
|
||||
--inc $break_loop
|
||||
}
|
||||
if ($i >= 300) {
|
||||
--inc $break_loop
|
||||
}
|
||||
--sleep 0.2
|
||||
}
|
||||
|
||||
connection conn0;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t(id int primary key) partition by range(id)
|
||||
(partition p0 values less than (10000), partition p1 values less than (3000000000));
|
||||
let $table_id=`select table_id from oceanbase.__all_virtual_table where table_name = 't' and tenant_id = $tenant_id`;
|
||||
let $ls_count=`select count(distinct ls_id) from oceanbase.__all_tablet_to_ls where table_id = $table_id`;
|
||||
if ($ls_count <= 1) {
|
||||
--echo "error, table should distributed to all ls"
|
||||
eval select * from oceanbase.__all_tablet_to_ls where table_id = $table_id;
|
||||
select * from oceanbase.__all_ls;
|
||||
}
|
||||
if $($ls_count > 1) {
|
||||
let $check_ts=`select now()`;
|
||||
let $svr_cnt=`select count(distinct svr_ip,svr_port) from oceanbase.__all_virtual_ls_meta_table where role = 1 and ls_id in (select distinct ls_id from oceanbase.__all_tablet_to_ls where table_id = $table_id)`;
|
||||
if ($svr_cnt <= 1) {
|
||||
--echo "ls leader not distributed to all server, check_ts=$check_ts, table_id=$table_id, ls_count=$ls_count"
|
||||
eval select * from oceanbase.__all_tablet_to_ls where table_id = $table_id;
|
||||
select * from oceanbase.__all_virtual_ls_meta_table where role = 1 order by ls_id;
|
||||
select * from oceanbase.__all_ls;
|
||||
}
|
||||
}
|
||||
--echo "-------------- 1 - basic in txn free route -----------------"
|
||||
#--------------------------------------------------------------------------
|
||||
# Server1 Server2
|
||||
# --------------- --------------------
|
||||
#CASE 1: cross
|
||||
# begin;insert 10
|
||||
# insert 10001
|
||||
# rollback
|
||||
# begin; insert 10002;
|
||||
# insert 11
|
||||
# commit;
|
||||
#CASE 2: begin implicit commit
|
||||
# begin;insert 20
|
||||
# insert 10003
|
||||
# begin;
|
||||
# insert 10004
|
||||
# begin;
|
||||
# commit;
|
||||
#--------------------------------------------------------------------------
|
||||
set autocommit=1;
|
||||
--echo "CASE 1.1"
|
||||
begin;
|
||||
insert into t values(10);
|
||||
let $session_1=`select connection_id()`;
|
||||
insert into t values(10001);
|
||||
let $session_2=`select connection_id()`;
|
||||
rollback;
|
||||
if ($session_1 == $session_2) { --echo "explicit txn not free routed !! $session_1 = $session_2"
|
||||
}
|
||||
select "txn rollback atomic", count(1) from t where id in (10,10001);
|
||||
begin;
|
||||
insert into t values(10002);
|
||||
let $session_1=`select connection_id()`;
|
||||
insert into t values(11);
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_1 == $session_2) { --echo "explicit txn not free routed !! $session_1 = $session_2"
|
||||
}
|
||||
select "txn commit atomic", count(2) from t where id in (11,10002);
|
||||
--echo "CASE 1.2"
|
||||
begin;
|
||||
insert into t values(20);
|
||||
let $session_1=`select connection_id()`;
|
||||
insert into t values(10003);
|
||||
let $session_2=`select connection_id()`;
|
||||
--echo "implicit commit prev txn and start new one"
|
||||
begin;
|
||||
insert into t values(10004);
|
||||
let $session_3=`select connection_id()`;
|
||||
begin;
|
||||
commit;
|
||||
let $tx_id_1=query_get_value(select transaction_id from oceanbase.__all_virtual_sql_audit where session_id = $session_1 and query_sql = 'insert into t values(20)' order by request_time desc, transaction_id, 1);
|
||||
let $tx_id_2=query_get_value(select transaction_id from oceanbase.__all_virtual_sql_audit where session_id = $session_2 and query_sql = 'insert into t values(10003)' order by request_time desc, transaction_id, 1);
|
||||
let $tx_id_3=query_get_value(select transaction_id from oceanbase.__all_virtual_sql_audit where session_id = $session_3 and query_sql = 'insert into t values(10004)' order by request_time desc, transaction_id, 1);
|
||||
if ($session_1 == $session_2) { --echo "txn not free routed !! $session_1 = $session_2"
|
||||
}
|
||||
if ($session_2 != $session_3) { --echo "txn not free routed !! $session_1 = $session_2"
|
||||
}
|
||||
if ($tx_id_1 != $tx_id_2) {
|
||||
if ($tx_id_2 != "No such row") {
|
||||
if ($tx_id_1 != "No such row") { --echo "oops ! txn split !! tx_id: $tx_id_1, $tx_id_2"
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($tx_id_1 == $tx_id_3) {
|
||||
if ($tx_id_1 != "No such row") { --echo "oops ! txn implicit commit not works !! tx_id: $tx_id_1, $tx_id_3"
|
||||
}
|
||||
}
|
||||
--echo "------------- 2 - implicit start txn ----------------------"
|
||||
#--------------------------------------------------------------------------
|
||||
# Server1 Server2
|
||||
# --------------- --------------------
|
||||
##Case 1: cross
|
||||
# insert 12
|
||||
# insert 1000000003
|
||||
# rollback
|
||||
# insert 1000000004;
|
||||
# insert 13
|
||||
# commit;
|
||||
##Case 2: select will not sync state repeately
|
||||
# insert 14
|
||||
# select 1000000003;
|
||||
# select 14
|
||||
# select 1000000004;
|
||||
# rollback;
|
||||
#--------------------------------------------------------------------------
|
||||
--echo "CASE 2.1"
|
||||
set autocommit=0;
|
||||
insert into t values(12);
|
||||
let $session_1=`select connection_id()`;
|
||||
insert into t values(1000000003);
|
||||
let $session_2=`select connection_id()`;
|
||||
rollback;
|
||||
if ($session_1 == $session_2) { --echo "implicit txn not free routed !! $session_1 = $session_2"
|
||||
}
|
||||
select "implicit txn rollback atomic", count(1) from t where id in (12,1000000003);
|
||||
insert into t values(1000000004);
|
||||
let $session_1=`select connection_id()`;
|
||||
insert into t values(13);
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_1 == $session_2) { --echo "implicit txn not free routed !! $session_1 = $session_2"
|
||||
}
|
||||
select "implicit txn commit atomic", count(1) from t where id in (13,1000000004);
|
||||
--echo "CASE 2.2"
|
||||
set autocommit=0;
|
||||
insert into t values(14);
|
||||
let $s1=`select connection_id()`;
|
||||
select * from t where id = 1000000003;
|
||||
let $s2=`select connection_id()`;
|
||||
select * from t where id = 14;
|
||||
let $s3=`select connection_id()`;
|
||||
select * from t where id = 1000000004;
|
||||
let $s4=`select connection_id()`;
|
||||
rollback;
|
||||
if ($s1 == $s2) { --echo "not free routed 1=$s1, 2=$s2";
|
||||
}
|
||||
if ($s3 == $s2) { --echo "not free routed 3=$3, 2=$s2";
|
||||
}
|
||||
if ($s4 != $s2) { --echo "unexpect route 4=$s4, 2=$s2";
|
||||
}
|
||||
|
||||
--echo "------------- 3 - serializable read only txn ----------------------"
|
||||
#--------------------------------------------------------------------------
|
||||
# Server1 Server2
|
||||
# --------------- --------------------
|
||||
##Case 1: cross
|
||||
# select 14
|
||||
# select 1000000005;
|
||||
# commit;
|
||||
# select 1000000006; // release old
|
||||
# select 15
|
||||
# rollback;
|
||||
##Case 2: release old, start txn remote
|
||||
# select 16
|
||||
# insert 10000016;
|
||||
# commit;
|
||||
##Case 3: release old remote of full, add extra only
|
||||
# select 17
|
||||
# select 10000017;
|
||||
# insert 18
|
||||
# commit;
|
||||
##Case 4: release old remote of extra only, add full
|
||||
# insert 19
|
||||
# select 100000018; // replace
|
||||
# commit;
|
||||
#--------------------------------------------------------------------------
|
||||
set autocommit=0;
|
||||
--echo "CASE 3.1"
|
||||
set session transaction isolation level serializable;
|
||||
select * from t where id = 14;
|
||||
let $session_1=`select connection_id()`;
|
||||
select * from t where id = 1000000005;
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_1 == $session_2) { --echo "serializable read only txn not free routed !! $session_1 = $session_2";
|
||||
}
|
||||
let $snapshot_1=query_get_value(select snapshot_version from oceanbase.__all_virtual_sql_audit where session_id = $session_1 and query_sql = 'select * from t where id = 14' order by request_time desc, snapshot_version, 1);
|
||||
let $snapshot_2=query_get_value(select snapshot_version from oceanbase.__all_virtual_sql_audit where session_id = $session_2 and query_sql = 'select * from t where id = 1000000005' order by request_time desc, snapshot_version, 1);
|
||||
if ($snapshot_1 == 0) { --echo "unexpected snapshot version 0";
|
||||
}
|
||||
if ($snapshot_1 != $snapshot_2) {
|
||||
if ($snapshot_2 != "No such row") {
|
||||
if ($snapshot_1 != "No such row") { --echo "serializable read only txn snapshot volation !! $snapshot_1 = $snapshot_2";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
--echo "commit a txn to promise max commit ts was advanced"
|
||||
connection conn1;
|
||||
set autocommit=0;
|
||||
insert into t values(100),(20000);
|
||||
delete from t where id in (100,20000);
|
||||
commit;
|
||||
--echo "continue second read only txn"
|
||||
connection conn0;
|
||||
select * from t where id = 1000000006;
|
||||
let $session_1=`select connection_id()`;
|
||||
select * from t where id = 15;
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_1 == $session_2) { --echo "serializable read only txn not free routed !! $session_1 = $session_2";
|
||||
}
|
||||
let $snapshot_2_1=query_get_value(select snapshot_version from oceanbase.__all_virtual_sql_audit where session_id = $session_1 and query_sql = 'select * from t where id = 1000000006' order by request_time desc, snapshot_version, 1);
|
||||
let $snapshot_2_2=query_get_value(select snapshot_version from oceanbase.__all_virtual_sql_audit where session_id = $session_2 and query_sql = 'select * from t where id = 15' order by request_time desc, snapshot_version, 1);
|
||||
if ($snapshot_2_1 == 0) { --echo "unexpected snapshot version 0";
|
||||
}
|
||||
if ($snapshot_2_1 != $snapshot_2_2) {
|
||||
if ($snapshot_2_2 != "No such row") {
|
||||
if ($snapshot_2_1 != "No such row") { --echo "serializable read only txn snapshot volation !! $snapshot_2_1 = $snapshot_2_2";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($snapshot_2_1 == $snapshot_1) {
|
||||
if ($snapshot_2_1 != "No such row") { --echo "serializable read only txn snapshot not changed after commit !! $snapshot_2_1 = $snapshot_1";
|
||||
}
|
||||
}
|
||||
|
||||
--echo "CASE 3.2"
|
||||
select * from t where id = 16;
|
||||
let $session_1=`select connection_id()`;
|
||||
insert into t values(10000016);
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_2 == $session_1) { --echo "txn is not freely routed !! $session_1 = $session_2";
|
||||
}
|
||||
--echo "CASE 3.3"
|
||||
select * from t where id = 17;
|
||||
let $session_1=`select connection_id()`;
|
||||
select * from t where id = 10000017;
|
||||
let $session_2=`select connection_id()`;
|
||||
insert into t values(18);
|
||||
let $session_3=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_2 == $session_1) { --echo "txn is not freely routed !! session: 1=$session_1, 2=$session_2";
|
||||
}
|
||||
if ($session_3 == $session_2) { --echo "txn is not freely routed !! session: 1=$session_2, 2=$session_3";
|
||||
}
|
||||
let $snapshot_1=query_get_value(select snapshot_version from oceanbase.__all_virtual_sql_audit where session_id = $session_1 and query_sql = 'select * from t where id = 17' order by request_time desc, snapshot_version, 1);
|
||||
let $snapshot_2=query_get_value(select snapshot_version from oceanbase.__all_virtual_sql_audit where session_id = $session_2 and query_sql = 'select * from t where id = 10000017' order by request_time desc, snapshot_version, 1);
|
||||
if ($snapshot_1 == 0) { --echo "unexpected snapshot version 0";
|
||||
}
|
||||
if ($snapshot_1 != $snapshot_2) {
|
||||
if ($snapshot_2 != "No such row") {
|
||||
if ($snapshot_1 != "No such row") { --echo "serializable read only txn snapshot volation !! $snapshot_1 = $snapshot_2";
|
||||
}
|
||||
}
|
||||
}
|
||||
--echo "CASE 3.4"
|
||||
insert into t values(19);
|
||||
let $session_1=`select connection_id()`;
|
||||
select * from t where id = 10000018;
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_2 == $session_1) { --echo "txn is not freely routed !! session: 1=$session_1, 2=$session_2";
|
||||
}
|
||||
--echo "recovery isolation level to RC"
|
||||
set session transaction isolation level read committed;
|
||||
|
||||
--echo "------------- 4 - savepoint leading txn ----------------------"
|
||||
#--------------------------------------------------------------------------
|
||||
# Server1 Server2
|
||||
# --------------- --------------------
|
||||
##Case 1: sync extra to remote, RC, no snapshot set
|
||||
# savepoint sp0
|
||||
# select 105
|
||||
# select 1000005; // snapshot = v0
|
||||
# savepoint sp1
|
||||
##Case 2: snapshot is set on remote
|
||||
# set session SERIALIZABLE
|
||||
# select 1000006; // snapshot = v1
|
||||
##Case 3: snapshot is synced from remote
|
||||
# select 101; // snapshot = v1
|
||||
# insert 1000006; // start txn on remote
|
||||
# savepoint sp2
|
||||
# insert 1000007;
|
||||
# insert 1007;
|
||||
# select 1007, 1000007, 1000006
|
||||
##Case 4: rollback savepoint cross nodes
|
||||
# rollback to sp2
|
||||
# select 1007, 1000007, 1000006 // => 1000006
|
||||
# commit;
|
||||
##Case 5: cross txn release old, add extra
|
||||
# savepoint sp3
|
||||
# select 106
|
||||
# select 1000007
|
||||
# commit;
|
||||
##Case 6: full txn replace old of extra
|
||||
# begin;insert 108
|
||||
# insert 1000008
|
||||
# commit;
|
||||
##Case 7: extra replace full
|
||||
# savepoint sp4
|
||||
# select 109;
|
||||
# select 1000009
|
||||
# commit;
|
||||
##Case 8: extra replace extra
|
||||
# savepoint sp5;
|
||||
# select 110;
|
||||
# select 1000010 // replace old tx desc
|
||||
# commit;
|
||||
#--------------------------------------------------------------------------
|
||||
set autocommit=0;
|
||||
--echo "CASE 4.1"
|
||||
savepoint sp0;
|
||||
let $session_0=`select connection_id()`;
|
||||
select * from t where id = 105;
|
||||
let $session_1=`select connection_id()`;
|
||||
select * from t where id = 1000005;
|
||||
let $session_2=`select connection_id()`;
|
||||
savepoint sp1;
|
||||
let $session_3=`select connection_id()`;
|
||||
if ($session_2 == $session_1) { --echo "txn is not freely routed !! session: 1=$session_1, 2=$session_2";
|
||||
}
|
||||
if ($session_0 != $session_3) { --echo "savepoint should always on same session !! session: 1=$session_0, 2=$session_3";
|
||||
}
|
||||
--echo "CASE 4.2"
|
||||
set session transaction isolation level SERIALIZABLE;
|
||||
select * from t where id = 1000006;
|
||||
let $session_4=`select connection_id()`;
|
||||
--echo "CASE 4.3"
|
||||
select * from t where id = 101;
|
||||
let $session_5=`select connection_id()`;
|
||||
if ($session_4 == $session_5) { --echo "txn is not freely routed !! session: 1=$session_4, 2=$session_5";
|
||||
}
|
||||
insert into t values(1000006);
|
||||
let $session_6=`select connection_id()`;
|
||||
if ($session_5 == $session_6) { --echo "txn is not freely routed !! session: 1=$session_5, 2=$session_6";
|
||||
}
|
||||
savepoint sp2;
|
||||
let $session_7=`select connection_id()`;
|
||||
if ($session_0 != $session_7) { --echo "savepoint should always on same session !! session: 1=$session_0, 2=$session_7";
|
||||
}
|
||||
insert into t values(1000007);
|
||||
let $session_8=`select connection_id()`;
|
||||
insert into t values(1007);
|
||||
let $session_9=`select connection_id()`;
|
||||
if ($session_8 == $session_9) { --echo "txn is not freely routed !! session: 1=$session_8, 2=$session_9";
|
||||
}
|
||||
select * from t where id in (1007, 1000007, 1000006) order by id asc;
|
||||
--echo "CASE 4.4"
|
||||
rollback to sp2;
|
||||
select * from t where id in (1007, 1000007, 1000006) order by id asc;
|
||||
commit;
|
||||
--echo "CASE 4.5"
|
||||
savepoint sp3;
|
||||
select * from t where id = 106;
|
||||
let $session_10=`select connection_id()`;
|
||||
select * from t where id = 1000007;
|
||||
let $session_11=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_10 == $session_11) { --echo "txn is not freely routed !! session: 1=$session_10, 2=$session_11";
|
||||
}
|
||||
--echo "CASE 4.6"
|
||||
begin;
|
||||
insert into t values(108);
|
||||
let $session_1=`select connection_id()`;
|
||||
insert into t values(1000008);
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_1 == $session_2) { --echo "txn is not freely routed !! session: 1=$session_1, 2=$session_2";
|
||||
}
|
||||
--echo "CASE 4.7"
|
||||
savepoint sp4;
|
||||
select * from t where id = 109;
|
||||
let $session_1=`select connection_id()`;
|
||||
select * from t where id = 1000009;
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_1 == $session_2) { --echo "txn is not freely routed !! session: 1=$session_1, 2=$session_2";
|
||||
}
|
||||
--echo "CASE 4.8"
|
||||
savepoint sp5;
|
||||
select * from t where id = 110;
|
||||
let $session_1=`select connection_id()`;
|
||||
select * from t where id = 1000010;
|
||||
let $session_2=`select connection_id()`;
|
||||
commit;
|
||||
if ($session_1 == $session_2) { --echo "txn is not freely routed !! session: 1=$session_1, 2=$session_2";
|
||||
}
|
||||
|
||||
--echo "------------- 5 - change session auto_commit ----------------------"
|
||||
#--------------------------------------------------------------------------
|
||||
# Server1 Server2
|
||||
# --------------- --------------------
|
||||
##Case 1: in txn change autocommit, will commit current txn
|
||||
# set autocommit=0
|
||||
# insert 100
|
||||
# insert 1000001
|
||||
# set autocommit=1 // cause implicit commit, must send to txn start node
|
||||
# insert 1000002 // sync txn-state, autocommit, insert
|
||||
# set autocommit=0
|
||||
# insert 200; // ac=0
|
||||
# insert 1000003
|
||||
# select *
|
||||
# rollback;
|
||||
# select *
|
||||
##Case 2: change autocommit after commit, txn state should synced
|
||||
# begin; insert 300
|
||||
# insert 1000004
|
||||
# commit;
|
||||
# set autocommit=1
|
||||
# select 1000004
|
||||
##Case 3: change autocommit for txn only has savepoint
|
||||
# set autocommit=0;
|
||||
# savepoint s1
|
||||
# insert 1000005
|
||||
# set autocommit=1
|
||||
# rollback to s1;
|
||||
# select 1000005
|
||||
#--------------------------------------------------------------------------
|
||||
--echo "CASE 5.1"
|
||||
delete from t;
|
||||
commit;
|
||||
set autocommit=0;
|
||||
insert into t values(100);
|
||||
let $session_1=`select connection_id()`;
|
||||
insert into t values(1000001);
|
||||
let $session_2=`select connection_id()`;
|
||||
set autocommit=1;
|
||||
insert into t values(1000002);
|
||||
let $session_3=`select connection_id()`;
|
||||
set autocommit=0;
|
||||
insert into t values(200);
|
||||
let $session_4=`select connection_id()`;
|
||||
insert into t values(1000003);
|
||||
let $session_5=`select connection_id()`;
|
||||
select * from t order by id asc;
|
||||
rollback;
|
||||
select * from t order by id asc;
|
||||
--echo "CASE 5.2"
|
||||
begin;
|
||||
insert into t values(300);
|
||||
let $session_6=`select connection_id()`;
|
||||
insert into t values(1000004);
|
||||
let $session_7=`select connection_id()`;
|
||||
commit;
|
||||
set autocommit=1;
|
||||
select * from t where id = 1000004;
|
||||
let $session_8=`select connection_id()`;
|
||||
--echo "CASE 5.3"
|
||||
select * from t where id = 1;
|
||||
set autocommit=0;
|
||||
savepoint s52;
|
||||
let $session_9=`select connection_id()`;
|
||||
insert into t values(1000005);
|
||||
let $session_10=`select connection_id()`;
|
||||
set autocommit=1;
|
||||
let $session_11=`select connection_id()`;
|
||||
--error 1305
|
||||
rollback to s52;
|
||||
select * from t where id = 1000005;
|
||||
## VERIFY FREE ROUTE
|
||||
if ($session_1 == $session_2) { echo "not free route session: 1 => $session_1, 2 => $session_2";
|
||||
}
|
||||
if ($session_2 != $session_3) { echo "not free route session: 2 => $session_2, 3 => $session_3";
|
||||
}
|
||||
if ($session_3 == $session_4) { echo "not free route session: 3 => $session_3, 4 => $session_4";
|
||||
}
|
||||
if ($session_5 == $session_4) { echo "not free route session: 4 => $session_4, 5 => $session_5";
|
||||
}
|
||||
if ($session_6 == $session_7) { echo "not free route session: 6 => $session_6, 7 => $session_7";
|
||||
}
|
||||
if ($session_7 != $session_8) { echo "not free route session: 7 => $session_7, 8 => $session_8";
|
||||
}
|
||||
if ($session_9 == $session_10) { echo "not free route session: 9 => $session_9, 10 => $session_10";
|
||||
}
|
||||
if ($session_9 != $session_11) { echo "not free route session: 9 => $session_9, 11 => $session_11";
|
||||
}
|
||||
|
||||
--echo "------------- 6 - switch on/off ----------------------"
|
||||
#--------------------------------------------------------------------------
|
||||
# Server1 Server2
|
||||
# --------------- --------------------
|
||||
##Case 1: off
|
||||
##Case 2: off -> trun on during txn
|
||||
# expect:
|
||||
# 1. current txn is always routing to one node
|
||||
# 2. next txn routing freely
|
||||
##Case 3: on -> trun off during txn
|
||||
# expect:
|
||||
# 1. current txn is continue routing freely
|
||||
# 2. next txn is routing to one node
|
||||
#--------------------------------------------------------------------------
|
||||
echo "CASE 6.1"
|
||||
connection conn1;
|
||||
alter system set _enable_transaction_internal_routing = false;
|
||||
connection conn0;
|
||||
--disable_warnings
|
||||
drop view if exists check__enable_transaction_internal_routing;
|
||||
--enable_warnings
|
||||
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;
|
||||
let $i = 0;
|
||||
while ($i < 100)
|
||||
{
|
||||
let $c=`select count(1) from check__enable_transaction_internal_routing WHERE Value != 'False'`;
|
||||
if ($c == 0)
|
||||
{
|
||||
let $i = 110;
|
||||
}
|
||||
if ($c != 0)
|
||||
{
|
||||
--sleep 1
|
||||
--inc $i
|
||||
}
|
||||
}
|
||||
if ($i != 110)
|
||||
{
|
||||
--echo "wait _enable_transaction_internal_routing to False failed : $i"
|
||||
select * from oceanbase.gv$ob_parameters where name = '_enable_transaction_internal_routing';
|
||||
}
|
||||
set autocommit=0;
|
||||
insert into t values(1);
|
||||
let $s1=`select connection_id()`;
|
||||
insert into t values(10001);
|
||||
let $s2=`select connection_id()`;
|
||||
select * from t where id = 1;
|
||||
let $s3=`select connection_id()`;
|
||||
select * from t where id = 10001;
|
||||
let $s4=`select connection_id()`;
|
||||
commit;
|
||||
if ($s1 != $s2) { --echo "free routed 1: $s1, $s2"
|
||||
}
|
||||
if ($s3 != $s4) { --echo "free routed 2: $s3, $s4"
|
||||
}
|
||||
if ($s2 != $s3) { --echo "free routed 3: $s1, $s3"
|
||||
}
|
||||
|
||||
--echo "CASE 6.2"
|
||||
insert into t values(2);
|
||||
let $s1=`select connection_id()`;
|
||||
connection conn1;
|
||||
alter system set _enable_transaction_internal_routing = true;
|
||||
connection conn0;
|
||||
let $i = 0;
|
||||
while ($i < 100)
|
||||
{
|
||||
let $c=`select count(1) from check__enable_transaction_internal_routing where Value != 'True'`;
|
||||
if ($c == 0)
|
||||
{
|
||||
let $i = 110;
|
||||
}
|
||||
if ($c != 0)
|
||||
{
|
||||
--sleep 1
|
||||
--inc $i
|
||||
}
|
||||
}
|
||||
if ($i != 110)
|
||||
{
|
||||
--echo "wait _enable_transaction_internal_routing to True failed: $i"
|
||||
select * from oceanbase.gv$ob_parameters where name = '_enable_transaction_internal_routing';
|
||||
}
|
||||
insert into t values(10002);
|
||||
let $s2=`select connection_id()`;
|
||||
select * from t where id = 2;
|
||||
let $s3=`select connection_id()`;
|
||||
select * from t where id = 10002;
|
||||
let $s4=`select connection_id()`;
|
||||
commit;
|
||||
if ($s1 != $s2) { --echo "free routed 1: $s1, $s2"
|
||||
}
|
||||
if ($s3 != $s4) { --echo "free routed 2: $s3, $s4"
|
||||
}
|
||||
if ($s2 != $s3) { --echo "free routed 3: $s1, $s3"
|
||||
}
|
||||
## next transaction: it should route freely
|
||||
insert into t values(3);
|
||||
let $s1=`select connection_id()`;
|
||||
insert into t values(10003);
|
||||
let $s2=`select connection_id()`;
|
||||
select * from t where id = 3;
|
||||
let $s3=`select connection_id()`;
|
||||
select * from t where id = 10003;
|
||||
let $s4=`select connection_id()`;
|
||||
commit;
|
||||
if ($s1 == $s2) { --echo "not free route 1: $s1, $s2"
|
||||
}
|
||||
if ($s3 == $s4) { --echo "not free routed 2: $s3, $s4"
|
||||
}
|
||||
if ($s1 != $s3) { --echo "not free routed 3: $s1, $s3"
|
||||
}
|
||||
if ($s2 != $s4) { --echo "not free routed 3: $s2, $s4"
|
||||
}
|
||||
|
||||
--echo "CASE 6.3"
|
||||
insert into t values(4);
|
||||
let $s1=`select connection_id()`;
|
||||
connection conn1;
|
||||
alter system set _enable_transaction_internal_routing = false;
|
||||
connection conn0;
|
||||
let $i = 0;
|
||||
while ($i < 100)
|
||||
{
|
||||
let $c=`select count(1) from check__enable_transaction_internal_routing WHERE Value != 'False'`;
|
||||
if ($c == 0)
|
||||
{
|
||||
let $i = 110;
|
||||
}
|
||||
if ($c != 0)
|
||||
{
|
||||
--sleep 1
|
||||
--inc $i
|
||||
}
|
||||
}
|
||||
if ($i != 110)
|
||||
{
|
||||
--echo "wait _enable_transaction_internal_routing to false failed"
|
||||
select * from oceanbase.gv$ob_parameters where name = '_enable_transaction_internal_routing';
|
||||
}
|
||||
insert into t values(10004);
|
||||
let $s2=`select connection_id()`;
|
||||
select * from t where id = 4;
|
||||
let $s3=`select connection_id()`;
|
||||
select * from t where id = 10004;
|
||||
let $s4=`select connection_id()`;
|
||||
commit;
|
||||
if ($s1 == $s2) { --echo "not free route 1: $s1, $s2"
|
||||
}
|
||||
if ($s3 == $s4) { --echo "not free routed 2: $s3, $s4"
|
||||
}
|
||||
if ($s1 != $s3) { --echo "not free routed 3: $s1, $s3"
|
||||
}
|
||||
if ($s2 != $s4) { --echo "not free routed 3: $s2, $s4"
|
||||
}
|
||||
## next transaction: it should not freely routed
|
||||
insert into t values(5);
|
||||
let $s1=`select connection_id()`;
|
||||
insert into t values(10005);
|
||||
let $s2=`select connection_id()`;
|
||||
select * from t where id = 5;
|
||||
let $s3=`select connection_id()`;
|
||||
select * from t where id = 10005;
|
||||
let $s4=`select connection_id()`;
|
||||
commit;
|
||||
if ($s1 != $s2) { --echo "free routed 1: $s1, $s2"
|
||||
}
|
||||
if ($s3 != $s4) { --echo "free routed 2: $s3, $s4"
|
||||
}
|
||||
if ($s2 != $s3) { --echo "free routed 3: $s1, $s3"
|
||||
}
|
||||
--echo "reset _enable_transaction_internal_routing=true"
|
||||
connection conn1;
|
||||
alter system set _enable_transaction_internal_routing = true;
|
||||
connection conn0;
|
||||
let $i = 0;
|
||||
while ($i < 100)
|
||||
{
|
||||
let $c=`select count(1) from check__enable_transaction_internal_routing where Value != 'True'`;
|
||||
if ($c == 0)
|
||||
{
|
||||
let $i = 110;
|
||||
}
|
||||
if ($c != 0)
|
||||
{
|
||||
--sleep 1
|
||||
--inc $i
|
||||
}
|
||||
}
|
||||
|
||||
if ($i != 110)
|
||||
{
|
||||
--echo "wait _enable_transaction_internal_routing to true failed";
|
||||
select * from oceanbase.gv$ob_parameters where name = '_enable_transaction_internal_routing';
|
||||
}
|
||||
--echo "------------- 6 - in txn DDL ----------------------"
|
||||
connection conn0;
|
||||
delete from t;
|
||||
commit;
|
||||
begin;
|
||||
insert into t values(1);
|
||||
let $s1=`select connection_id()`;
|
||||
insert into t values(10001);
|
||||
let $s2=`select connection_id()`;
|
||||
create table tx(id int);
|
||||
let $s3=`select connection_id()`;
|
||||
select * from t where id in (1, 10001) order by id asc;
|
||||
drop table tx;
|
||||
if ($s1 == $s2) { --echo "not free routed : $s1, $s2"
|
||||
}
|
||||
if ($s3 != $s1) { --echo "ddl is not routed to start tx node: $s3, $s1"
|
||||
}
|
||||
|
||||
--echo "------------- 7 - multi-stmt route ----------------------"
|
||||
connection conn0;
|
||||
delete from t;
|
||||
commit;
|
||||
--delimiter /
|
||||
begin /
|
||||
insert into t values(1) /
|
||||
let $s1=`select connection_id()` /
|
||||
insert into t values(10001);insert into t values(10002);/
|
||||
let $s2=`select connection_id()` /
|
||||
insert into t values(10003) /
|
||||
let $s3=`select connection_id()` /
|
||||
if ($s1 != $s2) { --echo "multi stmt not routed to tx start node: $s2, $s1"
|
||||
}
|
||||
if ($s3 == $s1) { --echo "not free routed: $s3, $s1"
|
||||
}
|
||||
select * from t order by id asc /
|
||||
--delimiter ;
|
||||
|
||||
--echo "------------- 8 - sync session var set autocommit=1 ----------------------"
|
||||
#
|
||||
# Server 1 Server2
|
||||
# ----------------- -------------------
|
||||
##CASE 1: set ac = 1 sync
|
||||
# set ac =1
|
||||
# begin;
|
||||
# insert 1
|
||||
# insert 10001 <-- proxy will sync 'set ac = 1' before send insert 2
|
||||
# commit;
|
||||
##CASE 2: set ac = 1 commit current tx
|
||||
# begin;
|
||||
# insert 2
|
||||
# insert 10002
|
||||
# set ac = 1
|
||||
# rollback
|
||||
#----------------------------------------------------------------------------------
|
||||
connection conn0;
|
||||
delete from t;
|
||||
commit;
|
||||
set global autocommit=0;
|
||||
--echo "CASE 8.1"
|
||||
connect (conn8,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection conn8;
|
||||
select * from t where id = 1;
|
||||
set autocommit=1;
|
||||
begin;
|
||||
insert into t values(1);
|
||||
let $s1=`select connection_id()`;
|
||||
insert into t values(10001);
|
||||
let $s2=`select connection_id()`;
|
||||
rollback;
|
||||
select * from t order by id asc;
|
||||
disconnect conn8;
|
||||
if ($s1 == $2) { --echo "not free routed: $s1, $s2"
|
||||
}
|
||||
--echo "CASE 8.2"
|
||||
connect (conn82,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
begin;
|
||||
insert into t values(2);
|
||||
let $s3=`select connection_id()`;
|
||||
insert into t values(10002);
|
||||
let $s4=`select connection_id()`;
|
||||
set autocommit=1;
|
||||
rollback;
|
||||
if ($s3 == $s4) { --echo "not free routed: $s3, $s4"
|
||||
}
|
||||
select * from t order by id asc;
|
||||
disconnect conn82;
|
||||
connection conn0;
|
||||
set global autocommit=1;
|
||||
|
||||
--echo "------------- 9 - error-packet caused proxy duplicate sync etc ----------------------"
|
||||
connect (conn90,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
delete from t;
|
||||
commit;
|
||||
begin;
|
||||
insert into t values(1);
|
||||
let $s1=`select connection_id()`;
|
||||
--error 1136
|
||||
insert into t values(10001,1);
|
||||
let $s2=`select connection_id()`;
|
||||
insert into t values(10001); ## duplicate sync: 5678, return 67
|
||||
let $s3=`select connection_id()`;
|
||||
--error 1136
|
||||
insert into t values(2, 1); ## sync 67
|
||||
let $s4=`select connection_id()`;
|
||||
update t set id = id + 1 where id = 10002; ## empty update, return 6
|
||||
let $s5=`select connection_id()`;
|
||||
insert into t values(2); ## duplicate sync 67, 6's version is larger than 7
|
||||
let $s6=`select connection_id()`;
|
||||
select * from t order by id asc;
|
||||
commit;
|
||||
select * from t order by id asc;
|
||||
if ($s1 == $s2) { --echo "not free routed: $s1, $s2"
|
||||
}
|
||||
if ($s2 != $s3) { --echo "s2 != s3: $s2, $s3"
|
||||
}
|
||||
if ($s4 != $s1) { --echo "s1 != s4: $s1, $s4"
|
||||
}
|
||||
if ($s5 != $s2) { --echo "s2 != s5: $s2, $s5"
|
||||
}
|
||||
if ($s6 != $s1) { --echo "s1 != s6: $s1, $s6"
|
||||
}
|
||||
disconnect conn90;
|
||||
--echo "------------- 10 - readonly tx with serializable snapshot swtich txn----------------------"
|
||||
connect (conn100,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
delete from t;
|
||||
commit;
|
||||
--disable_abort_on_error
|
||||
--disable_result_log
|
||||
drop outline tx_route_test_ot_4;
|
||||
--enable_abort_on_error
|
||||
--enable_result_log
|
||||
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;
|
||||
let $s1=`select connection_id()`;
|
||||
select * from t where id = 10001;
|
||||
let $s2=`select connection_id()`;
|
||||
--error 5264
|
||||
create outline tx_route_test_ot_4 on select * from (select * FROM t) a left join t b on a.id = b.id;
|
||||
let $s3=`select connection_id()`;
|
||||
select * from t where id = 10001;
|
||||
let $s4=`select connection_id()`;
|
||||
if ($s1 == $s2) { --echo "not free routed: $s1, $s2"
|
||||
}
|
||||
if ($s1 != $s3) { --echo "s1 != s3: $s1, $s3"
|
||||
}
|
||||
if ($s4 != $s2) { --echo "s2 != s4: $s2, $s4"
|
||||
}
|
||||
--disable_abort_on_error
|
||||
--disable_result_log
|
||||
drop outline tx_route_test_ot_4;
|
||||
--enable_abort_on_error
|
||||
--enable_result_log
|
||||
disconnect conn100;
|
||||
|
||||
--echo "------------- X - special query types ----------------------"
|
||||
#--------------------------------------------------------------------------
|
||||
# Server1 Server2
|
||||
# --------------- --------------------
|
||||
##Case 1: TEXT Prepare stmt / TEXT Execute stmt / TEXT Dellocate stmt
|
||||
##Case 2: prepare stmt / execute stmt / fetch stmt / close stmt
|
||||
##Case 3: InitDb
|
||||
##Case 4: ORACLE mode: alter system set current_schema = "XXX"
|
||||
##Case 5: set transsaction characteristics
|
||||
##Case 6: pl call
|
||||
##Case 7: mysql select udf with DML
|
||||
##Case 8: autonoumous transction
|
||||
##Case 9: trigger / forigenkey check
|
||||
##Case 10: cursor / for update cursor
|
||||
##Case 11: mysql select udf as expr
|
||||
##Case 12: insert ignore use local implicit savepoint
|
||||
##Case 13: use PS protocol, start transaction, execute some stmt, then disable ps protocol, then execute continue:
|
||||
--echo "CLEANUP"
|
||||
connection conn0;
|
||||
drop table t;
|
||||
connection sys;
|
||||
--echo recovery primary_zone settings for mysql tenant to : $saved_primary_zone
|
||||
eval alter tenant mysql set primary_zone = "$saved_primary_zone";
|
||||
--sleep 5
|
||||
disconnect conn0;
|
||||
disconnect conn1;
|
||||
Reference in New Issue
Block a user