Avoid unnecessary restart of replication master

Eliminates the unnecessary restart of the master site
in a replication set when a new slave is added to a
previously existing master site.

Also removed some dead code.

Change-Id: Ia76cca5cb084270c45ce782b7cecc3e17f8402d8
Closes-bug: #1368419
This commit is contained in:
Morgan Jones 2015-04-01 15:16:35 -04:00
parent 0f898f7861
commit 267a81625f
2 changed files with 6 additions and 4 deletions

View File

@ -845,6 +845,9 @@ class MySqlApp(object):
if os.path.exists(cnf_file):
utils.execute_with_timeout("sudo", "rm", cnf_file)
def exists_replication_source_overrides(self):
return os.path.exists(MYCNF_REPLMASTER)
def write_replication_source_overrides(self, overrideValues):
self._write_replication_overrides(overrideValues, MYCNF_REPLMASTER)

View File

@ -108,10 +108,9 @@ class MysqlReplicationBase(base.Replication):
return snapshot_id, log_position
def enable_as_master(self, service, master_config):
if not master_config:
master_config = self._get_master_config()
service.write_replication_source_overrides(master_config)
service.restart()
if not service.exists_replication_source_overrides():
service.write_replication_source_overrides(master_config)
service.restart()
@abc.abstractmethod
def connect_to_master(self, service, snapshot):