summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsundb <sundbcn@gmail.com>2022-12-29 00:15:50 +0800
committerOran Agra <oran@redislabs.com>2023-01-16 18:40:35 +0200
commitb7b78a2db2526cf95aa8ae3e86285abd7ccce652 (patch)
treeef16258520f245322766a6fd758cb07e8424ee13
parentfcfb046d91f606a67cb919f8a8de8c0e53671a2f (diff)
downloadredis-b7b78a2db2526cf95aa8ae3e86285abd7ccce652.tar.gz
Remove unnecessary updateClientMemUsageAndBucket() when feeding monitors (#11657)
This call is introduced in #8687, but became irrelevant in #11348, and is currently a no-op. The fact is that #11348 an unintended side effect, which is that even if the client eviction config is enabled, there are certain types of clients for which memory consumption is not accurately tracked, and so unlike normal clients, their memory isn't reported correctly in INFO. (cherry picked from commit af0a4fe20771603f0eab75a1f60748d124cf33c3)
-rw-r--r--src/replication.c1
-rw-r--r--src/server.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/replication.c b/src/replication.c
index 701217da5..2c7755512 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -585,7 +585,6 @@ void replicationFeedMonitors(client *c, list *monitors, int dictid, robj **argv,
while((ln = listNext(&li))) {
client *monitor = ln->value;
addReply(monitor,cmdobj);
- updateClientMemUsageAndBucket(c);
}
decrRefCount(cmdobj);
}
diff --git a/src/server.c b/src/server.c
index 6e47de67c..33ad776dc 100644
--- a/src/server.c
+++ b/src/server.c
@@ -873,6 +873,12 @@ void removeClientFromMemUsageBucket(client *c, int allow_eviction) {
* together clients consuming about the same amount of memory and can quickly
* free them in case we reach maxmemory-clients (client eviction).
*
+ * Note: This function filters clients of type monitor, master or replica regardless
+ * of whether the eviction is enabled or not, so the memory usage we get from these
+ * types of clients via the INFO command may be out of date. If someday we wanna
+ * improve that to make monitors' memory usage more accurate, we need to re-add this
+ * function call to `replicationFeedMonitors()`.
+ *
* returns 1 if client eviction for this client is allowed, 0 otherwise.
*/
int updateClientMemUsageAndBucket(client *c) {