diff options
author | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2019-07-23 15:25:00 +0800 |
---|---|---|
committer | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2019-07-23 15:25:00 +0800 |
commit | 9012e587ca6f7c7ef54e86a782910625fe3dc3e9 (patch) | |
tree | 1c520a3919107e20ad7a9eca5faa35d39f187c65 /src/tracking.c | |
parent | c41f94d2a3d9ca33ceefcdf67cc50c949d3a9657 (diff) | |
download | redis-9012e587ca6f7c7ef54e86a782910625fe3dc3e9.tar.gz |
Client side caching: do not reclaim tracking table if it's empty
Diffstat (limited to 'src/tracking.c')
-rw-r--r-- | src/tracking.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/tracking.c b/src/tracking.c index 1189e82d5..badec69a7 100644 --- a/src/tracking.c +++ b/src/tracking.c @@ -206,8 +206,6 @@ void trackingInvalidateKey(robj *keyobj) { * flush the table: it will slowly get garbage collected as more keys * are modified in the used caching slots. */ void trackingInvalidateKeysOnFlush(int dbid) { - UNUSED(dbid); - if (server.tracking_clients) { listNode *ln; listIter li; @@ -222,12 +220,11 @@ void trackingInvalidateKeysOnFlush(int dbid) { /* In case of FLUSHALL, reclaim all the memory used by tracking. */ if (dbid == -1 && TrackingTable) { - for (int j = 0; j < TRACKING_TABLE_SIZE; j++) { + for (int j = 0; j < TRACKING_TABLE_SIZE && TrackingTableUsedSlots > 0; j++) { if (TrackingTable[j] != NULL) { raxFree(TrackingTable[j]); TrackingTable[j] = NULL; TrackingTableUsedSlots--; - if (TrackingTableUsedSlots == 0) break; } } |