summaryrefslogtreecommitdiff
path: root/redis.conf
diff options
context:
space:
mode:
authoryourtree <56780191+yourtree@users.noreply.github.com>2022-08-21 22:55:45 +0800
committerGitHub <noreply@github.com>2022-08-21 17:55:45 +0300
commitca6aeadfbef8a0da8817f9f74a7bde1f5df004f7 (patch)
treecfef91d7fff74cad6898cd2418e55b9f7cbba2ba /redis.conf
parent31ef410e88dabb3f0d475dd3cae9edc00ba55aa7 (diff)
downloadredis-ca6aeadfbef8a0da8817f9f74a7bde1f5df004f7.tar.gz
Support setlocale via CONFIG operation. (#11059)
Till now Redis officially supported tuning it via environment variable see #1074. But we had other requests to allow changing it at runtime, see #799, and #11041. Note that `strcoll()` is used as Lua comparison function and also for comparison of certain string objects in Redis, which leads to a problem that, in different regions, for some characters, the result may be different. Below is an example. ``` 127.0.0.1:6333> SORT test alpha 1) "<" 2) ">" 3) "," 4) "*" 127.0.0.1:6333> CONFIG GET locale-collate 1) "locale-collate" 2) "" 127.0.0.1:6333> CONFIG SET locale-collate 1 (error) ERR CONFIG SET failed (possibly related to argument 'locale') 127.0.0.1:6333> CONFIG SET locale-collate C OK 127.0.0.1:6333> SORT test alpha 1) "*" 2) "," 3) "<" 4) ">" ``` That will cause accidental code compatibility issues for Lua scripts and some Redis commands. This commit creates a new config parameter to control the local environment which only affects `Collate` category. Above shows how it affects `SORT` command, and below shows the influence on Lua scripts. ``` 127.0.0.1:6333> CONFIG GET locale-collate 1) " locale-collate" 2) "C" 127.0.0.1:6333> EVAL "return ',' < '*'" 0 (nil) 127.0.0.1:6333> CONFIG SET locale-collate "" OK 127.0.0.1:6333> EVAL "return ',' < '*'" 0 (integer) 1 ``` Co-authored-by: calvincjli <calvincjli@tencent.com> Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'redis.conf')
-rw-r--r--redis.conf5
1 files changed, 5 insertions, 0 deletions
diff --git a/redis.conf b/redis.conf
index 13b29c428..3bb52e76d 100644
--- a/redis.conf
+++ b/redis.conf
@@ -409,6 +409,11 @@ set-proc-title yes
#
proc-title-template "{title} {listen-addr} {server-mode}"
+# Set the local environment which is used for string comparison operations, and
+# also affect the performance of Lua scripts. Empty String indicates the locale
+# is derived from the environment variables.
+locale-collate ""
+
################################ SNAPSHOTTING ################################
# Save the DB to disk.