Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
8f18345e
Commit
8f18345e
authored
Nov 29, 2013
by
antirez
Browse files
Cluster: basic data structures for nodes black list.
parent
3db825fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
8f18345e
...
@@ -260,6 +260,8 @@ void clusterInit(void) {
...
@@ -260,6 +260,8 @@ void clusterInit(void) {
server
.
cluster
->
state
=
REDIS_CLUSTER_FAIL
;
server
.
cluster
->
state
=
REDIS_CLUSTER_FAIL
;
server
.
cluster
->
size
=
1
;
server
.
cluster
->
size
=
1
;
server
.
cluster
->
nodes
=
dictCreate
(
&
clusterNodesDictType
,
NULL
);
server
.
cluster
->
nodes
=
dictCreate
(
&
clusterNodesDictType
,
NULL
);
server
.
cluster
->
nodes_black_list
=
dictCreate
(
&
clusterNodesBlackListDictType
,
NULL
);
server
.
cluster
->
failover_auth_time
=
0
;
server
.
cluster
->
failover_auth_time
=
0
;
server
.
cluster
->
failover_auth_count
=
0
;
server
.
cluster
->
failover_auth_count
=
0
;
server
.
cluster
->
failover_auth_epoch
=
0
;
server
.
cluster
->
failover_auth_epoch
=
0
;
...
...
src/cluster.h
View file @
8f18345e
...
@@ -78,6 +78,7 @@ typedef struct clusterState {
...
@@ -78,6 +78,7 @@ typedef struct clusterState {
int
state
;
/* REDIS_CLUSTER_OK, REDIS_CLUSTER_FAIL, ... */
int
state
;
/* REDIS_CLUSTER_OK, REDIS_CLUSTER_FAIL, ... */
int
size
;
/* Num of master nodes with at least one slot */
int
size
;
/* Num of master nodes with at least one slot */
dict
*
nodes
;
/* Hash table of name -> clusterNode structures */
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
*
migrating_slots_to
[
REDIS_CLUSTER_SLOTS
];
clusterNode
*
importing_slots_from
[
REDIS_CLUSTER_SLOTS
];
clusterNode
*
importing_slots_from
[
REDIS_CLUSTER_SLOTS
];
clusterNode
*
slots
[
REDIS_CLUSTER_SLOTS
];
clusterNode
*
slots
[
REDIS_CLUSTER_SLOTS
];
...
...
src/redis.c
View file @
8f18345e
...
@@ -583,6 +583,18 @@ dictType clusterNodesDictType = {
...
@@ -583,6 +583,18 @@ dictType clusterNodesDictType = {
NULL
/* val destructor */
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. */
/* Migrate cache dict type. */
dictType
migrateCacheDictType
=
{
dictType
migrateCacheDictType
=
{
dictSdsHash
,
/* hash function */
dictSdsHash
,
/* hash function */
...
...
src/redis.h
View file @
8f18345e
...
@@ -884,6 +884,7 @@ extern struct sharedObjectsStruct shared;
...
@@ -884,6 +884,7 @@ extern struct sharedObjectsStruct shared;
extern
dictType
setDictType
;
extern
dictType
setDictType
;
extern
dictType
zsetDictType
;
extern
dictType
zsetDictType
;
extern
dictType
clusterNodesDictType
;
extern
dictType
clusterNodesDictType
;
extern
dictType
clusterNodesBlackListDictType
;
extern
dictType
dbDictType
;
extern
dictType
dbDictType
;
extern
dictType
shaScriptObjectDictType
;
extern
dictType
shaScriptObjectDictType
;
extern
double
R_Zero
,
R_PosInf
,
R_NegInf
,
R_Nan
;
extern
double
R_Zero
,
R_PosInf
,
R_NegInf
,
R_Nan
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment