mirror of
https://github.com/MariaDB/server.git
synced 2026-02-24 03:28:46 +01:00
Implement an improved binlog implementation that is integrated into the storage engine. The new implementation is enabled with the --binlog-storage-engine option. Initially the InnoDB storage engine implements the binlog. Integrating the binlog in the storage engine improves performance, since it makes the InnoDB redo log the single source of truth and avoids the need for expensive two-phase commit between binlog and engine. It also makes it possible to disable durability (set --innodb-flush-log-at-trx-commit=0) to further improve performance, while still preserving the ability to recover the binlog and database into a consistent state after a crash. The new binlog implementation also greatly improves the internal design and implementation of the binlog, and enables future enhancements for replication. This is a squash of the original 11.4-based patch series. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
103 lines
2.9 KiB
Text
103 lines
2.9 KiB
Text
include/reset_master.inc
|
|
set TIMESTAMP= UNIX_TIMESTAMP("1970-01-21 15:32:22");
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
|
|
*** Test dumping all binlog files, including the last empty one.
|
|
FLUSH BINARY LOGS;
|
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
|
/*!40019 SET @@session.max_delayed_threads=0*/;
|
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
|
DELIMITER /*!*/;
|
|
use `test`/*!*/;
|
|
SET TIMESTAMP=1773142/*!*/;
|
|
SET @@session.pseudo_thread_id=999999999/*!*/;
|
|
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.system_versioning_insert_history=0/*!*/;
|
|
SET @@session.sql_mode=1411383296/*!*/;
|
|
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
|
/*!\C latin1 *//*!*/;
|
|
SET @@session.character_set_client=X,@@session.collation_connection=X,@@session.collation_server=X/*!*/;
|
|
SET @@session.lc_time_names=0/*!*/;
|
|
SET @@session.collation_database=DEFAULT/*!*/;
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
|
|
/*!*/;
|
|
DELIMITER ;
|
|
DELIMITER /*!*/;
|
|
DELIMITER ;
|
|
DELIMITER /*!*/;
|
|
DELIMITER ;
|
|
# End of log file
|
|
ROLLBACK /* added by mysqlbinlog */;
|
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
|
INSERT INTO t1 VALUES (1, 0), (2, 0), (3, 0);
|
|
UPDATE t1 SET b=1 WHERE a=1;
|
|
DELETE FROM t1 WHERE a=2;
|
|
REPLACE INTO t1 VALUES (3, 3);
|
|
FLUSH BINARY LOGS;
|
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
|
/*!40019 SET @@session.max_delayed_threads=0*/;
|
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
|
DELIMITER /*!*/;
|
|
START TRANSACTION
|
|
/*!*/;
|
|
# Annotate_rows:
|
|
#Q> INSERT INTO t1 VALUES (1, 0), (2, 0), (3, 0)
|
|
COMMIT/*!*/;
|
|
START TRANSACTION
|
|
/*!*/;
|
|
# Annotate_rows:
|
|
#Q> UPDATE t1 SET b=1 WHERE a=1
|
|
COMMIT/*!*/;
|
|
START TRANSACTION
|
|
/*!*/;
|
|
# Annotate_rows:
|
|
#Q> DELETE FROM t1 WHERE a=2
|
|
COMMIT/*!*/;
|
|
START TRANSACTION
|
|
/*!*/;
|
|
# Annotate_rows:
|
|
#Q> REPLACE INTO t1 VALUES (3, 3)
|
|
COMMIT/*!*/;
|
|
DELIMITER ;
|
|
# End of log file
|
|
ROLLBACK /* added by mysqlbinlog */;
|
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
|
*** Test dumping the last, pre-allocated, empty file.
|
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
|
|
/*!40019 SET @@session.max_delayed_threads=0*/;
|
|
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
|
DELIMITER /*!*/;
|
|
DELIMITER ;
|
|
# End of log file
|
|
ROLLBACK /* added by mysqlbinlog */;
|
|
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
|
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 1
|
|
3 3
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 1
|
|
3 3
|
|
SET SESSION binlog_format= MIXED;
|
|
INSERT INTO t1 SELECT a+10, 10 FROM t1;
|
|
UPDATE t1 SET b=11 WHERE a <= 12;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 11
|
|
3 11
|
|
11 11
|
|
13 10
|
|
FLUSH BINARY LOGS;
|
|
FLUSH BINARY LOGS;
|
|
TRUNCATE t1;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 11
|
|
3 11
|
|
11 11
|
|
13 10
|
|
DROP TABLE t1;
|