diff options
author | yourtree <56780191+yourtree@users.noreply.github.com> | 2022-08-21 22:55:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-21 17:55:45 +0300 |
commit | ca6aeadfbef8a0da8817f9f74a7bde1f5df004f7 (patch) | |
tree | cfef91d7fff74cad6898cd2418e55b9f7cbba2ba /TLS.md | |
parent | 31ef410e88dabb3f0d475dd3cae9edc00ba55aa7 (diff) | |
download | redis-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 'TLS.md')
0 files changed, 0 insertions, 0 deletions