Skip to content

Commit 0e8abaf

Browse files
[DPE-9072] allow rebootstrap on metadata removal (#75)
* rebootstrap when removed * fix typo in comment Co-authored-by: Juan Luis Cano Rodríguez <juan.rodriguez@canonical.com> Signed-off-by: Paulo Machado <paulo.machado@canonical.com> --------- Signed-off-by: Paulo Machado <paulo.machado@canonical.com> Co-authored-by: Juan Luis Cano Rodríguez <juan.rodriguez@canonical.com>
1 parent 2f538aa commit 0e8abaf

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

common/common/workload.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,11 @@ def reconcile(
404404
is_charm_exposed = self._charm.is_externally_accessible(event=event)
405405
socket_file_exists = self._container.path("/run/mysqlrouter/mysql.sock").exists()
406406
require_rebootstrap = is_charm_exposed == socket_file_exists
407+
# If the router is not in the cluster set, disable to restart it
408+
# This can happen when the server is scaled to zero and back
409+
require_rebootstrap = require_rebootstrap or not self.shell.is_router_in_cluster_set(
410+
self._router_id
411+
)
407412
if require_rebootstrap:
408413
self._disable_router()
409414

@@ -436,14 +441,6 @@ def status(self) -> ops.StatusBase | None:
436441
"""Report non-active status."""
437442
if status := super().status:
438443
return status
439-
if not self.shell.is_router_in_cluster_set(self._router_id):
440-
# Router should not be removed from ClusterSet after bootstrap (except by MySQL charm
441-
# when MySQL Router unit departs relation).
442-
# If Router is not part of ClusterSet after bootstrap, it most likely was manually
443-
# removed.
444-
return ops.BlockedStatus(
445-
"Router was manually removed from MySQL ClusterSet. Remove & re-deploy unit"
446-
)
447444

448445
def refresh(
449446
self,

0 commit comments

Comments
 (0)