1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Binlog-in-engine: Handle mixing transactional and non-transactional tables

When updating non-transactional tables inside a multi-statement transaction,
and binlog_direct_non_transactional_updates=1, then the non-transactional
updates are binlogged directly through the statement cache while the
transaction cache is still being added to in the main transaction.

Thus, move the engine_binlog_info out from binlog_cache_mngr and into the
individual stmt/trx binlog_cache_data, so that we can have separate
engine_binlog_info active for the statement and the transaction cache.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2025-07-23 00:19:30 +02:00
parent 7a67f72979
commit 585785c7bc
9 changed files with 612 additions and 71 deletions

View File

@@ -0,0 +1,415 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1(a INT PRIMARY KEY, b INT, c LONGTEXT) ENGINE=InnoDB;
CREATE TABLE t2(a INT PRIMARY KEY, b INT, c LONGTEXT) ENGINE=Aria;
SET @c= REPEAT('*', 20);
SET SESSION binlog_format=statement;
SET SESSION binlog_direct_non_transactional_updates= 0;
INSERT INTO t1 VALUES (1 + 0, 0, @c), (2 + 0, 0, @c), (3 + 0, 0, @c);
INSERT INTO t2 VALUES (1 + 0, 1, @c), (2 + 0, 1, @c), (3 + 0, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+0;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+0;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+0;
INSERT INTO t2 VALUES (4 + 0, 2, @c);
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
COMMIT;
SET SESSION binlog_direct_non_transactional_updates= 1;
INSERT INTO t1 VALUES (1 + 10, 0, @c), (2 + 10, 0, @c), (3 + 10, 0, @c);
INSERT INTO t2 VALUES (1 + 10, 1, @c), (2 + 10, 1, @c), (3 + 10, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+10;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+10;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+10;
INSERT INTO t2 VALUES (4 + 10, 2, @c);
COMMIT;
SET SESSION binlog_format=row;
SET SESSION binlog_direct_non_transactional_updates= 0;
INSERT INTO t1 VALUES (1 + 100, 0, @c), (2 + 100, 0, @c), (3 + 100, 0, @c);
INSERT INTO t2 VALUES (1 + 100, 1, @c), (2 + 100, 1, @c), (3 + 100, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+100;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+100;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+100;
INSERT INTO t2 VALUES (4 + 100, 2, @c);
COMMIT;
SET SESSION binlog_direct_non_transactional_updates= 1;
INSERT INTO t1 VALUES (1 + 110, 0, @c), (2 + 110, 0, @c), (3 + 110, 0, @c);
INSERT INTO t2 VALUES (1 + 110, 1, @c), (2 + 110, 1, @c), (3 + 110, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+110;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+110;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+110;
INSERT INTO t2 VALUES (4 + 110, 2, @c);
COMMIT;
SET @c= REPEAT('%', 1024);
SET SESSION binlog_format=statement;
SET SESSION binlog_direct_non_transactional_updates= 0;
INSERT INTO t1 VALUES (1 + 1000, 0, @c), (2 + 1000, 0, @c), (3 + 1000, 0, @c);
INSERT INTO t2 VALUES (1 + 1000, 1, @c), (2 + 1000, 1, @c), (3 + 1000, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+1000;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+1000;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+1000;
INSERT INTO t2 VALUES (4 + 1000, 2, @c);
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
COMMIT;
SET SESSION binlog_direct_non_transactional_updates= 1;
INSERT INTO t1 VALUES (1 + 1010, 0, @c), (2 + 1010, 0, @c), (3 + 1010, 0, @c);
INSERT INTO t2 VALUES (1 + 1010, 1, @c), (2 + 1010, 1, @c), (3 + 1010, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+1010;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+1010;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+1010;
INSERT INTO t2 VALUES (4 + 1010, 2, @c);
COMMIT;
SET SESSION binlog_format=row;
SET SESSION binlog_direct_non_transactional_updates= 0;
INSERT INTO t1 VALUES (1 + 1100, 0, @c), (2 + 1100, 0, @c), (3 + 1100, 0, @c);
INSERT INTO t2 VALUES (1 + 1100, 1, @c), (2 + 1100, 1, @c), (3 + 1100, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+1100;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+1100;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+1100;
INSERT INTO t2 VALUES (4 + 1100, 2, @c);
COMMIT;
SET SESSION binlog_direct_non_transactional_updates= 1;
INSERT INTO t1 VALUES (1 + 1110, 0, @c), (2 + 1110, 0, @c), (3 + 1110, 0, @c);
INSERT INTO t2 VALUES (1 + 1110, 1, @c), (2 + 1110, 1, @c), (3 + 1110, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+1110;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+1110;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+1110;
INSERT INTO t2 VALUES (4 + 1110, 2, @c);
COMMIT;
SET @c= REPEAT('.', 18000);
SET SESSION binlog_format=statement;
SET SESSION binlog_direct_non_transactional_updates= 0;
INSERT INTO t1 VALUES (1 + 2000, 0, @c), (2 + 2000, 0, @c), (3 + 2000, 0, @c);
INSERT INTO t2 VALUES (1 + 2000, 1, @c), (2 + 2000, 1, @c), (3 + 2000, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+2000;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+2000;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+2000;
INSERT INTO t2 VALUES (4 + 2000, 2, @c);
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
COMMIT;
SET SESSION binlog_direct_non_transactional_updates= 1;
INSERT INTO t1 VALUES (1 + 2010, 0, @c), (2 + 2010, 0, @c), (3 + 2010, 0, @c);
INSERT INTO t2 VALUES (1 + 2010, 1, @c), (2 + 2010, 1, @c), (3 + 2010, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+2010;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+2010;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+2010;
INSERT INTO t2 VALUES (4 + 2010, 2, @c);
COMMIT;
SET SESSION binlog_format=row;
SET SESSION binlog_direct_non_transactional_updates= 0;
INSERT INTO t1 VALUES (1 + 2100, 0, @c), (2 + 2100, 0, @c), (3 + 2100, 0, @c);
INSERT INTO t2 VALUES (1 + 2100, 1, @c), (2 + 2100, 1, @c), (3 + 2100, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+2100;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+2100;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+2100;
INSERT INTO t2 VALUES (4 + 2100, 2, @c);
COMMIT;
SET SESSION binlog_direct_non_transactional_updates= 1;
INSERT INTO t1 VALUES (1 + 2110, 0, @c), (2 + 2110, 0, @c), (3 + 2110, 0, @c);
INSERT INTO t2 VALUES (1 + 2110, 1, @c), (2 + 2110, 1, @c), (3 + 2110, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+2110;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+2110;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+2110;
INSERT INTO t2 VALUES (4 + 2110, 2, @c);
COMMIT;
SET @c= REPEAT('.', 40000);
SET SESSION binlog_format=statement;
SET SESSION binlog_direct_non_transactional_updates= 0;
INSERT INTO t1 VALUES (1 + 3000, 0, @c), (2 + 3000, 0, @c), (3 + 3000, 0, @c);
INSERT INTO t2 VALUES (1 + 3000, 1, @c), (2 + 3000, 1, @c), (3 + 3000, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+3000;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+3000;
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+3000;
INSERT INTO t2 VALUES (4 + 3000, 2, @c);
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction
COMMIT;
SET SESSION binlog_direct_non_transactional_updates= 1;
INSERT INTO t1 VALUES (1 + 3010, 0, @c), (2 + 3010, 0, @c), (3 + 3010, 0, @c);
INSERT INTO t2 VALUES (1 + 3010, 1, @c), (2 + 3010, 1, @c), (3 + 3010, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+3010;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+3010;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+3010;
INSERT INTO t2 VALUES (4 + 3010, 2, @c);
COMMIT;
SET SESSION binlog_format=row;
SET SESSION binlog_direct_non_transactional_updates= 0;
INSERT INTO t1 VALUES (1 + 3100, 0, @c), (2 + 3100, 0, @c), (3 + 3100, 0, @c);
INSERT INTO t2 VALUES (1 + 3100, 1, @c), (2 + 3100, 1, @c), (3 + 3100, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+3100;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+3100;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+3100;
INSERT INTO t2 VALUES (4 + 3100, 2, @c);
COMMIT;
SET SESSION binlog_direct_non_transactional_updates= 1;
INSERT INTO t1 VALUES (1 + 3110, 0, @c), (2 + 3110, 0, @c), (3 + 3110, 0, @c);
INSERT INTO t2 VALUES (1 + 3110, 1, @c), (2 + 3110, 1, @c), (3 + 3110, 1, @c);
BEGIN;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+3110;
UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+3110;
UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+3110;
INSERT INTO t2 VALUES (4 + 3110, 2, @c);
COMMIT;
SELECT a, b, length(c) FROM t1 ORDER BY a;
a b length(c)
1 2 21
2 0 20
3 2 21
11 2 21
12 0 20
13 2 21
101 2 21
102 0 20
103 2 21
111 2 21
112 0 20
113 2 21
1001 2 1025
1002 0 1024
1003 2 1025
1011 2 1025
1012 0 1024
1013 2 1025
1101 2 1025
1102 0 1024
1103 2 1025
1111 2 1025
1112 0 1024
1113 2 1025
2001 2 18001
2002 0 18000
2003 2 18001
2011 2 18001
2012 0 18000
2013 2 18001
2101 2 18001
2102 0 18000
2103 2 18001
2111 2 18001
2112 0 18000
2113 2 18001
3001 2 40001
3002 0 40000
3003 2 40001
3011 2 40001
3012 0 40000
3013 2 40001
3101 2 40001
3102 0 40000
3103 2 40001
3111 2 40001
3112 0 40000
3113 2 40001
SELECT a, b, length(c) FROM t2 ORDER BY a;
a b length(c)
1 1 20
2 2 21
3 1 20
4 2 20
11 1 20
12 2 21
13 1 20
14 2 20
101 1 20
102 2 21
103 1 20
104 2 20
111 1 20
112 2 21
113 1 20
114 2 20
1001 1 1024
1002 2 1025
1003 1 1024
1004 2 1024
1011 1 1024
1012 2 1025
1013 1 1024
1014 2 1024
1101 1 1024
1102 2 1025
1103 1 1024
1104 2 1024
1111 1 1024
1112 2 1025
1113 1 1024
1114 2 1024
2001 1 18000
2002 2 18001
2003 1 18000
2004 2 18000
2011 1 18000
2012 2 18001
2013 1 18000
2014 2 18000
2101 1 18000
2102 2 18001
2103 1 18000
2104 2 18000
2111 1 18000
2112 2 18001
2113 1 18000
2114 2 18000
3001 1 40000
3002 2 40001
3003 1 40000
3004 2 40000
3011 1 40000
3012 2 40001
3013 1 40000
3014 2 40000
3101 1 40000
3102 2 40001
3103 1 40000
3104 2 40000
3111 1 40000
3112 2 40001
3113 1 40000
3114 2 40000
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
SELECT a, b, length(c) FROM t1 ORDER BY a;
a b length(c)
1 2 21
2 0 20
3 2 21
11 2 21
12 0 20
13 2 21
101 2 21
102 0 20
103 2 21
111 2 21
112 0 20
113 2 21
1001 2 1025
1002 0 1024
1003 2 1025
1011 2 1025
1012 0 1024
1013 2 1025
1101 2 1025
1102 0 1024
1103 2 1025
1111 2 1025
1112 0 1024
1113 2 1025
2001 2 18001
2002 0 18000
2003 2 18001
2011 2 18001
2012 0 18000
2013 2 18001
2101 2 18001
2102 0 18000
2103 2 18001
2111 2 18001
2112 0 18000
2113 2 18001
3001 2 40001
3002 0 40000
3003 2 40001
3011 2 40001
3012 0 40000
3013 2 40001
3101 2 40001
3102 0 40000
3103 2 40001
3111 2 40001
3112 0 40000
3113 2 40001
SELECT a, b, length(c) FROM t2 ORDER BY a;
a b length(c)
1 1 20
2 2 21
3 1 20
4 2 20
11 1 20
12 2 21
13 1 20
14 2 20
101 1 20
102 2 21
103 1 20
104 2 20
111 1 20
112 2 21
113 1 20
114 2 20
1001 1 1024
1002 2 1025
1003 1 1024
1004 2 1024
1011 1 1024
1012 2 1025
1013 1 1024
1014 2 1024
1101 1 1024
1102 2 1025
1103 1 1024
1104 2 1024
1111 1 1024
1112 2 1025
1113 1 1024
1114 2 1024
2001 1 18000
2002 2 18001
2003 1 18000
2004 2 18000
2011 1 18000
2012 2 18001
2013 1 18000
2014 2 18000
2101 1 18000
2102 2 18001
2103 1 18000
2104 2 18000
2111 1 18000
2112 2 18001
2113 1 18000
2114 2 18000
3001 1 40000
3002 2 40001
3003 1 40000
3004 2 40000
3011 1 40000
3012 2 40001
3013 1 40000
3014 2 40000
3101 1 40000
3102 2 40001
3103 1 40000
3104 2 40000
3111 1 40000
3112 2 40001
3113 1 40000
3114 2 40000
connection master;
DROP TABLE t1, t2;
CALL mtr.add_suppression('Statement is unsafe because it accesses a non-transactional table after accessing a transactional table');
include/rpl_end.inc

View File

@@ -0,0 +1,67 @@
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
--source include/have_innodb_binlog.inc
CREATE TABLE t1(a INT PRIMARY KEY, b INT, c LONGTEXT) ENGINE=InnoDB;
CREATE TABLE t2(a INT PRIMARY KEY, b INT, c LONGTEXT) ENGINE=Aria;
--let $i= 0
while ($i <= 3) {
if ($i == 0) {
SET @c= REPEAT('*', 20);
}
if ($i == 1) {
SET @c= REPEAT('%', 1024);
}
if ($i == 2) {
SET @c= REPEAT('.', 18000);
}
if ($i == 3) {
SET @c= REPEAT('.', 40000);
}
--let $f= 0
while ($f <= 1) {
if ($f == 0) {
SET SESSION binlog_format=statement;
}
if ($f == 1) {
SET SESSION binlog_format=row;
}
--let $s= 0
while ($s <= 1) {
--let $k = `SELECT $i*1000 + $f*100 + $s*10`
eval SET SESSION binlog_direct_non_transactional_updates= $s;
eval INSERT INTO t1 VALUES (1 + $k, 0, @c), (2 + $k, 0, @c), (3 + $k, 0, @c);
eval INSERT INTO t2 VALUES (1 + $k, 1, @c), (2 + $k, 1, @c), (3 + $k, 1, @c);
BEGIN;
eval UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=1+$k;
eval UPDATE t2 SET b=2, c=CONCAT('!', c) WHERE a=2+$k;
eval UPDATE t1 SET b=2, c=CONCAT('!', c) WHERE a=3+$k;
eval INSERT INTO t2 VALUES (4 + $k, 2, @c);
COMMIT;
inc $s;
}
inc $f;
}
inc $i;
}
SELECT a, b, length(c) FROM t1 ORDER BY a;
SELECT a, b, length(c) FROM t2 ORDER BY a;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
SELECT a, b, length(c) FROM t1 ORDER BY a;
SELECT a, b, length(c) FROM t2 ORDER BY a;
--connection master
DROP TABLE t1, t2;
CALL mtr.add_suppression('Statement is unsafe because it accesses a non-transactional table after accessing a transactional table');
--source include/rpl_end.inc

View File

@@ -1,7 +1,7 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (i INT, a INT, b TEXT, PRIMARY KEY(i, a)) ENGINE=InnoDB;
CREATE TABLE t2 (i INT, a INT, b TEXT, PRIMARY KEY(i, a)) ENGINE=InnoDB;
CREATE TABLE t2 (i INT, a INT, b TEXT, PRIMARY KEY(i, a)) ENGINE=MyISAM;
SET @b= REPEAT('$', 0);
BEGIN;
INSERT INTO t1 VALUES (0, 1, @b);
@@ -34,12 +34,15 @@ SAVEPOINT s10;
INSERT INTO t1 VALUES (0, 11, @b);
INSERT INTO t2 VALUES (0, 12, @b);
ROLLBACK TO s10;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT;
SELECT a, length(b) FROM t1 WHERE i=0 AND a>=10 ORDER BY a;
a length(b)
10 0
SELECT a, length(b) FROM t2 WHERE i=0 ORDER BY a;
a length(b)
12 0
BEGIN;
UPDATE t1 SET a=a+1000 WHERE i=0;
UPDATE t1 SET b='x' WHERE i=0;
@@ -90,12 +93,15 @@ SAVEPOINT s10;
INSERT INTO t1 VALUES (1, 11, @b);
INSERT INTO t2 VALUES (1, 12, @b);
ROLLBACK TO s10;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT;
SELECT a, length(b) FROM t1 WHERE i=1 AND a>=10 ORDER BY a;
a length(b)
10 10
SELECT a, length(b) FROM t2 WHERE i=1 ORDER BY a;
a length(b)
12 10
BEGIN;
UPDATE t1 SET a=a+1000 WHERE i=1;
UPDATE t1 SET b='x' WHERE i=1;
@@ -146,12 +152,15 @@ SAVEPOINT s10;
INSERT INTO t1 VALUES (2, 11, @b);
INSERT INTO t2 VALUES (2, 12, @b);
ROLLBACK TO s10;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT;
SELECT a, length(b) FROM t1 WHERE i=2 AND a>=10 ORDER BY a;
a length(b)
10 100
SELECT a, length(b) FROM t2 WHERE i=2 ORDER BY a;
a length(b)
12 100
BEGIN;
UPDATE t1 SET a=a+1000 WHERE i=2;
UPDATE t1 SET b='x' WHERE i=2;
@@ -202,12 +211,15 @@ SAVEPOINT s10;
INSERT INTO t1 VALUES (3, 11, @b);
INSERT INTO t2 VALUES (3, 12, @b);
ROLLBACK TO s10;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT;
SELECT a, length(b) FROM t1 WHERE i=3 AND a>=10 ORDER BY a;
a length(b)
10 642
SELECT a, length(b) FROM t2 WHERE i=3 ORDER BY a;
a length(b)
12 642
BEGIN;
UPDATE t1 SET a=a+1000 WHERE i=3;
UPDATE t1 SET b='x' WHERE i=3;
@@ -258,12 +270,15 @@ SAVEPOINT s10;
INSERT INTO t1 VALUES (4, 11, @b);
INSERT INTO t2 VALUES (4, 12, @b);
ROLLBACK TO s10;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT;
SELECT a, length(b) FROM t1 WHERE i=4 AND a>=10 ORDER BY a;
a length(b)
10 3930
SELECT a, length(b) FROM t2 WHERE i=4 ORDER BY a;
a length(b)
12 3930
BEGIN;
UPDATE t1 SET a=a+1000 WHERE i=4;
UPDATE t1 SET b='x' WHERE i=4;
@@ -314,12 +329,15 @@ SAVEPOINT s10;
INSERT INTO t1 VALUES (5, 11, @b);
INSERT INTO t2 VALUES (5, 12, @b);
ROLLBACK TO s10;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT;
SELECT a, length(b) FROM t1 WHERE i=5 AND a>=10 ORDER BY a;
a length(b)
10 16000
SELECT a, length(b) FROM t2 WHERE i=5 ORDER BY a;
a length(b)
12 16000
BEGIN;
UPDATE t1 SET a=a+1000 WHERE i=5;
UPDATE t1 SET b='x' WHERE i=5;
@@ -370,12 +388,15 @@ SAVEPOINT s10;
INSERT INTO t1 VALUES (6, 11, @b);
INSERT INTO t2 VALUES (6, 12, @b);
ROLLBACK TO s10;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
COMMIT;
SELECT a, length(b) FROM t1 WHERE i=6 AND a>=10 ORDER BY a;
a length(b)
10 40000
SELECT a, length(b) FROM t2 WHERE i=6 ORDER BY a;
a length(b)
12 40000
BEGIN;
UPDATE t1 SET a=a+1000 WHERE i=6;
UPDATE t1 SET b='x' WHERE i=6;

View File

@@ -3,8 +3,7 @@
--source include/have_innodb_binlog.inc
CREATE TABLE t1 (i INT, a INT, b TEXT, PRIMARY KEY(i, a)) ENGINE=InnoDB;
# ToDo CREATE TABLE t2 (i INT, a INT, b TEXT, PRIMARY KEY(i, a)) ENGINE=MyISAM;
CREATE TABLE t2 (i INT, a INT, b TEXT, PRIMARY KEY(i, a)) ENGINE=InnoDB;
CREATE TABLE t2 (i INT, a INT, b TEXT, PRIMARY KEY(i, a)) ENGINE=MyISAM;
# Add different amounts of data, to test various cases where event
# groups fit or do not fit in case, are binlogged / not binlogged as