File: binlog_mysqlbinlog_fill.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (53 lines) | stat: -rw-r--r-- 1,807 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ==== Purpose ====
#
# Add [position|datetime] data to mysqlbinlog.  To generate a binary log with
# a few deterministic,increasing timestamps.
#
# ==== Implementation ====

# We need to set fixed timestamps in this test.
# Use a date in the future to keep a growing timestamp along the
# binlog (including the Start_log_event). This test will work
# unchanged everywhere, because mysql-test-run has fixed TZ, which it
# exports (so mysqlbinlog has same fixed TZ).
#
# ===== Assumption ========
# As this is a generic file and be used by other test, So we have made an
# assumption that a table is already created with defination like
# CREATE TABLE t1 (a INT);
#

# Binlog 1:
# One transaction with timestamp 2031-01-01 12:00:00
--let $datetime_1= 2031-01-01 12:00:00
eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_1");
INSERT INTO t1 VALUES(1);
--let $pos_1= query_get_value(SHOW MASTER STATUS, Position, 1)

# One transaction with timestamp 2032-01-01 12:00:00
--let $datetime_2= 2032-01-01 12:00:00
eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_2");
INSERT INTO t1 VALUES(2);
--let $pos_2= query_get_value(SHOW MASTER STATUS, Position, 1)

# One transaction with timestamp 2033-01-01 12:00:00
eval SET TIMESTAMP= UNIX_TIMESTAMP("2033-01-01 12:00:00");
INSERT INTO t1 VALUES(3);

--let $file_1= query_get_value(SHOW MASTER STATUS, File, 1)
FLUSH LOGS;

#Binlog 2:
# One transaction with timestamp 2034-01-01 12:00:00
SET TIMESTAMP= UNIX_TIMESTAMP("2034-01-01 12:00:00");
INSERT INTO t1 VALUES(4);
--let $pos_3= query_get_value(SHOW MASTER STATUS, Position, 1)

# One transaction with timestamp 2035-01-01 12:00:00
--let $datetime_3= 2035-01-01 12:00:00
eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_3");
INSERT INTO t1 VALUES(5);

--let $file_2= query_get_value(SHOW MASTER STATUS, File, 1)
FLUSH LOGS;