Add SST sync detection

This allows us to make a bit more sane mysql start time timeout

Change-Id: I5c071a5f4e0112d6e9b0bf4a8e6901c70dcd4adf
This commit is contained in:
Proskurin Kirill 2017-01-30 16:17:02 +00:00
parent 168ad0d266
commit 1db76f7d4e
2 changed files with 17 additions and 2 deletions

View File

@ -102,7 +102,7 @@ class GaleraChecker(object):
def check_if_sst_running(self):
return True if os.path.isfile(SST_FLAG) else False
return os.path.isfile(SST_FLAG)
def check_if_pidfile_created(self):

View File

@ -23,6 +23,7 @@ DATADIR = "/var/lib/mysql"
INIT_FILE = os.path.join(DATADIR, 'init.ok')
PID_FILE = os.path.join(DATADIR, "mysqld.pid")
GRASTATE_FILE = os.path.join(DATADIR, 'grastate.dat')
SST_FLAG = os.path.join(DATADIR, "sst_in_progress")
GLOBALS_PATH = '/etc/ccp/globals/globals.json'
LOG_DATEFMT = "%Y-%m-%d %H:%M:%S"
@ -320,6 +321,11 @@ def check_for_stale_seqno(etcd_client):
queue_set, seqno_set)
def check_if_sst_running():
return os.path.isfile(SST_FLAG)
def wait_for_expected_state(etcd_client, ttl):
while True:
@ -470,7 +476,16 @@ def wait_for_mysqld(proc):
def wait_for_mysqld_to_start(proc, insecure):
LOG.info("Waiting mysql to start...")
for i in range(0, 299):
time.sleep(5)
while True:
if check_if_sst_running():
LOG.debug("SST sync detected, waiting...")
time.sleep(30)
else:
LOG.debug("No SST sync detected")
break
for i in range(0, 59):
try:
mysql_client = get_mysql_client(insecure=insecure)
mysql_exec(mysql_client, [("SELECT 1", None)])