summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2017-10-26 12:46:45 +0300
committerMonty <monty@mariadb.org>2017-12-18 13:43:36 +0200
commitea37c129f968593e48170e489788cc481fe9a2bd (patch)
tree1878fb29f55b3bc020119660fe7f3a2b7dbe2cba /sql/sql_repl.cc
parent2e53b96a0aa9dcb18d8bbe12e5bc7e0aba208540 (diff)
downloadmariadb-git-ea37c129f968593e48170e489788cc481fe9a2bd.tar.gz
Removed not used lock argument from read_log_event
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc71
1 files changed, 69 insertions, 2 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 08e9dcf3fe6..d85d984606d 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -875,6 +875,73 @@ get_binlog_list(MEM_ROOT *memroot)
DBUG_RETURN(current_list);
}
+/*
+ Find the Gtid_list_log_event at the start of a binlog.
+
+ NULL for ok, non-NULL error message for error.
+
+ If ok, then the event is returned in *out_gtid_list. This can be NULL if we
+ get back to binlogs written by old server version without GTID support. If
+ so, it means we have reached the point to start from, as no GTID events can
+ exist in earlier binlogs.
+*/
+
+static const char *
+get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list)
+{
+ Format_description_log_event init_fdle(BINLOG_VERSION);
+ Format_description_log_event *fdle;
+ Log_event *ev;
+ const char *errormsg = NULL;
+
+ *out_gtid_list= NULL;
+
+ if (!(ev= Log_event::read_log_event(cache, &init_fdle,
+ opt_master_verify_checksum)) ||
+ ev->get_type_code() != FORMAT_DESCRIPTION_EVENT)
+ {
+ if (ev)
+ delete ev;
+ return "Could not read format description log event while looking for "
+ "GTID position in binlog";
+ }
+
+ fdle= static_cast<Format_description_log_event *>(ev);
+
+ for (;;)
+ {
+ Log_event_type typ;
+
+ ev= Log_event::read_log_event(cache, fdle, opt_master_verify_checksum);
+ if (!ev)
+ {
+ errormsg= "Could not read GTID list event while looking for GTID "
+ "position in binlog";
+ break;
+ }
+ typ= ev->get_type_code();
+ if (typ == GTID_LIST_EVENT)
+ break; /* Done, found it */
+ if (typ == START_ENCRYPTION_EVENT)
+ {
+ if (fdle->start_decryption((Start_encryption_log_event*) ev))
+ errormsg= "Could not set up decryption for binlog.";
+ }
+ delete ev;
+ if (typ == ROTATE_EVENT || typ == STOP_EVENT ||
+ typ == FORMAT_DESCRIPTION_EVENT || typ == START_ENCRYPTION_EVENT)
+ continue; /* Continue looking */
+
+ /* We did not find any Gtid_list_log_event, must be old binlog. */
+ ev= NULL;
+ break;
+ }
+
+ delete fdle;
+ *out_gtid_list= static_cast<Gtid_list_log_event *>(ev);
+ return errormsg;
+}
+
/*
Check if every GTID requested by the slave is contained in this (or a later)
@@ -3930,7 +3997,7 @@ bool mysql_show_binlog_events(THD* thd)
my_off_t scan_pos = BIN_LOG_HEADER_SIZE;
while (scan_pos < pos)
{
- ev= Log_event::read_log_event(&log, (mysql_mutex_t*)0, description_event,
+ ev= Log_event::read_log_event(&log, description_event,
opt_master_verify_checksum);
scan_pos = my_b_tell(&log);
if (ev == NULL || !ev->is_valid())
@@ -3964,7 +4031,7 @@ bool mysql_show_binlog_events(THD* thd)
my_b_seek(&log, pos);
for (event_count = 0;
- (ev = Log_event::read_log_event(&log, (mysql_mutex_t*) 0,
+ (ev = Log_event::read_log_event(&log,
description_event,
opt_master_verify_checksum)); )
{