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

Function pauseClients

src/networking.cpp:3994–4010  ·  view source on GitHub ↗

Pause clients up to the specified unixtime (in ms) for a given type of * commands. * * A main use case of this function is to allow pausing replication traffic * so that a failover without data loss to occur. Replicas will continue to receive * traffic to faciliate this functionality. * * This function is also internally used by Redis Cluster for the manual * failover procedure implemente

Source from the content-addressed store, hash-verified

3992 * In such a case, the duration is set to the maximum and new end time and the
3993 * type is set to the more restrictive type of pause. */
3994void pauseClients(mstime_t end, pause_type type) {
3995 if (type > g_pserver->client_pause_type) {
3996 g_pserver->client_pause_type = type;
3997 }
3998
3999 if (end > g_pserver->client_pause_end_time) {
4000 g_pserver->client_pause_end_time = end;
4001 }
4002
4003 /* We allow write commands that were queued
4004 * up before and after to execute. We need
4005 * to track this state so that we don't assert
4006 * in propagate(). */
4007 if (serverTL->in_exec) {
4008 serverTL->client_pause_in_transaction = 1;
4009 }
4010}
4011
4012/* Unpause clients and queue them for reprocessing. */
4013void unpauseClients(void) {

Callers 3

clusterProcessPacketFunction · 0.85
failoverCommandFunction · 0.85
clientCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected