Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# shellcheck shell=sh
#
# H10: the galera memberLeave action was a silent no-op — it ran in the
# kbagent execution face (no mariadb client), all SQL guarded with
# `2>/dev/null || true`, so its claimed FLUSH TABLES / wsrep_desync=ON never
# executed. Galera evicts a departed node natively (keepalive timeout) and
# the shutdown-time graceful leave (final seqno + safe_to_bootstrap, clean
# InnoDB flush) is handled by the mariadb container preStop, which runs
# in-container against 127.0.0.1. The broken action + its script were removed.

Describe "galera memberLeave removal (H10)"
CMPD_GALERA="${SHELLSPEC_CWD:?}/addons/mariadb/templates/cmpd-galera.yaml"
CFGMAP_GALERA="${SHELLSPEC_CWD:?}/addons/mariadb/templates/configmap-scripts-galera.yaml"
SCRIPTS_DIR="${SHELLSPEC_CWD:?}/addons/mariadb/scripts"

It "cmpd-galera declares no memberLeave lifecycle action"
When run sh -c "grep -E '^[[:space:]]*memberLeave:' '${CMPD_GALERA}' || true"
The status should be success
The output should equal ""
End

It "cmpd-galera does not reference the removed galera-member-leave.sh"
When run sh -c "grep -F 'galera-member-leave.sh' '${CMPD_GALERA}' || true"
The status should be success
The output should equal ""
End

It "galera scripts ConfigMap does not mount galera-member-leave.sh"
When run sh -c "grep -F 'galera-member-leave.sh' '${CFGMAP_GALERA}' || true"
The status should be success
The output should equal ""
End

It "the galera-member-leave.sh script file is gone"
When run sh -c "test ! -e '${SCRIPTS_DIR}/galera-member-leave.sh' && echo GONE"
The status should be success
The output should equal "GONE"
End

It "graceful-leave intent is still covered by the galera preStop (in-container)"
# The shutdown-time graceful leave lives in the mariadb container preStop.
When run sh -c "grep -c 'preStop:' '${CMPD_GALERA}'"
The status should be success
The output should equal "1"
End

It "preStop performs the in-container graceful shutdown SQL"
When run sh -c "grep -F 'SET GLOBAL wsrep_on=OFF' '${CMPD_GALERA}'"
The status should be success
The output should include "wsrep_on=OFF"
End
End
19 changes: 0 additions & 19 deletions addons/mariadb/scripts/galera-member-leave.sh

This file was deleted.

14 changes: 8 additions & 6 deletions addons/mariadb/templates/cmpd-galera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ spec:
command:
- /bin/sh
- /scripts/galera-member-join.sh
memberLeave:
exec:
container: mariadb
command:
- /bin/sh
- /scripts/galera-member-leave.sh
# No memberLeave action: Galera evicts a departed node natively via
# keepalive timeout (down-after group-communication), so no database-
# internal removal step is required. The previous memberLeave ran in the
# kbagent execution face (no mariadb client, all SQL `2>/dev/null || true`),
# so its claimed FLUSH TABLES / wsrep_desync=ON never executed — a silent
# no-op. The graceful-leave that does matter at shutdown (final seqno +
# safe_to_bootstrap, clean InnoDB flush) is handled by the mariadb
# container preStop below, which runs in-container against 127.0.0.1.
runtime:
# Allow enough time for Galera to write grastate.dat on clean shutdown.
# 30s (default) is insufficient when InnoDB has dirty pages to flush.
Expand Down
2 changes: 0 additions & 2 deletions addons/mariadb/templates/configmap-scripts-galera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ data:
{{- .Files.Get "scripts/galera-roleprobe.sh" | nindent 4 }}
galera-member-join.sh: |-
{{- .Files.Get "scripts/galera-member-join.sh" | nindent 4 }}
galera-member-leave.sh: |-
{{- .Files.Get "scripts/galera-member-leave.sh" | nindent 4 }}
Loading