1 ################################################################################
2 # This file aims to check if a log, either binary or relay log, has correctly
3 # stored the Previous_gtids_log_event and Gtid_log_event events.
6 # (Type of the log: binlog or relaylog)
7 # --let $binlog= <type_log>
8 # (Check in the current log has <set_ini>-<set_end> in Previous GTIDs)
9 # $gtid_set_ini= <set_ini>
10 # $gtid_set_end= <set_end>
11 # (Check in the current log has GTIDs from <gtid_ini> to <gtid_end>)
12 # $gtid_ini= <gtid_ini>
13 # $gtid_end= <gtid_end>
14 # (Enable or disable debug)
15 # --let $debug= <enabled>
18 # --let $binlog= <type_log>
19 # --let $gtid_set_ini= <set_ini>
20 # --let $gtid_set_end= <set_end>
21 # --let $gtid_ini= <gtid_ini>
22 # --let $gtid_end= <gtid_end>
23 # --source extra/rpl_tests/rpl_check_gtid.inc
25 # Example (Checking both Previous GTIDs and current Gtids in the master's
26 # current binary log):
28 # --let $binlog= binlog
29 # --let $gtid_set_ini= <set_ini>
30 # --let $gtid_set_end= <set_end>
31 # --let $gtid_ini= <gtid_ini>
32 # --let $gtid_end= <gtid_end>
33 # --source extra/rpl_tests/rpl_check_gtid.inc
35 # Example (Checking Previous GTIDs in the slave's current binary log):
37 # --let $binlog= binlog
38 # --let $gtid_set_ini= <set_ini>
39 # --let $gtid_set_end= <set_end>
42 # --source extra/rpl_tests/rpl_check_gtid.inc
44 # Example (Checking GTIDs in the slave's current relay log):
46 # --let $binlog= relaylog
47 # --let $gtid_set_ini=
48 # --let $gtid_set_end=
49 # --let $gtid_ini= <gtid_ini>
50 # --let $gtid_end= <gtid_end>
51 # --source extra/rpl_tests/rpl_check_gtid.inc
52 ################################################################################
54 --echo
extra/rpl_tests/rpl_check_gtid.inc
56 if (`SELECT
"$binlog" =
"binlog"`)
58 --let $command_set= SHOW MASTER
STATUS
59 --let $command_set_info= File
60 --let $command_show= SHOW BINLOG EVENTS
63 if (`SELECT
"$binlog" =
"relaylog"`)
65 --let $command_set= SHOW SLAVE
STATUS
66 --let $command_set_info= Relay_Log_File
67 --let $command_show= SHOW RELAYLOG EVENTS
71 if (`SELECT
"$binlog" <>
"" and
"$gtid_set_end" <>
"" and
"$gtid_set_ini" <>
""`)
73 --let $server_log= query_get_value($command_set, $command_set_info, 1)
74 if (`SELECT "$debug" <> ""`)
76 --eval $command_show in
"$server_log"
78 --let $type= query_get_value($command_show in
"$server_log", Event_type, 2)
79 --let $info= query_get_value($command_show in
"$server_log", Info, 2)
80 if ($type != Previous_gtids)
82 --source include/show_rpl_debug_info.inc
83 --echo $type $info --- Type should be Previous_gtids.
84 --echo log=
'$server_log'
85 --eval $command_show in
"$server_log"
88 if ($gtid_set_end == 0 && $gtid_set_ini == 0)
90 if (`SELECT
"$info" <>
""`)
92 --source include/show_rpl_debug_info.inc
93 --echo $type $info -- Info should be empty.
94 --let $datadir= `select @@datadir`
95 --echo log=
'$server_log'
96 --exec $MYSQL_BINLOG $datadir/$server_log
97 --eval $command_show in
"$server_log"
101 if (`SELECT $gtid_set_end <> 0 and $gtid_set_ini <> 0 and $gtid_set_end <> $gtid_set_ini`)
103 if (`SELECT NOT (
"$info" REGEXP
"$server_uuid:$gtid_set_ini-$gtid_set_end")`)
105 --source include/show_rpl_debug_info.inc
106 --echo $type $info -- Info should be $server_uuid:$gtid_set_ini-$gtid_set_end.
107 --let $datadir= `select @@datadir`
108 --echo log=
'$server_log'
109 --exec $MYSQL_BINLOG $datadir/$server_log
110 --eval $command_show in
"$server_log"
114 if ($gtid_set_end != 0 && $gtid_set_ini != 0 && $gtid_set_end == $gtid_set_ini)
116 if (`SELECT NOT (
"$info" REGEXP
"$server_uuid:$gtid_set_ini")`)
118 --source include/show_rpl_debug_info.inc
119 --echo $type $info -- Info should be $server_uuid:$gtid_set_ini.
120 --let $datadir= `select @@datadir`
121 --echo log=
'$server_log'
122 --exec $MYSQL_BINLOG $datadir/$server_log
123 --eval $command_show in
"$server_log"
129 if (`SELECT
"$binlog" <>
"" and
"$gtid_end" <>
"" and
"$gtid_ini" <>
""`)
132 --let $trans= `SELECT $gtid_ini`
135 --let $server_log= query_get_value($command_set, $command_set_info, 1)
136 while (`SELECT $trans <= $gtid_end AND "$type" <> "No such row"`)
138 --let $type= query_get_value($command_show in
"$server_log", Event_type, $pos)
141 --let $info= query_get_value($command_show in
"$server_log", Info, $pos)
142 if (`SELECT "$info" REGEXP "^SET @@SESSION.GTID_NEXT= '$server_uuid:$trans'"`)
144 --let $trans= `SELECT $trans + 1`
149 if ($trans <= $gtid_end)
151 --source include/show_rpl_debug_info.inc
152 --echo $type $info -- We should retrieve from $gtid_ini
to $gtid_end.
153 --echo log=
'$server_log'
154 --eval $command_show in
"$server_log"