Update a few uses of slave to use the new replica terminology (Issue #75)
Former-commit-id: c15633ea9e784ef0e12e4015a75245661a8cf1b7
This commit is contained in:
parent
6080010db0
commit
05d7536b02
@ -2608,12 +2608,12 @@ rdbSaveInfo *rdbPopulateSaveInfo(rdbSaveInfo *rsi) {
|
|||||||
* synchronization, at the same time we will use a new replid and clear
|
* synchronization, at the same time we will use a new replid and clear
|
||||||
* replid2. */
|
* replid2. */
|
||||||
if (g_pserver->fActiveReplica || (!listLength(g_pserver->masters) && g_pserver->repl_backlog)) {
|
if (g_pserver->fActiveReplica || (!listLength(g_pserver->masters) && g_pserver->repl_backlog)) {
|
||||||
/* Note that when g_pserver->slaveseldb is -1, it means that this master
|
/* Note that when g_pserver->replicaseldb is -1, it means that this master
|
||||||
* didn't apply any write commands after a full synchronization.
|
* didn't apply any write commands after a full synchronization.
|
||||||
* So we can let repl_stream_db be 0, this allows a restarted slave
|
* So we can let repl_stream_db be 0, this allows a restarted slave
|
||||||
* to reload replication ID/offset, it's safe because the next write
|
* to reload replication ID/offset, it's safe because the next write
|
||||||
* command must generate a SELECT statement. */
|
* command must generate a SELECT statement. */
|
||||||
rsi->repl_stream_db = g_pserver->slaveseldb == -1 ? 0 : g_pserver->slaveseldb;
|
rsi->repl_stream_db = g_pserver->replicaseldb == -1 ? 0 : g_pserver->replicaseldb;
|
||||||
return rsi;
|
return rsi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ void replicationFeedSlave(client *slave, int dictid, robj **argv, int argc, bool
|
|||||||
std::unique_lock<decltype(slave->lock)> lock(slave->lock);
|
std::unique_lock<decltype(slave->lock)> lock(slave->lock);
|
||||||
|
|
||||||
/* Send SELECT command to every slave if needed. */
|
/* Send SELECT command to every slave if needed. */
|
||||||
if (g_pserver->slaveseldb != dictid) {
|
if (g_pserver->replicaseldb != dictid) {
|
||||||
robj *selectcmd;
|
robj *selectcmd;
|
||||||
|
|
||||||
/* For a few DBs we have pre-computed SELECT command. */
|
/* For a few DBs we have pre-computed SELECT command. */
|
||||||
@ -263,7 +263,7 @@ void replicationFeedSlave(client *slave, int dictid, robj **argv, int argc, bool
|
|||||||
if (dictid < 0 || dictid >= PROTO_SHARED_SELECT_CMDS)
|
if (dictid < 0 || dictid >= PROTO_SHARED_SELECT_CMDS)
|
||||||
decrRefCount(selectcmd);
|
decrRefCount(selectcmd);
|
||||||
}
|
}
|
||||||
g_pserver->slaveseldb = dictid;
|
g_pserver->replicaseldb = dictid;
|
||||||
|
|
||||||
/* Feed slaves that are waiting for the initial SYNC (so these commands
|
/* Feed slaves that are waiting for the initial SYNC (so these commands
|
||||||
* are queued in the output buffer until the initial SYNC completes),
|
* are queued in the output buffer until the initial SYNC completes),
|
||||||
@ -571,9 +571,9 @@ int replicationSetupSlaveForFullResync(client *slave, long long offset) {
|
|||||||
slave->psync_initial_offset = offset;
|
slave->psync_initial_offset = offset;
|
||||||
slave->replstate = SLAVE_STATE_WAIT_BGSAVE_END;
|
slave->replstate = SLAVE_STATE_WAIT_BGSAVE_END;
|
||||||
/* We are going to accumulate the incremental changes for this
|
/* We are going to accumulate the incremental changes for this
|
||||||
* slave as well. Set slaveseldb to -1 in order to force to re-emit
|
* slave as well. Set replicaseldb to -1 in order to force to re-emit
|
||||||
* a SELECT statement in the replication stream. */
|
* a SELECT statement in the replication stream. */
|
||||||
g_pserver->slaveseldb = -1;
|
g_pserver->replicaseldb = -1;
|
||||||
|
|
||||||
/* Don't send this reply to slaves that approached us with
|
/* Don't send this reply to slaves that approached us with
|
||||||
* the old SYNC command. */
|
* the old SYNC command. */
|
||||||
@ -680,7 +680,7 @@ int masterTryPartialResynchronization(client *c) {
|
|||||||
"Partial resynchronization request from %s accepted. Sending %lld bytes of backlog starting from offset %lld.",
|
"Partial resynchronization request from %s accepted. Sending %lld bytes of backlog starting from offset %lld.",
|
||||||
replicationGetSlaveName(c),
|
replicationGetSlaveName(c),
|
||||||
psync_len, psync_offset);
|
psync_len, psync_offset);
|
||||||
/* Note that we don't need to set the selected DB at g_pserver->slaveseldb
|
/* Note that we don't need to set the selected DB at g_pserver->replicaseldb
|
||||||
* to -1 to force the master to emit SELECT, since the slave already
|
* to -1 to force the master to emit SELECT, since the slave already
|
||||||
* has this state from the previous connection with the master. */
|
* has this state from the previous connection with the master. */
|
||||||
|
|
||||||
@ -2374,7 +2374,7 @@ void replicationUnsetMaster(redisMaster *mi) {
|
|||||||
* with a SELECT statement. This is forced after a full resync, but
|
* with a SELECT statement. This is forced after a full resync, but
|
||||||
* with PSYNC version 2, there is no need for full resync after a
|
* with PSYNC version 2, there is no need for full resync after a
|
||||||
* master switch. */
|
* master switch. */
|
||||||
g_pserver->slaveseldb = -1;
|
g_pserver->replicaseldb = -1;
|
||||||
|
|
||||||
/* Once we turn from slave to master, we consider the starting time without
|
/* Once we turn from slave to master, we consider the starting time without
|
||||||
* slaves (that is used to count the replication backlog time to live) as
|
* slaves (that is used to count the replication backlog time to live) as
|
||||||
@ -3031,7 +3031,7 @@ void replicationCron(void) {
|
|||||||
|
|
||||||
if (!manual_failover_in_progress) {
|
if (!manual_failover_in_progress) {
|
||||||
ping_argv[0] = createStringObject("PING",4);
|
ping_argv[0] = createStringObject("PING",4);
|
||||||
replicationFeedSlaves(g_pserver->slaves, g_pserver->slaveseldb,
|
replicationFeedSlaves(g_pserver->slaves, g_pserver->replicaseldb,
|
||||||
ping_argv, 1);
|
ping_argv, 1);
|
||||||
decrRefCount(ping_argv[0]);
|
decrRefCount(ping_argv[0]);
|
||||||
}
|
}
|
||||||
|
@ -2106,7 +2106,7 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
|
|||||||
argv[0] = createStringObject("REPLCONF",8);
|
argv[0] = createStringObject("REPLCONF",8);
|
||||||
argv[1] = createStringObject("GETACK",6);
|
argv[1] = createStringObject("GETACK",6);
|
||||||
argv[2] = createStringObject("*",1); /* Not used argument. */
|
argv[2] = createStringObject("*",1); /* Not used argument. */
|
||||||
replicationFeedSlaves(g_pserver->slaves, g_pserver->slaveseldb, argv, 3);
|
replicationFeedSlaves(g_pserver->slaves, g_pserver->replicaseldb, argv, 3);
|
||||||
decrRefCount(argv[0]);
|
decrRefCount(argv[0]);
|
||||||
decrRefCount(argv[1]);
|
decrRefCount(argv[1]);
|
||||||
decrRefCount(argv[2]);
|
decrRefCount(argv[2]);
|
||||||
@ -2961,7 +2961,7 @@ void initServer(void) {
|
|||||||
cserver.pid = getpid();
|
cserver.pid = getpid();
|
||||||
g_pserver->clients_index = raxNew();
|
g_pserver->clients_index = raxNew();
|
||||||
g_pserver->clients_to_close = listCreate();
|
g_pserver->clients_to_close = listCreate();
|
||||||
g_pserver->slaveseldb = -1; /* Force to emit the first SELECT command. */
|
g_pserver->replicaseldb = -1; /* Force to emit the first SELECT command. */
|
||||||
g_pserver->ready_keys = listCreate();
|
g_pserver->ready_keys = listCreate();
|
||||||
g_pserver->clients_waiting_acks = listCreate();
|
g_pserver->clients_waiting_acks = listCreate();
|
||||||
g_pserver->get_ack_from_slaves = 0;
|
g_pserver->get_ack_from_slaves = 0;
|
||||||
|
@ -1675,7 +1675,7 @@ struct redisServer {
|
|||||||
char replid2[CONFIG_RUN_ID_SIZE+1]; /* replid inherited from master*/
|
char replid2[CONFIG_RUN_ID_SIZE+1]; /* replid inherited from master*/
|
||||||
long long master_repl_offset; /* My current replication offset */
|
long long master_repl_offset; /* My current replication offset */
|
||||||
long long second_replid_offset; /* Accept offsets up to this for replid2. */
|
long long second_replid_offset; /* Accept offsets up to this for replid2. */
|
||||||
int slaveseldb; /* Last SELECTed DB in replication output */
|
int replicaseldb; /* Last SELECTed DB in replication output */
|
||||||
int repl_ping_slave_period; /* Master pings the slave every N seconds */
|
int repl_ping_slave_period; /* Master pings the slave every N seconds */
|
||||||
char *repl_backlog; /* Replication backlog for partial syncs */
|
char *repl_backlog; /* Replication backlog for partial syncs */
|
||||||
long long repl_backlog_size; /* Backlog circular buffer size */
|
long long repl_backlog_size; /* Backlog circular buffer size */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user