[unstable mysqltest] trx.tx_free_route

This commit is contained in:
chinaxing
2024-03-28 07:45:54 +00:00
committed by ob-robot
parent 022fbefd85
commit fbfd964307

View File

@ -6,12 +6,18 @@ connect (sys,$OBMYSQL_MS0,root,"",oceanbase,$OBMYSQL_PORT);
connect (conn0,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT); connect (conn0,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
connect (conn1,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT); connect (conn1,$OBMYSQL_MS0,admin@mysql,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
connection sys; connection sys;
# change tenant primary zone to RANDOM
let $saved_primary_zone=`select primary_zone from oceanbase.__all_tenant where tenant_name = 'mysql'`; 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 --echo change mysql tenant primary_zone from $saved_primary_zone to RANDOM
alter tenant mysql set primary_zone = 'RANDOM'; alter tenant mysql set primary_zone = 'RANDOM';
let $tenant_id=`select tenant_id from oceanbase.__all_tenant where tenant_name = 'mysql'`; let $tenant_id=`select tenant_id from oceanbase.__all_tenant where tenant_name = 'mysql'`;
# check tenant has multiple ls
let $break_loop=0; let $break_loop=0;
let $i=0; let $i=0;
let $fail = 0;
while ($break_loop == 0) while ($break_loop == 0)
{ {
--inc $i --inc $i
@ -20,10 +26,15 @@ while ($break_loop == 0)
--inc $break_loop --inc $break_loop
} }
if ($i >= 300) { if ($i >= 300) {
--inc $fail
--inc $break_loop --inc $break_loop
} }
--sleep 0.2 --sleep 0.2
} }
if ($fail > 0) {
--echo "tenant normal ls not distributed to multiple server"
eval select * from oceanbase.__all_virtual_ls where tenant_id = $tenant_id;
}
connection conn0; connection conn0;
@ -41,23 +52,41 @@ commit;
--enable_result_log --enable_result_log
--enable_query_log --enable_query_log
# check tablet of target table distributed to multiple ls
let $table_id=`select table_id from oceanbase.__all_virtual_table where table_name = 't' and tenant_id = $tenant_id`; 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`; let $break_loop=0;
if ($ls_count <= 1) { let $i=0;
--echo "error, table should distributed to all ls" let $fail=0;
eval select * from oceanbase.__all_tablet_to_ls where table_id = $table_id; while ($break_loop == 0)
select * from oceanbase.__all_ls; {
--inc $i
let $ls_count=`select count(distinct ls_id) from oceanbase.__all_tablet_to_ls where table_id = $table_id`;
if ($ls_cnt > 1) {
--inc $break_loop
}
if ($i >= 300) {
--inc $fail
--inc $break_loop
}
--sleep 0.2
} }
if $($ls_count > 1) {
if ($fail > 0) {
--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;
}
# check ls leader distributed to multiple server
let $check_ts=`select now()`; 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)`; 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) { if ($svr_cnt <= 1) {
--echo "ls leader not distributed to all server, check_ts=$check_ts, table_id=$table_id, ls_count=$ls_count" --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; 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_virtual_ls_meta_table where role = 1 order by ls_id;
select * from oceanbase.__all_ls; select * from oceanbase.__all_ls;
}
} }
--echo "-------------- 1 - basic in txn free route -----------------" --echo "-------------- 1 - basic in txn free route -----------------"
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Server1 Server2 # Server1 Server2