From 9f81cc03854023b0ac8aa4f1cc51a06f373054cc Mon Sep 17 00:00:00 2001 From: Vivek Saini Date: Thu, 21 Apr 2022 01:18:12 +0000 Subject: [PATCH] Removed mergeReplicationId --- src/replication.cpp | 27 +-------------------------- src/server.h | 1 - 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/replication.cpp b/src/replication.cpp index 1f20f225d..7ca2a647e 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -2249,24 +2249,6 @@ void changeReplicationId(void) { 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 * example, after a full resynchronization, when we start a new replication * history. */ @@ -3008,9 +2990,6 @@ void readSyncBulkPayload(connection *conn) { 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 */ replicationCreateMasterClient(mi,mi->repl_transfer_s,rsi.repl_stream_db); if (mi->isRocksdbSnapshotRepl) { @@ -3037,11 +3016,7 @@ void readSyncBulkPayload(connection *conn) { /* After a full resynchronization we use the replication ID and * offset of the master. The secondary ID / offset are cleared since * we are starting a new history. */ - if (fUpdate) - { - mergeReplicationId(mi->master->replid); - } - else if (!g_pserver->fActiveReplica) + if (!g_pserver->fActiveReplica) { /* After a full resynchroniziation we use the replication ID and * offset of the master. The secondary ID / offset are cleared since diff --git a/src/server.h b/src/server.h index 74ac1372a..e174d6902 100644 --- a/src/server.h +++ b/src/server.h @@ -3159,7 +3159,6 @@ long long getPsyncInitialOffset(void); int replicationSetupSlaveForFullResync(client *replica, long long offset); void changeReplicationId(void); void clearReplicationId2(void); -void mergeReplicationId(const char *); void chopReplicationBacklog(void); void replicationCacheMasterUsingMyself(struct redisMaster *mi); void replicationCacheMasterUsingMaster(struct redisMaster *mi);