Fix Python exceptions

If thread launch_cluster_Monitor() and launch_leader_election() operates on the configmap at the same time, Will cause a error 'Exception in thread "Thread-1"'.
This error will cause the thread to get stuck. Configmap will not be updated and the error "data too old" will be reported.
Just passing kubernetes_API exceptions is not enough, all are more appropriate.

Change-Id: I6baa9ece474f9c937fe9bce2231ef500562e0406
This commit is contained in:
jinyuanliu 2021-10-29 04:11:45 -04:00 committed by jayonlau
parent 092e295a67
commit 6d808ceb47
3 changed files with 4 additions and 3 deletions

View File

@ -15,7 +15,7 @@ apiVersion: v1
appVersion: v10.2.31
description: OpenStack-Helm MariaDB
name: mariadb
version: 0.2.9
version: 0.2.10
home: https://mariadb.com/kb/en/
icon: http://badges.mariadb.org/mariadb-badge-180x60.png
sources:

View File

@ -756,7 +756,7 @@ def monitor_cluster():
while True:
try:
update_grastate_configmap()
except kubernetes.client.rest.ApiException as error:
except Exception as error:
logger.error("Error updating grastate configmap: {0}".format(error))
time.sleep(state_configmap_update_period)
@ -777,7 +777,7 @@ def leader_election():
while True:
try:
deadmans_leader_election()
except kubernetes.client.rest.ApiException as error:
except Exception as error:
logger.error("Error electing leader: {0}".format(error))
time.sleep(cluster_leader_ttl / 2)

View File

@ -25,4 +25,5 @@ mariadb:
- 0.2.7 add ingress resources
- 0.2.8 Helm 3 - Fix Job labels
- 0.2.9 Update htk requirements
- 0.2.10 Fix Python exceptions
...