Fix memory leak when doing lazyfreeing client tracking table (#8822)
Interior rax pointers were not being freed (cherry picked from commit c73b4ddfd96d00ed0d0fde17953ce63d78bc3777)
This commit is contained in:
parent
87c5cf52df
commit
3e97074649
@ -39,12 +39,11 @@ void lazyfreeFreeSlotsMap(void *args[]) {
|
|||||||
atomicIncr(lazyfreed_objects,len);
|
atomicIncr(lazyfreed_objects,len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the rax mapping Redis Cluster keys to slots in the
|
/* Release the key tracking table. */
|
||||||
* lazyfree thread. */
|
|
||||||
void lazyFreeTrackingTable(void *args[]) {
|
void lazyFreeTrackingTable(void *args[]) {
|
||||||
rax *rt = args[0];
|
rax *rt = args[0];
|
||||||
size_t len = rt->numele;
|
size_t len = rt->numele;
|
||||||
raxFree(rt);
|
freeTrackingRadixTree(rt);
|
||||||
atomicDecr(lazyfree_objects,len);
|
atomicDecr(lazyfree_objects,len);
|
||||||
atomicIncr(lazyfreed_objects,len);
|
atomicIncr(lazyfreed_objects,len);
|
||||||
}
|
}
|
||||||
|
@ -1911,6 +1911,7 @@ void disableTracking(client *c);
|
|||||||
void trackingRememberKeys(client *c);
|
void trackingRememberKeys(client *c);
|
||||||
void trackingInvalidateKey(client *c, robj *keyobj);
|
void trackingInvalidateKey(client *c, robj *keyobj);
|
||||||
void trackingInvalidateKeysOnFlush(int async);
|
void trackingInvalidateKeysOnFlush(int async);
|
||||||
|
void freeTrackingRadixTree(rax *rt);
|
||||||
void freeTrackingRadixTreeAsync(rax *rt);
|
void freeTrackingRadixTreeAsync(rax *rt);
|
||||||
void trackingLimitUsedSlots(void);
|
void trackingLimitUsedSlots(void);
|
||||||
uint64_t trackingGetTotalItems(void);
|
uint64_t trackingGetTotalItems(void);
|
||||||
|
@ -395,6 +395,17 @@ start_server {tags {"tracking network"}} {
|
|||||||
assert {[lindex msg 2] eq {} }
|
assert {[lindex msg 2] eq {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {Test ASYNC flushall} {
|
||||||
|
clean_all
|
||||||
|
r CLIENT TRACKING on REDIRECT $redir_id
|
||||||
|
r GET key1
|
||||||
|
r GET key2
|
||||||
|
assert_equal [s 0 tracking_total_keys] 2
|
||||||
|
$rd_sg FLUSHALL ASYNC
|
||||||
|
assert_equal [s 0 tracking_total_keys] 0
|
||||||
|
assert_equal [lindex [$rd_redirection read] 2] {}
|
||||||
|
}
|
||||||
|
|
||||||
# Keys are defined to be evicted 100 at a time by default.
|
# Keys are defined to be evicted 100 at a time by default.
|
||||||
# If after eviction the number of keys still surpasses the limit
|
# If after eviction the number of keys still surpasses the limit
|
||||||
# defined in tracking-table-max-keys, we increases eviction
|
# defined in tracking-table-max-keys, we increases eviction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user