diff options
author | Chen Tianjie <TJ_Chen@outlook.com> | 2023-02-23 15:07:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-23 09:07:49 +0200 |
commit | 897c3d522c6814b1853b767795a18565c047133e (patch) | |
tree | bdf1ccbb9b25d9144ba1c1ee115565c7a9f696d8 /src/server.h | |
parent | cd58af4d7fe4b506899591b2846cfba61335c958 (diff) | |
download | redis-897c3d522c6814b1853b767795a18565c047133e.tar.gz |
Add CLIENT NO-TOUCH for clients to run commands without affecting LRU/LFU of keys (#11483)
When no-touch mode is enabled, the client will not touch LRU/LFU of the
keys it accesses, except when executing command `TOUCH`.
This allows inspecting or modifying the key-space without affecting their eviction.
Changes:
- A command `CLIENT NO-TOUCH ON|OFF` to switch on and off this mode.
- A client flag `#define CLIENT_NOTOUCH (1ULL<<45)`, which can be shown
with `CLIENT INFO`, by the letter "T" in the "flags" field.
- Clear `NO-TOUCH` flag in `clearClientConnectionState`, which is used by `RESET`
command and resetting temp clients used by modules.
- Also clear `NO-EVICT` flag in `clearClientConnectionState`, this might have been an
oversight, spotted by @madolson.
- A test using `DEBUG OBJECT` command to verify that LRU stat is not touched when
no-touch mode is on.
Co-authored-by: chentianjie <chentianjie@alibaba-inc.com>
Co-authored-by: Madelyn Olson <34459052+madolson@users.noreply.github.com>
Co-authored-by: sundb <sundbcn@gmail.com>
Diffstat (limited to 'src/server.h')
-rw-r--r-- | src/server.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/server.h b/src/server.h index 11629c718..7d8e65b36 100644 --- a/src/server.h +++ b/src/server.h @@ -390,6 +390,7 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT]; memory eviction. */ #define CLIENT_ALLOW_OOM (1ULL<<44) /* Client used by RM_Call is allowed to fully execute scripts even when in OOM */ +#define CLIENT_NO_TOUCH (1ULL<<45) /* This client will not touch LFU/LRU stats. */ /* Client block type (btype field in client structure) * if CLIENT_BLOCKED flag is set. */ |