mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merged 5.1-bugteam -> bug 34773 tree
This commit is contained in:
@ -77,6 +77,7 @@ dist-hook:
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(distdir)/std_data/ndb_backup51_data_be
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(distdir)/std_data/ndb_backup51_data_le
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/parts/part_* $(distdir)/std_data/parts
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/parts/*.MY* $(distdir)/std_data/parts
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(distdir)/std_data/funcs_1
|
||||
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
|
||||
$(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(distdir)/lib/My
|
||||
@ -132,6 +133,7 @@ install-data-local:
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/parts/part_* $(DESTDIR)$(testdir)/std_data/parts
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/parts/*.MY* $(DESTDIR)$(testdir)/std_data/parts
|
||||
$(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(DESTDIR)$(testdir)/std_data/funcs_1
|
||||
$(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
|
||||
$(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(DESTDIR)$(testdir)/lib/My
|
||||
|
@ -125,6 +125,45 @@ drop table t1;
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/
|
||||
show binlog events from 0;
|
||||
|
||||
|
||||
#
|
||||
# Bug #39182: Binary log producing incompatible character set query from
|
||||
# stored procedure.
|
||||
#
|
||||
reset master;
|
||||
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
|
||||
USE bug39182;
|
||||
CREATE TABLE t1 (a VARCHAR(255) COLLATE utf8_unicode_ci)
|
||||
DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
DELIMITER //;
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
BEGIN
|
||||
DECLARE s1 VARCHAR(255);
|
||||
SET s1= "test";
|
||||
CREATE TEMPORARY TABLE tmp1
|
||||
SELECT * FROM t1 WHERE a LIKE CONCAT("%", s1, "%");
|
||||
SELECT
|
||||
COLLATION(NAME_CONST('s1', _utf8'test')) c1,
|
||||
COLLATION(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) c2,
|
||||
COLLATION(s1) c3,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test')) d1,
|
||||
COERCIBILITY(NAME_CONST('s1', _utf8'test' COLLATE utf8_unicode_ci)) d2,
|
||||
COERCIBILITY(s1) d3;
|
||||
DROP TEMPORARY TABLE tmp1;
|
||||
END//
|
||||
|
||||
DELIMITER ;//
|
||||
|
||||
CALL p1();
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
DROP DATABASE bug39182;
|
||||
USE test;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Test of a too big SET INSERT_ID: see if the truncated value goes
|
||||
|
@ -1,17 +1,43 @@
|
||||
# Test of binlogging of INSERT_ID with INSERT DELAYED
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Verify that INSERT DELAYED in mixed or row mode writes events to the
|
||||
# binlog, and that AUTO_INCREMENT works correctly.
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Insert both single and multiple rows into an autoincrement column,
|
||||
# both with specified value and with NULL.
|
||||
#
|
||||
# With INSERT DELAYED, the rows do not show up in the table
|
||||
# immediately, so we must do source include/wait_until_rows_count.inc
|
||||
# between any two INSERT DELAYED statements. Moreover, if mixed or
|
||||
# row-based logging is used, there is also a delay between when rows
|
||||
# show up in the table and when they show up in the binlog. To ensure
|
||||
# that the rows show up in the binlog, we call FLUSH TABLES, which
|
||||
# waits until the delayed_insert thread has finished.
|
||||
#
|
||||
# We cannot read the binlog after executing INSERT DELAYED statements
|
||||
# that insert multiple rows, because that is nondeterministic. More
|
||||
# precisely, rows may be written in batches to the binlog, where each
|
||||
# batch has one Table_map_log_event and one or more
|
||||
# Write_rows_log_event. The number of rows included in each batch is
|
||||
# nondeterministic.
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#20627: INSERT DELAYED does not honour auto_increment_* variables
|
||||
# Bug in this test: BUG#38068: binlog_stm_binlog fails sporadically in pushbuild
|
||||
|
||||
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
|
||||
# First, avoid BUG#20627:
|
||||
set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
|
||||
# Verify that only one INSERT_ID event is binlogged.
|
||||
# Note, that because of WL#3368 mixed mode binlog records RBR events for the delayed
|
||||
|
||||
let $table=t1;
|
||||
let $rows_inserted=11; # total number of inserted rows in this test
|
||||
let $count=0;
|
||||
|
||||
insert delayed into t1 values (207);
|
||||
let $count=1;
|
||||
|
||||
# use this macro instead of sleeps.
|
||||
|
||||
inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
insert delayed into t1 values (null);
|
||||
inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
@ -20,9 +46,10 @@ insert delayed into t1 values (300);
|
||||
inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
# moving binlog check affront of multi-rows queries which work is indeterministic (extra table_maps)
|
||||
# todo: better check is to substitute SHOW BINLOG with reading from binlog, probably bug#19459 is in
|
||||
# the way
|
||||
# It is not enough to wait until all rows have been inserted into the
|
||||
# table. FLUSH TABLES ensures that they are in the binlog too. See
|
||||
# comment above.
|
||||
FLUSH TABLES;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
insert delayed into t1 values (null),(null),(null),(null);
|
||||
@ -33,8 +60,5 @@ insert delayed into t1 values (null),(null),(400),(null);
|
||||
inc $count; inc $count; inc $count; inc $count;
|
||||
--source include/wait_until_rows_count.inc
|
||||
|
||||
#check this assertion about $count calculation
|
||||
--echo $count == $rows_inserted
|
||||
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -139,15 +139,6 @@ drop table t1,t2,t3;
|
||||
# table
|
||||
#
|
||||
CREATE TABLE t1(a INT) ENGINE=BLACKHOLE;
|
||||
# NOTE: After exchanging open_ltable() by open_and_lock_tables() in
|
||||
# handle_delayed_insert() to fix problems with MERGE tables (Bug#26379),
|
||||
# problems with INSERT DELAYED and BLACKHOLE popped up. open_ltable()
|
||||
# does not check if the binlogging capabilities of the statement and the
|
||||
# table match. So the below used to succeed. But since INSERT DELAYED
|
||||
# switches to row-based logging in mixed-mode and BLACKHOLE cannot do
|
||||
# row-based logging, it could not really work. Until this problem is
|
||||
# correctly fixed, we have that error here.
|
||||
--error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
INSERT DELAYED INTO t1 VALUES(1);
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -13,3 +13,18 @@ create trigger tr1 before insert on t1 for each row insert into t2 values (2*new
|
||||
create procedure sp1 (a int) insert into t1 values(a);
|
||||
drop database testing_1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
# BUG#38773: DROP DATABASE cause switch to stmt-mode when there are
|
||||
# temporary tables open
|
||||
|
||||
use test;
|
||||
reset master;
|
||||
create temporary table tt1 (a int);
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
disable_warnings;
|
||||
drop database if exists mysqltest1;
|
||||
enable_warnings;
|
||||
insert into t1 values (1);
|
||||
drop table tt1, t1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
@ -7,6 +7,7 @@
|
||||
# Actually this test has nothing to do with innodb per se, it just requires
|
||||
# transactional table.
|
||||
#
|
||||
flush status;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
--disable_warnings
|
||||
@ -38,12 +39,3 @@ commit;
|
||||
show status like "binlog_cache_use";
|
||||
show status like "binlog_cache_disk_use";
|
||||
drop table t1;
|
||||
|
||||
# Test for testable InnoDB status variables. This test
|
||||
# uses previous ones(pages_created, rows_deleted, ...).
|
||||
show status like "Innodb_buffer_pool_pages_total";
|
||||
show status like "Innodb_page_size";
|
||||
show status like "Innodb_rows_deleted";
|
||||
show status like "Innodb_rows_inserted";
|
||||
show status like "Innodb_rows_updated";
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
eval create table t1 (a int) engine=$engine_type;
|
||||
flush tables;
|
||||
system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
|
||||
remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
|
||||
drop table if exists t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
|
32
mysql-test/extra/rpl_tests/rpl_blackhole.test
Normal file
32
mysql-test/extra/rpl_tests/rpl_blackhole.test
Normal file
@ -0,0 +1,32 @@
|
||||
# Check replication of one statement assuming that the engine on the
|
||||
# slave is a blackhole engine.
|
||||
|
||||
# Input:
|
||||
# $statement Statement to evaluate, it is assumed to change t1
|
||||
|
||||
# 1. Evaluate statement on master, it is assumed to change t1
|
||||
# 2. Wait for statement to be processed on slave
|
||||
# 3. SELECT from table t1 to see what was written
|
||||
# 4. Compare position on slave before executing statement and after
|
||||
# executing statement. If difference is >0, then something was
|
||||
# written to the binary log on the slave.
|
||||
|
||||
connection slave;
|
||||
let $before = query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
eval $statement;
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
--echo # Expect 0
|
||||
SELECT COUNT(*) FROM t1;
|
||||
let $after = query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
let $something_written = `select $after - $before != 0`;
|
||||
if ($something_written) {
|
||||
--echo >>> Something was written to binary log <<<
|
||||
}
|
||||
if (!$something_written) {
|
||||
--echo >>> Nothing was written to binary log <<<
|
||||
}
|
@ -151,6 +151,20 @@ DROP DATABASE IF EXISTS mysqltest3;
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE DATABASE mysqltest2;
|
||||
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
|
||||
# Prevent Bug#26687 rpl_ddl test fails if run with --innodb option
|
||||
# The testscript (suite/rpl/rpl_ddl.test) + the expected result need that the
|
||||
# slave uses MyISAM for the table mysqltest.t1.
|
||||
# This is not valid in case of suite/rpl_ndb/rpl_ndb_ddl.test which sources
|
||||
# also this script.
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
if (`SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA = 'mysqltest1' AND TABLE_NAME = 't1'
|
||||
AND ENGINE <> 'MyISAM' AND '$engine_type' <> 'NDB'`)
|
||||
{
|
||||
skip This test needs on slave side: InnoDB disabled, default engine: MyISAM;
|
||||
}
|
||||
connection master;
|
||||
INSERT INTO mysqltest1.t1 SET f1= 0;
|
||||
eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type;
|
||||
eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type;
|
||||
|
@ -442,8 +442,6 @@ SELECT f1();
|
||||
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
|
||||
INSERT INTO t1 VALUES (NULL, f2());
|
||||
INSERT INTO t1 VALUES (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID(5)),
|
||||
(NULL, @@LAST_INSERT_ID);
|
||||
# Test replication of substitution "IS NULL" -> "= LAST_INSERT_ID".
|
||||
INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
|
||||
UPDATE t1 SET j= -1 WHERE i IS NULL;
|
||||
|
@ -13,22 +13,15 @@ save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
reset master;
|
||||
reset slave;
|
||||
# We are going to read the slave's binlog which contains file_id (for some LOAD
|
||||
# DATA INFILE); to make it repeatable (not influenced by other tests), we need
|
||||
# to stop and start the slave, to be sure file_id will start from 1.
|
||||
# This can be done with 'server_stop slave', but
|
||||
# this would require the manager, so most of the time the test will be skipped
|
||||
# :(
|
||||
# To workaround this, I (Guilhem) add a (empty) rpl_log-slave.opt (because when
|
||||
# mysql-test-run finds such a file it restarts the slave before doing the
|
||||
# test). That's not very elegant but I could find no better way, sorry.
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
let $VERSION=`select version()`;
|
||||
|
||||
connection master;
|
||||
reset master;
|
||||
eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type;
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
@ -79,7 +72,6 @@ connection slave;
|
||||
# Note that the above 'slave start' will cause a 3rd rotate event (a fake one)
|
||||
# to go into the relay log (the master always sends a fake one when replication
|
||||
# starts).
|
||||
start slave;
|
||||
let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%';
|
||||
--source include/wait_slave_status.inc
|
||||
sync_with_master;
|
||||
@ -87,6 +79,7 @@ sync_with_master;
|
||||
select * from t1 order by 1 asc;
|
||||
flush logs;
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
connection master;
|
||||
|
||||
# Create some entries for second log
|
||||
@ -95,6 +88,7 @@ eval create table t2 (n int)ENGINE=$engine_type;
|
||||
insert into t2 values (1);
|
||||
source include/show_binlog_events.inc;
|
||||
--replace_result $VERSION VERSION
|
||||
--replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /infile '.+'/infile 'words.dat'/
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
show binlog events in 'master-bin.000002';
|
||||
@ -102,10 +96,12 @@ show binary logs;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
sync_with_master;
|
||||
show binary logs;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /INFILE '.+'/INFILE 'words.dat'/
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
show binlog events in 'slave-bin.000001' from 4;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
|
||||
|
@ -259,12 +259,28 @@ DELETE FROM t1;
|
||||
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
|
||||
sync_slave_with_master;
|
||||
set @@global.slave_exec_mode= default;
|
||||
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
|
||||
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
disable_query_log;
|
||||
eval SELECT "$last_error" AS Last_SQL_Error;
|
||||
enable_query_log;
|
||||
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
|
||||
|
||||
# BUG#37076: TIMESTAMP/DATETIME values are not replicated correctly
|
||||
# between machines with mixed endiannes
|
||||
# (regression test)
|
||||
|
||||
--echo **** Test for BUG#37076 ****
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
|
||||
INSERT INTO t1 VALUES(
|
||||
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
|
||||
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master slave;
|
||||
SELECT * FROM t1;
|
||||
|
||||
#
|
||||
# cleanup
|
||||
#
|
||||
@ -272,3 +288,186 @@ query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#37426: RBR breaks for CHAR() UTF8 fields > 85 chars
|
||||
#
|
||||
|
||||
# We have 4 combinations to test with respect to the field length
|
||||
# (i.e., the number of bytes) of the CHAR fields:
|
||||
#
|
||||
# 1. Replicating from CHAR<256 to CHAR<256
|
||||
# 2. Replicating from CHAR<256 to CHAR>255
|
||||
# 3. Replicating from CHAR>255 to CHAR<256
|
||||
# 4. Replicating from CHAR>255 to CHAR>255
|
||||
|
||||
# We also make a special case of using the max size of a field on the
|
||||
# master, i.e. CHAR(255) in UTF-8, giving another three cases.
|
||||
#
|
||||
# 5. Replicating UTF-8 CHAR(255) to CHAR(<256)
|
||||
# 6. Replicating UTF-8 CHAR(255) to CHAR(>255)
|
||||
# 7. Replicating UTF-8 CHAR(255) to CHAR(255) UTF-8
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (i INT NOT NULL,
|
||||
c CHAR(16) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
eval CREATE TABLE t2 (i INT NOT NULL,
|
||||
c CHAR(16) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t3 (i INT NOT NULL,
|
||||
c CHAR(128) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t4 (i INT NOT NULL,
|
||||
c CHAR(128) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
eval CREATE TABLE t5 (i INT NOT NULL,
|
||||
c CHAR(255) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t6 (i INT NOT NULL,
|
||||
c CHAR(255) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
sync_slave_with_master;
|
||||
ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t7 (i INT NOT NULL,
|
||||
c CHAR(255) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, "", 1);
|
||||
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_table_1=master:test.t1;
|
||||
let $diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t2 VALUES (1, "", 1);
|
||||
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_table_1=master:test.t2;
|
||||
let $diff_table_2=slave:test.t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo [expecting slave to stop]
|
||||
connection master;
|
||||
INSERT INTO t3 VALUES (1, "", 1);
|
||||
INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
|
||||
|
||||
connection slave;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
disable_query_log;
|
||||
eval SELECT "$last_error" AS Last_SQL_Error;
|
||||
enable_query_log;
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t4 VALUES (1, "", 1);
|
||||
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_table_1=master:test.t4;
|
||||
let $diff_table_2=slave:test.t4;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo [expecting slave to stop]
|
||||
connection master;
|
||||
INSERT INTO t5 VALUES (1, "", 1);
|
||||
INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
|
||||
|
||||
connection slave;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
disable_query_log;
|
||||
eval SELECT "$last_error" AS Last_SQL_Error;
|
||||
enable_query_log;
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
|
||||
--echo [expecting slave to stop]
|
||||
connection master;
|
||||
INSERT INTO t6 VALUES (1, "", 1);
|
||||
INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
|
||||
|
||||
connection slave;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
disable_query_log;
|
||||
eval SELECT "$last_error" AS Last_SQL_Error;
|
||||
enable_query_log;
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t7 VALUES (1, "", 1);
|
||||
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_table_1=master:test.t7;
|
||||
let $diff_table_2=slave:test.t7;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1, t2, t3, t4, t5, t6, t7;
|
||||
sync_slave_with_master;
|
||||
|
||||
#
|
||||
# BUG#32709: Assertion failed: trx_data->empty(), file .\log.cc, line 1293
|
||||
#
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=$type;
|
||||
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
--error ER_DUP_ENTRY
|
||||
UPDATE t1 SET a = 10;
|
||||
INSERT INTO t1 VALUES (4);
|
||||
sync_slave_with_master;
|
||||
|
||||
let $diff_table_1=master:test.t1;
|
||||
let $diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
@ -4,354 +4,641 @@
|
||||
# Bug#3300
|
||||
# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
|
||||
#
|
||||
# two non-interfering UPDATE's not changing result set
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
# These variables have to be set before sourcing this script:
|
||||
# TRANSACTION ISOLATION LEVEL REPEATABLE READ
|
||||
# innodb_locks_unsafe_for_binlog 0 (default) or 1 (by
|
||||
# --innodb_locks_unsafe_for_binlog)
|
||||
# $engine_type storage engine to be tested
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/innodb_concurrent.test
|
||||
# main code went into include/concurrent.inc
|
||||
# 2008-06-03 KP test refactored; removed name locks, added comments.
|
||||
# renamed wrapper t/concurrent_innodb.test ->
|
||||
# t/concurrent_innodb_unsafelog.test
|
||||
# new wrapper t/concurrent_innodb_safelog.test
|
||||
#
|
||||
|
||||
connection default;
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
#
|
||||
# Show prerequisites for this test.
|
||||
#
|
||||
SELECT @@global.tx_isolation;
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
#
|
||||
# When innodb_locks_unsafe_for_binlog is not set (zero), which is the
|
||||
# default, InnoDB takes "next-key locks"/"gap locks". This means it
|
||||
# locks the gap before the keys that it accessed to find the rows to
|
||||
# use for a statement. In this case we have to expect some more lock
|
||||
# wait timeouts in the tests below as if innodb_locks_unsafe_for_binlog
|
||||
# is set (non-zero). In the latter case no "next-key locks"/"gap locks"
|
||||
# are taken and locks on keys that do not match the WHERE conditon are
|
||||
# released. Hence less lock collisions occur.
|
||||
# We use the variable $keep_locks to set the expectations for
|
||||
# lock wait timeouts accordingly.
|
||||
#
|
||||
let $keep_locks= `SELECT NOT @@global.innodb_locks_unsafe_for_binlog`;
|
||||
--echo # keep_locks == $keep_locks
|
||||
|
||||
#
|
||||
# Set up privileges and remove user level locks, if exist.
|
||||
#
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
|
||||
#
|
||||
# Preparatory cleanup.
|
||||
#
|
||||
DO release_lock("hello");
|
||||
DO release_lock("hello2");
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",1);
|
||||
connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send update t1 set eta=1+get_lock("hello",1)*0 where tipo=11;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
update t1 set eta=2 where tipo=22;
|
||||
select release_lock("hello");
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
commit;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# two UPDATE's running and one changing result set
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
select release_lock("hello");
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
commit;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two UPDATE's running and both changing distinct result sets
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
--echo ** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
|
||||
--echo ** connection thread2
|
||||
connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Start transaction for thread 2
|
||||
begin;
|
||||
--echo ** Update will cause a table scan and a new ULL will
|
||||
--echo ** be created and blocked on the first row where tipo=11.
|
||||
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Start new transaction for thread 1
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set eta=2 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set eta=2 where tipo=22;
|
||||
}
|
||||
--echo ** Release user level name lock from thread 1. This will cause the ULL
|
||||
--echo ** on thread 2 to end its wait.
|
||||
select release_lock("hello");
|
||||
--echo ** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Release the lock and collect result from update on thread 2
|
||||
reap;
|
||||
select release_lock("hello");
|
||||
--echo ** Table should have eta updates where tipo=11 but updates made by
|
||||
--echo ** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
--echo ** Sending commit on thread 2.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
--echo ** And send final commit on thread 1.
|
||||
commit;
|
||||
--echo ** Table should now be updated by both updates in the order of
|
||||
--echo ** thread 1,2.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# One UPDATE and one INSERT .... Monty's test
|
||||
#
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two UPDATE's running and one changing result set
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
--echo ** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
select get_lock("hello2",1000);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send update t1 set b=10+get_lock(concat("hello",a),1000)*0 where
|
||||
a=2;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
insert into t1 values (1,1);
|
||||
select release_lock("hello2");
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
sleep 1;
|
||||
connection thread2;
|
||||
reap;
|
||||
connection default;
|
||||
drop table t1;
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Start transaction on thread 2
|
||||
begin;
|
||||
--echo ** Update will cause a table scan.
|
||||
--echo ** This will cause a hang on the first row where tipo=1 until the
|
||||
--echo ** blocking ULL is released.
|
||||
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
sleep 1;
|
||||
|
||||
#
|
||||
# one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send select * from t1 where tipo=2 FOR UPDATE;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
--error 1205
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
connection default;
|
||||
drop table t1;
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Start transaction on thread 1
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
}
|
||||
--echo ** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
select release_lock("hello");
|
||||
--echo ** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
|
||||
#
|
||||
# one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send select * from t1 where tipo=2 FOR UPDATE;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
--error 1205
|
||||
update t1 set tipo=11+get_lock("hello",10)*0 where tipo=22;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
connection default;
|
||||
drop table t1;
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Release the lock and collect result from thread 2:
|
||||
reap;
|
||||
select release_lock("hello");
|
||||
--echo ** Seen from thread 2 the table should have been updated on four
|
||||
--echo ** places.
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
#
|
||||
# two SELECT ... FOR UPDATE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send select * from t1 where tipo=2 FOR UPDATE;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
--error 1205
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Thread 2 has committed but the result should remain the same for
|
||||
--echo ** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
commit;
|
||||
--echo ** After a commit the table should be merged with the previous
|
||||
--echo ** commit.
|
||||
--echo ** This select should show both updates:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# one UPDATE changing result set and DELETE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
--error 1205
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** One UPDATE and one INSERT .... Monty's test
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
--echo ** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
--echo ** Update will create a table scan which creates a ULL where a=2;
|
||||
--echo ** this will hang waiting on thread 1.
|
||||
send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Insert new values to t1 from thread 1; this created an implicit
|
||||
--echo ** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
--echo ** Release the ULL (thread 2 updates will finish).
|
||||
select release_lock("hello2");
|
||||
--echo ** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Collect results from thread 2 and release the lock.
|
||||
reap;
|
||||
select release_lock("hello2");
|
||||
--echo ** The table should look like the original+updates for thread 2,
|
||||
--echo ** and consist of new rows:
|
||||
select * from t1;
|
||||
--echo ** Commit changes from thread 2
|
||||
commit;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# one UPDATE not changing result set and DELETE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=22;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
--echo ** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Begin a new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Update the same range which is marked for update on thread 2; this
|
||||
--echo ** will hang because of row locks.
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
--echo ** After the update the table will be unmodified because the previous
|
||||
--echo ** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
--echo ** Sending a commit should release the row locks and enable
|
||||
--echo ** thread 1 to complete the transaction.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Commit on thread 1.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The table should not have been changed.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Even on thread 1:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
sleep 1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Starting new transaction on thread 2.
|
||||
begin;
|
||||
--echo ** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo
|
||||
--echo ** Starting new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Updating single row using a table scan. This will time out
|
||||
--echo ** because of ongoing transaction on thread 1 holding lock on
|
||||
--echo ** all primary keys in the scan.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
}
|
||||
--echo ** After the time out the transaction is aborted; no rows should
|
||||
--echo ** have changed.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The same thing should hold true for the transaction on
|
||||
--echo ** thread 2
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Even after committing:
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Begin a new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Selecting a range for update by table scan will be blocked
|
||||
--echo ** because of on-going transaction on thread 2.
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Table will be unchanged and the select command will not be
|
||||
--echo ** blocked:
|
||||
select * from t1;
|
||||
--echo ** Commit transacton on thread 2.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Commit transaction on thread 1.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE changing result set and DELETE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
begin;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE not changing result set and DELETE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
}
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
disconnect thread1;
|
||||
disconnect thread2;
|
||||
|
||||
|
@ -136,7 +136,7 @@ connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
|
||||
connection user3;
|
||||
select "user3";
|
||||
--replace_result 127.0.0.1 localhost
|
||||
--error ER_COLUMNACCESS_DENIED_ERROR
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from t1;
|
||||
select a from t1;
|
||||
--replace_result 127.0.0.1 localhost
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_big5.require
|
||||
disable_query_log;
|
||||
show collation like "big5_chinese_ci";
|
||||
show collation like 'big5_chinese_ci';
|
||||
enable_query_log;
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
-- require r/have_binlog_format_mixed.require
|
||||
disable_query_log;
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
|
@ -3,5 +3,5 @@
|
||||
--require r/have_binlog_format_row.require
|
||||
--disable_query_log
|
||||
--replace_result MIXED ROW
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
|
@ -4,5 +4,5 @@ source include/have_log_bin.inc;
|
||||
--require r/have_binlog_format_statement.require
|
||||
--disable_query_log
|
||||
--replace_result MIXED STATEMENT
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
-- require r/have_binlog_format_row.require
|
||||
disable_query_log;
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
|
@ -3,5 +3,5 @@
|
||||
-- require r/have_binlog_format_statement.require
|
||||
--disable_query_log
|
||||
--replace_result ROW STATEMENT
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
--enable_query_log
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
-- require r/have_binlog_format_statement.require
|
||||
disable_query_log;
|
||||
show variables like "binlog_format";
|
||||
show variables like 'binlog_format';
|
||||
enable_query_log;
|
||||
|
@ -3,5 +3,5 @@
|
||||
#
|
||||
--require r/have_bug25714.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$MYSQL_BUG25714") > 0 as "have_bug25714_exe";
|
||||
eval select LENGTH('$MYSQL_BUG25714') > 0 as 'have_bug25714_exe';
|
||||
enable_query_log;
|
||||
|
4
mysql-test/include/have_case_insensitive_file_system.inc
Normal file
4
mysql-test/include/have_case_insensitive_file_system.inc
Normal file
@ -0,0 +1,4 @@
|
||||
--require r/case_insensitive_file_system.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_file_system";
|
||||
--enable_query_log
|
@ -1,4 +1,4 @@
|
||||
--require r/case_sensitive_file_system.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_file_system";
|
||||
show variables like 'lower_case_file_system';
|
||||
--enable_query_log
|
||||
|
@ -1,4 +1,4 @@
|
||||
--require r/have_community_features.require
|
||||
--disable_query_log
|
||||
show variables like "have_community_features";
|
||||
show variables like 'have_community_features';
|
||||
--enable_query_log
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_compress.require
|
||||
disable_query_log;
|
||||
show variables like "have_compress";
|
||||
show variables like 'have_compress';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_cp1250_ch.require
|
||||
disable_query_log;
|
||||
show collation like "cp1250_czech_cs";
|
||||
show collation like 'cp1250_czech_cs';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_cp932.require
|
||||
disable_query_log;
|
||||
show collation like "cp932_japanese_ci";
|
||||
show collation like 'cp932_japanese_ci';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_crypt.require
|
||||
disable_query_log;
|
||||
show variables like "have_crypt";
|
||||
show variables like 'have_crypt';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_debug.require
|
||||
disable_query_log;
|
||||
select (version() like "%debug%") as debug;
|
||||
select (version() like '%debug%') as debug;
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_eucjpms.require
|
||||
disable_query_log;
|
||||
show collation like "eucjpms_japanese_ci";
|
||||
show collation like 'eucjpms_japanese_ci';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_euckr.require
|
||||
disable_query_log;
|
||||
show collation like "euckr_korean_ci";
|
||||
show collation like 'euckr_korean_ci';
|
||||
enable_query_log;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
--require r/have_dynamic_loading.require
|
||||
disable_query_log;
|
||||
show variables like "have_dynamic_loading";
|
||||
show variables like 'have_dynamic_loading';
|
||||
enable_query_log;
|
||||
|
||||
#
|
||||
@ -12,5 +12,5 @@ enable_query_log;
|
||||
#
|
||||
--require r/have_example_plugin.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$EXAMPLE_PLUGIN") > 0 as "have_example_plugin";
|
||||
eval select LENGTH('$EXAMPLE_PLUGIN') > 0 as 'have_example_plugin';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_gb2312.require
|
||||
disable_query_log;
|
||||
show collation like "gb2312_chinese_ci";
|
||||
show collation like 'gb2312_chinese_ci';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_gbk.require
|
||||
disable_query_log;
|
||||
show collation like "gbk_chinese_ci";
|
||||
show collation like 'gbk_chinese_ci';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
--require r/have_geometry.require
|
||||
--disable_query_log
|
||||
show variables like "have_geometry";
|
||||
show variables like 'have_geometry';
|
||||
--enable_query_log
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_latin2_ch.require
|
||||
disable_query_log;
|
||||
show collation like "latin2_czech_cs";
|
||||
show collation like 'latin2_czech_cs';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_log_bin.require
|
||||
disable_query_log;
|
||||
show variables like "log_bin";
|
||||
show variables like 'log_bin';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
--require r/lowercase0.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_%";
|
||||
show variables like "lower_case_table_names";
|
||||
--enable_query_log
|
||||
|
4
mysql-test/include/have_lowercase2.inc
Normal file
4
mysql-test/include/have_lowercase2.inc
Normal file
@ -0,0 +1,4 @@
|
||||
--require r/lowercase2.require
|
||||
--disable_query_log
|
||||
show variables like 'lower_case_table_names';
|
||||
--enable_query_log
|
@ -1,4 +1,4 @@
|
||||
--require r/have_ndbapi_examples.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$MY_NDB_EXAMPLES_BINARY") > 0 as "have_ndb_example";
|
||||
eval select LENGTH('$MY_NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example';
|
||||
enable_query_log;
|
||||
|
@ -1,5 +1,5 @@
|
||||
-- require r/have_outfile.require
|
||||
disable_query_log;
|
||||
select load_file(concat(@tmpdir,"/outfile.test"));
|
||||
select load_file(concat(@tmpdir,'/outfile.test'));
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/outfile.test
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_partition.require
|
||||
disable_query_log;
|
||||
show variables like "have_partitioning";
|
||||
show variables like 'have_partitioning';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_query_cache.require
|
||||
disable_query_log;
|
||||
show variables like "have_query_cache";
|
||||
show variables like 'have_query_cache';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_sjis.require
|
||||
disable_query_log;
|
||||
show collation like "sjis_japanese_ci";
|
||||
show collation like 'sjis_japanese_ci';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_ssl.require
|
||||
disable_query_log;
|
||||
show variables like "have_ssl";
|
||||
show variables like 'have_ssl';
|
||||
enable_query_log;
|
||||
|
@ -6,5 +6,5 @@
|
||||
-- require r/have_symlink.require
|
||||
|
||||
disable_query_log;
|
||||
show variables like "have_symlink";
|
||||
show variables like 'have_symlink';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_tis620.require
|
||||
disable_query_log;
|
||||
show collation like "tis620_thai_ci";
|
||||
show collation like 'tis620_thai_ci';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_ucs2.require
|
||||
disable_query_log;
|
||||
show collation like "ucs2_general_ci";
|
||||
show collation like 'ucs2_general_ci';
|
||||
enable_query_log;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
--require r/have_dynamic_loading.require
|
||||
disable_query_log;
|
||||
show variables like "have_dynamic_loading";
|
||||
show variables like 'have_dynamic_loading';
|
||||
enable_query_log;
|
||||
|
||||
#
|
||||
@ -12,5 +12,5 @@ enable_query_log;
|
||||
#
|
||||
--require r/have_udf_example.require
|
||||
disable_query_log;
|
||||
eval select LENGTH("$UDF_EXAMPLE_LIB") > 0 as "have_udf_example_lib";
|
||||
eval select LENGTH('$UDF_EXAMPLE_LIB') > 0 as 'have_udf_example_lib';
|
||||
enable_query_log;
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- require r/have_ujis.require
|
||||
disable_query_log;
|
||||
show collation like "ujis_japanese_ci";
|
||||
show collation like 'ujis_japanese_ci';
|
||||
enable_query_log;
|
||||
|
@ -487,3 +487,18 @@ select * from t2 where a=4 or b=4;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Bug #37943: Reproducible mysqld crash/sigsegv in sel_trees_can_be_ored
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a varchar(8), b set('a','b','c','d','e','f','g','h'),
|
||||
KEY b(b), KEY a(a));
|
||||
INSERT INTO t1 VALUES ('y',''), ('z','');
|
||||
|
||||
#should not crash
|
||||
SELECT b,a from t1 WHERE (b!='c' AND b!='f' && b!='h') OR
|
||||
(a='pure-S') OR (a='DE80337a') OR (a='DE80799');
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -1103,6 +1103,24 @@ set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency;
|
||||
set global innodb_commit_concurrency=0;
|
||||
set global innodb_commit_concurrency=@my_innodb_commit_concurrency;
|
||||
|
||||
#
|
||||
# Bug #37830: ORDER BY ASC/DESC - no difference
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY (a), KEY t1_b (b))
|
||||
ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 (a,b,c) VALUES (1,1,1), (2,1,1), (3,1,1), (4,1,1);
|
||||
INSERT INTO t1 (a,b,c) SELECT a+4,b,c FROM t1;
|
||||
|
||||
# should be range access
|
||||
EXPLAIN SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
|
||||
# should produce '8 7 6 5 4' for a
|
||||
SELECT a, b, c FROM t1 WHERE b = 1 ORDER BY a DESC LIMIT 5;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
|
||||
@ -1238,6 +1256,7 @@ 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;
|
||||
|
||||
@ -1428,29 +1447,31 @@ DROP TABLE t1;
|
||||
# Bug#21704: Renaming column does not update FK definition.
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1(id INT PRIMARY KEY)
|
||||
ENGINE=innodb;
|
||||
|
||||
CREATE TABLE t2(
|
||||
t1_id INT PRIMARY KEY,
|
||||
CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
|
||||
ENGINE=innodb;
|
||||
|
||||
--echo
|
||||
|
||||
--disable_result_log
|
||||
--error ER_ERROR_ON_RENAME
|
||||
ALTER TABLE t1 CHANGE id id2 INT;
|
||||
--enable_result_log
|
||||
|
||||
--echo
|
||||
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# --disable_warnings
|
||||
# DROP TABLE IF EXISTS t1;
|
||||
# DROP TABLE IF EXISTS t2;
|
||||
# --enable_warnings
|
||||
#
|
||||
# CREATE TABLE t1(id INT PRIMARY KEY)
|
||||
# ENGINE=innodb;
|
||||
#
|
||||
# CREATE TABLE t2(
|
||||
# t1_id INT PRIMARY KEY,
|
||||
# CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id))
|
||||
# ENGINE=innodb;
|
||||
#
|
||||
# --echo
|
||||
#
|
||||
# --disable_result_log
|
||||
# --error ER_ERROR_ON_RENAME
|
||||
# ALTER TABLE t1 CHANGE id id2 INT;
|
||||
# --enable_result_log
|
||||
#
|
||||
# --echo
|
||||
#
|
||||
# DROP TABLE t2;
|
||||
# DROP TABLE t1;
|
||||
#
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
1922
mysql-test/include/mysqlbinlog_row_engine.inc
Normal file
1922
mysql-test/include/mysqlbinlog_row_engine.inc
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--exec rm -f $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--error 0,1
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/tmp.dat
|
||||
--let ndb_restore_opts=
|
||||
--let ndb_restore_filter=
|
||||
|
25
mysql-test/include/ps_ddl_1.inc
Normal file
25
mysql-test/include/ps_ddl_1.inc
Normal file
@ -0,0 +1,25 @@
|
||||
# include/ps_ddl_1.inc
|
||||
#
|
||||
# Auxiliary script to be used in ps_ddl.test
|
||||
#
|
||||
|
||||
prepare stmt_sf from 'select f_12093();';
|
||||
prepare stmt_sp from 'call p_12093(f_12093())';
|
||||
execute stmt_sf;
|
||||
execute stmt_sp;
|
||||
|
||||
connection con1;
|
||||
eval $my_drop;
|
||||
#
|
||||
connection default;
|
||||
--echo # XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
--echo # XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
#
|
||||
--echo # XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
--echo # XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
|
||||
connection default;
|
@ -4,7 +4,7 @@ if (!$binlog_start)
|
||||
{
|
||||
let $binlog_start=106;
|
||||
}
|
||||
--replace_result $binlog_start <binlog_start>
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
|
||||
--replace_column 2 # 4 # 5 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
|
||||
--eval show binlog events from $binlog_start
|
||||
|
59
mysql-test/include/wait_condition.inc.moved
Normal file
59
mysql-test/include/wait_condition.inc.moved
Normal file
@ -0,0 +1,59 @@
|
||||
# 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;
|
||||
}
|
||||
|
||||
--enable_query_log
|
27
mysql-test/include/wait_for_slave_sql_error_and_skip.inc
Normal file
27
mysql-test/include/wait_for_slave_sql_error_and_skip.inc
Normal file
@ -0,0 +1,27 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Wait for slave SQL error, skip the erroneous statement and restart
|
||||
# slave
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# let show_sql_error=0|1;
|
||||
# source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
|
||||
echo --source include/wait_for_slave_sql_error_and_skip.inc;
|
||||
connection slave;
|
||||
source include/wait_for_slave_sql_error.inc;
|
||||
if ($show_sql_error)
|
||||
{
|
||||
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
echo Last_SQL_Error = $error;
|
||||
}
|
||||
|
||||
# wait for SQL thread to stop after the error
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
|
||||
# skip the erroneous statement
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
connection master;
|
@ -433,41 +433,51 @@ sub optimize_cases {
|
||||
# Skip processing if already marked as skipped
|
||||
next if $tinfo->{skip};
|
||||
|
||||
# Replication test needs an adjustment of binlog format
|
||||
if (mtr_match_prefix($tinfo->{'name'}, "rpl"))
|
||||
# =======================================================
|
||||
# If a special binlog format was selected with
|
||||
# --mysqld=--binlog-format=x, skip all test that does not
|
||||
# support it
|
||||
# =======================================================
|
||||
#print "used_binlog_format: $::used_binlog_format\n";
|
||||
if (defined $::used_binlog_format )
|
||||
{
|
||||
# =======================================================
|
||||
# Fixed --binlog-format=x specified on command line
|
||||
# =======================================================
|
||||
if ( defined $tinfo->{'binlog_formats'} )
|
||||
{
|
||||
#print "binlog_formats: ". join(", ", @{$tinfo->{binlog_formats}})."\n";
|
||||
|
||||
# The test supports different binlog formats
|
||||
# check if the selected one is ok
|
||||
my $supported=
|
||||
grep { $_ eq $::used_binlog_format } @{$tinfo->{'binlog_formats'}};
|
||||
if ( !$supported )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
$tinfo->{'comment'}=
|
||||
"Doesn't support --binlog-format='$::used_binlog_format'";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
# =======================================================
|
||||
# Use dynamic switching of binlog format
|
||||
# =======================================================
|
||||
|
||||
# Get binlog-format used by this test from master_opt
|
||||
# =======================================================
|
||||
my $test_binlog_format;
|
||||
foreach my $opt ( @{$tinfo->{master_opt}} ) {
|
||||
$test_binlog_format= $test_binlog_format ||
|
||||
mtr_match_prefix($opt, "--binlog-format=");
|
||||
}
|
||||
# print $tinfo->{name}." uses ".$test_binlog_format."\n";
|
||||
|
||||
# =======================================================
|
||||
# If a special binlog format was selected with
|
||||
# --mysqld=--binlog-format=x, skip all test with different
|
||||
# binlog-format
|
||||
# =======================================================
|
||||
if (defined $::used_binlog_format and
|
||||
$test_binlog_format and
|
||||
$::used_binlog_format ne $test_binlog_format)
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
$tinfo->{'comment'}= "Requires --binlog-format='$test_binlog_format'";
|
||||
next;
|
||||
$test_binlog_format=
|
||||
mtr_match_prefix($opt, "--binlog-format=") || $test_binlog_format;
|
||||
}
|
||||
|
||||
# =======================================================
|
||||
# Check that testcase supports the designated binlog-format
|
||||
# =======================================================
|
||||
if ($test_binlog_format and defined $tinfo->{'sup_binlog_formats'} )
|
||||
if (defined $test_binlog_format and
|
||||
defined $tinfo->{binlog_formats} )
|
||||
{
|
||||
my $supported=
|
||||
grep { $_ eq $test_binlog_format } @{$tinfo->{'sup_binlog_formats'}};
|
||||
grep { $_ eq $test_binlog_format } @{$tinfo->{'binlog_formats'}};
|
||||
if ( !$supported )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
@ -476,20 +486,8 @@ sub optimize_cases {
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
# =======================================================
|
||||
# Use dynamic switching of binlog-format if mtr started
|
||||
# w/o --mysqld=--binlog-format=xxx and combinations.
|
||||
# =======================================================
|
||||
if (!defined $tinfo->{'combination'} and
|
||||
!defined $::used_binlog_format)
|
||||
{
|
||||
$test_binlog_format= $tinfo->{'sup_binlog_formats'}->[0];
|
||||
}
|
||||
|
||||
# Save binlog format for dynamic switching
|
||||
$tinfo->{binlog_format}= $test_binlog_format;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -773,6 +771,13 @@ sub collect_one_test_case($$$$$$$$$) {
|
||||
if ( $::used_default_engine =~ /^innodb/i );
|
||||
}
|
||||
|
||||
#enable federated for this test
|
||||
if ($tinfo->{'federated_test'})
|
||||
{
|
||||
push(@{$tinfo->{'master_opt'}}, "--loose-federated");
|
||||
push(@{$tinfo->{'slave_opt'}}, "--loose-federated");
|
||||
}
|
||||
|
||||
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
|
||||
{
|
||||
$tinfo->{'skip'}= 1;
|
||||
@ -872,18 +877,19 @@ sub collect_one_test_case($$$$$$$$$) {
|
||||
# the specified value in "tinfo"
|
||||
our @tags=
|
||||
(
|
||||
["include/have_innodb.inc", "innodb_test", 1],
|
||||
["include/have_binlog_format_row.inc", "sup_binlog_formats", ["row"]],
|
||||
["include/have_log_bin.inc", "need_binlog", 1],
|
||||
["include/have_binlog_format_statement.inc",
|
||||
"sup_binlog_formats", ["statement"]],
|
||||
["include/have_binlog_format_mixed.inc", "sup_binlog_formats", ["mixed"]],
|
||||
|
||||
["include/have_binlog_format_row.inc", "binlog_formats", ["row"]],
|
||||
["include/have_binlog_format_statement.inc", "binlog_formats", ["statement"]],
|
||||
["include/have_binlog_format_mixed.inc", "binlog_formats", ["mixed"]],
|
||||
["include/have_binlog_format_mixed_or_row.inc",
|
||||
"sup_binlog_formats", ["mixed","row"]],
|
||||
"binlog_formats", ["mixed", "row"]],
|
||||
["include/have_binlog_format_mixed_or_statement.inc",
|
||||
"sup_binlog_formats", ["mixed","statement"]],
|
||||
"binlog_formats", ["mixed", "statement"]],
|
||||
["include/have_binlog_format_row_or_statement.inc",
|
||||
"sup_binlog_formats", ["row","statement"]],
|
||||
"binlog_formats", ["row", "statement"]],
|
||||
|
||||
["include/have_innodb.inc", "innodb_test", 1],
|
||||
["include/have_log_bin.inc", "need_binlog", 1],
|
||||
["include/big_test.inc", "big_test", 1],
|
||||
["include/have_debug.inc", "need_debug", 1],
|
||||
["include/have_ndb.inc", "ndb_test", 1],
|
||||
@ -891,6 +897,8 @@ our @tags=
|
||||
["include/have_ndb_extra.inc", "ndb_extra", 1],
|
||||
["include/ndb_master-slave.inc", "ndb_test", 1],
|
||||
["require_manager", "require_manager", 1],
|
||||
["include/federated.inc", "federated_test", 1],
|
||||
["include/have_federated_db.inc", "federated_test", 1],
|
||||
);
|
||||
|
||||
sub mtr_options_from_test_file($$) {
|
||||
|
@ -312,7 +312,7 @@ sub mtr_report_stats ($) {
|
||||
/Slave: According to the master's version/ or
|
||||
/Slave: Column [0-9]* type mismatch/ or
|
||||
/Slave: Error .* doesn't exist/ or
|
||||
/Slave: Error .*Deadlock found/ or
|
||||
/Slave: Deadlock found/ or
|
||||
/Slave: Error .*Unknown table/ or
|
||||
/Slave: Error in Write_rows event: / or
|
||||
/Slave: Field .* of table .* has no default value/ or
|
||||
@ -327,7 +327,6 @@ sub mtr_report_stats ($) {
|
||||
/Sort aborted/ or
|
||||
/Time-out in NDB/ or
|
||||
/One can only use the --user.*root/ or
|
||||
/Setting lower_case_table_names=2/ or
|
||||
/Table:.* on (delete|rename)/ or
|
||||
/You have an error in your SQL syntax/ or
|
||||
/deprecated/ or
|
||||
@ -402,7 +401,18 @@ sub mtr_report_stats ($) {
|
||||
)) or
|
||||
|
||||
# Test case for Bug#31590 produces the following error:
|
||||
/Out of sort memory; increase server sort buffer size/
|
||||
/Out of sort memory; increase server sort buffer size/ or
|
||||
|
||||
# Bug#35161, test of auto repair --myisam-recover
|
||||
/able.*_will_crash/ or
|
||||
|
||||
# lowercase_table3 using case sensitive option on
|
||||
# case insensitive filesystem (InnoDB error).
|
||||
/Cannot find or open table test\/BUG29839 from/ or
|
||||
|
||||
# When trying to set lower_case_table_names = 2
|
||||
# on a case sensitive file system. Bug#37402.
|
||||
/lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
|
||||
)
|
||||
{
|
||||
next; # Skip these lines
|
||||
|
@ -112,6 +112,7 @@ our $glob_basedir;
|
||||
|
||||
our $path_charsetsdir;
|
||||
our $path_client_bindir;
|
||||
our $path_client_libdir;
|
||||
our $path_share;
|
||||
our $path_language;
|
||||
our $path_timefile;
|
||||
@ -250,7 +251,7 @@ our $opt_sleep;
|
||||
our $opt_testcase_timeout;
|
||||
our $opt_suite_timeout;
|
||||
my $default_testcase_timeout= 15; # 15 min max
|
||||
my $default_suite_timeout= 180; # 3 hours max
|
||||
my $default_suite_timeout= 300; # 5 hours max
|
||||
|
||||
our $opt_start_and_exit;
|
||||
our $opt_start_dirty;
|
||||
@ -657,6 +658,8 @@ sub command_line_setup () {
|
||||
'vardir=s' => \$opt_vardir,
|
||||
'benchdir=s' => \$glob_mysql_bench_dir,
|
||||
'mem' => \$opt_mem,
|
||||
'client-bindir=s' => \$path_client_bindir,
|
||||
'client-libdir=s' => \$path_client_libdir,
|
||||
|
||||
# Misc
|
||||
'report-features' => \$opt_report_features,
|
||||
@ -783,12 +786,20 @@ sub command_line_setup () {
|
||||
#
|
||||
|
||||
# Look for the client binaries directory
|
||||
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
|
||||
"$glob_basedir/client_debug",
|
||||
vs_config_dirs('client', ''),
|
||||
"$glob_basedir/client",
|
||||
"$glob_basedir/bin");
|
||||
|
||||
if ($path_client_bindir)
|
||||
{
|
||||
# --client-bindir=path set on command line, check that the path exists
|
||||
$path_client_bindir= mtr_path_exists($path_client_bindir);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
|
||||
"$glob_basedir/client_debug",
|
||||
vs_config_dirs('client', ''),
|
||||
"$glob_basedir/client",
|
||||
"$glob_basedir/bin");
|
||||
}
|
||||
|
||||
# Look for language files and charsetsdir, use same share
|
||||
$path_share= mtr_path_exists("$glob_basedir/share/mysql",
|
||||
"$glob_basedir/sql/share",
|
||||
@ -1568,13 +1579,15 @@ sub executable_setup_ndb () {
|
||||
|
||||
$exe_ndbd=
|
||||
mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd",
|
||||
"$ndb_path/ndbd");
|
||||
"$ndb_path/ndbd",
|
||||
"$glob_basedir/libexec/ndbd");
|
||||
$exe_ndb_mgm=
|
||||
mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm",
|
||||
"$ndb_path/ndb_mgm");
|
||||
$exe_ndb_mgmd=
|
||||
mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd",
|
||||
"$ndb_path/ndb_mgmd");
|
||||
"$ndb_path/ndb_mgmd",
|
||||
"$glob_basedir/libexec/ndb_mgmd");
|
||||
$exe_ndb_waiter=
|
||||
mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter",
|
||||
"$ndb_path/ndb_waiter");
|
||||
@ -1671,7 +1684,8 @@ sub executable_setup () {
|
||||
# Look for mysql_fix_privilege_tables.sql script
|
||||
$file_mysql_fix_privilege_tables=
|
||||
mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
|
||||
"$glob_basedir/share/mysql_fix_privilege_tables.sql");
|
||||
"$glob_basedir/share/mysql_fix_privilege_tables.sql",
|
||||
"$glob_basedir/share/mysql/mysql_fix_privilege_tables.sql");
|
||||
|
||||
if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
|
||||
{
|
||||
@ -1837,19 +1851,25 @@ sub environment_setup () {
|
||||
|
||||
my @ld_library_paths;
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
|
||||
# are used in favor of the system installed ones
|
||||
# --------------------------------------------------------------------------
|
||||
if ( $source_dist )
|
||||
if ($path_client_libdir)
|
||||
{
|
||||
push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
|
||||
"$glob_basedir/libmysql_r/.libs/",
|
||||
"$glob_basedir/zlib.libs/");
|
||||
# Use the --client-libdir passed on commandline
|
||||
push(@ld_library_paths, "$path_client_libdir");
|
||||
}
|
||||
else
|
||||
{
|
||||
push(@ld_library_paths, "$glob_basedir/lib");
|
||||
# Setup LD_LIBRARY_PATH so the libraries from this distro/clone
|
||||
# are used in favor of the system installed ones
|
||||
if ( $source_dist )
|
||||
{
|
||||
push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
|
||||
"$glob_basedir/libmysql_r/.libs/",
|
||||
"$glob_basedir/zlib.libs/");
|
||||
}
|
||||
else
|
||||
{
|
||||
push(@ld_library_paths, "$glob_basedir/lib");
|
||||
}
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@ -2091,6 +2111,9 @@ sub environment_setup () {
|
||||
{
|
||||
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
|
||||
}
|
||||
# Always use the given tmpdir for the LOAD files created
|
||||
# by mysqlbinlog
|
||||
$cmdline_mysqlbinlog .=" --local-load=$opt_tmpdir";
|
||||
|
||||
if ( $opt_debug )
|
||||
{
|
||||
@ -3578,7 +3601,16 @@ sub run_testcase ($) {
|
||||
{
|
||||
mtr_timer_stop_all($glob_timers);
|
||||
mtr_report("\nServers started, exiting");
|
||||
exit(0);
|
||||
if ($glob_win32_perl)
|
||||
{
|
||||
#ActiveState perl hangs when using normal exit, use POSIX::_exit instead
|
||||
use POSIX qw[ _exit ];
|
||||
POSIX::_exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@ -4334,19 +4366,10 @@ sub run_testcase_need_master_restart($)
|
||||
elsif (! mtr_same_opts($master->[0]->{'start_opts'},
|
||||
$tinfo->{'master_opt'}) )
|
||||
{
|
||||
# Chech that diff is binlog format only
|
||||
my $diff_opts= mtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'});
|
||||
if (scalar(@$diff_opts) eq 2)
|
||||
{
|
||||
$do_restart= 1 unless ($diff_opts->[0] =~/^--binlog-format=/ and $diff_opts->[1] =~/^--binlog-format=/);
|
||||
}
|
||||
else
|
||||
{
|
||||
$do_restart= 1;
|
||||
mtr_verbose("Restart master: running with different options '" .
|
||||
join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
|
||||
$do_restart= 1;
|
||||
mtr_verbose("Restart master: running with different options '" .
|
||||
join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
|
||||
join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
|
||||
}
|
||||
}
|
||||
elsif( ! $master->[0]->{'pid'} )
|
||||
{
|
||||
@ -5357,6 +5380,8 @@ Misc options
|
||||
warnings | log-warnings Pass --log-warnings to mysqld
|
||||
|
||||
sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time
|
||||
client-bindir=PATH Path to the directory where client binaries are located
|
||||
client-libdir=PATH Path to the directory where client libraries are located
|
||||
|
||||
Deprecated options
|
||||
with-openssl Deprecated option for ssl
|
||||
|
@ -1184,3 +1184,60 @@ check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (id int, c int) character set latin1;
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
ALTER TABLE t1 CHANGE c d int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE d c int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 MODIFY c VARCHAR(10);
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE c d varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE d c varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (id int, c int) character set utf8;
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
ALTER TABLE t1 CHANGE c d int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE d c int;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 MODIFY c VARCHAR(10);
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE c d varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 CHANGE d c varchar(10);
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
DROP TABLE t1;
|
||||
create table t1(f1 int not null, f2 int not null, key (f1), key (f2));
|
||||
select index_length into @unpaked_keys_size from
|
||||
information_schema.tables where table_name='t1';
|
||||
alter table t1 pack_keys=1;
|
||||
select index_length into @paked_keys_size from
|
||||
information_schema.tables where table_name='t1';
|
||||
select (@unpaked_keys_size > @paked_keys_size);
|
||||
(@unpaked_keys_size > @paked_keys_size)
|
||||
1
|
||||
select max_data_length into @orig_max_data_length from
|
||||
information_schema.tables where table_name='t1';
|
||||
alter table t1 max_rows=100;
|
||||
select max_data_length into @changed_max_data_length from
|
||||
information_schema.tables where table_name='t1';
|
||||
select (@orig_max_data_length > @changed_max_data_length);
|
||||
(@orig_max_data_length > @changed_max_data_length)
|
||||
1
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
@ -454,3 +454,11 @@ select last_insert_id();
|
||||
last_insert_id()
|
||||
3
|
||||
drop table t1;
|
||||
create table t1 (a int primary key auto_increment, b int, c int, e int, d timestamp default current_timestamp, unique(b),unique(c),unique(e));
|
||||
insert into t1 values(null,1,1,1,now());
|
||||
insert into t1 values(null,0,0,0,null);
|
||||
replace into t1 values(null,1,0,2,null);
|
||||
select last_insert_id();
|
||||
last_insert_id()
|
||||
3
|
||||
drop table t1;
|
||||
|
2
mysql-test/r/case_insensitive_file_system.require
Normal file
2
mysql-test/r/case_insensitive_file_system.require
Normal file
@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
lower_case_file_system ON
|
@ -1,5 +1,6 @@
|
||||
set @old_concurrent_insert= @@global.concurrent_insert;
|
||||
set @@global.concurrent_insert= 0;
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
`a&b` int,
|
||||
`a<b` int,
|
||||
|
@ -45,7 +45,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';*' at line 1
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';";
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!98765' AND b = 'bar'' at line 1
|
||||
prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!98765' AND b = 'bar';*";
|
||||
|
@ -90,4 +90,9 @@ Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
|
||||
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a TIMESTAMP);
|
||||
INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
|
||||
SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
|
||||
a
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
803
mysql-test/r/concurrent_innodb_safelog.result
Normal file
803
mysql-test/r/concurrent_innodb_safelog.result
Normal file
@ -0,0 +1,803 @@
|
||||
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
@@global.innodb_locks_unsafe_for_binlog
|
||||
0
|
||||
# keep_locks == 1
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
DO release_lock("hello");
|
||||
DO release_lock("hello2");
|
||||
drop table if exists t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and both changing distinct result sets
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction for thread 2
|
||||
begin;
|
||||
** Update will cause a table scan and a new ULL will
|
||||
** be created and blocked on the first row where tipo=11.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
** connection thread1
|
||||
** Start new transaction for thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set eta=2 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** Release user level name lock from thread 1. This will cause the ULL
|
||||
** on thread 2 to end its wait.
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from update on thread 2
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Table should have eta updates where tipo=11 but updates made by
|
||||
** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending commit on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** And send final commit on thread 1.
|
||||
commit;
|
||||
** Table should now be updated by both updates in the order of
|
||||
** thread 1,2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and one changing result set
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction on thread 2
|
||||
begin;
|
||||
** Update will cause a table scan.
|
||||
** This will cause a hang on the first row where tipo=1 until the
|
||||
** blocking ULL is released.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
** connection thread1
|
||||
** Start transaction on thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from thread 2:
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Seen from thread 2 the table should have been updated on four
|
||||
** places.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
** Thread 2 has committed but the result should remain the same for
|
||||
** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** After a commit the table should be merged with the previous
|
||||
** commit.
|
||||
** This select should show both updates:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** One UPDATE and one INSERT .... Monty's test
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
get_lock("hello2",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
** Update will create a table scan which creates a ULL where a=2;
|
||||
** this will hang waiting on thread 1.
|
||||
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
** connection thread1
|
||||
** Insert new values to t1 from thread 1; this created an implicit
|
||||
** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
** Release the ULL (thread 2 updates will finish).
|
||||
select release_lock("hello2");
|
||||
release_lock("hello2")
|
||||
1
|
||||
** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** connection thread2
|
||||
** Collect results from thread 2 and release the lock.
|
||||
select release_lock("hello2");
|
||||
release_lock("hello2")
|
||||
1
|
||||
** The table should look like the original+updates for thread 2,
|
||||
** and consist of new rows:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 10
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** Commit changes from thread 2
|
||||
commit;
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Update the same range which is marked for update on thread 2; this
|
||||
** will hang because of row locks.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the update the table will be unmodified because the previous
|
||||
** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending a commit should release the row locks and enable
|
||||
** thread 1 to complete the transaction.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** The table should not have been changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Even on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Starting new transaction on thread 2.
|
||||
begin;
|
||||
** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
|
||||
** Starting new transaction on thread 1
|
||||
begin;
|
||||
** Updating single row using a table scan. This will time out
|
||||
** because of ongoing transaction on thread 1 holding lock on
|
||||
** all primary keys in the scan.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the time out the transaction is aborted; no rows should
|
||||
** have changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The same thing should hold true for the transaction on
|
||||
** thread 2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
** Even after committing:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Selecting a range for update by table scan will be blocked
|
||||
** because of on-going transaction on thread 2.
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** connection thread2
|
||||
** Table will be unchanged and the select command will not be
|
||||
** blocked:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Commit transacton on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit transaction on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
@ -1,109 +1,22 @@
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
@@global.innodb_locks_unsafe_for_binlog
|
||||
1
|
||||
# keep_locks == 0
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
DO release_lock("hello");
|
||||
DO release_lock("hello2");
|
||||
drop table if exists t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
|
||||
**
|
||||
** two UPDATE's running and both changing distinct result sets
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",1);
|
||||
get_lock("hello",1)
|
||||
1
|
||||
begin;
|
||||
update t1 set eta=1+get_lock("hello",1)*0 where tipo=11;
|
||||
begin;
|
||||
update t1 set eta=2 where tipo=22;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -116,16 +29,173 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
0
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction for thread 2
|
||||
begin;
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
** Update will cause a table scan and a new ULL will
|
||||
** be created and blocked on the first row where tipo=11.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
** connection thread1
|
||||
** Start new transaction for thread 1
|
||||
begin;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set eta=2 where tipo=22;
|
||||
** Release user level name lock from thread 1. This will cause the ULL
|
||||
** on thread 2 to end its wait.
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
0
|
||||
1
|
||||
** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from update on thread 2
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Table should have eta updates where tipo=11 but updates made by
|
||||
** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending commit on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** And send final commit on thread 1.
|
||||
commit;
|
||||
** Table should now be updated by both updates in the order of
|
||||
** thread 1,2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and one changing result set
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction on thread 2
|
||||
begin;
|
||||
** Update will cause a table scan.
|
||||
** This will cause a hang on the first row where tipo=1 until the
|
||||
** blocking ULL is released.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
** connection thread1
|
||||
** Start transaction on thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -139,6 +209,13 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from thread 2:
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Seen from thread 2 the table should have been updated on four
|
||||
** places.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -152,7 +229,10 @@ eta tipo c
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
commit;
|
||||
** connection thread1
|
||||
** Thread 2 has committed but the result should remain the same for
|
||||
** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -167,19 +247,9 @@ eta tipo c
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** After a commit the table should be merged with the previous
|
||||
** commit.
|
||||
** This select should show both updates:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -193,6 +263,7 @@ eta tipo c
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -206,19 +277,50 @@ eta tipo c
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** One UPDATE and one INSERT .... Monty's test
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
select get_lock("hello2",1000);
|
||||
get_lock("hello2",1000)
|
||||
** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
get_lock("hello2",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
update t1 set b=10+get_lock(concat("hello",a),1000)*0 where
|
||||
a=2;
|
||||
** Update will create a table scan which creates a ULL where a=2;
|
||||
** this will hang waiting on thread 1.
|
||||
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
** connection thread1
|
||||
** Insert new values to t1 from thread 1; this created an implicit
|
||||
** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
** Release the ULL (thread 2 updates will finish).
|
||||
select release_lock("hello2");
|
||||
release_lock("hello2")
|
||||
1
|
||||
** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
@ -226,6 +328,13 @@ a b
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** connection thread2
|
||||
** Collect results from thread 2 and release the lock.
|
||||
select release_lock("hello2");
|
||||
release_lock("hello2")
|
||||
1
|
||||
** The table should look like the original+updates for thread 2,
|
||||
** and consist of new rows:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
@ -233,90 +342,17 @@ a b
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** Commit changes from thread 2
|
||||
commit;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -329,17 +365,24 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
update t1 set tipo=11+get_lock("hello",10)*0 where tipo=22;
|
||||
** Update the same range which is marked for update on thread 2; this
|
||||
** will hang because of row locks.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the update the table will be unmodified because the previous
|
||||
** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -353,10 +396,8 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread2
|
||||
** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -370,8 +411,14 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** Sending a commit should release the row locks and enable
|
||||
** thread 1 to complete the transaction.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** The table should not have been changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -385,6 +432,8 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Even on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -398,7 +447,15 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -411,21 +468,127 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Starting new transaction on thread 2.
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
|
||||
** Starting new transaction on thread 1
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Updating single row using a table scan. This will time out
|
||||
** because of ongoing transaction on thread 1 holding lock on
|
||||
** all primary keys in the scan.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
** After the time out the transaction is aborted; no rows should
|
||||
** have changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The same thing should hold true for the transaction on
|
||||
** thread 2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
** Even after committing:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Selecting a range for update by table scan will be blocked
|
||||
** because of on-going transaction on thread 2.
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread2
|
||||
** Table will be unchanged and the select command will not be
|
||||
** blocked:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -439,8 +602,13 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** Commit transacton on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit transaction on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -454,6 +622,8 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -467,7 +637,15 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -480,16 +658,12 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
@ -504,6 +678,7 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -514,8 +689,10 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -526,6 +703,7 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -536,7 +714,15 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -549,16 +735,17 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=22;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -572,6 +759,7 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -582,8 +770,10 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -594,6 +784,7 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -604,4 +795,5 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
@ -1559,6 +1559,19 @@ SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 c1 1 c1 A NULL NULL NULL YES BTREE
|
||||
DROP TABLE t1;
|
||||
create user mysqltest_1@'test@test';
|
||||
ERROR HY000: Malformed hostname (illegal symbol: '@')
|
||||
CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
|
||||
INSERT IGNORE INTO t1 (b) VALUES (5);
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
|
||||
SELECT a FROM t1;
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
insert into t1 values (1,1),(1,2);
|
||||
|
@ -5388,4 +5388,10 @@ select * from t1;
|
||||
c1
|
||||
That
|
||||
drop table t1;
|
||||
create table t1 (a int not null) engine=csv;
|
||||
lock tables t1 read;
|
||||
select * from t1;
|
||||
ERROR HY000: File './test/t1.CSV' not found (Errcode: 2)
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
@ -40,9 +40,9 @@ IN ind DECIMAL(10,2))
|
||||
BEGIN
|
||||
INSERT INTO t4 VALUES (ins1, ins2, ind);
|
||||
END
|
||||
master-bin.000001 784 Query 1 992 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 992 Query 1 1081 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1081 Query 1 1160 use `test`; DROP TABLE t4
|
||||
master-bin.000001 784 Query 1 1048 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
|
||||
master-bin.000001 1048 Query 1 1137 use `test`; DROP PROCEDURE bug18293
|
||||
master-bin.000001 1137 Query 1 1216 use `test`; DROP TABLE t4
|
||||
End of 5.0 tests
|
||||
SHOW BINLOG EVENTS FROM 364;
|
||||
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
|
||||
|
@ -1098,6 +1098,17 @@ ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_gen
|
||||
select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
|
||||
ERROR HY000: Illegal mix of collations (ascii_general_ci,IMPLICIT) and (ucs2_general_ci,COERCIBLE) for operation '='
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2);
|
||||
INSERT INTO t1 VALUES ('a');
|
||||
SET @@sql_mode=pad_char_to_full_length;
|
||||
SELECT HEX(s1) FROM t1;
|
||||
HEX(s1)
|
||||
00610020002000200020
|
||||
SET @@sql_mode=default;
|
||||
SELECT HEX(s1) FROM t1;
|
||||
HEX(s1)
|
||||
0061
|
||||
DROP TABLE t1;
|
||||
set collation_connection=ucs2_general_ci;
|
||||
drop table if exists t1;
|
||||
create table t1 as
|
||||
|
@ -205,4 +205,19 @@ Warnings:
|
||||
Warning 1364 Field 'id' doesn't have a default value
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
create table t1 (a int unique);
|
||||
create table t2 (b int default 10);
|
||||
insert into t1 (a) values (1);
|
||||
insert into t2 (b) values (1);
|
||||
insert into t1 (a) select b from t2 on duplicate key update a=default;
|
||||
select * from t1;
|
||||
a
|
||||
NULL
|
||||
insert into t1 (a) values (1);
|
||||
insert into t1 (a) select b from t2 on duplicate key update a=default(b);
|
||||
select * from t1;
|
||||
a
|
||||
NULL
|
||||
10
|
||||
drop table t1, t2;
|
||||
End of 5.0 tests.
|
||||
|
@ -608,6 +608,65 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
|
||||
a a
|
||||
DROP TABLE t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
|
||||
default NULL);
|
||||
INSERT INTO t1 VALUES (1,1,'ORANGE');
|
||||
INSERT INTO t1 VALUES (2,2,'APPLE');
|
||||
INSERT INTO t1 VALUES (3,2,'APPLE');
|
||||
INSERT INTO t1 VALUES (4,3,'PEAR');
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
|
||||
'APPLE';
|
||||
SELECT @v1, @v2;
|
||||
@v1 @v2
|
||||
2 APPLE
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
|
||||
fruit_name HAVING fruit_name = 'APPLE';
|
||||
SELECT @v3, @v4;
|
||||
@v3 @v4
|
||||
2 APPLE
|
||||
SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
|
||||
fruit_name = 'APPLE';
|
||||
SELECT @v5, @v6, @v7, @v8;
|
||||
@v5 @v6 @v7 @v8
|
||||
3 PEAR 3 PEAR
|
||||
SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
|
||||
WHERE fruit_name = 'APPLE';
|
||||
SELECT @v5, @v6, @v7, @v8, @v9, @v10;
|
||||
@v5 @v6 @v7 @v8 @v9 @v10
|
||||
3 PEAR 3 PEAR 5 PEARAPPLE
|
||||
SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
|
||||
@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
|
||||
SELECT @v11, @v12, @v13, @v14;
|
||||
@v11 @v12 @v13 @v14
|
||||
6 PEARPEAR 6 PEARPEAR
|
||||
SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
|
||||
SELECT @v15, @v16;
|
||||
@v15 @v16
|
||||
6 PEARPEAR
|
||||
SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
|
||||
'APPLE';
|
||||
SELECT @v17, @v18;
|
||||
@v17 @v18
|
||||
4 Bob
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
|
||||
default NULL);
|
||||
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
|
||||
'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
|
||||
LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
|
||||
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
|
||||
'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
|
||||
LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
|
||||
SELECT @v19, @v20;
|
||||
@v19 @v20
|
||||
2 APPLE
|
||||
SELECT * FROM t2;
|
||||
fruit_id fruit_name
|
||||
2 APPLE
|
||||
2 APPLE
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
CREATE TABLE t1 (a CHAR(1));
|
||||
INSERT INTO t1 VALUES('A'), (0);
|
||||
SELECT a FROM t1 WHERE a=0;
|
||||
|
@ -328,4 +328,81 @@ create event
|
||||
очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66
|
||||
on schedule every 2 year do select 1;
|
||||
ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long
|
||||
create event event_35981 on schedule every 6 month on completion preserve
|
||||
disable
|
||||
do
|
||||
select 1;
|
||||
The following SELECTs should all give 1
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
alter event event_35981 enable;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
alter event event_35981 on completion not preserve;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'NOT PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
alter event event_35981 disable;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'NOT PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
alter event event_35981 on completion preserve;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
drop event event_35981;
|
||||
create event event_35981 on schedule every 6 month disable
|
||||
do
|
||||
select 1;
|
||||
select count(*) from information_schema.events
|
||||
where event_schema = database() and event_name = 'event_35981' and
|
||||
on_completion = 'NOT PRESERVE';
|
||||
count(*)
|
||||
1
|
||||
drop event event_35981;
|
||||
create event event_35981 on schedule every 1 hour starts current_timestamp
|
||||
on completion not preserve
|
||||
do
|
||||
select 1;
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00';
|
||||
ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
|
||||
drop event event_35981;
|
||||
create event event_35981 on schedule every 1 hour starts current_timestamp
|
||||
on completion not preserve
|
||||
do
|
||||
select 1;
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00' on completion preserve;
|
||||
Warnings:
|
||||
Note 1544 Event execution time is in the past. Event has been disabled
|
||||
drop event event_35981;
|
||||
create event event_35981 on schedule every 1 hour starts current_timestamp
|
||||
on completion preserve
|
||||
do
|
||||
select 1;
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00';
|
||||
Warnings:
|
||||
Note 1544 Event execution time is in the past. Event has been disabled
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00' on completion not preserve;
|
||||
ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.
|
||||
alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
|
||||
ends '1999-01-02 00:00:00' on completion preserve;
|
||||
Warnings:
|
||||
Note 1544 Event execution time is in the past. Event has been disabled
|
||||
drop event event_35981;
|
||||
drop database events_test;
|
||||
|
@ -9,7 +9,9 @@ DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
SET @OLD_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
Warnings:
|
||||
@ -186,6 +188,7 @@ INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010);
|
||||
SELECT * FROM federated.t1;
|
||||
id name other created
|
||||
1 First Name 11111 2004-04-04 04:04:04
|
||||
10 Tenth Name 101010 2004-04-04 04:04:04
|
||||
2 Second Name 22222 2004-04-04 04:04:04
|
||||
3 Third Name 33333 2004-04-04 04:04:04
|
||||
4 Fourth Name 44444 2004-04-04 04:04:04
|
||||
@ -194,7 +197,6 @@ id name other created
|
||||
7 Seventh Name 77777 2004-04-04 04:04:04
|
||||
8 Eigth Name 88888 2004-04-04 04:04:04
|
||||
9 Ninth Name 99999 2004-04-04 04:04:04
|
||||
10 Tenth Name 101010 2004-04-04 04:04:04
|
||||
SELECT * FROM federated.t1 WHERE id = 5;
|
||||
id name other created
|
||||
5 Fifth Name 55555 2004-04-04 04:04:04
|
||||
@ -208,6 +210,7 @@ SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444;
|
||||
id name other created
|
||||
SELECT * FROM federated.t1 WHERE name like '%th%';
|
||||
id name other created
|
||||
10 Tenth Name 101010 2004-04-04 04:04:04
|
||||
3 Third Name 33333 2004-04-04 04:04:04
|
||||
4 Fourth Name 44444 2004-04-04 04:04:04
|
||||
5 Fifth Name 55555 2004-04-04 04:04:04
|
||||
@ -215,7 +218,6 @@ id name other created
|
||||
7 Seventh Name 77777 2004-04-04 04:04:04
|
||||
8 Eigth Name 88888 2004-04-04 04:04:04
|
||||
9 Ninth Name 99999 2004-04-04 04:04:04
|
||||
10 Tenth Name 101010 2004-04-04 04:04:04
|
||||
UPDATE federated.t1 SET name = '3rd name' WHERE id = 3;
|
||||
SELECT * FROM federated.t1 WHERE name = '3rd name';
|
||||
id name other created
|
||||
@ -336,6 +338,7 @@ VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01');
|
||||
SELECT * FROM federated.t1;
|
||||
id name other created
|
||||
1 First Name 11111 2004-01-01 01:01:01
|
||||
10 Tenth Name 101010 2005-03-12 12:00:01
|
||||
2 Second Name 22222 2004-01-23 02:43:00
|
||||
3 Third Name 33333 2004-02-14 02:14:00
|
||||
4 Fourth Name 44444 2003-04-05 00:00:00
|
||||
@ -344,7 +347,6 @@ id name other created
|
||||
7 Seventh Name 77777 2003-12-12 18:32:00
|
||||
8 Eigth Name 88888 2005-03-12 11:00:00
|
||||
9 Ninth Name 99999 2005-03-12 11:00:01
|
||||
10 Tenth Name 101010 2005-03-12 12:00:01
|
||||
SELECT * FROM federated.t1 WHERE id = 5;
|
||||
id name other created
|
||||
5 Fifth Name 55555 2001-02-02 02:02:02
|
||||
@ -356,6 +358,7 @@ id name other created
|
||||
4 Fourth Name 44444 2003-04-05 00:00:00
|
||||
SELECT * FROM federated.t1 WHERE name like '%th%';
|
||||
id name other created
|
||||
10 Tenth Name 101010 2005-03-12 12:00:01
|
||||
3 Third Name 33333 2004-02-14 02:14:00
|
||||
4 Fourth Name 44444 2003-04-05 00:00:00
|
||||
5 Fifth Name 55555 2001-02-02 02:02:02
|
||||
@ -363,7 +366,6 @@ id name other created
|
||||
7 Seventh Name 77777 2003-12-12 18:32:00
|
||||
8 Eigth Name 88888 2005-03-12 11:00:00
|
||||
9 Ninth Name 99999 2005-03-12 11:00:01
|
||||
10 Tenth Name 101010 2005-03-12 12:00:01
|
||||
UPDATE federated.t1 SET name = '3rd name' WHERE id = 3;
|
||||
SELECT * FROM federated.t1 WHERE name = '3rd name';
|
||||
id name other created
|
||||
@ -470,17 +472,17 @@ id name other
|
||||
7 Seventh Name NULL
|
||||
SELECT * FROM federated.t1 WHERE name IS NULL;
|
||||
id name other
|
||||
4 NULL NULL
|
||||
10 NULL fee fie foe fum
|
||||
4 NULL NULL
|
||||
SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL;
|
||||
id name other
|
||||
4 NULL NULL
|
||||
SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL;
|
||||
id name other
|
||||
10 NULL fee fie foe fum
|
||||
2 Second Name NULL
|
||||
4 NULL NULL
|
||||
7 Seventh Name NULL
|
||||
10 NULL fee fie foe fum
|
||||
UPDATE federated.t1
|
||||
SET name = 'Fourth Name', other = 'four four four'
|
||||
WHERE name IS NULL AND other IS NULL;
|
||||
@ -492,6 +494,7 @@ id name other
|
||||
SELECT * FROM federated.t1;
|
||||
id name other
|
||||
1 First Name 11111
|
||||
10 Tenth Name fee fie foe fum
|
||||
2 Second Name two two two two
|
||||
3 Third Name 33333
|
||||
4 Fourth Name four four four
|
||||
@ -500,7 +503,6 @@ id name other
|
||||
7 Seventh Name seven seven
|
||||
8 Eigth Name 88888
|
||||
9 Ninth Name 99999
|
||||
10 Tenth Name fee fie foe fum
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`id` int(20) NOT NULL auto_increment,
|
||||
@ -681,8 +683,8 @@ id col1 col2 col3 col4
|
||||
SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5')
|
||||
OR (col2 = 'three Three' AND col3 = 33);
|
||||
id col1 col2 col3 col4
|
||||
5 5 five 5 five five 5 5 55555
|
||||
3 3 three Three 33 33333
|
||||
5 5 five 5 five five 5 5 55555
|
||||
SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two')
|
||||
OR (col2 = 444 AND col3 = 4444444);
|
||||
id col1 col2 col3 col4
|
||||
@ -693,25 +695,25 @@ OR col3 = 33
|
||||
OR col4 = 4444444;
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
4 4 fourfourfour 444 4444444
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE id > 5;
|
||||
id col1 col2 col3 col4
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE id >= 5;
|
||||
id col1 col2 col3 col4
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
5 5 five 5 five five 5 5 55555
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE id < 5;
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
@ -728,6 +730,7 @@ id col1 col2 col3 col4
|
||||
SELECT * FROM federated.t1 WHERE id != 5;
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
4 4 fourfourfour 444 4444444
|
||||
@ -735,7 +738,6 @@ id col1 col2 col3 col4
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE id > 3 AND id < 7;
|
||||
id col1 col2 col3 col4
|
||||
4 4 fourfourfour 444 4444444
|
||||
@ -763,25 +765,25 @@ id col1 col2 col3 col4
|
||||
SELECT * FROM federated.t1 WHERE id < 3 OR id > 7;
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE col2 = 'three Three';
|
||||
id col1 col2 col3 col4
|
||||
3 3 three Three 33 33333
|
||||
SELECT * FROM federated.t1 WHERE col2 > 'one';
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE col2 LIKE 's%';
|
||||
id col1 col2 col3 col4
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
SELECT * FROM federated.t1 WHERE col2 LIKE 'si%';
|
||||
id col1 col2 col3 col4
|
||||
6 6 six six Sixsix 6666 6
|
||||
@ -791,6 +793,7 @@ id col1 col2 col3 col4
|
||||
SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%';
|
||||
id col1 col2 col3 col4
|
||||
1 1 one One 11 1111
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
4 4 fourfourfour 444 4444444
|
||||
@ -798,18 +801,17 @@ id col1 col2 col3 col4
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
SELECT * FROM federated.t1 WHERE col2 <> 'one One';
|
||||
id col1 col2 col3 col4
|
||||
4 4 fourfourfour 444 4444444
|
||||
5 5 five 5 five five 5 5 55555
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
2 2 Two two 22 2222
|
||||
3 3 three Three 33 33333
|
||||
4 4 fourfourfour 444 4444444
|
||||
5 5 five 5 five five 5 5 55555
|
||||
6 6 six six Sixsix 6666 6
|
||||
7 7 seven Sevenseven 77777 7777
|
||||
10 10 Tenth ten TEN 1010101 1010
|
||||
8 8 eight eight eight 88888 88
|
||||
9 9 nine Nine 999999 999999
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`col1` varchar(8) NOT NULL DEFAULT '',
|
||||
@ -976,11 +978,11 @@ INSERT INTO federated.t1 (name, floatval, other)
|
||||
VALUES (0, 00.3333, NULL);
|
||||
SELECT * FROM federated.t1;
|
||||
id name floatval other
|
||||
NULL NULL NULL NULL
|
||||
NULL NULL NULL NULL
|
||||
1 NULL NULL NULL
|
||||
NULL foo 33.3333 NULL
|
||||
NULL 0 0.3333 NULL
|
||||
NULL NULL NULL NULL
|
||||
NULL NULL NULL NULL
|
||||
NULL foo 33.3333 NULL
|
||||
SELECT count(*) FROM federated.t1
|
||||
WHERE id IS NULL
|
||||
AND name IS NULL
|
||||
@ -1009,13 +1011,13 @@ Warning 1101 BLOB/TEXT column 'blurb' can't have a default value
|
||||
INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.");
|
||||
INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.");
|
||||
INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. ");
|
||||
INSERT INTO federated.t1 VALUES(4, "Die <20>bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest f<>r jemanden, der seine Zielsprache ernst nimmt:");
|
||||
INSERT INTO federated.t1 VALUES(4, "Die <20>bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest f<>r jemanden, der seine Zielsprache ernst nimmt:");
|
||||
SELECT * FROM federated.t1;
|
||||
blurb_id blurb
|
||||
1 MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.
|
||||
2 All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.
|
||||
3 A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined.
|
||||
4 Die <20>bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest f<>r jemanden, der seine Zielsprache ernst nimmt:
|
||||
4 Die <20>bersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest f<>r jemanden, der seine Zielsprache ernst nimmt:
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
CREATE TABLE federated.t1 (
|
||||
`a` int NOT NULL,
|
||||
@ -2118,11 +2120,23 @@ DROP TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT) ENGINE=federated CONNECTION='mysql://@:://';
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a LONGBLOB, b LONGBLOB);
|
||||
INSERT INTO t1 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaa', NULL);
|
||||
CREATE TABLE t1
|
||||
(a LONGBLOB, b LONGBLOB) ENGINE=FEDERATED
|
||||
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
|
||||
CHECKSUM TABLE t1;
|
||||
Table Checksum
|
||||
test.t1 2465757603
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
create server 's1' foreign data wrapper 'mysql' options (port 3306);
|
||||
drop server 's1';
|
||||
End of 5.1 tests
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_CONCURRENT_INSERT;
|
||||
|
@ -9,7 +9,9 @@ DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
CREATE DATABASE federated;
|
||||
SET @OLD_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= 0;
|
||||
DROP TABLE IF EXISTS federated.bug_13118_table;
|
||||
CREATE TABLE federated.t1 (
|
||||
@ -51,9 +53,10 @@ id value
|
||||
7 54
|
||||
8 55
|
||||
DROP TABLE federated.t1;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT;
|
||||
DROP TABLE federated.t1;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_CONCURRENT_INSERT;
|
||||
|
@ -1416,4 +1416,41 @@ SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
|
||||
AVG(a) CAST(AVG(a) AS DECIMAL)
|
||||
15 15
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE derived1 (a bigint(21));
|
||||
INSERT INTO derived1 VALUES (2);
|
||||
CREATE TABLE D (
|
||||
pk int(11) NOT NULL AUTO_INCREMENT,
|
||||
int_nokey int(11) DEFAULT NULL,
|
||||
int_key int(11) DEFAULT NULL,
|
||||
filler blob,
|
||||
PRIMARY KEY (pk),
|
||||
KEY int_key (int_key)
|
||||
);
|
||||
INSERT INTO D VALUES
|
||||
(39,40,4,repeat(' X', 42)),
|
||||
(43,56,4,repeat(' X', 42)),
|
||||
(47,12,4,repeat(' X', 42)),
|
||||
(71,28,4,repeat(' X', 42)),
|
||||
(76,54,4,repeat(' X', 42)),
|
||||
(83,45,4,repeat(' X', 42)),
|
||||
(105,53,12,NULL);
|
||||
SELECT
|
||||
(SELECT COUNT( int_nokey )
|
||||
FROM derived1 AS X
|
||||
WHERE
|
||||
X.int_nokey < 61
|
||||
GROUP BY pk
|
||||
LIMIT 1)
|
||||
FROM D AS X
|
||||
WHERE X.int_key < 13
|
||||
GROUP BY int_nokey LIMIT 1;
|
||||
(SELECT COUNT( int_nokey )
|
||||
FROM derived1 AS X
|
||||
WHERE
|
||||
X.int_nokey < 61
|
||||
GROUP BY pk
|
||||
LIMIT 1)
|
||||
1
|
||||
DROP TABLE derived1;
|
||||
DROP TABLE D;
|
||||
End of 5.0 tests
|
||||
|
@ -131,3 +131,49 @@ drop table t1;
|
||||
select if(0, 18446744073709551610, 18446744073709551610);
|
||||
if(0, 18446744073709551610, 18446744073709551610)
|
||||
18446744073709551610
|
||||
CREATE TABLE t1(a DECIMAL(10,3));
|
||||
SELECT t1.a,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
|
||||
FROM t1;
|
||||
a IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((ROUND(t1.a,2)=1), 2,
|
||||
IF((R
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
@ -569,4 +569,10 @@ insert into t1 values (),(),(),(),(),(),(),(),(),();
|
||||
select a from t1 where a not in (a,a,a) group by a;
|
||||
a
|
||||
drop table t1;
|
||||
create table t1 (id int);
|
||||
select * from t1 where NOT id in (select null union all select 1);
|
||||
id
|
||||
select * from t1 where NOT id in (null, 1);
|
||||
id
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
@ -310,6 +310,20 @@ drop table t1;
|
||||
SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
|
||||
NAME_CONST('var', 'value') COLLATE latin1_general_cs
|
||||
value
|
||||
select @@session.time_zone into @save_tz;
|
||||
set @@session.time_zone='UTC';
|
||||
select uuid() into @my_uuid;
|
||||
select mid(@my_uuid,15,1);
|
||||
mid(@my_uuid,15,1)
|
||||
1
|
||||
select 24 * 60 * 60 * 1000 * 1000 * 10 into @my_uuid_one_day;
|
||||
select concat('0',mid(@my_uuid,16,3),mid(@my_uuid,10,4),left(@my_uuid,8)) into @my_uuidate;
|
||||
select floor(conv(@my_uuidate,16,10)/@my_uuid_one_day) into @my_uuid_date;
|
||||
select 141427 + datediff(curdate(),'1970-01-01') into @my_uuid_synthetic;
|
||||
select @my_uuid_date - @my_uuid_synthetic;
|
||||
@my_uuid_date - @my_uuid_synthetic
|
||||
0
|
||||
set @@session.time_zone=@save_tz;
|
||||
End of 5.0 tests
|
||||
select connection_id() > 0;
|
||||
connection_id() > 0
|
||||
|
@ -114,4 +114,34 @@ End of 4.1 tests
|
||||
SELECT 1 REGEXP NULL;
|
||||
1 REGEXP NULL
|
||||
NULL
|
||||
SELECT '' REGEXP BINARY NULL;
|
||||
'' REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT NULL REGEXP BINARY NULL;
|
||||
NULL REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT 'A' REGEXP BINARY NULL;
|
||||
'A' REGEXP BINARY NULL
|
||||
NULL
|
||||
SELECT "ABC" REGEXP BINARY NULL;
|
||||
"ABC" REGEXP BINARY NULL
|
||||
NULL
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1(a INT, b CHAR(4));
|
||||
INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');
|
||||
PREPARE stmt1 FROM "SELECT a FROM t1 WHERE a=1 AND '7.0' REGEXP b LIMIT 1";
|
||||
EXECUTE stmt1;
|
||||
a
|
||||
1
|
||||
EXECUTE stmt1;
|
||||
a
|
||||
1
|
||||
EXECUTE stmt1;
|
||||
a
|
||||
1
|
||||
EXECUTE stmt1;
|
||||
a
|
||||
1
|
||||
DEALLOCATE PREPARE stmt1;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -434,7 +434,7 @@ USE db1;
|
||||
SELECT c FROM t2;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
SELECT * FROM t2;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table 't2'
|
||||
SELECT * FROM t1 JOIN t2 USING (b);
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
|
||||
DROP TABLE db1.t1, db1.t2;
|
||||
|
@ -155,7 +155,7 @@ select "user3";
|
||||
user3
|
||||
user3
|
||||
select * from t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
select a from t1;
|
||||
a
|
||||
1
|
||||
|
@ -155,7 +155,7 @@ select "user3";
|
||||
user3
|
||||
user3
|
||||
select * from t1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
select a from t1;
|
||||
a
|
||||
1
|
||||
|
@ -2372,3 +2372,79 @@ a MIN(b) MAX(b) AVG(b)
|
||||
2 1 3 2.0000
|
||||
1 1 3 2.0000
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int, b int, primary key (a,b), key `index` (a,b)) engine=MyISAM;
|
||||
insert into t1 (a,b) values
|
||||
(0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),
|
||||
(0,7),(0,8),(0,9),(0,10),(0,11),(0,12),(0,13),
|
||||
(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),
|
||||
(1,7),(1,8),(1,9),(1,10),(1,11),(1,12),(1,13),
|
||||
(2,0),(2,1),(2,2),(2,3),(2,4),(2,5),(2,6),
|
||||
(2,7),(2,8),(2,9),(2,10),(2,11),(2,12),(2,13),
|
||||
(3,0),(3,1),(3,2),(3,3),(3,4),(3,5),(3,6),
|
||||
(3,7),(3,8),(3,9),(3,10),(3,11),(3,12),(3,13);
|
||||
insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
|
||||
select * from t1;
|
||||
a b
|
||||
0 0
|
||||
0 1
|
||||
0 2
|
||||
0 3
|
||||
0 4
|
||||
0 5
|
||||
0 6
|
||||
0 7
|
||||
0 8
|
||||
0 9
|
||||
0 10
|
||||
0 11
|
||||
0 12
|
||||
0 13
|
||||
0 14
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 5
|
||||
1 6
|
||||
1 7
|
||||
1 8
|
||||
1 9
|
||||
1 10
|
||||
1 11
|
||||
1 12
|
||||
1 13
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 3
|
||||
2 4
|
||||
2 5
|
||||
2 6
|
||||
2 7
|
||||
2 8
|
||||
2 9
|
||||
2 10
|
||||
2 11
|
||||
2 12
|
||||
2 13
|
||||
3 0
|
||||
3 1
|
||||
3 2
|
||||
3 3
|
||||
3 4
|
||||
3 5
|
||||
3 6
|
||||
3 7
|
||||
3 8
|
||||
3 9
|
||||
3 10
|
||||
3 11
|
||||
3 12
|
||||
3 13
|
||||
explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 range PRIMARY,index PRIMARY 4 NULL 3 100.00 Using where; Using index for group-by; Using temporary
|
||||
Warnings:
|
||||
Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,(max(`test`.`t1`.`b`) + 1) AS `max(b)+1` from `test`.`t1` where (`test`.`t1`.`a` = 0) group by `test`.`t1`.`a`
|
||||
drop table t1;
|
||||
|
@ -1,3 +1,5 @@
|
||||
drop view if exists v1;
|
||||
drop table if exists t1,t4;
|
||||
create table t4 (
|
||||
pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
|
||||
) engine=innodb;
|
||||
@ -70,3 +72,25 @@ explain select distinct f1, f2 from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
|
||||
drop table t1;
|
||||
create table t1(pk int primary key) engine=innodb;
|
||||
create view v1 as select pk from t1 where pk < 20;
|
||||
insert into t1 values (1), (2), (3), (4);
|
||||
select distinct pk from v1;
|
||||
pk
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
insert into t1 values (5), (6), (7);
|
||||
select distinct pk from v1;
|
||||
pk
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
@ -484,6 +484,7 @@ c1
|
||||
handler t1 close;
|
||||
read the result from the other connection
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
proceed with the normal connection
|
||||
drop table t1;
|
||||
@ -698,6 +699,7 @@ handler a2 read a first;
|
||||
a
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
handler a1 close;
|
||||
ERROR 42S02: Unknown table 'a1' in HANDLER
|
||||
|
@ -520,6 +520,16 @@ a filler b
|
||||
4 zz 4
|
||||
5 qq 4
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (a varchar(8), b set('a','b','c','d','e','f','g','h'),
|
||||
KEY b(b), KEY a(a));
|
||||
INSERT INTO t1 VALUES ('y',''), ('z','');
|
||||
SELECT b,a from t1 WHERE (b!='c' AND b!='f' && b!='h') OR
|
||||
(a='pure-S') OR (a='DE80337a') OR (a='DE80799');
|
||||
b a
|
||||
y
|
||||
z
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
#---------------- ROR-index_merge tests -----------------------
|
||||
SET SESSION STORAGE_ENGINE = MyISAM;
|
||||
drop table if exists t0,t1,t2;
|
||||
|
@ -758,7 +758,6 @@ table_schema table_name column_name
|
||||
information_schema COLUMNS COLUMN_DEFAULT
|
||||
information_schema COLUMNS COLUMN_TYPE
|
||||
information_schema EVENTS EVENT_DEFINITION
|
||||
information_schema EVENTS SQL_MODE
|
||||
information_schema PARTITIONS PARTITION_EXPRESSION
|
||||
information_schema PARTITIONS SUBPARTITION_EXPRESSION
|
||||
information_schema PARTITIONS PARTITION_DESCRIPTION
|
||||
@ -768,8 +767,6 @@ information_schema ROUTINES ROUTINE_DEFINITION
|
||||
information_schema ROUTINES SQL_MODE
|
||||
information_schema TRIGGERS ACTION_CONDITION
|
||||
information_schema TRIGGERS ACTION_STATEMENT
|
||||
information_schema TRIGGERS SQL_MODE
|
||||
information_schema TRIGGERS DEFINER
|
||||
information_schema VIEWS VIEW_DEFINITION
|
||||
select table_name, column_name, data_type from information_schema.columns
|
||||
where data_type = 'datetime';
|
||||
@ -1646,4 +1643,13 @@ drop table t1;
|
||||
drop function f1;
|
||||
select * from information_schema.tables where 1=sleep(100000);
|
||||
select * from information_schema.columns where 1=sleep(100000);
|
||||
explain select count(*) from information_schema.tables;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE tables ALL NULL NULL NULL NULL NULL Skip_open_table; Scanned all databases
|
||||
explain select count(*) from information_schema.columns;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE columns ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases
|
||||
explain select count(*) from information_schema.views;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE views ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases
|
||||
End of 5.1 tests.
|
||||
|
@ -221,3 +221,24 @@ drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
||||
drop database testdb_1;
|
||||
drop user testdb_1@localhost;
|
||||
drop user testdb_2@localhost;
|
||||
create database testdb_1;
|
||||
create table testdb_1.t1 (a int);
|
||||
create view testdb_1.v1 as select * from testdb_1.t1;
|
||||
grant show view on testdb_1.* to mysqltest_1@localhost;
|
||||
grant select on testdb_1.v1 to mysqltest_1@localhost;
|
||||
select table_schema, table_name, view_definition from information_schema.views
|
||||
where table_name='v1';
|
||||
table_schema table_name view_definition
|
||||
testdb_1 v1 select `testdb_1`.`t1`.`a` AS `a` from `testdb_1`.`t1`
|
||||
show create view testdb_1.v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v1` AS select `testdb_1`.`t1`.`a` AS `a` from `testdb_1`.`t1` latin1 latin1_swedish_ci
|
||||
revoke select on testdb_1.v1 from mysqltest_1@localhost;
|
||||
select table_schema, table_name, view_definition from information_schema.views
|
||||
where table_name='v1';
|
||||
table_schema table_name view_definition
|
||||
testdb_1 v1
|
||||
show create view testdb_1.v1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v1'
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database testdb_1;
|
||||
|
7
mysql-test/r/innodb-autoinc-optimize.result
Normal file
7
mysql-test/r/innodb-autoinc-optimize.result
Normal file
@ -0,0 +1,7 @@
|
||||
drop table if exists t1;
|
||||
create table t1(a int not null auto_increment primary key) engine=innodb;
|
||||
insert into t1 set a = -1;
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
171
mysql-test/r/innodb-autoinc.result
Normal file
171
mysql-test/r/innodb-autoinc.result
Normal file
@ -0,0 +1,171 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
9223372036854775807 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (127, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
127 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (255, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
255 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (32767, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
32767 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (65535, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
65535 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (8388607, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
8388607 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (16777215, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
16777215 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (2147483647, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
2147483647 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (4294967295, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
4294967295 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
9223372036854775807 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (18446744073709551615, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
18446744073709551615 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
TRUNCATE TABLE t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
7
|
||||
8
|
||||
9
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
@ -1,4 +1,5 @@
|
||||
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;
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
@ -6,6 +7,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;
|
||||
|
@ -166,6 +166,7 @@ level id parent_id
|
||||
1 1007 101
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
@ -190,6 +191,7 @@ create table t1 (a int) engine=innodb;
|
||||
insert into t1 values (1), (2);
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
delete from t1 where a = 1;
|
||||
select * from t1;
|
||||
@ -738,6 +740,7 @@ world 2
|
||||
hello 1
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
@ -1021,6 +1024,7 @@ id code name
|
||||
4 2 Erik
|
||||
5 3 Sasha
|
||||
COMMIT;
|
||||
SET binlog_format='MIXED';
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
|
||||
@ -2958,9 +2962,11 @@ drop table t1,t2;
|
||||
create table t1(a int not null, b int, primary key(a)) engine=innodb;
|
||||
insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
|
||||
commit;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t1 set b = 5 where b = 1;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
select * from t1 where a = 7 and b = 3 for update;
|
||||
@ -2999,6 +3005,7 @@ d e
|
||||
3 1
|
||||
8 6
|
||||
12 1
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t1 select * from t2;
|
||||
@ -3029,30 +3036,39 @@ a b
|
||||
3 1
|
||||
8 6
|
||||
12 1
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
insert into t1 select * from t2;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
update t3 set b = (select b from t2 where a = d);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t5 (select * from t2 lock in share mode);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t6 set e = (select b from t2 where a = d lock in share mode);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
insert into t8 (select * from t2 for update);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
update t9 set e = (select b from t2 where a = d for update);
|
||||
SET binlog_format='MIXED';
|
||||
set autocommit = 0;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
|
||||
@ -3109,6 +3125,7 @@ BEGIN;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
|
||||
@ -3198,6 +3215,7 @@ id
|
||||
-10
|
||||
1
|
||||
DROP TABLE t1;
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
@ -3208,6 +3226,7 @@ CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
@ -3215,10 +3234,12 @@ COMMIT;
|
||||
SELECT * FROM t1 WHERE a=1;
|
||||
a
|
||||
1
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
SELECT * FROM t2;
|
||||
a
|
||||
SET binlog_format='MIXED';
|
||||
SET TX_ISOLATION='read-committed';
|
||||
SET AUTOCOMMIT=0;
|
||||
INSERT INTO t1 VALUES (2);
|
||||
@ -3263,3 +3284,14 @@ AUTO_INCREMENT
|
||||
200
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 int default NULL,
|
||||
c2 int default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
TRUNCATE TABLE t1;
|
||||
affected rows: 0
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
|
||||
affected rows: 5
|
||||
info: Records: 5 Duplicates: 0 Warnings: 0
|
||||
TRUNCATE TABLE t1;
|
||||
affected rows: 0
|
||||
DROP TABLE t1;
|
||||
|
4
mysql-test/r/innodb_bug34300.result
Normal file
4
mysql-test/r/innodb_bug34300.result
Normal file
@ -0,0 +1,4 @@
|
||||
f4 f8
|
||||
xxx zzz
|
||||
f4 f8
|
||||
xxx zzz
|
1
mysql-test/r/innodb_bug35220.result
Normal file
1
mysql-test/r/innodb_bug35220.result
Normal file
@ -0,0 +1 @@
|
||||
SET storage_engine=InnoDB;
|
@ -1,7 +1,7 @@
|
||||
'#---------------------BS_STVARS_025_01----------------------#'
|
||||
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
|
||||
COUNT(@@GLOBAL.innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_025_02----------------------#'
|
||||
SET @@GLOBAL.innodb_data_home_dir=1;
|
||||
@ -9,7 +9,7 @@ ERROR HY000: Variable 'innodb_data_home_dir' is a read only variable
|
||||
Expected error 'Read only variable'
|
||||
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
|
||||
COUNT(@@GLOBAL.innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_025_03----------------------#'
|
||||
SELECT @@GLOBAL.innodb_data_home_dir = VARIABLE_VALUE
|
||||
@ -20,7 +20,7 @@ NULL
|
||||
1 Expected
|
||||
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
|
||||
COUNT(@@GLOBAL.innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
@ -36,7 +36,7 @@ NULL
|
||||
'#---------------------BS_STVARS_025_05----------------------#'
|
||||
SELECT COUNT(@@innodb_data_home_dir);
|
||||
COUNT(@@innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(@@local.innodb_data_home_dir);
|
||||
ERROR HY000: Variable 'innodb_data_home_dir' is a GLOBAL variable
|
||||
@ -46,7 +46,7 @@ ERROR HY000: Variable 'innodb_data_home_dir' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@GLOBAL.innodb_data_home_dir);
|
||||
COUNT(@@GLOBAL.innodb_data_home_dir)
|
||||
0
|
||||
1
|
||||
1 Expected
|
||||
SELECT innodb_data_home_dir = @@SESSION.innodb_data_home_dir;
|
||||
ERROR 42S22: Unknown column 'innodb_data_home_dir' in 'field list'
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user