Merge "Avoid unnecessary restart of replication master"

This commit is contained in:
Jenkins 2015-04-07 01:26:28 +00:00 committed by Gerrit Code Review
commit 01cd91427f
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):