mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Cluster: basic data structures for nodes black list.
This commit is contained in:
parent
3db825fde4
commit
8f18345ef0
@ -260,6 +260,8 @@ void clusterInit(void) {
|
||||
server.cluster->state = REDIS_CLUSTER_FAIL;
|
||||
server.cluster->size = 1;
|
||||
server.cluster->nodes = dictCreate(&clusterNodesDictType,NULL);
|
||||
server.cluster->nodes_black_list =
|
||||
dictCreate(&clusterNodesBlackListDictType,NULL);
|
||||
server.cluster->failover_auth_time = 0;
|
||||
server.cluster->failover_auth_count = 0;
|
||||
server.cluster->failover_auth_epoch = 0;
|
||||
|
@ -78,6 +78,7 @@ typedef struct clusterState {
|
||||
int state; /* REDIS_CLUSTER_OK, REDIS_CLUSTER_FAIL, ... */
|
||||
int size; /* Num of master nodes with at least one slot */
|
||||
dict *nodes; /* Hash table of name -> clusterNode structures */
|
||||
dict *nodes_black_list; /* Nodes we don't re-add for a few seconds. */
|
||||
clusterNode *migrating_slots_to[REDIS_CLUSTER_SLOTS];
|
||||
clusterNode *importing_slots_from[REDIS_CLUSTER_SLOTS];
|
||||
clusterNode *slots[REDIS_CLUSTER_SLOTS];
|
||||
|
12
src/redis.c
12
src/redis.c
@ -583,6 +583,18 @@ dictType clusterNodesDictType = {
|
||||
NULL /* val destructor */
|
||||
};
|
||||
|
||||
/* Cluster re-addition blacklist. This maps node IDs to the time
|
||||
* we can re-add this node. The goal is to avoid readding a removed
|
||||
* node for some time. */
|
||||
dictType clusterNodesBlackListDictType = {
|
||||
dictSdsCaseHash, /* hash function */
|
||||
NULL, /* key dup */
|
||||
NULL, /* val dup */
|
||||
dictSdsKeyCaseCompare, /* key compare */
|
||||
dictSdsDestructor, /* key destructor */
|
||||
NULL /* val destructor */
|
||||
};
|
||||
|
||||
/* Migrate cache dict type. */
|
||||
dictType migrateCacheDictType = {
|
||||
dictSdsHash, /* hash function */
|
||||
|
@ -884,6 +884,7 @@ extern struct sharedObjectsStruct shared;
|
||||
extern dictType setDictType;
|
||||
extern dictType zsetDictType;
|
||||
extern dictType clusterNodesDictType;
|
||||
extern dictType clusterNodesBlackListDictType;
|
||||
extern dictType dbDictType;
|
||||
extern dictType shaScriptObjectDictType;
|
||||
extern double R_Zero, R_PosInf, R_NegInf, R_Nan;
|
||||
|
Loading…
Reference in New Issue
Block a user