From 897c3d522c6814b1853b767795a18565c047133e Mon Sep 17 00:00:00 2001 From: Chen Tianjie Date: Thu, 23 Feb 2023 15:07:49 +0800 Subject: 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 Co-authored-by: Madelyn Olson <34459052+madolson@users.noreply.github.com> Co-authored-by: sundb --- src/server.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/server.h') 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. */ -- cgit v1.2.1