summaryrefslogtreecommitdiff
path: root/sql/rpl_rli.cc
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-05-28 13:28:31 +0200
committerunknown <knielsen@knielsen-hq.org>2013-05-28 13:28:31 +0200
commitee2b7db3f88f6882022a8aa71b30043ed8b40792 (patch)
treece63742ca2896e0bd73a702efeb9eb40ed784f04 /sql/rpl_rli.cc
parentf5319394e3dee146f112b41674ffa188d5e89150 (diff)
downloadmariadb-git-ee2b7db3f88f6882022a8aa71b30043ed8b40792.tar.gz
MDEV-4478: Implement GTID "strict mode"
When @@GLOBAL.gtid_strict_mode=1, then certain operations result in error that would otherwise result in out-of-order binlog files between servers. GTID sequence numbers are now allocated independently per domain; this results in less/no holes in GTID sequences, increasing the likelyhood that diverging binlogs will be caught by the slave when GTID strict mode is enabled.
Diffstat (limited to 'sql/rpl_rli.cc')
-rw-r--r--sql/rpl_rli.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index d27a80313ac..03ec77e1433 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1397,7 +1397,6 @@ rpl_load_gtid_slave_state(THD *thd)
HASH hash;
int err= 0;
uint32 i;
- uint64 highest_seq_no= 0;
DBUG_ENTER("rpl_load_gtid_slave_state");
rpl_global_gtid_slave_state.lock();
@@ -1450,8 +1449,6 @@ rpl_load_gtid_slave_state(THD *thd)
DBUG_PRINT("info", ("Read slave state row: %u-%u-%lu sub_id=%lu\n",
(unsigned)domain_id, (unsigned)server_id,
(ulong)seq_no, (ulong)sub_id));
- if (seq_no > highest_seq_no)
- highest_seq_no= seq_no;
if ((rec= my_hash_search(&hash, (const uchar *)&domain_id, 0)))
{
@@ -1495,6 +1492,14 @@ rpl_load_gtid_slave_state(THD *thd)
rpl_global_gtid_slave_state.unlock();
goto end;
}
+ if (opt_bin_log &&
+ mysql_bin_log.bump_seq_no_counter_if_needed(entry->gtid.domain_id,
+ entry->gtid.seq_no))
+ {
+ my_error(ER_OUT_OF_RESOURCES, MYF(0));
+ rpl_global_gtid_slave_state.unlock();
+ goto end;
+ }
}
rpl_global_gtid_slave_state.loaded= true;
rpl_global_gtid_slave_state.unlock();
@@ -1514,7 +1519,6 @@ end:
thd->mdl_context.release_transactional_locks();
}
my_hash_free(&hash);
- mysql_bin_log.bump_seq_no_counter_if_needed(highest_seq_no);
DBUG_RETURN(err);
}