summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-05-02 13:19:53 +0300
committerMonty <monty@mariadb.org>2020-05-23 12:29:10 +0300
commit4102f1589c23309de968a5bf9511d3228a1b9319 (patch)
tree9450597fff4a510282b2dec366cb102f5aadfc57 /mysql-test/main
parentd1d472646d578608791dcd33c13ca6b2472e31b2 (diff)
downloadmariadb-git-4102f1589c23309de968a5bf9511d3228a1b9319.tar.gz
Aria will now register it's transactions
MDEV-22531 Remove maria::implicit_commit() MDEV-22607 Assertion `ha_info->ht() != binlog_hton' failed in MYSQL_BIN_LOG::unlog_xa_prepare From the handler point of view, Aria now looks like a transactional engine. One effect of this is that we don't need to call maria::implicit_commit() anymore. This change also forces the server to call trans_commit_stmt() after doing any read or writes to system tables. This work will also make it easier to later allow users to have system tables in other engines than Aria. To handle the case that Aria doesn't support rollback, a new handlerton flag, HTON_NO_ROLLBACK, was added to engines that has transactions without rollback (for the moment only binlog and Aria). Other things - Moved freeing of MARIA_SHARE to a separate function as the MARIA_SHARE can be still part of a transaction even if the table has closed. - Changed Aria checkpoint to use the new MARIA_SHARE free function. This fixes a possible memory leak when using S3 tables - Changed testing of binlog_hton to instead test for HTON_NO_ROLLBACK - Removed checking of has_transaction_manager() in handler.cc as we can assume that as the transaction was started by the engine, it does support transactions. - Added new class 'start_new_trans' that can be used to start indepdendent sub transactions, for example while reading mysql.proc, using help or status tables etc. - open_system_tables...() and open_proc_table_for_Read() doesn't anymore take a Open_tables_backup list. This is now handled by 'start_new_trans'. - Split thd::has_transactions() to thd::has_transactions() and thd::has_transactions_and_rollback() - Added handlerton code to free cached transactions objects. Needed by InnoDB. squash! 2ed35999f2a2d84f1c786a21ade5db716b6f1bbc
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/backup_lock.result37
-rw-r--r--mysql-test/main/backup_lock.test30
-rw-r--r--mysql-test/main/commit_1innodb.result19
-rw-r--r--mysql-test/main/warnings_debug.result6
-rw-r--r--mysql-test/main/warnings_debug.test2
-rw-r--r--mysql-test/main/xa_binlog.result54
-rw-r--r--mysql-test/main/xa_binlog.test35
7 files changed, 164 insertions, 19 deletions
diff --git a/mysql-test/main/backup_lock.result b/mysql-test/main/backup_lock.result
index 8a179578e79..96503814d00 100644
--- a/mysql-test/main/backup_lock.result
+++ b/mysql-test/main/backup_lock.result
@@ -193,23 +193,51 @@ SET GLOBAL lock_wait_timeout=0;
CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB;
CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM;
CREATE TABLE t_permanent_aria (col1 INT) ENGINE = Aria transactional=1;
+CREATE TABLE t_permanent_aria2 (col1 INT) ENGINE = Aria transactional=0;
INSERT INTO t_permanent_innodb SET col1 = 1;
INSERT INTO t_permanent_myisam SET col1 = 1;
INSERT INTO t_permanent_aria SET col1 = 1;
+INSERT INTO t_permanent_aria2 SET col1 = 1;
CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB;
CREATE TABLE t_con1_myisam (col1 INT) ENGINE = MyISAM;
connect con1,localhost,root,,;
-SET AUTOCOMMIT = 0;
connection default;
BACKUP STAGE START;
BACKUP STAGE FLUSH;
BACKUP STAGE BLOCK_DDL;
BACKUP STAGE BLOCK_COMMIT;
connection con1;
+SET AUTOCOMMIT = 1;
+UPDATE t_permanent_aria SET col1 = 1;
+UPDATE t_permanent_innodb SET col1 = 1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t_permanent_innodb SET col1 = 8;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t_permanent_myisam SET col1 = 8;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t_permanent_aria SET col1 = 8;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UPDATE t_permanent_aria2 SET col1 = 8;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t_permanent_innodb;
+col1
+1
+select * from t_permanent_myisam;
+col1
+1
+select * from t_permanent_aria;
+col1
+8
+select * from t_permanent_aria2;
+col1
+1
+SET AUTOCOMMIT = 0;
+UPDATE t_permanent_innodb SET col1 = 9;
+UPDATE t_permanent_aria SET col1 = 9;
+UPDATE t_permanent_myisam SET col1 = 9;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UPDATE t_permanent_aria2 SET col1 = 9;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DROP TABLE t_con1_innodb;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DROP TABLE t_con1_myisam;
@@ -224,8 +252,11 @@ col1
1
select * from t_permanent_aria;
col1
-8
-DROP TABLE t_permanent_myisam, t_permanent_innodb, t_permanent_aria;
+9
+select * from t_permanent_aria2;
+col1
+1
+DROP TABLE t_permanent_myisam, t_permanent_innodb, t_permanent_aria, t_permanent_aria2;
DROP TABLE t_con1_innodb, t_con1_myisam;
disconnect con1;
set global lock_wait_timeout=default;
diff --git a/mysql-test/main/backup_lock.test b/mysql-test/main/backup_lock.test
index 65c11432bb5..0d4da8cb892 100644
--- a/mysql-test/main/backup_lock.test
+++ b/mysql-test/main/backup_lock.test
@@ -252,15 +252,16 @@ SET GLOBAL lock_wait_timeout=0;
CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB;
CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM;
CREATE TABLE t_permanent_aria (col1 INT) ENGINE = Aria transactional=1;
+CREATE TABLE t_permanent_aria2 (col1 INT) ENGINE = Aria transactional=0;
INSERT INTO t_permanent_innodb SET col1 = 1;
INSERT INTO t_permanent_myisam SET col1 = 1;
INSERT INTO t_permanent_aria SET col1 = 1;
+INSERT INTO t_permanent_aria2 SET col1 = 1;
CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB;
CREATE TABLE t_con1_myisam (col1 INT) ENGINE = MyISAM;
--connect(con1,localhost,root,,)
-SET AUTOCOMMIT = 0;
--connection default
BACKUP STAGE START;
@@ -269,10 +270,34 @@ BACKUP STAGE BLOCK_DDL;
BACKUP STAGE BLOCK_COMMIT;
--connection con1
+SET AUTOCOMMIT = 1;
+
+# These should work as values are not changed
+UPDATE t_permanent_aria SET col1 = 1;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t_permanent_innodb SET col1 = 1;
+
+--error ER_LOCK_WAIT_TIMEOUT
UPDATE t_permanent_innodb SET col1 = 8;
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t_permanent_myisam SET col1 = 8;
+--error ER_LOCK_WAIT_TIMEOUT
UPDATE t_permanent_aria SET col1 = 8;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t_permanent_aria2 SET col1 = 8;
+
+select * from t_permanent_innodb;
+select * from t_permanent_myisam;
+select * from t_permanent_aria;
+select * from t_permanent_aria2;
+
+SET AUTOCOMMIT = 0;
+UPDATE t_permanent_innodb SET col1 = 9;
+UPDATE t_permanent_aria SET col1 = 9;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t_permanent_myisam SET col1 = 9;
+--error ER_LOCK_WAIT_TIMEOUT
+UPDATE t_permanent_aria2 SET col1 = 9;
--error ER_LOCK_WAIT_TIMEOUT
DROP TABLE t_con1_innodb;
@@ -286,8 +311,9 @@ BACKUP STAGE END;
select * from t_permanent_innodb;
select * from t_permanent_myisam;
select * from t_permanent_aria;
+select * from t_permanent_aria2;
-DROP TABLE t_permanent_myisam, t_permanent_innodb, t_permanent_aria;
+DROP TABLE t_permanent_myisam, t_permanent_innodb, t_permanent_aria, t_permanent_aria2;
DROP TABLE t_con1_innodb, t_con1_myisam;
--disconnect con1
set global lock_wait_timeout=default;
diff --git a/mysql-test/main/commit_1innodb.result b/mysql-test/main/commit_1innodb.result
index 7d21540b548..cf673f81d82 100644
--- a/mysql-test/main/commit_1innodb.result
+++ b/mysql-test/main/commit_1innodb.result
@@ -386,6 +386,11 @@ end|
# Reset Handler_commit and Handler_prepare counters
flush status;
#
+# Count of reading of p_verify_status_increment() from mysql.proc
+call p_verify_status_increment(2, 0, 2, 0);
+SUCCESS
+
+#
# 1. Read-only statement: SELECT
#
select * from t1;
@@ -568,7 +573,7 @@ begin
insert t2 set a=2;
return 2;
end|
-call p_verify_status_increment(0, 0, 0, 0);
+call p_verify_status_increment(4, 0, 4, 0);
SUCCESS
# 16. A function changes non-trans-table.
@@ -580,7 +585,7 @@ SUCCESS
select f1();
f1()
2
-call p_verify_status_increment(1, 0, 1, 0);
+call p_verify_status_increment(3, 0, 3, 0);
SUCCESS
commit;
@@ -688,9 +693,9 @@ SUCCESS
# 24. DDL: TRUNCATE TEMPORARY TABLE
truncate table t2;
-call p_verify_status_increment(4, 0, 4, 0);
-ERROR
-Expected commit increment: 4 actual: 2
+call p_verify_status_increment(2, 0, 2, 0);
+SUCCESS
+
commit;
# There is nothing left to commit
call p_verify_status_increment(0, 0, 0, 0);
@@ -855,7 +860,7 @@ call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
create view v1 as select * from t2;
-call p_verify_status_increment(2, 0, 2, 0);
+call p_verify_status_increment(4, 0, 4, 0);
SUCCESS
check table t1;
@@ -882,7 +887,7 @@ call p_verify_status_increment(0, 0, 0, 0);
SUCCESS
drop view v1;
-call p_verify_status_increment(0, 0, 0, 0);
+call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
#
diff --git a/mysql-test/main/warnings_debug.result b/mysql-test/main/warnings_debug.result
index 3a9d8225795..4d815767c14 100644
--- a/mysql-test/main/warnings_debug.result
+++ b/mysql-test/main/warnings_debug.result
@@ -5,8 +5,12 @@ SET SESSION debug_dbug="+d,warn_during_ha_commit_trans";
INSERT INTO t1 VALUES (1);
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
SHOW WARNINGS;
Level Code Message
Warning 1196 Some non-transactional changed tables couldn't be rolled back
-drop table t1;
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
SET debug_dbug= @saved_dbug;
+drop table t1;
diff --git a/mysql-test/main/warnings_debug.test b/mysql-test/main/warnings_debug.test
index 6605daf875d..4d084b1f52c 100644
--- a/mysql-test/main/warnings_debug.test
+++ b/mysql-test/main/warnings_debug.test
@@ -17,5 +17,5 @@ INSERT INTO t1 VALUES (1);
# packet. Show the warnings manually also.
SHOW WARNINGS;
-drop table t1;
SET debug_dbug= @saved_dbug;
+drop table t1;
diff --git a/mysql-test/main/xa_binlog.result b/mysql-test/main/xa_binlog.result
index c45749d500f..a272570aac1 100644
--- a/mysql-test/main/xa_binlog.result
+++ b/mysql-test/main/xa_binlog.result
@@ -18,7 +18,33 @@ a
1
2
3
-SHOW BINLOG EVENTS LIMIT 3,12;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+INSERT INTO t1 VALUES (1),(2);
+XA BEGIN 'x';
+DELETE FROM t1;
+XA END 'x';
+XA PREPARE 'x';
+Warnings:
+Warning 1030 Got error 131 "Command not supported by the engine" from storage engine Aria
+XA COMMIT 'x';
+SELECT * from t1;
+a
+XA BEGIN 'x';
+INSERT INTO t1 VALUES (3),(4);
+XA END 'x';
+XA PREPARE 'x';
+Warnings:
+Warning 1030 Got error 131 "Command not supported by the engine" from storage engine Aria
+XA ROLLBACK 'x';
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT * from t1;
+a
+3
+4
+DROP TABLE t1;
+SHOW BINLOG EVENTS LIMIT 3,100;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid 1 # XA START X'786174657374',X'',1 GTID #-#-#
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
@@ -32,4 +58,28 @@ master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (3)
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
-DROP TABLE t1;
+master-bin.000001 # Gtid 1 # GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid 1 # GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT) ENGINE=Aria
+master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1),(2)
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; DELETE FROM t1
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Gtid 1 # XA START X'78',X'',1 GTID #-#-#
+master-bin.000001 # Query 1 # XA END X'78',X'',1
+master-bin.000001 # XA_prepare 1 # XA PREPARE X'78',X'',1
+master-bin.000001 # Gtid 1 # GTID #-#-#
+master-bin.000001 # Query 1 # XA COMMIT X'78',X'',1
+master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (3),(4)
+master-bin.000001 # Query 1 # COMMIT
+master-bin.000001 # Gtid 1 # XA START X'78',X'',1 GTID #-#-#
+master-bin.000001 # Query 1 # XA END X'78',X'',1
+master-bin.000001 # XA_prepare 1 # XA PREPARE X'78',X'',1
+master-bin.000001 # Gtid 1 # GTID #-#-#
+master-bin.000001 # Query 1 # XA ROLLBACK X'78',X'',1
+master-bin.000001 # Gtid 1 # GTID #-#-#
+master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */
diff --git a/mysql-test/main/xa_binlog.test b/mysql-test/main/xa_binlog.test
index 91bca2ac8cb..1343fa2aaee 100644
--- a/mysql-test/main/xa_binlog.test
+++ b/mysql-test/main/xa_binlog.test
@@ -24,9 +24,38 @@ INSERT INTO t1 VALUES (3);
COMMIT;
SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
---replace_column 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
-SHOW BINLOG EVENTS LIMIT 3,12;
+#
+# MDEV-22607 Assertion `ha_info->ht() != binlog_hton' failed in
+# MYSQL_BIN_LOG::unlog_xa_prepare
+#
+
+CREATE TABLE t1 (a INT) ENGINE=Aria;
+INSERT INTO t1 VALUES (1),(2);
+XA BEGIN 'x';
+DELETE FROM t1;
+XA END 'x';
+XA PREPARE 'x';
+
+# Cleanup
+XA COMMIT 'x';
+
+SELECT * from t1;
+XA BEGIN 'x';
+INSERT INTO t1 VALUES (3),(4);
+XA END 'x';
+XA PREPARE 'x';
+XA ROLLBACK 'x';
+
+SELECT * from t1;
DROP TABLE t1;
+
+#
+# Time to check the log
+#
+
+--replace_column 2 # 5 #
+--replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
+SHOW BINLOG EVENTS LIMIT 3,100;