diff --git a/releasenotes/notes/fix-galera_common-cluster-shrink-e2c80913423772dd.yaml b/releasenotes/notes/fix-galera_common-cluster-shrink-e2c80913423772dd.yaml new file mode 100644 index 0000000000..ce15b93246 --- /dev/null +++ b/releasenotes/notes/fix-galera_common-cluster-shrink-e2c80913423772dd.yaml @@ -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 diff --git a/trove/common/strategies/cluster/experimental/galera_common/api.py b/trove/common/strategies/cluster/experimental/galera_common/api.py index 084fee9803..bbbf89a9c6 100644 --- a/trove/common/strategies/cluster/experimental/galera_common/api.py +++ b/trove/common/strategies/cluster/experimental/galera_common/api.py @@ -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() diff --git a/trove/common/strategies/cluster/experimental/galera_common/taskmanager.py b/trove/common/strategies/cluster/experimental/galera_common/taskmanager.py index 6fdfbfe79e..47972ea956 100644 --- a/trove/common/strategies/cluster/experimental/galera_common/taskmanager.py +++ b/trove/common/strategies/cluster/experimental/galera_common/taskmanager.py @@ -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]