Skip to content

Commit

Permalink
Add a note to conf about the dangers of modifying dir at runtime (#887)
Browse files Browse the repository at this point in the history
We've had security issues in the past with it, which is why
we marked it as PROTECTED. But, modifying during runtime
is also a dangerous action. For example, when child processes
are running, persistent temp files and log files may have
unexpected effects.

A scenario for modifying dir at runtime is to migrate a disk
failure, such as using disk-based replication to migrate a node,
writing nodes.conf to save the cluster configuration.

We decided to leave it as is and add a note in the conf
about the dangers of modifying dir at runtime.

Signed-off-by: Binbin <[email protected]>
  • Loading branch information
enjoy-binbin authored Dec 8, 2024
1 parent f20d629 commit 176fafc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/unit/introspection.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,13 @@ start_server {tags {"introspection"}} {
}
} {} {external:skip}

test {valkey-server command line arguments - dir multiple times} {
start_server {config "default.conf" args {--dir "./" --dir "./"}} {
r config get dir
assert_equal {PONG} [r ping]
}
} {} {external:skip}

# Config file at this point is at a weird state, and includes all
# known keywords. Might be a good idea to avoid adding tests here.
}
Expand Down
6 changes: 6 additions & 0 deletions valkey.conf
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ rdb-del-sync-files no

# The working directory.
#
# The server log is written relative this directory, if the 'logfile'
# configuration directive is a relative path.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
Expand All @@ -591,6 +594,9 @@ rdb-del-sync-files no
# 'cluster-config-file' configuration directive is a relative path.
#
# Note that you must specify a directory here, not a file name.
# Note that modifying 'dir' during runtime may have unexpected behavior,
# for example when a child process is running, related file operations may
# have unexpected effects.
dir ./

################################# REPLICATION #################################
Expand Down

0 comments on commit 176fafc

Please sign in to comment.