summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorTeemu Ollakka <teemu.ollakka@galeracluster.com>2015-11-04 16:19:48 +0200
committerNirbhay Choubey <nirbhay@mariadb.com>2016-02-10 17:42:22 -0500
commit8a93a7c0b0436a1b863c3b3cc165dca9a690a064 (patch)
treeb72d23ddc1c17e4065d0d2db06527bf4deebf150 /sql/log.cc
parent652e4c1d3333ef0649a504995e39b5c0c664c5ff (diff)
downloadmariadb-git-8a93a7c0b0436a1b863c3b3cc165dca9a690a064.tar.gz
refs codership/mysql-wsrep#226 Limit binlog recovery to found wsrep position
Limit binlog recovery so that the wsrep position found from storage engines is not exceeded. This is required to have consistent position between wsrep position stored in innodb header and recoverd binlog.
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc
index f9756e6c450..cf0c066c750 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -7701,6 +7701,22 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
HASH xids;
MEM_ROOT mem_root;
+#ifdef WITH_WSREP
+ /*
+ Read current wsrep position from storage engines to have consistent
+ end position for binlog scan.
+ */
+ wsrep_uuid_t uuid;
+ wsrep_seqno_t seqno;
+ wsrep_get_SE_checkpoint(uuid, seqno);
+ char uuid_str[40];
+ wsrep_uuid_print(&uuid, uuid_str, sizeof(uuid_str));
+ WSREP_INFO("Binlog recovery, found wsrep position %s:%lld", uuid_str,
+ (long long)seqno);
+ const wsrep_seqno_t last_xid_seqno= seqno;
+ wsrep_seqno_t cur_xid_seqno= WSREP_SEQNO_UNDEFINED;
+#endif /* WITH_WSREP */
+
if (! fdle->is_valid() ||
my_hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0,
sizeof(my_xid), 0, 0, MYF(0)))
@@ -7712,7 +7728,12 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
while ((ev= Log_event::read_log_event(log, 0, fdle,
opt_master_verify_checksum))
- && ev->is_valid())
+ && ev->is_valid()
+#ifdef WITH_WSREP
+ && (last_xid_seqno == WSREP_SEQNO_UNDEFINED ||
+ last_xid_seqno != cur_xid_seqno)
+#endif
+ )
{
if (ev->get_type_code() == XID_EVENT)
{
@@ -7721,10 +7742,18 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle)
sizeof(xev->xid));
if (!x || my_hash_insert(&xids, x))
goto err2;
+#ifdef WITH_WSREP
+ cur_xid_seqno= xev->xid;
+#endif /* WITH_WSREP */
}
delete ev;
}
+#ifdef WITH_WSREP
+ WSREP_INFO("Binlog recovery scan stopped at Xid event %lld",
+ (long long)cur_xid_seqno);
+#endif /* WITH_WSREP */
+
if (ha_recover(&xids))
goto err2;