From 0034a99d6d946c13b4373c373fa45d32b28e54e9 Mon Sep 17 00:00:00 2001 From: Sugu Sougoumarane Date: Wed, 27 Feb 2019 14:03:27 -0800 Subject: [PATCH] InitShardMaster: make it more idempotent If ISM is retried, it's possible it gets stuck. The specific use case where this happens is when the first attempt went past the point where semi-sync gets enabled. If we retry ISM after that, the part where we create the reparent journal table will hang because the master will have semi-sync enabled, but no replica will be pointing to it. To overcome this, we always disable semi-sync when resetting replication. All the code that enables replication turns semi sync on as needed already. Signed-off-by: Sugu Sougoumarane --- go/mysql/flavor_mariadb.go | 1 + go/mysql/flavor_mysql.go | 1 + 2 files changed, 2 insertions(+) diff --git a/go/mysql/flavor_mariadb.go b/go/mysql/flavor_mariadb.go index 329b6a04b5..efef7cb24b 100644 --- a/go/mysql/flavor_mariadb.go +++ b/go/mysql/flavor_mariadb.go @@ -87,6 +87,7 @@ func (mariadbFlavor) resetReplicationCommands() []string { "RESET SLAVE ALL", // "ALL" makes it forget master host:port. "RESET MASTER", "SET GLOBAL gtid_slave_pos = ''", + "SET GLOBAL rpl_semi_sync_master_enabled = false, GLOBAL rpl_semi_sync_slave_enabled = false", // semi-sync will be enabled if needed when slave is started. } } diff --git a/go/mysql/flavor_mysql.go b/go/mysql/flavor_mysql.go index 3a3fd99400..8a05472841 100644 --- a/go/mysql/flavor_mysql.go +++ b/go/mysql/flavor_mysql.go @@ -69,6 +69,7 @@ func (mysqlFlavor) resetReplicationCommands() []string { "STOP SLAVE", "RESET SLAVE ALL", // "ALL" makes it forget master host:port. "RESET MASTER", // This will also clear gtid_executed and gtid_purged. + "SET GLOBAL rpl_semi_sync_master_enabled = false, GLOBAL rpl_semi_sync_slave_enabled = false", // semi-sync will be enabled if needed when slave is started. } }