fix(redis): dynamic reconfigure fails for hyphenated parameters#2741
Open
weicao wants to merge 2 commits into
Open
fix(redis): dynamic reconfigure fails for hyphenated parameters#2741weicao wants to merge 2 commits into
weicao wants to merge 2 commits into
Conversation
The reconfigure exec command running in the kbagent container failed to apply CONFIG SET for parameters with hyphens (e.g. maxmemory-policy, repl-backlog-size, slowlog-max-len). Three stacked issues: 1. /bin/sh strips env vars with invalid POSIX names (containing hyphens) from its environment, making them invisible to `env` and `printenv`. 2. The original `set -eu` + pipe-based `while` loop (`tr | while`) created a subshell where `set -e` caused silent exit on the first redis-cli stderr warning. 3. The redis-cluster scripts ConfigMap was missing reload-parameter.sh, causing the reconfigure script to fail with "not found" on Redis Cluster topology. Fix: read parameters from /proc/self/environ (which preserves the original execve environment including hyphenated names), use file- redirect loop instead of pipe to avoid subshell, and include reload-parameter.sh in redis-cluster scripts ConfigMap. Validated on all 4 topologies (standalone, replication, twemproxy, Redis Cluster) with 4 parameters (3 hyphenated + 1 non-hyphenated). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2741 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 73 73
Lines 9236 9236
=====================================
Misses 9236 9236 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Accumulate reload-parameter.sh exit code so a failed CONFIG SET surfaces as a non-zero exit instead of being masked by the final rm -f (which always returns 0). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
https://github.com/apecloud/kubeblocks/pull/10182/changes look at this pr. only can reconfigure parameters by reconfigure operation. |
wangyelei
reviewed
Jun 4, 2026
|
|
||
| env | cut -d= -f1 | grep -E '^[a-z0-9_.-][a-z0-9_.-]*$' | sort -u | while IFS= read -r param; do | ||
| [ -n "${param}" ] || continue | ||
| /scripts/reload-parameter.sh "${param}" "$(printenv "${param}")" |
Contributor
There was a problem hiding this comment.
only replace param _ to -
Contributor
There was a problem hiding this comment.
replace ^[a-z0-9_.-][a-z0-9_.-]*$ to ^[a-zA-Z0-9_.-]+$
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
maxmemory-policy,repl-backlog-size,slowlog-max-len)/bin/shstrips env vars with invalid POSIX names (hyphens) from its environment, makingenv/printenvunable to see themset -eu+ pipewhileloop (tr | while) runs in subshell whereset -esilently exits on firstredis-clistderr warningreload-parameter.sh, breaking reconfigure on cluster topology/proc/self/environ(preserves originalexecveenvironment), uses file-redirect loop to avoid subshell, and includesreload-parameter.shin redis-cluster scriptsChanges
_helpers.tplredis.config.reconfigureAction: Replaceenv | cut+ pipe while with/proc/self/environ+ file-redirect while_helpers.tplredis-cluster.extend.scripts: Addreload-parameter.shto redis-cluster scripts ConfigMapTest plan
🤖 Generated with Claude Code