Wrong load removed node of galera cluster.
trove/common/strategies/cluster/experimental/galera_common/api.py. Method "shrink" in class GaleraCommonCluster,when use DBInstance.find_all should set argument deleted=False, otherwise it may missing raise a ClusterShrinkMustNotLeaveClusterEmpty exception. Same problem at galera_common/taskmanager.py. Method "shrink_cluster" in GaleraCommonClusterTasks, call DBInstance.findall() with deleted=False to exclude deleted nodes and that can avoid a NotFound error. Change-Id: Ibb377630b830da06485fc17a1a723dc1055d9b01 Closes-Bug: 1699953
This commit is contained in:
parent
7c258abb01
commit
86497c3e69
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes an issue in galera_common shrink that wrong load removed nodes
|
||||
which could missing a ClusterShrinkMustNotLeaveClusterEmpty exception
|
||||
or meet a NotFound error. Bug 1699953
|
@ -184,7 +184,8 @@ class GaleraCommonCluster(cluster_models.Cluster):
|
||||
self.validate_cluster_available()
|
||||
removal_instances = [Instance.load(self.context, inst_id)
|
||||
for inst_id in instances]
|
||||
db_instances = DBInstance.find_all(cluster_id=self.db_info.id).all()
|
||||
db_instances = DBInstance.find_all(
|
||||
cluster_id=self.db_info.id, deleted=False).all()
|
||||
if len(db_instances) - len(removal_instances) < 1:
|
||||
raise exception.ClusterShrinkMustNotLeaveClusterEmpty()
|
||||
|
||||
|
@ -285,7 +285,8 @@ class GaleraCommonClusterTasks(task_models.ClusterTasks):
|
||||
LOG.error(_("timeout for instances to be marked as deleted."))
|
||||
return
|
||||
|
||||
db_instances = DBInstance.find_all(cluster_id=cluster_id).all()
|
||||
db_instances = DBInstance.find_all(
|
||||
cluster_id=cluster_id, deleted=False).all()
|
||||
leftover_instances = [Instance.load(context, db_inst.id)
|
||||
for db_inst in db_instances
|
||||
if db_inst.id not in removal_instance_ids]
|
||||
|
Loading…
Reference in New Issue
Block a user