mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
6e69536956
Problem 1: tests often fail in pushbuild with a timeout when waiting for the slave to start/stop/receive error. Fix 1: Updated the wait_for_slave_* macros in the following way: - The timeout is increased by a factor ten - Refactored the macros so that wait_for_slave_param does the work for the other macros. Problem 2: Tests are often incorrectly written, lacking a source include/wait_for_slave_to_[start|stop].inc. Fix 2: Improved the chance to get it right by adding include/start_slave.inc and include/stop_slave.inc, and updated tests to use these. Problem 3: The the built-in test language command wait_for_slave_to_stop is a misnomer (does not wait for the slave io thread) and does not give as much debug info in case of failure as the otherwise equivalent macro source include/wait_for_slave_sql_to_stop.inc Fix 3: Replaced all calls to the built-in command by a call to the macro. Problem 4: Some, but not all, of the wait_for_slave_* macros had an implicit connection slave. This made some tests confusing to read, and made it more difficult to use the macro in circular replication scenarios, where the connection named master needs to wait. Fix 4: Removed the implicit connection slave from all wait_for_slave_* macros, and updated tests to use an explicit connection slave where necessary. Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc were unused. Moreover, using them is difficult and error-prone. Fix 5: remove these macros. Problem 6: log_bin_trust_function_creators_basic failed when running tests because it assumed @@global.log_bin_trust_function_creators=1, and some tests modified this variable without resetting it to its original value. Fix 6: All tests that use this variable have been updated so that they reset the value at end of test. mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test: Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test: Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc Added connection slave since includ/wait_for_slave_sql_to_stop.inc does not do that anymore. mysql-test/extra/rpl_tests/rpl_log.test: Replaced start slave+wait_slave_status by start_slave.inc mysql-test/include/reset_master_and_slave.inc: replaced start/stop slave by start_slave.inc/stop_slave.inc mysql-test/include/sync_slave_io_with_master.inc: Improved comments and error message. mysql-test/include/wait_for_slave_io_to_stop.inc: Refactored to use wait_for_slave_param.inc. Removed connection slave. mysql-test/include/wait_for_slave_param.inc: - Improved usage instructions - Added more debug info in case of timeout - Added parameters $slave_param_comparison, $slave_timeout, $slave_keep_connection, $slave_error_message mysql-test/include/wait_for_slave_sql_error.inc: Refactored to use wait_for_slave_param.inc. Removed connection slave. mysql-test/include/wait_for_slave_sql_to_start.inc: Refactored to use wait_for_slave_param.inc. Removed connection slave. mysql-test/include/wait_for_slave_sql_to_stop.inc: Refactored to use wait_for_slave_param.inc. Removed connection slave. mysql-test/include/wait_for_slave_to_start.inc: Refactored to use wait_for_slave_param.inc. Removed connection slave. mysql-test/include/wait_for_slave_to_stop.inc: Refactored to use wait_for_slave_param.inc. Removed connection slave. mysql-test/include/wait_show_pattern.inc: Removed unused (and error-prone) file mysql-test/include/wait_slave_status.inc: Removed unused (and error-prone) file mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test: Renamed $keep_connection to $slave_keep_connection. mysql-test/suite/rpl/t/rpl_bug26395.test: Replace stop slave by stop_slave.inc mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test: Replace start/stop slave by start_slave.inc/stop_slave.inc. Replace wait_for_slave_param by wait_for_slave_sql_to_stop.inc. mysql-test/suite/rpl/t/rpl_dual_pos_advance.test: Renamed $keep_connection to $slave_keep_connection. mysql-test/suite/rpl/t/rpl_flushlog_loop.test: Replace wait_slave_status by start_slave.inc mysql-test/suite/rpl/t/rpl_idempotency.test: Added connection slave since wait_for_slave_sql_to_stop.inc does not do that any more. mysql-test/suite/rpl/t/rpl_incident.test: Replaced wait_for_slave_to_stop by wait_for_slave_sql_to_stop.inc mysql-test/suite/rpl/t/rpl_init_slave.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. Replaced save_master_pos;connection slave;sync_with_master by sync_slave_with_master. mysql-test/suite/rpl/t/rpl_log_pos.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. Replaced wait_for_slave_param by other wait_for_slave_* macros. mysql-test/suite/rpl/t/rpl_packet.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. mysql-test/suite/rpl/t/rpl_row_until.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. Replaced save_master_pos;connection slave;sync_with_master by sync_slave_with_master. mysql-test/suite/rpl/t/rpl_server_id1.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. mysql-test/suite/rpl/t/rpl_slave_grp_exec.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. mysql-test/suite/rpl/t/rpl_slave_skip.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. mysql-test/suite/rpl/t/rpl_slave_status.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. mysql-test/suite/rpl/t/rpl_sp.test: Restore @@global.log_bin_trust_function_creators at end of test. mysql-test/suite/rpl/t/rpl_sp_effects.test: Restore @@global.log_bin_trust_function_creators at end of test. mysql-test/suite/rpl/t/rpl_stm_until.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. Replaced save_master_pos;connection slave;sync_with_master by sync_slave_with_master. mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test: Replaced start slave by start_slave.inc. Added explicit connection slave since wait_for_slave_sql_to_stop.inc does not do that anymore. mysql-test/t/disabled.def: Disabled failing test. mysql-test/t/func_time.test: Restore @@global.log_bin_trust_function_creators at end of test. mysql-test/t/grant.test: Restore @@global.log_bin_trust_function_creators at end of test. mysql-test/t/grant2.test: Restore @@global.log_bin_trust_function_creators at end of test. mysql-test/t/innodb_notembedded.test: Restore @@global.log_bin_trust_function_creators at end of test. mysql-test/t/log_bin_trust_function_creators_func.test: Restore @@global.log_bin_trust_function_creators at end of test. Clean up at end of test by dropping the created user. mysql-test/t/query_cache.test: Restore @@global.log_bin_trust_function_creators at end of test. mysql-test/t/query_cache_notembedded.test: Restore @@global.log_bin_trust_function_creators at end of test. mysql-test/t/rpl_init_slave_func.test: Replaced start/stop slave by start_slave.inc/stop_slave.inc. mysql-test/t/timezone2.test: Restore @@global.log_bin_trust_function_creators at end of test.
280 lines
4.2 KiB
Text
280 lines
4.2 KiB
Text
stop slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
reset master;
|
|
reset slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
start slave;
|
|
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
|
|
drop procedure if exists p1;
|
|
drop procedure if exists p2;
|
|
drop function if exists f1;
|
|
drop table if exists t1,t2;
|
|
drop view if exists v1;
|
|
create table t1 (a int);
|
|
SET GLOBAL log_bin_trust_function_creators = 1;
|
|
create procedure p1()
|
|
begin
|
|
declare spv int default 0;
|
|
while spv < 5 do
|
|
insert into t1 values(spv+1);
|
|
set spv=spv+1;
|
|
end while;
|
|
end//
|
|
call p1();
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
create procedure p2()
|
|
begin
|
|
declare a int default 4;
|
|
create table t2 as select a;
|
|
end//
|
|
call p2();
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
4
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
4
|
|
drop procedure p1;
|
|
drop procedure p2;
|
|
drop table t2;
|
|
create function f1(x int) returns int
|
|
begin
|
|
insert into t1 values(x);
|
|
return x+1;
|
|
end//
|
|
create procedure p1(a int, b int)
|
|
begin
|
|
declare v int default f1(5);
|
|
if (f1(6)) then
|
|
select 'yes';
|
|
end if;
|
|
set v = f1(7);
|
|
while f1(8) < 1 do
|
|
select 'this cant be';
|
|
end while;
|
|
end//
|
|
call p1(f1(1), f1(2));
|
|
yes
|
|
yes
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
1
|
|
2
|
|
2
|
|
3
|
|
4
|
|
5
|
|
5
|
|
6
|
|
7
|
|
8
|
|
create table t2(a int);
|
|
insert into t2 values (10),(11);
|
|
SELECT a,f1(a) FROM t2 ORDER BY a;
|
|
a f1(a)
|
|
10 11
|
|
11 12
|
|
insert into t2 select f1(3);
|
|
SELECT 'master:',a FROM t1 ORDER BY a;
|
|
master: a
|
|
master: 1
|
|
master: 1
|
|
master: 2
|
|
master: 2
|
|
master: 3
|
|
master: 3
|
|
master: 4
|
|
master: 5
|
|
master: 5
|
|
master: 6
|
|
master: 7
|
|
master: 8
|
|
master: 10
|
|
master: 11
|
|
SELECT 'slave:',a FROM t1 ORDER BY a;
|
|
slave: a
|
|
slave: 1
|
|
slave: 1
|
|
slave: 2
|
|
slave: 2
|
|
slave: 3
|
|
slave: 3
|
|
slave: 4
|
|
slave: 5
|
|
slave: 5
|
|
slave: 6
|
|
slave: 7
|
|
slave: 8
|
|
slave: 10
|
|
slave: 11
|
|
drop procedure p1;
|
|
delete from t1;
|
|
delete from t2;
|
|
delete from t1;
|
|
insert into t2 values(1),(2);
|
|
create view v1 as select f1(a) as f from t2;
|
|
select * from v1 order by f;
|
|
f
|
|
2
|
|
3
|
|
SELECT 'master:',a FROM t1 ORDER BY a;
|
|
master: a
|
|
master: 1
|
|
master: 2
|
|
SELECT 'slave:',a FROM t1 ORDER BY a;
|
|
slave: a
|
|
slave: 1
|
|
slave: 2
|
|
drop view v1;
|
|
delete from t1;
|
|
prepare s1 from 'select f1(?)';
|
|
set @xx=123;
|
|
execute s1 using @xx;
|
|
f1(?)
|
|
124
|
|
SELECT 'master:',a FROM t1 ORDER BY a;
|
|
master: a
|
|
master: 123
|
|
SELECT 'slave:',a FROM t1 ORDER BY a;
|
|
slave: a
|
|
slave: 123
|
|
delete from t1;
|
|
create procedure p1(spv int)
|
|
begin
|
|
declare c cursor for select f1(spv) from t2;
|
|
while (spv > 2) do
|
|
open c;
|
|
fetch c into spv;
|
|
close c;
|
|
set spv= spv - 10;
|
|
end while;
|
|
end//
|
|
call p1(15);
|
|
SELECT 'master:',a FROM t1 ORDER BY a;
|
|
master: a
|
|
master: 6
|
|
master: 6
|
|
master: 15
|
|
master: 15
|
|
SELECT 'slave:',a FROM t1 ORDER BY a;
|
|
slave: a
|
|
slave: 6
|
|
slave: 6
|
|
slave: 15
|
|
slave: 15
|
|
drop procedure p1;
|
|
drop function f1;
|
|
drop table t1,t2;
|
|
create table t1 (a int);
|
|
create procedure p1()
|
|
begin
|
|
insert into t1 values(@x);
|
|
set @x=@x+1;
|
|
insert into t1 values(@x);
|
|
if (f2()) then
|
|
insert into t1 values(1243);
|
|
end if;
|
|
end//
|
|
create function f2() returns int
|
|
begin
|
|
insert into t1 values(@z);
|
|
set @z=@z+1;
|
|
insert into t1 values(@z);
|
|
return 0;
|
|
end//
|
|
create function f1() returns int
|
|
begin
|
|
insert into t1 values(@y);
|
|
call p1();
|
|
return 0;
|
|
end//
|
|
set @x=10;
|
|
set @y=20;
|
|
set @z=100;
|
|
select f1();
|
|
f1()
|
|
0
|
|
set @x=30;
|
|
call p1();
|
|
SELECT 'master', a FROM t1 ORDER BY a;
|
|
master a
|
|
master 10
|
|
master 11
|
|
master 20
|
|
master 30
|
|
master 31
|
|
master 100
|
|
master 101
|
|
master 101
|
|
master 102
|
|
SELECT 'slave', a FROM t1 ORDER BY a;
|
|
slave a
|
|
slave 10
|
|
slave 11
|
|
slave 20
|
|
slave 30
|
|
slave 31
|
|
slave 100
|
|
slave 101
|
|
slave 101
|
|
slave 102
|
|
drop table t1;
|
|
drop function f1;
|
|
drop function f2;
|
|
drop procedure p1;
|
|
create table t2 (b BIT(7));
|
|
create procedure sp_bug26199(bitvalue BIT(7))
|
|
begin
|
|
insert into t2 set b = bitvalue;
|
|
end //
|
|
create function sf_bug26199(b BIT(7)) returns int
|
|
begin
|
|
insert into t2 values(b);
|
|
return 0;
|
|
end//
|
|
call sp_bug26199(b'1110');
|
|
call sp_bug26199('\0');
|
|
select sf_bug26199(b'1111111');
|
|
sf_bug26199(b'1111111')
|
|
0
|
|
select sf_bug26199(b'101111111');
|
|
sf_bug26199(b'101111111')
|
|
0
|
|
Warnings:
|
|
Warning 1264 Out of range value for column 'b' at row 1
|
|
select sf_bug26199('\'');
|
|
sf_bug26199('\'')
|
|
0
|
|
select hex(b) from t2;
|
|
hex(b)
|
|
E
|
|
0
|
|
7F
|
|
7F
|
|
27
|
|
select hex(b) from t2;
|
|
hex(b)
|
|
E
|
|
0
|
|
7F
|
|
7F
|
|
27
|
|
drop table t2;
|
|
drop procedure sp_bug26199;
|
|
drop function sf_bug26199;
|
|
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
|
|
end of the tests
|