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
a9419e23
Commit
a9419e23
authored
Sep 10, 2018
by
antirez
Browse files
Slave removal: Convert cluster.c log messages and command names.
parent
f579b774
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
a9419e23
...
@@ -1230,7 +1230,7 @@ void clearNodeFailureIfNeeded(clusterNode *node) {
...
@@ -1230,7 +1230,7 @@ void clearNodeFailureIfNeeded(clusterNode *node) {
serverLog(LL_NOTICE,
serverLog(LL_NOTICE,
"Clear FAIL state for node %.40s: %s is reachable again.",
"Clear FAIL state for node %.40s: %s is reachable again.",
node->name,
node->name,
nodeIsSlave
(
node
)
?
"
slave
"
:
"master without slots"
);
nodeIsSlave(node) ? "
replica
" : "master without slots");
node->flags &= ~CLUSTER_NODE_FAIL;
node->flags &= ~CLUSTER_NODE_FAIL;
clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
}
}
...
@@ -2059,7 +2059,7 @@ int clusterProcessPacket(clusterLink *link) {
...
@@ -2059,7 +2059,7 @@ int clusterProcessPacket(clusterLink *link) {
server.cluster->mf_end = mstime() + CLUSTER_MF_TIMEOUT;
server.cluster->mf_end = mstime() + CLUSTER_MF_TIMEOUT;
server.cluster->mf_slave = sender;
server.cluster->mf_slave = sender;
pauseClients(mstime()+(CLUSTER_MF_TIMEOUT*2));
pauseClients(mstime()+(CLUSTER_MF_TIMEOUT*2));
serverLog
(
LL_WARNING
,
"Manual failover requested by
slave
%.40s."
,
serverLog(LL_WARNING,"Manual failover requested by
replica
%.40s.",
sender->name);
sender->name);
} else if (type == CLUSTERMSG_TYPE_UPDATE) {
} else if (type == CLUSTERMSG_TYPE_UPDATE) {
clusterNode *n; /* The node the update is about. */
clusterNode *n; /* The node the update is about. */
...
@@ -2873,7 +2873,7 @@ void clusterLogCantFailover(int reason) {
...
@@ -2873,7 +2873,7 @@ void clusterLogCantFailover(int reason) {
switch(reason) {
switch(reason) {
case CLUSTER_CANT_FAILOVER_DATA_AGE:
case CLUSTER_CANT_FAILOVER_DATA_AGE:
msg = "Disconnected from master for longer than allowed. "
msg = "Disconnected from master for longer than allowed. "
"Please check the 'cluster-
slave
-validity-factor' configuration "
"Please check the 'cluster-
replica
-validity-factor' configuration "
"option.";
"option.";
break;
break;
case CLUSTER_CANT_FAILOVER_WAITING_DELAY:
case CLUSTER_CANT_FAILOVER_WAITING_DELAY:
...
@@ -3054,7 +3054,7 @@ void clusterHandleSlaveFailover(void) {
...
@@ -3054,7 +3054,7 @@ void clusterHandleSlaveFailover(void) {
server.cluster->failover_auth_time += added_delay;
server.cluster->failover_auth_time += added_delay;
server.cluster->failover_auth_rank = newrank;
server.cluster->failover_auth_rank = newrank;
serverLog(LL_WARNING,
serverLog(LL_WARNING,
"
Slave
rank updated to #%d, added %lld milliseconds of delay."
,
"
Replica
rank updated to #%d, added %lld milliseconds of delay.",
newrank, added_delay);
newrank, added_delay);
}
}
}
}
...
@@ -4187,7 +4187,7 @@ void clusterCommand(client *c) {
...
@@ -4187,7 +4187,7 @@ void clusterCommand(client *c) {
"COUNT-failure-reports <node-id> -- Return number of failure reports for <node-id>.",
"COUNT-failure-reports <node-id> -- Return number of failure reports for <node-id>.",
"COUNTKEYSINSLOT <slot> - Return the number of keys in <slot>.",
"COUNTKEYSINSLOT <slot> - Return the number of keys in <slot>.",
"DELSLOTS <slot> [slot ...] -- Delete slots information from current node.",
"DELSLOTS <slot> [slot ...] -- Delete slots information from current node.",
"FAILOVER [force|takeover] -- Promote current
slave
node to being a master."
,
"FAILOVER [force|takeover] -- Promote current
replica
node to being a master.",
"FORGET <node-id> -- Remove a node from the cluster.",
"FORGET <node-id> -- Remove a node from the cluster.",
"GETKEYSINSLOT <slot> <count> -- Return key names stored by current node in a slot.",
"GETKEYSINSLOT <slot> <count> -- Return key names stored by current node in a slot.",
"FLUSHSLOTS -- Delete current node own slots information.",
"FLUSHSLOTS -- Delete current node own slots information.",
...
@@ -4197,11 +4197,11 @@ void clusterCommand(client *c) {
...
@@ -4197,11 +4197,11 @@ void clusterCommand(client *c) {
"MYID -- Return the node id.",
"MYID -- Return the node id.",
"NODES -- Return cluster configuration seen by node. Output format:",
"NODES -- Return cluster configuration seen by node. Output format:",
" <id> <ip:port> <flags> <master> <pings> <pongs> <epoch> <link> <slot> ... <slot>",
" <id> <ip:port> <flags> <master> <pings> <pongs> <epoch> <link> <slot> ... <slot>",
"REPLICATE <node-id> -- Configure current node as
slave
to <node-id>."
,
"REPLICATE <node-id> -- Configure current node as
replica
to <node-id>.",
"RESET [hard|soft] -- Reset current node (default: soft).",
"RESET [hard|soft] -- Reset current node (default: soft).",
"SET-config-epoch <epoch> - Set config epoch of current node.",
"SET-config-epoch <epoch> - Set config epoch of current node.",
"SETSLOT <slot> (importing|migrating|stable|node <node-id>) -- Set slot state.",
"SETSLOT <slot> (importing|migrating|stable|node <node-id>) -- Set slot state.",
"
SLAVE
S <node-id> -- Return <node-id>
slave
s."
,
"
REPLICA
S <node-id> -- Return <node-id>
replica
s.",
"SLOTS -- Return information about slots range mappings. Each range is made of:",
"SLOTS -- Return information about slots range mappings. Each range is made of:",
" start, end, master and replicas IP addresses, ports and ids",
" start, end, master and replicas IP addresses, ports and ids",
NULL
NULL
...
@@ -4578,7 +4578,7 @@ NULL
...
@@ -4578,7 +4578,7 @@ NULL
/* Can't replicate a slave. */
/* Can't replicate a slave. */
if (nodeIsSlave(n)) {
if (nodeIsSlave(n)) {
addReplyError
(
c
,
"I can only replicate a master, not a
slave
."
);
addReplyError(c,"I can only replicate a master, not a
replica
.");
return;
return;
}
}
...
@@ -4597,7 +4597,8 @@ NULL
...
@@ -4597,7 +4597,8 @@ NULL
clusterSetMaster(n);
clusterSetMaster(n);
clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|CLUSTER_TODO_SAVE_CONFIG);
addReply(c,shared.ok);
addReply(c,shared.ok);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"slaves"
)
&&
c
->
argc
==
3
)
{
} else if ((!strcasecmp(c->argv[1]->ptr,"slaves") ||
!strcasecmp(c->argv[1]->ptr,"replicas")) && c->argc == 3) {
/* CLUSTER SLAVES <NODE ID> */
/* CLUSTER SLAVES <NODE ID> */
clusterNode *n = clusterLookupNode(c->argv[2]->ptr);
clusterNode *n = clusterLookupNode(c->argv[2]->ptr);
int j;
int j;
...
@@ -4651,10 +4652,10 @@ NULL
...
@@ -4651,10 +4652,10 @@ NULL
/* Check preconditions. */
/* Check preconditions. */
if (nodeIsMaster(myself)) {
if (nodeIsMaster(myself)) {
addReplyError
(
c
,
"You should send CLUSTER FAILOVER to a
slave
"
);
addReplyError(c,"You should send CLUSTER FAILOVER to a
replica
");
return;
return;
} else if (myself->slaveof == NULL) {
} else if (myself->slaveof == NULL) {
addReplyError
(
c
,
"I'm a
slave
but my master is unknown to me"
);
addReplyError(c,"I'm a
replica
but my master is unknown to me");
return;
return;
} else if (!force &&
} else if (!force &&
(nodeFailed(myself->slaveof) ||
(nodeFailed(myself->slaveof) ||
...
...
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