Skip to content

Commit

Permalink
Update remaining master references to primary (#660)
Browse files Browse the repository at this point in the history
Signed-off-by: Ping Xie <pingxie@google.com>
  • Loading branch information
PingXie authored Jun 18, 2024
1 parent 495a121 commit 4135894
Show file tree
Hide file tree
Showing 24 changed files with 199 additions and 182 deletions.
6 changes: 3 additions & 3 deletions src/blocked.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void initClientBlockingState(client *c) {
* flag is set client query buffer is not longer processed, but accumulated,
* and will be processed when the client is unblocked. */
void blockClient(client *c, int btype) {
/* Master client should never be blocked unless pause or module */
/* Primary client should never be blocked unless pause or module */
serverAssert(!(c->flags & CLIENT_PRIMARY && btype != BLOCKED_MODULE && btype != BLOCKED_POSTPONE));

c->flags |= CLIENT_BLOCKED;
Expand Down Expand Up @@ -265,8 +265,8 @@ void replyToClientsBlockedOnShutdown(void) {

/* Mass-unblock clients because something changed in the instance that makes
* blocking no longer safe. For example clients blocked in list operations
* in an instance which turns from master to replica is unsafe, so this function
* is called when a master turns into a replica.
* in an instance which turns from primary to replica is unsafe, so this function
* is called when a primary turns into a replica.
*
* The semantics is to send an -UNBLOCKED error to the client, disconnecting
* it at the same time. */
Expand Down
4 changes: 2 additions & 2 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,12 +813,12 @@ void clusterCommandHelp(client *c) {
" Return the node's shard id.",
"NODES",
" Return cluster configuration seen by node. Output format:",
" <id> <ip:port@bus-port[,hostname]> <flags> <master> <pings> <pongs> <epoch> <link> <slot> ...",
" <id> <ip:port@bus-port[,hostname]> <flags> <primary> <pings> <pongs> <epoch> <link> <slot> ...",
"REPLICAS <node-id>",
" Return <node-id> replicas.",
"SLOTS",
" Return information about slots range mappings. Each range is made of:",
" start, end, master and replicas IP addresses, ports and ids",
" start, end, primary and replicas IP addresses, ports and ids",
"SHARDS",
" Return information about slot range mappings and the nodes associated with them.",
NULL};
Expand Down
8 changes: 4 additions & 4 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,9 @@ int clusterLoadConfig(char *filename) {
serverAssert(server.cluster->myself == NULL);
myself = server.cluster->myself = n;
n->flags |= CLUSTER_NODE_MYSELF;
} else if (!strcasecmp(s, "master")) {
} else if (!strcasecmp(s, "master") || !strcasecmp(s, "primary")) {
n->flags |= CLUSTER_NODE_PRIMARY;
} else if (!strcasecmp(s, "slave")) {
} else if (!strcasecmp(s, "slave") || !strcasecmp(s, "replica")) {
n->flags |= CLUSTER_NODE_REPLICA;
} else if (!strcasecmp(s, "fail?")) {
n->flags |= CLUSTER_NODE_PFAIL;
Expand Down Expand Up @@ -1903,7 +1903,7 @@ void clearNodeFailureIfNeeded(clusterNode *node) {
* node again. */
if (nodeIsReplica(node) || node->numslots == 0) {
serverLog(LL_NOTICE, "Clear FAIL state for node %.40s (%s):%s is reachable again.", node->name,
node->human_nodename, nodeIsReplica(node) ? "replica" : "master without slots");
node->human_nodename, nodeIsReplica(node) ? "replica" : "primary without slots");
node->flags &= ~CLUSTER_NODE_FAIL;
clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_SAVE_CONFIG);
}
Expand Down Expand Up @@ -4154,7 +4154,7 @@ void clusterLogCantFailover(int reason) {

switch (reason) {
case CLUSTER_CANT_FAILOVER_DATA_AGE:
msg = "Disconnected from master for longer than allowed. "
msg = "Disconnected from primary for longer than allowed. "
"Please check the 'cluster-replica-validity-factor' configuration "
"option.";
break;
Expand Down
19 changes: 11 additions & 8 deletions src/commands.def

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/commands/client-kill.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
[
"8.0.0",
"`MAXAGE` option."
],
[
"8.0.0",
"Replaced `master` `TYPE` with `primary`. `master` still supported for backward compatibility."
]
],
"command_flags": [
Expand Down Expand Up @@ -84,6 +88,12 @@
"token": "master",
"since": "3.2.0"
},
{
"name": "primary",
"type": "pure-token",
"token": "primary",
"since": "8.0.0"
},
{
"name": "slave",
"type": "pure-token",
Expand Down
4 changes: 4 additions & 0 deletions src/commands/client-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
[
"7.0.3",
"Added `ssub` field."
],
[
"8.0.0",
"Replaced `master` `TYPE` with `primary`. `master` still supported for backward compatibility."
]
],
"command_flags": [
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cluster-failover.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FAILOVER": {
"summary": "Forces a replica to perform a manual failover of its master.",
"summary": "Forces a replica to perform a manual failover of its primary.",
"complexity": "O(1)",
"group": "cluster",
"since": "3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/cluster-replicas.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"REPLICAS": {
"summary": "Lists the replica nodes of a master node.",
"summary": "Lists the replica nodes of a primary node.",
"complexity": "O(N) where N is the number of replicas.",
"group": "cluster",
"since": "5.0.0",
Expand All @@ -21,7 +21,7 @@
}
],
"reply_schema": {
"description": "A list of replica nodes replicating from the specified master node provided in the same format used by CLUSTER NODES.",
"description": "A list of replica nodes replicating from the specified primary node provided in the same format used by CLUSTER NODES.",
"type": "array",
"items": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cluster-replicate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"REPLICATE": {
"summary": "Configure a node as replica of a master node.",
"summary": "Configure a node as replica of a primary node.",
"complexity": "O(1)",
"group": "cluster",
"since": "3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/commands/cluster-slaves.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"SLAVES": {
"summary": "Lists the replica nodes of a master node.",
"summary": "Lists the replica nodes of a primary node.",
"complexity": "O(N) where N is the number of replicas.",
"group": "cluster",
"since": "3.0.0",
Expand All @@ -26,7 +26,7 @@
}
],
"reply_schema": {
"description": "A list of replica nodes replicating from the specified master node provided in the same format used by CLUSTER NODES.",
"description": "A list of replica nodes replicating from the specified primary node provided in the same format used by CLUSTER NODES.",
"type": "array",
"items": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cluster-slots.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
{
"type": "array",
"description": "Master node for the slot range.",
"description": "Primary node for the slot range.",
"minItems": 4,
"maxItems": 4,
"items": [
Expand Down
2 changes: 1 addition & 1 deletion src/commands/replicaof.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"REPLICAOF": {
"summary": "Configures a server as replica of another, or promotes it to a master.",
"summary": "Configures a server as replica of another, or promotes it to a primary.",
"complexity": "O(1)",
"group": "server",
"since": "5.0.0",
Expand Down
20 changes: 10 additions & 10 deletions src/commands/role.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"const": "master"
},
{
"description": "Current replication master offset.",
"description": "Current replication primary offset.",
"type": "integer"
},
{
Expand Down Expand Up @@ -65,34 +65,34 @@
"const": "slave"
},
{
"description": "IP of master.",
"description": "IP of primary.",
"type": "string"
},
{
"description": "Port number of master.",
"description": "Port number of primary.",
"type": "integer"
},
{
"description": "State of the replication from the point of view of the master.",
"description": "State of the replication from the point of view of the primary.",
"oneOf": [
{
"description": "The instance is in handshake with its master.",
"description": "The instance is in handshake with its primary.",
"const": "handshake"
},
{
"description": "The instance in not active.",
"const": "none"
},
{
"description": "The instance needs to connect to its master.",
"description": "The instance needs to connect to its primary.",
"const": "connect"
},
{
"description": "The master-replica connection is in progress.",
"description": "The primary-replica connection is in progress.",
"const": "connecting"
},
{
"description": "The master and replica are trying to perform the synchronization.",
"description": "The primary and replica are trying to perform the synchronization.",
"const": "sync"
},
{
Expand All @@ -106,7 +106,7 @@
]
},
{
"description": "The amount of data received from the replica so far in terms of master replication offset.",
"description": "The amount of data received from the replica so far in terms of primary replication offset.",
"type": "integer"
}
]
Expand All @@ -120,7 +120,7 @@
"const": "sentinel"
},
{
"description": "List of master names monitored by this sentinel instance.",
"description": "List of primary names monitored by this sentinel instance.",
"type": "array",
"items": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ static int setConfigReplicaOfOption(standardConfig *config, sds *argv, int argc,
char *ptr;
server.primary_port = strtol(argv[1], &ptr, 10);
if (server.primary_port < 0 || server.primary_port > 65535 || *ptr != '\0') {
*err = "Invalid master port";
*err = "Invalid primary port";
return 0;
}
server.primary_host = sdsnew(argv[0]);
Expand Down
13 changes: 7 additions & 6 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "script.h"
#include "fpconv_dtoa.h"
#include "fmtargs.h"
#include <strings.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <math.h>
Expand Down Expand Up @@ -586,11 +587,11 @@ void afterErrorReply(client *c, const char *s, size_t len, int flags) {
to = "AOF-loading-client";
from = "server";
} else if (ctype == CLIENT_TYPE_PRIMARY) {
to = "master";
to = "primary";
from = "replica";
} else {
to = "replica";
from = "master";
from = "primary";
}

if (len > 4096) len = 4096;
Expand Down Expand Up @@ -2232,7 +2233,7 @@ int processInlineBuffer(client *c) {
sdsfreesplitres(argv, argc);
serverLog(LL_WARNING, "WARNING: Receiving inline protocol from primary, primary stream corruption? Closing the "
"primary connection and discarding the cached primary.");
setProtocolError("Master using the inline protocol. Desync?", c);
setProtocolError("Primary using the inline protocol. Desync?", c);
return C_ERR;
}

Expand Down Expand Up @@ -3075,7 +3076,7 @@ void clientCommand(client *c) {
" Kill connections made from the specified address",
" * LADDR (<ip:port>|<unixsocket>:0)",
" Kill connections made to specified local address",
" * TYPE (NORMAL|MASTER|REPLICA|PUBSUB)",
" * TYPE (NORMAL|PRIMARY|REPLICA|PUBSUB)",
" Kill connections by type.",
" * USER <username>",
" Kill connections authenticated by <username>.",
Expand All @@ -3087,7 +3088,7 @@ void clientCommand(client *c) {
" Kill connections older than the specified age.",
"LIST [options ...]",
" Return information about client connections. Options:",
" * TYPE (NORMAL|MASTER|REPLICA|PUBSUB)",
" * TYPE (NORMAL|PRIMARY|REPLICA|PUBSUB)",
" Return clients of specified type.",
"UNPAUSE",
" Stop the current client pause, resuming traffic.",
Expand Down Expand Up @@ -3898,7 +3899,7 @@ int getClientTypeByName(char *name) {
return CLIENT_TYPE_REPLICA;
else if (!strcasecmp(name, "pubsub"))
return CLIENT_TYPE_PUBSUB;
else if (!strcasecmp(name, "master"))
else if (!strcasecmp(name, "master") || !strcasecmp(name, "primary"))
return CLIENT_TYPE_PRIMARY;
else
return -1;
Expand Down
2 changes: 1 addition & 1 deletion src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ sds getMemoryDoctorReport(void) {
" * Big replica buffers: The replica output buffers in this instance are greater than 10MB for "
"each replica (on average). This likely means that there is some replica instance that is "
"struggling receiving data, either because it is too slow or because of networking issues. As a "
"result, data piles on the master output buffers. Please try to identify what replica is not "
"result, data piles on the primary output buffers. Please try to identify what replica is not "
"receiving data correctly and why. You can use the INFO output in order to check the replicas "
"delays and the CLIENT LIST command to check the output buffers of each replica.\n\n");
}
Expand Down
Loading

0 comments on commit 4135894

Please sign in to comment.