mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-31761: mariadb-binlog prints fractional timestamp part incorrectly
Fractional part < 100000 microseconds was printed without leading zeros, causing such timestamps to be applied incorrectly in mariadb-binlog | mysql Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
@@ -637,3 +637,37 @@ FLUSH LOGS;
|
||||
--exec $MYSQL_BINLOG --rewrite-db=" ->" --short-form $MYSQLD_DATADIR/master-bin.000001 2>&1
|
||||
|
||||
--exec $MYSQL_BINLOG --rewrite-db=" test -> foo " --short-form $MYSQLD_DATADIR/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31761: mariadb-binlog prints fractional timestamp part incorrectly
|
||||
--echo #
|
||||
|
||||
SET SESSION binlog_format= MIXED;
|
||||
|
||||
RESET MASTER;
|
||||
SET time_zone= '+02:00';
|
||||
CREATE TABLE t (a INT,
|
||||
b TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
|
||||
set SESSION timestamp= 1689978980.012345;
|
||||
INSERT INTO t (a) VALUES (1);
|
||||
SELECT * from t;
|
||||
FLUSH BINARY LOGS;
|
||||
SET SESSION timestamp= 1689978980.567890;
|
||||
SET SESSION binlog_format= ROW;
|
||||
UPDATE t SET a = 2;
|
||||
FLUSH BINARY LOGS;
|
||||
SET SESSION binlog_format= STATEMENT;
|
||||
|
||||
# Replay to see that timestamps are applied correctly.
|
||||
# The bug was that leading zeros on the fractional part were not included in
|
||||
# the mysqlbinlog output, so 1689978980.012345 was applied as 1689978980.12345.
|
||||
|
||||
DROP TABLE t;
|
||||
--let $datadir= `select @@datadir`
|
||||
--exec $MYSQL_BINLOG $datadir/master-bin.000001 | $MYSQL test
|
||||
SELECT * FROM t;
|
||||
--exec $MYSQL_BINLOG $datadir/master-bin.000002 | $MYSQL test
|
||||
SELECT * FROM t;
|
||||
DROP TABLE t;
|
||||
SET time_zone= default;
|
||||
|
Reference in New Issue
Block a user