diff --git a/src/blocked.c b/src/blocked.c index e848c9cdb8..8e1974a703 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -81,7 +81,7 @@ void initClientBlockingState(client *c) { c->bstate.numreplicas = 0; c->bstate.numlocal = 0; c->bstate.reploffset = 0; - c->bstate.client_waiting_acks_list_node = NULL; + c->bstate.generic_blocked_list_node = NULL; c->bstate.module_blocked_handle = NULL; c->bstate.async_rm_call_handle = NULL; } diff --git a/src/server.h b/src/server.h index 12bbe05368..5d47951dab 100644 --- a/src/server.h +++ b/src/server.h @@ -1011,15 +1011,22 @@ typedef struct blockingState { * is > timeout then the operation timed out. */ int unblock_on_nokey; /* Whether to unblock the client when at least one of the keys is deleted or does not exist anymore */ + union { + listNode *client_waiting_acks_list_node; /* list node in server.clients_waiting_acks list. */ + listNode *postponed_list_node; /* list node in server.postponed_clients */ + listNode *generic_blocked_list_node; /* generic placeholder for blocked clients utility lists. + Since a client cannot be blocked multiple times, we can assume + it will be held in only one extra utility list, so it is ok to maintain + a union of these listNode references. */ + }; /* BLOCKED_LIST, BLOCKED_ZSET and BLOCKED_STREAM or any other Keys related blocking */ dict *keys; /* The keys we are blocked on */ /* BLOCKED_WAIT and BLOCKED_WAITAOF */ - int numreplicas; /* Number of replicas we are waiting for ACK. */ - int numlocal; /* Indication if WAITAOF is waiting for local fsync. */ - long long reploffset; /* Replication offset to reach. */ - listNode *client_waiting_acks_list_node; /* list node in server.clients_waiting_acks list. */ + int numreplicas; /* Number of replicas we are waiting for ACK. */ + int numlocal; /* Indication if WAITAOF is waiting for local fsync. */ + long long reploffset; /* Replication offset to reach. */ /* BLOCKED_MODULE */ void *module_blocked_handle; /* ValkeyModuleBlockedClient structure.