Skip to content

Commit 7ae27f6

Browse files
JohnSullyJohn Sully
authored andcommitted
rename constants
1 parent 47f635e commit 7ae27f6

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/replication.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ int rdbSaveSnapshotForReplication(rdbSaveInfo *rsi) {
11581158
listRewind(g_pserver->slaves, &li);
11591159
while (replica == nullptr && (ln = listNext(&li))) {
11601160
client *replicaCur = (client*)listNodeValue(ln);
1161-
if ((replicaCur->slave_capa & SLAVE_CAPA_ROCKSDB_SNAPSHOT) && (replicaCur->replstate == SLAVE_STATE_WAIT_BGSAVE_START)) {
1161+
if ((replicaCur->slave_capa & SLAVE_CAPA_KEYDB_FASTSYNC) && (replicaCur->replstate == SLAVE_STATE_WAIT_BGSAVE_START)) {
11621162
replica = replicaCur;
11631163
spreplBuf->addReplica(replica);
11641164
replicaCur->replstate = SLAVE_STATE_FASTSYNC_TX;
@@ -1302,7 +1302,7 @@ int startBgsaveForReplication(int mincapa) {
13021302
/* Only do rdbSave* when rsiptr is not NULL,
13031303
* otherwise replica will miss repl-stream-db. */
13041304
if (rsiptr) {
1305-
if (mincapa & SLAVE_CAPA_ROCKSDB_SNAPSHOT && g_pserver->m_pstorageFactory)
1305+
if (mincapa & SLAVE_CAPA_KEYDB_FASTSYNC && g_pserver->m_pstorageFactory)
13061306
retval = rdbSaveSnapshotForReplication(rsiptr);
13071307
else if (socket_target)
13081308
retval = rdbSaveToSlavesSockets(rsiptr);
@@ -1481,7 +1481,7 @@ void syncCommand(client *c) {
14811481
}
14821482

14831483
/* CASE 0: Fast Sync */
1484-
if ((c->slave_capa & SLAVE_CAPA_ROCKSDB_SNAPSHOT) && g_pserver->m_pstorageFactory) {
1484+
if ((c->slave_capa & SLAVE_CAPA_KEYDB_FASTSYNC) && g_pserver->m_pstorageFactory) {
14851485
serverLog(LL_NOTICE,"Fast SYNC on next replication cycle");
14861486
/* CASE 1: BGSAVE is in progress, with disk target. */
14871487
} else if (g_pserver->FRdbSaveInProgress() &&
@@ -1673,7 +1673,7 @@ void replconfCommand(client *c) {
16731673
else if (!strcasecmp((const char*)ptrFromObj(c->argv[j+1]), "activeExpire"))
16741674
c->slave_capa |= SLAVE_CAPA_ACTIVE_EXPIRE;
16751675
else if (!strcasecmp((const char*)ptrFromObj(c->argv[j+1]), "rocksdb-snapshot-load"))
1676-
c->slave_capa |= SLAVE_CAPA_ROCKSDB_SNAPSHOT;
1676+
c->slave_capa |= SLAVE_CAPA_KEYDB_FASTSYNC;
16771677

16781678
fCapaCommand = true;
16791679
} else if (!strcasecmp((const char*)ptrFromObj(c->argv[j]),"ack")) {
@@ -1740,7 +1740,7 @@ void replconfCommand(client *c) {
17401740
sds reply = sdsnew("+OK");
17411741
if (g_pserver->fActiveReplica)
17421742
reply = sdscat(reply, " active-replica");
1743-
if (g_pserver->m_pstorageFactory && (c->slave_capa & SLAVE_CAPA_ROCKSDB_SNAPSHOT) && !g_pserver->fActiveReplica)
1743+
if (g_pserver->m_pstorageFactory && (c->slave_capa & SLAVE_CAPA_KEYDB_FASTSYNC) && !g_pserver->fActiveReplica)
17441744
reply = sdscat(reply, " rocksdb-snapshot-save");
17451745
reply = sdscat(reply, "\r\n");
17461746
addReplySds(c, reply);
@@ -3001,7 +3001,7 @@ void readSyncBulkPayload(connection *conn) {
30013001
return;
30023002
}
30033003

3004-
if (mi->isRocksdbSnapshotRepl) {
3004+
if (mi->isKeydbFastsync) {
30053005
if (!readSnapshotBulkPayload(conn, mi, rsi))
30063006
return;
30073007
} else {
@@ -3014,7 +3014,7 @@ void readSyncBulkPayload(connection *conn) {
30143014

30153015
/* Final setup of the connected slave <- master link */
30163016
replicationCreateMasterClient(mi,mi->repl_transfer_s,rsi.repl_stream_db);
3017-
if (mi->isRocksdbSnapshotRepl) {
3017+
if (mi->isKeydbFastsync) {
30183018
/* We need to handle the case where the initial querybuf data was read by fast sync */
30193019
/* This should match the work readQueryFromClient would do for a master client */
30203020
mi->master->querybuf = sdscatsds(mi->master->querybuf, mi->bulkreadBuffer);
@@ -3063,13 +3063,13 @@ void readSyncBulkPayload(connection *conn) {
30633063
}
30643064

30653065
/* Send the initial ACK immediately to put this replica in online state. */
3066-
if (usemark || mi->isRocksdbSnapshotRepl) replicationSendAck(mi);
3066+
if (usemark || mi->isKeydbFastsync) replicationSendAck(mi);
30673067

30683068
/* Restart the AOF subsystem now that we finished the sync. This
30693069
* will trigger an AOF rewrite, and when done will start appending
30703070
* to the new file. */
30713071
if (g_pserver->aof_enabled) restartAOFAfterSYNC();
3072-
if (mi->isRocksdbSnapshotRepl)
3072+
if (mi->isKeydbFastsync)
30733073
readQueryFromClient(conn); // There may be querybuf data we just appeneded
30743074
return;
30753075
}
@@ -3395,15 +3395,15 @@ void parseMasterCapa(redisMaster *mi, sds strcapa)
33953395
char *pchEnd = szStart;
33963396

33973397
mi->isActive = false;
3398-
mi->isRocksdbSnapshotRepl = false;
3398+
mi->isKeydbFastsync = false;
33993399
for (;;)
34003400
{
34013401
if (*pchEnd == ' ' || *pchEnd == '\0') {
34023402
// Parse the word
34033403
if (strncmp(szStart, "active-replica", pchEnd - szStart) == 0) {
34043404
mi->isActive = true;
34053405
} else if (strncmp(szStart, "rocksdb-snapshot-save", pchEnd - szStart) == 0) {
3406-
mi->isRocksdbSnapshotRepl = true;
3406+
mi->isKeydbFastsync = true;
34073407
}
34083408
szStart = pchEnd + 1;
34093409
}

src/server.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ typedef enum {
620620
#define SLAVE_CAPA_EOF (1<<0) /* Can parse the RDB EOF streaming format. */
621621
#define SLAVE_CAPA_PSYNC2 (1<<1) /* Supports PSYNC2 protocol. */
622622
#define SLAVE_CAPA_ACTIVE_EXPIRE (1<<2) /* Will the slave perform its own expirations? (Don't send delete) */
623-
#define SLAVE_CAPA_ROCKSDB_SNAPSHOT (1<<3)
623+
#define SLAVE_CAPA_KEYDB_FASTSYNC (1<<3)
624624

625625
/* Synchronous read timeout - replica side */
626626
#define CONFIG_REPL_SYNCIO_TIMEOUT 5
@@ -1871,7 +1871,7 @@ struct redisMaster {
18711871
long long master_initial_offset; /* Master PSYNC offset. */
18721872

18731873
bool isActive = false;
1874-
bool isRocksdbSnapshotRepl = false;
1874+
bool isKeydbFastsync = false;
18751875
int repl_state; /* Replication status if the instance is a replica */
18761876
off_t repl_transfer_size; /* Size of RDB to read from master during sync. */
18771877
off_t repl_transfer_read; /* Amount of RDB read from master during sync. */

0 commit comments

Comments
 (0)