1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-28 17:36:30 +03:00
Files
mariadb/mysql-test/suite/maria/rollback.result
Monty 4102f1589c 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
2020-05-23 12:29:10 +03:00

187 lines
6.7 KiB
Plaintext

call mtr.add_suppression("Table '.*' is marked as crashed and should be repaired");
call mtr.add_suppression("Checking table: .*");
create table t1 (a int primary key auto_increment, b int) engine=aria transactional= 1;
create table t2 (a int primary key auto_increment, b int) engine=aria transactional= 0;
create sequence s1 cache=2 engine=aria;
insert into t1 (b) values (1),(2),(3),(4);
insert into t2 (b) values (1),(2),(3),(4);
select NEXT VALUE for s1,seq from seq_1_to_4;
NEXT VALUE for s1 seq
1 1
2 2
3 3
4 4
begin;
insert into t1 (b) values (5),(6);
insert into t1 (b) values (7),(8);
insert into t2 (b) values (5),(6);
insert into t2 (b) values (7),(8);
commit;
begin;
insert into t1 (b) values (10),(11),(12);
update t1 set b=100 where a=2;
delete from t1 where a between 3 and 4;
insert into t2 (b) values (10),(11),(12);
update t2 set b=100 where a=2;
delete from t2 where a between 3 and 4;
select NEXT VALUE for s1,seq from seq_1_to_4;
NEXT VALUE for s1 seq
5 1
6 2
7 3
8 4
# Kill and restart
select * from t1 order by a;
a b
1 1
2 100
5 5
6 6
7 7
8 8
9 10
10 11
11 12
select * from t2 order by a;
a b
1 1
2 100
5 5
6 6
7 7
8 8
9 10
10 11
11 12
Warnings:
Error 145 Table './test/t2' is marked as crashed and should be repaired
Warning 1034 1 client is using or hasn't closed the table properly
Note 1034 Table is fixed
insert into t1 (b) values (100),(200);
insert into t2 (b) values (100),(200);
select * from t1 order by a;
a b
1 1
2 100
5 5
6 6
7 7
8 8
9 10
10 11
11 12
12 100
13 200
select * from t2 order by a;
a b
1 1
2 100
5 5
6 6
7 7
8 8
9 10
10 11
11 12
12 100
13 200
select NEXT VALUE for s1,seq from seq_1_to_4;
NEXT VALUE for s1 seq
9 1
10 2
11 3
12 4
Warnings:
Error 145 Table './test/s1' is marked as crashed and should be repaired
Warning 1034 1 client is using or hasn't closed the table properly
Note 1034 Table is fixed
drop table t1,t2;
drop sequence s1;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Table \'.*\' is marked as crashed and should be repaired' COLLATE 'latin1_swedish_ci'))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Checking table: .*' COLLATE 'latin1_swedish_ci'))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t1 (a int primary key auto_increment, b int) engine=aria transactional= 1
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create table t2 (a int primary key auto_increment, b int) engine=aria transactional= 0
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create sequence s1 cache=2 engine=aria
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=1
master-bin.000001 # Query # # use `test`; insert into t1 (b) values (1),(2),(3),(4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=1
master-bin.000001 # Query # # use `test`; insert into t2 (b) values (1),(2),(3),(4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # select NEXT VALUE for s1,seq from seq_1_to_4
master-bin.000001 # Table_map # # table_id: # (test.s1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=5
master-bin.000001 # Query # # use `test`; insert into t1 (b) values (5),(6)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=7
master-bin.000001 # Query # # use `test`; insert into t1 (b) values (7),(8)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=5
master-bin.000001 # Query # # use `test`; insert into t2 (b) values (5),(6)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=7
master-bin.000001 # Query # # use `test`; insert into t2 (b) values (7),(8)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=9
master-bin.000001 # Query # # use `test`; insert into t1 (b) values (10),(11),(12)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; update t1 set b=100 where a=2
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; delete from t1 where a between 3 and 4
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Intvar # # INSERT_ID=9
master-bin.000001 # Query # # use `test`; insert into t2 (b) values (10),(11),(12)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; update t2 set b=100 where a=2
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; delete from t2 where a between 3 and 4
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # select NEXT VALUE for s1,seq from seq_1_to_4
master-bin.000001 # Table_map # # table_id: # (test.s1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Intvar # # INSERT_ID=12
master-bin.000002 # Query # # use `test`; insert into t1 (b) values (100),(200)
master-bin.000002 # Query # # COMMIT
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Intvar # # INSERT_ID=12
master-bin.000002 # Query # # use `test`; insert into t2 (b) values (100),(200)
master-bin.000002 # Query # # COMMIT
master-bin.000002 # Gtid # # BEGIN GTID #-#-#
master-bin.000002 # Annotate_rows # # select NEXT VALUE for s1,seq from seq_1_to_4
master-bin.000002 # Table_map # # table_id: # (test.s1)
master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000002 # Query # # COMMIT
master-bin.000002 # Gtid # # GTID #-#-#
master-bin.000002 # Query # # use `test`; DROP TABLE `t1`,`t2` /* generated by server */
master-bin.000002 # Gtid # # GTID #-#-#
master-bin.000002 # Query # # use `test`; DROP SEQUENCE `s1` /* generated by server */