mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
Adding support to allow engines to tell what formats they can handle. The server will generate an error if it is not possible to log the statement according to the logging mode in effect. Adding flags to several storage engines to state what they can handle. Changes to NDB handler removing code that forces row-based mode and adding flag saying that NDB can only handle row format. Adding check that binlog flags are only used for real tables that are opened for writing. BitKeeper/deleted/.del-binlog_row_blackhole.result: Rename: mysql-test/r/binlog_row_blackhole.result -> BitKeeper/deleted/.del-binlog_row_blackhole.result BitKeeper/deleted/.del-binlog_row_blackhole.test: Rename: mysql-test/t/binlog_row_blackhole.test -> BitKeeper/deleted/.del-binlog_row_blackhole.test mysql-test/t/partition_hash.test: Adding error check for statement that might fail. sql/ha_ndbcluster.cc: Removing statements that switch to row-based format. Adding row capabilities. sql/handler.h: Adding handler/table flags to indicate that the engine is row- and/or statement-logging capable. Adding typedef for table_flags type. sql/set_var.cc: Removing code that prevents changing binlog format when NDB is active. sql/share/errmsg.txt: Adding error messages for when row- and/or statement-based logging formats cannot be used. sql/sql_base.cc: Adding business logic in lock_tables() to decide when an error should be thrown because logging is not possible. Add logic to switch to row format when that is allowed and needed. --- Binlog flags should only be checked for real tables that are opened for writing. Adding code to check that. storage/archive/ha_archive.h: Adding row- and statement-logging capabilities to engine. storage/blackhole/ha_blackhole.h: Blackhole can handle statement-format only. storage/csv/ha_tina.h: Adding row- and statement-logging capabilities to engine. storage/example/ha_example.h: For the example engine, we arbitrarily decided that it only can handle row format. storage/federated/ha_federated.h: Adding row- and statement-logging capabilities to engine. storage/heap/ha_heap.h: Heap can handle both row- and statement-based logging format. storage/myisam/ha_myisam.cc: MyISAM can handle both row- and statement-based logging format. storage/myisammrg/ha_myisammrg.h: MyISAM can handle both row- and statement-based logging format. mysql-test/r/binlog_multi_engine.result: New BitKeeper file ``mysql-test/r/binlog_multi_engine.result'' mysql-test/t/binlog_multi_engine.test: New BitKeeper file ``mysql-test/t/binlog_multi_engine.test''
60 lines
1.6 KiB
Plaintext
60 lines
1.6 KiB
Plaintext
source include/have_blackhole.inc;
|
|
source include/have_ndb.inc;
|
|
|
|
CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
|
|
CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
|
|
CREATE TABLE t1n (e INT, f INT) ENGINE=NDB;
|
|
|
|
SET SESSION BINLOG_FORMAT=STATEMENT;
|
|
|
|
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
|
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
|
error ER_BINLOG_STMT_FORMAT_FORBIDDEN;
|
|
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
|
|
|
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
|
error ER_BINLOG_STMT_FORMAT_FORBIDDEN;
|
|
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
|
error ER_BINLOG_ENGINES_INCOMPATIBLE;
|
|
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
|
|
|
TRUNCATE t1m;
|
|
TRUNCATE t1b;
|
|
TRUNCATE t1n;
|
|
|
|
SET SESSION BINLOG_FORMAT=MIXED;
|
|
|
|
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
|
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
|
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
|
|
|
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
|
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
|
error ER_BINLOG_ENGINES_INCOMPATIBLE;
|
|
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
|
|
|
TRUNCATE t1m;
|
|
TRUNCATE t1b;
|
|
TRUNCATE t1n;
|
|
|
|
SET SESSION BINLOG_FORMAT=ROW;
|
|
|
|
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
|
|
error ER_BINLOG_ROW_FORMAT_FORBIDDEN;
|
|
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
|
|
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
|
|
|
|
error ER_BINLOG_ROW_FORMAT_FORBIDDEN;
|
|
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
|
|
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
|
|
error ER_BINLOG_ENGINES_INCOMPATIBLE;
|
|
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
|
|
|
|
TRUNCATE t1m;
|
|
TRUNCATE t1b;
|
|
TRUNCATE t1n;
|
|
|
|
source include/show_binlog_events.inc;
|
|
|
|
DROP TABLE t1m, t1b, t1n;
|