Removed mergeReplicationId

This commit is contained in:
Vivek Saini 2022-04-21 01:18:12 +00:00
parent eaf76b5944
commit 9f81cc0385
2 changed files with 1 additions and 27 deletions

View File

@ -2249,24 +2249,6 @@ void changeReplicationId(void) {
saveMasterStatusToStorage(false); saveMasterStatusToStorage(false);
} }
int hexchToInt(char ch)
{
if (ch >= '0' && ch <= '9')
return ch - '0';
if (ch >= 'a' && ch <= 'f')
return (ch - 'a') + 10;
return (ch - 'A') + 10;
}
void mergeReplicationId(const char *id)
{
for (int i = 0; i < CONFIG_RUN_ID_SIZE; ++i)
{
const char *charset = "0123456789abcdef";
g_pserver->replid[i] = charset[hexchToInt(g_pserver->replid[i]) ^ hexchToInt(id[i])];
}
}
/* Clear (invalidate) the secondary replication ID. This happens, for /* Clear (invalidate) the secondary replication ID. This happens, for
* example, after a full resynchronization, when we start a new replication * example, after a full resynchronization, when we start a new replication
* history. */ * history. */
@ -3008,9 +2990,6 @@ void readSyncBulkPayload(connection *conn) {
return; return;
} }
// Should we update our database, or create from scratch?
int fUpdate = g_pserver->fActiveReplica || g_pserver->enable_multimaster;
/* Final setup of the connected slave <- master link */ /* Final setup of the connected slave <- master link */
replicationCreateMasterClient(mi,mi->repl_transfer_s,rsi.repl_stream_db); replicationCreateMasterClient(mi,mi->repl_transfer_s,rsi.repl_stream_db);
if (mi->isRocksdbSnapshotRepl) { if (mi->isRocksdbSnapshotRepl) {
@ -3037,11 +3016,7 @@ void readSyncBulkPayload(connection *conn) {
/* After a full resynchronization we use the replication ID and /* After a full resynchronization we use the replication ID and
* offset of the master. The secondary ID / offset are cleared since * offset of the master. The secondary ID / offset are cleared since
* we are starting a new history. */ * we are starting a new history. */
if (fUpdate) if (!g_pserver->fActiveReplica)
{
mergeReplicationId(mi->master->replid);
}
else if (!g_pserver->fActiveReplica)
{ {
/* After a full resynchroniziation we use the replication ID and /* After a full resynchroniziation we use the replication ID and
* offset of the master. The secondary ID / offset are cleared since * offset of the master. The secondary ID / offset are cleared since

View File

@ -3159,7 +3159,6 @@ long long getPsyncInitialOffset(void);
int replicationSetupSlaveForFullResync(client *replica, long long offset); int replicationSetupSlaveForFullResync(client *replica, long long offset);
void changeReplicationId(void); void changeReplicationId(void);
void clearReplicationId2(void); void clearReplicationId2(void);
void mergeReplicationId(const char *);
void chopReplicationBacklog(void); void chopReplicationBacklog(void);
void replicationCacheMasterUsingMyself(struct redisMaster *mi); void replicationCacheMasterUsingMyself(struct redisMaster *mi);
void replicationCacheMasterUsingMaster(struct redisMaster *mi); void replicationCacheMasterUsingMaster(struct redisMaster *mi);