Fix differing bootstrap uuids
When is_bootstrapped is consulted it was returning a false negative. When the leader node is bootstrapped it sets the uuid via leader_set, but during a leader-settings-changed hook when the non-leader should be picking up the uuid it was checking relation data instead which will be way behind the curve. This is a vestigial block of code pre-leadership. Leader settings get set much earlier than relation data. This change consults leader_get rather than the relation. We also make sure the mysqld.cnf file is rendered on a leader-settings-changed hook. Change-Id: I95e56bd28152c934f413025a22dd6821b2ad8e94 Closes-Bug: #1738896
This commit is contained in:
parent
e579ac7a94
commit
a3b43e16ec
|
@ -730,8 +730,8 @@ def ha_relation_changed():
|
|||
def leader_settings_changed():
|
||||
'''Re-trigger install once leader has seeded passwords into install'''
|
||||
install_percona_xtradb_cluster()
|
||||
# Notify any changes to data in leader storage
|
||||
update_shared_db_rels()
|
||||
# Need to render the template files
|
||||
config_changed()
|
||||
log('leader-settings-changed', level='DEBUG')
|
||||
try:
|
||||
update_bootstrap_uuid()
|
||||
|
|
|
@ -76,6 +76,8 @@ SEEDED_MARKER = "{data_dir}/seeded"
|
|||
HOSTS_FILE = '/etc/hosts'
|
||||
DEFAULT_MYSQL_PORT = 3306
|
||||
|
||||
WSREP_FILE = "/etc/mysql/percona-xtradb-cluster.conf.d/wsrep.cnf"
|
||||
|
||||
# NOTE(ajkavanagh) - this is 'required' for the pause/resume code for
|
||||
# maintenance mode, but is currently not populated as the
|
||||
# charm_check_function() checks whether the unit is working properly.
|
||||
|
@ -407,23 +409,15 @@ def is_bootstrapped():
|
|||
|
||||
@returns boolean
|
||||
"""
|
||||
uuids = []
|
||||
rids = relation_ids('cluster') or []
|
||||
for rid in rids:
|
||||
units = related_units(rid)
|
||||
units.append(local_unit())
|
||||
for unit in units:
|
||||
id = relation_get('bootstrap-uuid', unit=unit, rid=rid)
|
||||
if id:
|
||||
uuids.append(id)
|
||||
|
||||
if uuids:
|
||||
if len(set(uuids)) > 1:
|
||||
log("Found inconsistent bootstrap uuids - %s" % (uuids), WARNING)
|
||||
|
||||
# Is the leader bootstrapped?
|
||||
# Leader settings happen long before relation settings.
|
||||
if leader_get('bootstrap-uuid'):
|
||||
log("Leader is bootstrapped uuid: {}".format(
|
||||
leader_get('bootstrap-uuid')), WARNING)
|
||||
return True
|
||||
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def bootstrap_pxc():
|
||||
|
|
Loading…
Reference in New Issue