Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/fix redis rdb policy logic #37523

Merged
merged 6 commits into from
Aug 8, 2023
Merged
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
Expand Up @@ -55,7 +55,7 @@ redis_conf_set() {
[[ "$value" = "" ]] && value="\"$value\""

# Determine whether to enable the configuration for RDB persistence, if yes, do not enable the replacement operation
if [ "${key}" == "save" ];then
if [ "${key}" == "save" ]; then
echo "${key} ${value}" >> "${REDIS_BASE_DIR}/etc/redis.conf"
else
replace_in_file "${REDIS_BASE_DIR}/etc/redis.conf" "^#*\s*${key} .*" "${key} ${value}" false
Expand Down Expand Up @@ -406,12 +406,14 @@ redis_configure_default() {
redis_conf_set appendonly "${REDIS_AOF_ENABLED}"

#The value stored in $i here is the number of seconds and times of save rules in redis rdb mode
if [ -z "${REDIS_RDB_POLICY}" ];then
redis_conf_set save ""
if is_empty_value "$REDIS_RDB_POLICY"; then
if is_boolean_yes "$REDIS_RDB_POLICY_DISABLED"; then
redis_conf_set save ""
fi
else
for i in ${REDIS_RDB_POLICY};do
redis_conf_set save "${i//#/ }"
done
for i in ${REDIS_RDB_POLICY}; do
redis_conf_set save "${i//#/ }"
done
fi

redis_conf_set port "$REDIS_PORT_NUMBER"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ redis_conf_set() {
[[ "$value" = "" ]] && value="\"$value\""

# Determine whether to enable the configuration for RDB persistence, if yes, do not enable the replacement operation
if [ "${key}" == "save" ];then
if [ "${key}" == "save" ]; then
echo "${key} ${value}" >> "${REDIS_BASE_DIR}/etc/redis.conf"
else
replace_in_file "${REDIS_BASE_DIR}/etc/redis.conf" "^#*\s*${key} .*" "${key} ${value}" false
Expand Down Expand Up @@ -406,12 +406,14 @@ redis_configure_default() {
redis_conf_set appendonly "${REDIS_AOF_ENABLED}"

#The value stored in $i here is the number of seconds and times of save rules in redis rdb mode
if [ -z "${REDIS_RDB_POLICY}" ];then
redis_conf_set save ""
if is_empty_value "$REDIS_RDB_POLICY"; then
if is_boolean_yes "$REDIS_RDB_POLICY_DISABLED"; then
redis_conf_set save ""
fi
else
for i in ${REDIS_RDB_POLICY};do
redis_conf_set save "${i//#/ }"
done
for i in ${REDIS_RDB_POLICY}; do
redis_conf_set save "${i//#/ }"
done
fi

redis_conf_set port "$REDIS_PORT_NUMBER"
Expand Down
Loading