#At file:///home/acorreia/workspace.sun/repository.mysql/bzrwork/bug-49019/mysql-5.1-bugteam/ based on revid:zhenxing.he@stripped
3374 Alfranio Correia 2010-05-09
BUG#49019 Mixing self-logging eng. and regular eng. does not switch to row in mixed mode
Backport of the patch for 5.1-bugteam.
modified:
mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result
mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test
sql/sql_base.cc
=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result 2008-07-06 10:53:25 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result 2010-05-09 22:45:25 +0000
@@ -341,6 +341,33 @@ ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SET AUTOCOMMIT = 1;
+---- Mixed statements Innodb ----
+BEGIN;
+INSERT INTO tndb VALUES (147);
+INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+COMMIT;
+INSERT INTO tndb VALUES (148);
+BEGIN;
+INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+INSERT INTO tndb VALUES (149);
+COMMIT;
+BEGIN;
+INSERT INTO tndb VALUES (150);
+INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+COMMIT;
+INSERT INTO tndb VALUES (151);
+BEGIN;
+INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+Warnings:
+Note 1592 Statement may not be safe to log in statement format.
+INSERT INTO tndb VALUES (152);
+COMMIT;
==== Verify the result ====
SELECT * FROM tmyisam ORDER BY a;
a
@@ -393,6 +420,8 @@ a
140
142
146
+150
+151
SELECT * FROM tinnodb ORDER BY a;
a
1
@@ -420,6 +449,8 @@ a
120
125
127
+147
+148
SELECT * FROM tndb ORDER BY a;
a
2
@@ -447,6 +478,12 @@ a
121
123
126
+147
+148
+149
+150
+151
+152
[on slave]
Comparing tables master:test.tmyisam and slave:test.tmyisam
Comparing tables master:test.tinnodb and slave:test.tinnodb
=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test 2008-08-13 21:18:31 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test 2010-05-09 22:45:25 +0000
@@ -415,6 +415,29 @@ ROLLBACK;
SET AUTOCOMMIT = 1;
+--echo ---- Mixed statements Innodb ----
+
+BEGIN;
+INSERT INTO tndb VALUES (147);
+INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+COMMIT;
+
+INSERT INTO tndb VALUES (148);
+BEGIN;
+INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+INSERT INTO tndb VALUES (149);
+COMMIT;
+
+BEGIN;
+INSERT INTO tndb VALUES (150);
+INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+COMMIT;
+
+INSERT INTO tndb VALUES (151);
+BEGIN;
+INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
+INSERT INTO tndb VALUES (152);
+COMMIT;
--echo ==== Verify the result ====
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2010-03-08 23:57:26 +0000
+++ b/sql/sql_base.cc 2010-05-09 22:45:25 +0000
@@ -5183,6 +5183,16 @@ int decide_logging_format(THD *thd, TABL
thd->variables.binlog_format));
DBUG_PRINT("info", ("multi_engine: %s",
multi_engine ? "TRUE" : "FALSE"));
+ /*
+ Reading from a self-logging engine and updating another engine
+ generates changes that are written to the binary log in the
+ statement format and may make slaves to diverge. In the mixed
+ mode, such changes should be written to the binary log in the
+ row format.
+ */
+ if (multi_engine &&
+ (flags_some_set & HA_HAS_OWN_BINLOGGING))
+ thd->lex->set_stmt_unsafe();
int error= 0;
if (flags_all_set == 0)
Attachment: [text/bzr-bundle]
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (alfranio.correia:3374)Bug#49019 | Alfranio Correia | 10 May |