mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Auto-merge from 5.1-bugteam
This commit is contained in:
62
mysql-test/include/wait_condition_sp.inc
Normal file
62
mysql-test/include/wait_condition_sp.inc
Normal file
@ -0,0 +1,62 @@
|
||||
# include/wait_condition.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Waits until the passed statement returns true, or the operation
|
||||
# times out.
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# let $wait_condition=
|
||||
# SELECT c = 3 FROM t;
|
||||
# --source include/wait_condition.inc
|
||||
#
|
||||
# OR
|
||||
#
|
||||
# let $wait_timeout= 60; # Override default 30 seconds with 60.
|
||||
# let $wait_condition=
|
||||
# SELECT c = 3 FROM t;
|
||||
# --source include/wait_condition.inc
|
||||
# --echo Executed the test condition $wait_condition_reps times
|
||||
#
|
||||
# EXAMPLE
|
||||
# events_bugs.test, events_time_zone.test
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
|
||||
let $wait_counter= 300;
|
||||
if ($wait_timeout)
|
||||
{
|
||||
let $wait_counter= `SELECT $wait_timeout * 10`;
|
||||
}
|
||||
# Reset $wait_timeout so that its value won't be used on subsequent
|
||||
# calls, and default will be used instead.
|
||||
let $wait_timeout= 0;
|
||||
|
||||
# Keep track of how many times the wait condition is tested
|
||||
# This is used by some tests (e.g., main.status)
|
||||
let $wait_condition_reps= 0;
|
||||
while ($wait_counter)
|
||||
{
|
||||
let $success= `$wait_condition`;
|
||||
inc $wait_condition_reps;
|
||||
if ($success)
|
||||
{
|
||||
let $wait_counter= 0;
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
real_sleep 0.1;
|
||||
dec $wait_counter;
|
||||
}
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
echo Timeout in wait_condition.inc for $wait_condition;
|
||||
show master status;
|
||||
show slave status;
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
|
@ -28,7 +28,7 @@ Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
drop table if exists t1;
|
||||
create table t1(f1 int, f2 varchar(255));
|
||||
create table t1(f1 int, f2 char(255));
|
||||
insert into t1 values(1, 'foo'), (2, 'bar');
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
|
128
mysql-test/r/partition_innodb_semi_consistent.result
Normal file
128
mysql-test/r/partition_innodb_semi_consistent.result
Normal file
@ -0,0 +1,128 @@
|
||||
drop table if exists t1;
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null)
|
||||
engine=innodb
|
||||
DEFAULT CHARSET=latin1
|
||||
PARTITION BY RANGE(a)
|
||||
(PARTITION p0 VALUES LESS THAN (20),
|
||||
PARTITION p1 VALUES LESS THAN MAXVALUE);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
select * from t1 where a=3 lock in share mode;
|
||||
a
|
||||
3
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
update t1 set a=10 where a=5;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
update t1 set a=10 where a=5;
|
||||
select * from t1 where a=2 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1 where a=2 limit 1 for update;
|
||||
a
|
||||
2
|
||||
update t1 set a=11 where a=6;
|
||||
update t1 set a=12 where a=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
update t1 set a=13 where a=1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
commit;
|
||||
update t1 set a=14 where a=1;
|
||||
commit;
|
||||
select * from t1;
|
||||
a
|
||||
10
|
||||
11
|
||||
14
|
||||
2
|
||||
3
|
||||
4
|
||||
7
|
||||
drop table t1;
|
||||
SET SESSION AUTOCOMMIT = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
set binlog_format=mixed;
|
||||
# Switch to connection con1
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
|
||||
ENGINE = InnoDB
|
||||
PARTITION BY RANGE (a)
|
||||
(PARTITION p0 VALUES LESS THAN (300),
|
||||
PARTITION p1 VALUES LESS THAN MAXVALUE);
|
||||
INSERT INTO t1 VALUES (1,2);
|
||||
# 1. test for locking:
|
||||
BEGIN;
|
||||
UPDATE t1 SET b = 12 WHERE a = 1;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 12
|
||||
# Switch to connection con2
|
||||
UPDATE t1 SET b = 21 WHERE a = 1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 12
|
||||
ROLLBACK;
|
||||
# 2. test for serialized update:
|
||||
CREATE TABLE t2 (a INT);
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 VALUES (1,'init');
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
|
||||
INSERT INTO t2 VALUES ();
|
||||
END|
|
||||
BEGIN;
|
||||
UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 init+con1
|
||||
# Switch to connection con2
|
||||
CALL p1;;
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 init+con1
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 init+con1
|
||||
# Switch to connection con2
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 init+con1+con2
|
||||
# Switch to connection con1
|
||||
# 3. test for updated key column:
|
||||
TRUNCATE t1;
|
||||
TRUNCATE t2;
|
||||
INSERT INTO t1 VALUES (1,'init');
|
||||
BEGIN;
|
||||
UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2 init+con1
|
||||
# Switch to connection con2
|
||||
CALL p1;;
|
||||
# Switch to connection con1
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2 init+con1
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2 init+con1
|
||||
# Switch to connection con2
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
2 init+con1
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1, t2;
|
@ -4,44 +4,43 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
'#--------------------FN_DYNVARS_037_01-------------------------#'
|
||||
SET @@global.init_slave = "SET @a = 10";
|
||||
'connect (con1,localhost,root,,)'
|
||||
'connection con1'
|
||||
SELECT @@global.init_slave;
|
||||
@@global.init_slave
|
||||
SET @a = 10
|
||||
'connection master'
|
||||
'#--------------------FN_DYNVARS_037_02-------------------------#'
|
||||
'check if value in slave opt file is executed'
|
||||
'connection slave'
|
||||
show variables like 'init_slave';
|
||||
Variable_name Value
|
||||
init_slave set global max_connections=500
|
||||
show variables like 'max_connections';
|
||||
Variable_name Value
|
||||
max_connections 500
|
||||
reset master;
|
||||
'check if value in slave opt file doesnt apply to master'
|
||||
'connection master'
|
||||
show variables like 'init_slave';
|
||||
Variable_name Value
|
||||
init_slave SET @a = 10
|
||||
show variables like 'max_connections';
|
||||
Variable_name Value
|
||||
max_connections 151
|
||||
'connection slave'
|
||||
'try creating a temporary variable in init_slave'
|
||||
connection slave
|
||||
SET @start_max_connections= @@global.max_connections;
|
||||
SET @start_init_slave= @@global.init_slave;
|
||||
SET @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1';
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
|
||||
DESCRIBE t1;
|
||||
Field Type Null Key Default Extra
|
||||
my_column longtext NO NULL
|
||||
DROP TABLE t1;
|
||||
SELECT @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1';
|
||||
@@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1'
|
||||
1
|
||||
Expect 1
|
||||
SELECT @@global.max_connections= @start_max_connections;
|
||||
@@global.max_connections= @start_max_connections
|
||||
1
|
||||
Expect 1
|
||||
STOP SLAVE;
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
SELECT @@global.max_connections = @start_max_connections + 1;
|
||||
@@global.max_connections = @start_max_connections + 1
|
||||
1
|
||||
Expect 1
|
||||
SET @@global.init_slave = "SET @a=5";
|
||||
stop slave;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
STOP SLAVE;
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
SHOW VARIABLES LIKE 'init_slave';
|
||||
Variable_name Value
|
||||
init_slave SET @a=5
|
||||
SELECT @a;
|
||||
@a
|
||||
NULL
|
||||
'Bug#35365 SET statement in init_slave not execute if slave is restarted'
|
||||
set global max_connections= default;
|
||||
Expect NULL
|
||||
SET @@global.max_connections= @start_max_connections;
|
||||
SET @@global.init_slave= @start_init_slave;
|
||||
|
73
mysql-test/r/status2.result
Normal file
73
mysql-test/r/status2.result
Normal file
@ -0,0 +1,73 @@
|
||||
#
|
||||
# Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
|
||||
#
|
||||
FLUSH STATUS;
|
||||
CREATE FUNCTION testQuestion() RETURNS INTEGER
|
||||
BEGIN
|
||||
DECLARE foo INTEGER;
|
||||
DECLARE bar INTEGER;
|
||||
SET foo=1;
|
||||
SET bar=2;
|
||||
RETURN foo;
|
||||
END $$
|
||||
CREATE PROCEDURE testQuestion2()
|
||||
BEGIN
|
||||
SELECT 1;
|
||||
END $$
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
CREATE TABLE t2 (c1 INT);
|
||||
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
|
||||
DO INSERT INTO t1 VALUES(1);
|
||||
Assert Questions == 7
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 7
|
||||
SELECT testQuestion();
|
||||
testQuestion()
|
||||
1
|
||||
Assert Questions == 9
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 9
|
||||
CALL testQuestion2();
|
||||
1
|
||||
1
|
||||
Assert Questions == 11
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 11
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
Assert Questions == 13
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 13
|
||||
SELECT 1;
|
||||
1
|
||||
1
|
||||
Assert Questions == 14
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 14
|
||||
CREATE TRIGGER trigg1 AFTER INSERT ON t1
|
||||
FOR EACH ROW BEGIN
|
||||
INSERT INTO t2 VALUES (1);
|
||||
END;
|
||||
$$
|
||||
Assert Questions == 16
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 16
|
||||
INSERT INTO t1 VALUES (1);
|
||||
Assert Questions == 18
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
Variable_name Value
|
||||
Questions 18
|
||||
DROP PROCEDURE testQuestion2;
|
||||
DROP TRIGGER trigg1;
|
||||
DROP FUNCTION testQuestion;
|
||||
DROP EVENT ev1;
|
||||
DROP TABLE t1,t2;
|
||||
End of 6.0 tests
|
@ -1,7 +1,15 @@
|
||||
create table t1 (id int) engine=NDB;
|
||||
Warnings:
|
||||
Warning 1286 Unknown table engine 'NDB'
|
||||
Warning 1266 Using storage engine MyISAM for table 't1'
|
||||
alter table t1 engine=NDB;
|
||||
Warnings:
|
||||
Warning 1266 Using storage engine MyISAM for table 't1'
|
||||
Warning 1286 Unknown table engine 'NDB'
|
||||
drop table t1;
|
||||
SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ndbcluster';
|
||||
ENGINE SUPPORT
|
||||
ndbcluster NO
|
||||
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE
|
||||
PLUGIN_NAME='ndbcluster';
|
||||
PLUGIN_NAME PLUGIN_STATUS
|
||||
ndbcluster DISABLED
|
||||
|
@ -43,10 +43,10 @@ NULL information_schema COLUMN_PRIVILEGES TABLE_NAME 4 NO varchar 64 192 NULL N
|
||||
NULL information_schema COLUMN_PRIVILEGES TABLE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
NULL information_schema ENGINES COMMENT 3 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select
|
||||
NULL information_schema ENGINES ENGINE 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
NULL information_schema ENGINES SAVEPOINTS 6 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
|
||||
NULL information_schema ENGINES SAVEPOINTS 6 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
|
||||
NULL information_schema ENGINES SUPPORT 2 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select
|
||||
NULL information_schema ENGINES TRANSACTIONS 4 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
|
||||
NULL information_schema ENGINES XA 5 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
|
||||
NULL information_schema ENGINES TRANSACTIONS 4 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
|
||||
NULL information_schema ENGINES XA 5 NULL YES varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
|
||||
NULL information_schema EVENTS CHARACTER_SET_CLIENT 22 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
|
||||
NULL information_schema EVENTS COLLATION_CONNECTION 23 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
|
||||
NULL information_schema EVENTS CREATED 17 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL NULL NULL datetime select
|
||||
|
@ -31,27 +31,27 @@ Field Type Null Key Default Extra
|
||||
ENGINE varchar(64) NO
|
||||
SUPPORT varchar(8) NO
|
||||
COMMENT varchar(80) NO
|
||||
TRANSACTIONS varchar(3) NO
|
||||
XA varchar(3) NO
|
||||
SAVEPOINTS varchar(3) NO
|
||||
TRANSACTIONS varchar(3) YES NULL
|
||||
XA varchar(3) YES NULL
|
||||
SAVEPOINTS varchar(3) YES NULL
|
||||
SHOW CREATE TABLE information_schema.ENGINES;
|
||||
Table Create Table
|
||||
ENGINES CREATE TEMPORARY TABLE `ENGINES` (
|
||||
`ENGINE` varchar(64) NOT NULL DEFAULT '',
|
||||
`SUPPORT` varchar(8) NOT NULL DEFAULT '',
|
||||
`COMMENT` varchar(80) NOT NULL DEFAULT '',
|
||||
`TRANSACTIONS` varchar(3) NOT NULL DEFAULT '',
|
||||
`XA` varchar(3) NOT NULL DEFAULT '',
|
||||
`SAVEPOINTS` varchar(3) NOT NULL DEFAULT ''
|
||||
`TRANSACTIONS` varchar(3) DEFAULT NULL,
|
||||
`XA` varchar(3) DEFAULT NULL,
|
||||
`SAVEPOINTS` varchar(3) DEFAULT NULL
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8
|
||||
SHOW COLUMNS FROM information_schema.ENGINES;
|
||||
Field Type Null Key Default Extra
|
||||
ENGINE varchar(64) NO
|
||||
SUPPORT varchar(8) NO
|
||||
COMMENT varchar(80) NO
|
||||
TRANSACTIONS varchar(3) NO
|
||||
XA varchar(3) NO
|
||||
SAVEPOINTS varchar(3) NO
|
||||
TRANSACTIONS varchar(3) YES NULL
|
||||
XA varchar(3) YES NULL
|
||||
SAVEPOINTS varchar(3) YES NULL
|
||||
########################################################################
|
||||
# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
||||
# DDL on INFORMATION_SCHEMA tables are not supported
|
||||
|
@ -38,7 +38,7 @@ DROP TABLE t1;
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(f1 int, f2 varchar(255));
|
||||
create table t1(f1 int, f2 char(255));
|
||||
insert into t1 values(1, 'foo'), (2, 'bar');
|
||||
insert into t1 select * from t1;
|
||||
insert into t1 select * from t1;
|
||||
|
1
mysql-test/t/partition_innodb_semi_consistent-master.opt
Normal file
1
mysql-test/t/partition_innodb_semi_consistent-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb_lock_wait_timeout=2
|
194
mysql-test/t/partition_innodb_semi_consistent.test
Normal file
194
mysql-test/t/partition_innodb_semi_consistent.test
Normal file
@ -0,0 +1,194 @@
|
||||
-- source include/have_partition.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
# basic tests of semi-consistent reads
|
||||
# for verifying Bug#40595: Non-matching rows not released with READ-COMMITTED
|
||||
# on tables with partitions
|
||||
|
||||
connect (a,localhost,root,,);
|
||||
connect (b,localhost,root,,);
|
||||
connection a;
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level read committed;
|
||||
create table t1(a int not null)
|
||||
engine=innodb
|
||||
DEFAULT CHARSET=latin1
|
||||
PARTITION BY RANGE(a)
|
||||
(PARTITION p0 VALUES LESS THAN (20),
|
||||
PARTITION p1 VALUES LESS THAN MAXVALUE);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
set autocommit=0;
|
||||
# this should lock the entire table
|
||||
select * from t1 where a=3 lock in share mode;
|
||||
connection b;
|
||||
set binlog_format=mixed;
|
||||
set session transaction isolation level read committed;
|
||||
set autocommit=0;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=10 where a=5;
|
||||
connection a;
|
||||
#DELETE FROM t1 WHERE a=5;
|
||||
commit;
|
||||
connection b;
|
||||
update t1 set a=10 where a=5;
|
||||
connection a;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
select * from t1 where a=2 for update;
|
||||
# this should lock the records (1),(2)
|
||||
select * from t1 where a=2 limit 1 for update;
|
||||
connection b;
|
||||
update t1 set a=11 where a=6;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=12 where a=2;
|
||||
-- error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set a=13 where a=1;
|
||||
connection a;
|
||||
commit;
|
||||
connection b;
|
||||
update t1 set a=14 where a=1;
|
||||
commit;
|
||||
connection a;
|
||||
--sorted_result
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
connection default;
|
||||
disconnect a;
|
||||
disconnect b;
|
||||
|
||||
#
|
||||
# Bug #31310: Locked rows silently skipped in read-committed isolation level.
|
||||
# (This also tests the '*_semi_consistent*' functions in partitioning)
|
||||
# Copied from include/mix1.inc
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
connect (con2,localhost,root,,);
|
||||
SET SESSION AUTOCOMMIT = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
set binlog_format=mixed;
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
|
||||
eval
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
|
||||
ENGINE = InnoDB
|
||||
PARTITION BY RANGE (a)
|
||||
(PARTITION p0 VALUES LESS THAN (300),
|
||||
PARTITION p1 VALUES LESS THAN MAXVALUE);
|
||||
INSERT INTO t1 VALUES (1,2);
|
||||
|
||||
--echo # 1. test for locking:
|
||||
|
||||
BEGIN;
|
||||
--enable_info
|
||||
UPDATE t1 SET b = 12 WHERE a = 1;
|
||||
--disable_info
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
|
||||
--enable_info
|
||||
--disable_abort_on_error
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
UPDATE t1 SET b = 21 WHERE a = 1;
|
||||
--disable_info
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
SELECT * FROM t1;
|
||||
ROLLBACK;
|
||||
|
||||
--echo # 2. test for serialized update:
|
||||
|
||||
CREATE TABLE t2 (a INT);
|
||||
|
||||
TRUNCATE t1;
|
||||
INSERT INTO t1 VALUES (1,'init');
|
||||
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
|
||||
INSERT INTO t2 VALUES ();
|
||||
END|
|
||||
DELIMITER ;|
|
||||
|
||||
BEGIN;
|
||||
--enable_info
|
||||
UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
|
||||
--disable_info
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
|
||||
--send CALL p1;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
SELECT * FROM t1;
|
||||
COMMIT;
|
||||
|
||||
let $bug31310 = 1;
|
||||
while ($bug31310)
|
||||
{
|
||||
let $bug31310= `SELECT 1 - COUNT(*) FROM t2`;
|
||||
}
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
--reap
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
|
||||
--echo # 3. test for updated key column:
|
||||
|
||||
TRUNCATE t1;
|
||||
TRUNCATE t2;
|
||||
|
||||
INSERT INTO t1 VALUES (1,'init');
|
||||
|
||||
BEGIN;
|
||||
--enable_info
|
||||
UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
|
||||
--disable_info
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
|
||||
--send CALL p1;
|
||||
|
||||
--echo # Switch to connection con1
|
||||
connection con1;
|
||||
SELECT * FROM t1;
|
||||
COMMIT;
|
||||
|
||||
let $bug31310 = 1;
|
||||
while ($bug31310)
|
||||
{
|
||||
let $bug31310= `SELECT 1 - COUNT(*) FROM t2`;
|
||||
}
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
--echo # Switch to connection con2
|
||||
connection con2;
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection default;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1, t2;
|
||||
|
@ -1 +0,0 @@
|
||||
--init-slave="set global max_connections=500"
|
@ -10,86 +10,92 @@
|
||||
# #
|
||||
# Creation Date: 2008-03-08 #
|
||||
# Author: Rizwan #
|
||||
# Modified: HHunger 2008-09-29 Fixed the bug by inserting the usual wait and #
|
||||
# SQL-Satements to control master and slave, #
|
||||
# deleted the sleep and made improvements like: #
|
||||
# - Replaced the opt file by dynamic variables, #
|
||||
# - Made the tests independant of the initial #
|
||||
# values of the global variables, #
|
||||
# - Reduced the test to the needed test case to #
|
||||
# save run time, #
|
||||
# - Beautification. #
|
||||
# #
|
||||
# Description: Test Cases of Dynamic System Variable init_slave #
|
||||
# that checks the behavior of this variable #
|
||||
# #
|
||||
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
|
||||
# server-system-variables.html #
|
||||
# Reference: #
|
||||
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_037_01-------------------------#'
|
||||
##################################################################
|
||||
# Check if setting init_slave is changed in every new connection #
|
||||
##################################################################
|
||||
|
||||
SET @@global.init_slave = "SET @a = 10";
|
||||
|
||||
--echo 'connect (con1,localhost,root,,)'
|
||||
connect (con1,localhost,root,,);
|
||||
--echo 'connection con1'
|
||||
connection con1;
|
||||
SELECT @@global.init_slave;
|
||||
disconnect con1;
|
||||
--echo 'connection master'
|
||||
connection master;
|
||||
|
||||
--echo '#--------------------FN_DYNVARS_037_02-------------------------#'
|
||||
####################################################
|
||||
# Begin the functionality Testing of init_slave #
|
||||
####################################################
|
||||
|
||||
#====================================================
|
||||
--echo 'check if value in slave opt file is executed'
|
||||
#====================================================
|
||||
save_master_pos;
|
||||
--echo 'connection slave'
|
||||
--echo connection slave
|
||||
connection slave;
|
||||
sleep 1;
|
||||
show variables like 'init_slave';
|
||||
show variables like 'max_connections';
|
||||
sync_with_master;
|
||||
reset master;
|
||||
#
|
||||
# save the current values
|
||||
|
||||
#===============================================================
|
||||
--echo 'check if value in slave opt file doesnt apply to master'
|
||||
#===============================================================
|
||||
SET @start_max_connections= @@global.max_connections;
|
||||
SET @start_init_slave= @@global.init_slave;
|
||||
|
||||
--echo 'connection master'
|
||||
connection master;
|
||||
show variables like 'init_slave';
|
||||
show variables like 'max_connections';
|
||||
save_master_pos;
|
||||
--echo 'connection slave'
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
# setting of a global value with an effect on the next start of the slave server
|
||||
# check that @@global.init_slave could be set
|
||||
let $my_init_slave=
|
||||
'SET @@global.max_connections = @@global.max_connections + 1';
|
||||
eval SET @@global.init_slave = $my_init_slave;
|
||||
|
||||
#=======================================================
|
||||
--echo 'try creating a temporary variable in init_slave'
|
||||
#=======================================================
|
||||
|
||||
SET @@global.init_slave = "SET @a=5";
|
||||
|
||||
stop slave;
|
||||
--wait_for_slave_to_stop
|
||||
reset slave;
|
||||
# Clean up old test tables
|
||||
# show the data type of the variable
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column;
|
||||
--enable_warnings
|
||||
start slave;
|
||||
|
||||
DESCRIBE t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# check that the new setting of @@global.init_slave becomes immediately visible
|
||||
eval SELECT @@global.init_slave = $my_init_slave;
|
||||
--echo Expect 1
|
||||
# wait for the slave threads have set the global variable.
|
||||
let $wait_timeout= 90;
|
||||
let $wait_condition= SELECT @@global.max_connections = @start_max_connections;
|
||||
--source include/wait_condition_sp.inc
|
||||
# check that the action in init_slave does not happen immediately
|
||||
SELECT @@global.max_connections= @start_max_connections;
|
||||
--echo Expect 1
|
||||
#
|
||||
# reset of the server
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
#
|
||||
# wait for the slave threads have set the global variable.
|
||||
let $wait_timeout= 90;
|
||||
let $wait_condition= SELECT @@global.max_connections = @start_max_connections + 1;
|
||||
--source include/wait_condition_sp.inc
|
||||
# check that the action in init_slave was executed and had the intended effect
|
||||
SELECT @@global.max_connections = @start_max_connections + 1;
|
||||
--echo Expect 1
|
||||
#
|
||||
# Setting a variable(which is local to a session) and must not be visible
|
||||
SET @@global.init_slave = "SET @a=5";
|
||||
#
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
#
|
||||
SHOW VARIABLES LIKE 'init_slave';
|
||||
# expect NULL
|
||||
SELECT @a;
|
||||
|
||||
--echo 'Bug#35365 SET statement in init_slave not execute if slave is restarted'
|
||||
|
||||
# Restore value
|
||||
set global max_connections= default;
|
||||
|
||||
--echo Expect NULL
|
||||
#
|
||||
# Clean up
|
||||
SET @@global.max_connections= @start_max_connections;
|
||||
SET @@global.init_slave= @start_init_slave;
|
||||
##################################################
|
||||
# End of functionality Testing for init_slave #
|
||||
##################################################
|
||||
|
68
mysql-test/t/status2.test
Normal file
68
mysql-test/t/status2.test
Normal file
@ -0,0 +1,68 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
|
||||
--echo #
|
||||
FLUSH STATUS;
|
||||
DELIMITER $$;
|
||||
CREATE FUNCTION testQuestion() RETURNS INTEGER
|
||||
BEGIN
|
||||
DECLARE foo INTEGER;
|
||||
DECLARE bar INTEGER;
|
||||
SET foo=1;
|
||||
SET bar=2;
|
||||
RETURN foo;
|
||||
END $$
|
||||
CREATE PROCEDURE testQuestion2()
|
||||
BEGIN
|
||||
SELECT 1;
|
||||
END $$
|
||||
DELIMITER ;$$
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
CREATE TABLE t2 (c1 INT);
|
||||
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
|
||||
DO INSERT INTO t1 VALUES(1);
|
||||
|
||||
--echo Assert Questions == 7
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
SELECT testQuestion();
|
||||
--echo Assert Questions == 9
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
CALL testQuestion2();
|
||||
--echo Assert Questions == 11
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
SELECT 1;
|
||||
--echo Assert Questions == 13
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
connect (con1,localhost,root,,);
|
||||
connection con1;
|
||||
SELECT 1;
|
||||
connection default;
|
||||
disconnect con1;
|
||||
--echo Assert Questions == 14
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
DELIMITER $$;
|
||||
CREATE TRIGGER trigg1 AFTER INSERT ON t1
|
||||
FOR EACH ROW BEGIN
|
||||
INSERT INTO t2 VALUES (1);
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
--echo Assert Questions == 16
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
INSERT INTO t1 VALUES (1);
|
||||
--echo Assert Questions == 18
|
||||
SHOW STATUS LIKE 'Questions';
|
||||
# TODO: Uncomment the lines below when FLUSH GLOBAL STATUS is implemented.
|
||||
# FLUSH STATUS;
|
||||
# SHOW GLOBAL STATUS LIKE 'Questions';
|
||||
DROP PROCEDURE testQuestion2;
|
||||
DROP TRIGGER trigg1;
|
||||
DROP FUNCTION testQuestion;
|
||||
DROP EVENT ev1;
|
||||
DROP TABLE t1,t2;
|
||||
--echo End of 6.0 tests
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
disable_query_log;
|
||||
--require r/true.require
|
||||
select support = 'Disabled' as `TRUE` from information_schema.engines where engine = 'ndbcluster';
|
||||
select support = 'NO' as `TRUE` from information_schema.engines where engine = 'ndbcluster';
|
||||
enable_query_log;
|
||||
|
||||
|
||||
@ -16,4 +16,9 @@ create table t1 (id int) engine=NDB;
|
||||
alter table t1 engine=NDB;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#29263 disabled storage engines omitted in SHOW ENGINES
|
||||
#
|
||||
SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ndbcluster';
|
||||
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE
|
||||
PLUGIN_NAME='ndbcluster';
|
||||
|
Reference in New Issue
Block a user