MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / trackingInvalidateKeysOnFlush

Function trackingInvalidateKeysOnFlush

src/tracking.cpp:423–446  ·  view source on GitHub ↗

A RESP NULL is sent to indicate that all keys are invalid */

Source from the content-addressed store, hash-verified

421
422/* A RESP NULL is sent to indicate that all keys are invalid */
423void trackingInvalidateKeysOnFlush(int async) {
424 if (g_pserver->tracking_clients) {
425 listNode *ln;
426 listIter li;
427 listRewind(g_pserver->clients,&li);
428 while ((ln = listNext(&li)) != NULL) {
429 client *c = (client*)listNodeValue(ln);
430 if (c->flags & CLIENT_TRACKING) {
431 sendTrackingMessage(c,szFromObj(shared.null[c->resp]),sdslen(szFromObj(shared.null[c->resp])),1);
432 }
433 }
434 }
435
436 /* In case of FLUSHALL, reclaim all the memory used by tracking. */
437 if (TrackingTable) {
438 if (async) {
439 freeTrackingRadixTreeAsync(TrackingTable);
440 } else {
441 freeTrackingRadixTree(TrackingTable);
442 }
443 TrackingTable = raxNew();
444 TrackingTableTotalItems = 0;
445 }
446}
447
448/* Tracking forces Redis to remember information about which client may have
449 * certain keys. In workloads where there are a lot of reads, but keys are

Callers 1

signalFlushedDbFunction · 0.85

Calls 8

listRewindFunction · 0.85
listNextFunction · 0.85
sendTrackingMessageFunction · 0.85
szFromObjFunction · 0.85
sdslenFunction · 0.85
freeTrackingRadixTreeFunction · 0.85
raxNewFunction · 0.85

Tested by

no test coverage detected