Commit 3e968088 authored by Andrei Elkin's avatar Andrei Elkin

merge from 5.1-bt to a local tree.

parents ffb14117 49429751
...@@ -62,7 +62,9 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name ...@@ -62,7 +62,9 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
--enable_warnings --enable_warnings
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO # Create an event on slave and check its state. An event shouldn't be executed
# so set start time in 1 hour.
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
--echo "Checking event status on the slave for originator value = slave's server_id" --echo "Checking event status on the slave for originator value = slave's server_id"
...@@ -81,8 +83,11 @@ connection master; ...@@ -81,8 +83,11 @@ connection master;
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
--enable_warnings --enable_warnings
# Create an event on master and check its state on slave. An event shouldn't be executed
# so set start time in 1 hour. Check that changes of event statement replicated to slave
--echo "Creating event test.er on the master" --echo "Creating event test.er on the master"
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
--echo "Checking event status on the master" --echo "Checking event status on the master"
...@@ -95,7 +100,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND ...@@ -95,7 +100,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND
connection master; connection master;
--echo "Altering event test.er on the master" --echo "Altering event test.er on the master"
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
--echo "Checking event status on the master" --echo "Checking event status on the master"
...@@ -123,8 +128,11 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; ...@@ -123,8 +128,11 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
# test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status # test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status
# on CREATE EVENT # on CREATE EVENT
# Create an event on slave and check its status. An event shouldn't be executed
# so set start time in 1 hour.
--echo "Creating event test.slave_terminate on the slave" --echo "Creating event test.slave_terminate on the slave"
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
--echo "Checking event status on the slave" --echo "Checking event status on the slave"
......
...@@ -48,4 +48,9 @@ Table Op Msg_type Msg_text ...@@ -48,4 +48,9 @@ Table Op Msg_type Msg_text
test.t1 optimize error Table 'test.t1' is read only test.t1 optimize error Table 'test.t1' is read only
Warnings: Warnings:
Error 1036 Table 't1' is read only Error 1036 Table 't1' is read only
repair table t1;
Table Op Msg_type Msg_text
test.t1 repair error Table 'test.t1' is read only
Warnings:
Error 1036 Table 't1' is read only
drop table t1; drop table t1;
...@@ -346,6 +346,22 @@ id ...@@ -346,6 +346,22 @@ id
drop table t1; drop table t1;
drop function f1; drop function f1;
set GLOBAL query_cache_size=0; set GLOBAL query_cache_size=0;
DROP TABLE IF EXISTS t1;
FLUSH STATUS;
SET GLOBAL query_cache_size=1048576;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 0
LOCK TABLES t1 WRITE;
SELECT * FROM t1;
UNLOCK TABLES;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 0
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
SET GLOBAL log_bin_trust_function_creators = 0; SET GLOBAL log_bin_trust_function_creators = 0;
DROP DATABASE IF EXISTS bug30269; DROP DATABASE IF EXISTS bug30269;
FLUSH STATUS; FLUSH STATUS;
......
set global event_scheduler=1;
stop slave; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
SET @old_event_scheduler = @@global.event_scheduler;
set global event_scheduler=1;
set binlog_format=row; set binlog_format=row;
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
drop table if exists t1,t2; drop table if exists t1,t2;
...@@ -34,7 +35,7 @@ db name status originator ...@@ -34,7 +35,7 @@ db name status originator
test justonce SLAVESIDE_DISABLED 1 test justonce SLAVESIDE_DISABLED 1
"Dropping event test.slave_once on the slave" "Dropping event test.slave_once on the slave"
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
"Checking event status on the slave for originator value = slave's server_id" "Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
...@@ -45,7 +46,7 @@ DROP EVENT IF EXISTS test.slave_once; ...@@ -45,7 +46,7 @@ DROP EVENT IF EXISTS test.slave_once;
"Dropping event test.justonce on the master" "Dropping event test.justonce on the master"
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
"Creating event test.er on the master" "Creating event test.er on the master"
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
"Checking event status on the master" "Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
...@@ -56,7 +57,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND ...@@ -56,7 +57,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND
db name status originator body db name status originator body
test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er') test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
"Altering event test.er on the master" "Altering event test.er on the master"
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
"Checking event status on the master" "Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
...@@ -75,7 +76,7 @@ db name status originator ...@@ -75,7 +76,7 @@ db name status originator
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
db name status originator db name status originator
"Creating event test.slave_terminate on the slave" "Creating event test.slave_terminate on the slave"
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
"Checking event status on the slave" "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
...@@ -123,7 +124,7 @@ db name status originator ...@@ -123,7 +124,7 @@ db name status originator
test justonce SLAVESIDE_DISABLED 1 test justonce SLAVESIDE_DISABLED 1
"Dropping event test.slave_once on the slave" "Dropping event test.slave_once on the slave"
DROP EVENT IF EXISTS test.slave_once; DROP EVENT IF EXISTS test.slave_once;
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
"Checking event status on the slave for originator value = slave's server_id" "Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
...@@ -134,7 +135,7 @@ DROP EVENT IF EXISTS test.slave_once; ...@@ -134,7 +135,7 @@ DROP EVENT IF EXISTS test.slave_once;
"Dropping event test.justonce on the master" "Dropping event test.justonce on the master"
DROP EVENT IF EXISTS test.justonce; DROP EVENT IF EXISTS test.justonce;
"Creating event test.er on the master" "Creating event test.er on the master"
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
"Checking event status on the master" "Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
...@@ -145,7 +146,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND ...@@ -145,7 +146,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND
db name status originator body db name status originator body
test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er') test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
"Altering event test.er on the master" "Altering event test.er on the master"
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
"Checking event status on the master" "Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
...@@ -164,7 +165,7 @@ db name status originator ...@@ -164,7 +165,7 @@ db name status originator
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
db name status originator db name status originator
"Creating event test.slave_terminate on the slave" "Creating event test.slave_terminate on the slave"
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
"Checking event status on the slave" "Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
...@@ -190,4 +191,5 @@ select * from t28953; ...@@ -190,4 +191,5 @@ select * from t28953;
END;| END;|
ALTER EVENT event1 RENAME TO event2; ALTER EVENT event1 RENAME TO event2;
DROP EVENT event2; DROP EVENT event2;
SET @@global.event_scheduler= @old_event_scheduler;
DROP TABLE t28953; DROP TABLE t28953;
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
# in both row based and statement based format # # in both row based and statement based format #
################################################################## ##################################################################
set global event_scheduler=1;
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/master-slave.inc --source include/master-slave.inc
SET @old_event_scheduler = @@global.event_scheduler;
set global event_scheduler=1;
let $engine_type= MyISAM; let $engine_type= MyISAM;
set binlog_format=row; set binlog_format=row;
...@@ -51,5 +52,6 @@ sync_slave_with_master; ...@@ -51,5 +52,6 @@ sync_slave_with_master;
# that there is no bad timing cauing it to try to access the table. # that there is no bad timing cauing it to try to access the table.
connection master; connection master;
SET @@global.event_scheduler= @old_event_scheduler;
DROP TABLE t28953; DROP TABLE t28953;
sync_slave_with_master; sync_slave_with_master;
...@@ -34,6 +34,8 @@ DROP TABLE t1; ...@@ -34,6 +34,8 @@ DROP TABLE t1;
# #
# Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table. # Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
# expanded with testcase for
# BUG#41574 - REPAIR TABLE: crashes for compressed tables
# #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
...@@ -55,4 +57,5 @@ insert into t1 select * from t1; ...@@ -55,4 +57,5 @@ insert into t1 select * from t1;
flush tables; flush tables;
--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1 --exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
optimize table t1; optimize table t1;
repair table t1;
drop table t1; drop table t1;
...@@ -224,6 +224,38 @@ disconnect con2; ...@@ -224,6 +224,38 @@ disconnect con2;
connection default; connection default;
set GLOBAL query_cache_size=0; set GLOBAL query_cache_size=0;
#
# Bug#40264: Aborted cached query causes query to hang indefinitely on next cache hit
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
FLUSH STATUS;
SET GLOBAL query_cache_size=1048576;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SHOW STATUS LIKE 'Qcache_queries_in_cache';
LOCK TABLES t1 WRITE;
connect(con1,localhost,root,,);
--send SELECT * FROM t1
connection default;
let $show_type= open tables where `table`='t1' and in_use=2;
let $show_pattern= '%t1%2%';
--source include/wait_show_pattern.inc
dirty_close con1;
UNLOCK TABLES;
let $show_type= open tables where `table`='t1' and in_use=0;
let $show_pattern= '%t1%0%';
--source include/wait_show_pattern.inc
SHOW STATUS LIKE 'Qcache_queries_in_cache';
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
# End of 5.0 tests
SET GLOBAL log_bin_trust_function_creators = 0; SET GLOBAL log_bin_trust_function_creators = 0;
# #
......
...@@ -781,6 +781,9 @@ void query_cache_end_of_result(THD *thd) ...@@ -781,6 +781,9 @@ void query_cache_end_of_result(THD *thd)
if (thd->net.query_cache_query == 0) if (thd->net.query_cache_query == 0)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
/* Ensure that only complete results are cached. */
DBUG_ASSERT(thd->main_da.is_eof());
if (thd->killed) if (thd->killed)
{ {
query_cache_abort(&thd->net); query_cache_abort(&thd->net);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment