Skip to content

Commit

Permalink
Fix dual channel and "replicaof no one"
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Murphy <[email protected]>
  • Loading branch information
murphyjacob4 committed Nov 1, 2024
1 parent be1472c commit 2f07e9a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -3787,6 +3787,7 @@ void syncWithSource(connection *conn) {
if (psync_result == PSYNC_FULLRESYNC_DUAL_CHANNEL) {
/* Create RDB connection */
link->rdb_transfer_s = connCreate(connTypeOfReplication());
connSetPrivateData(link->rdb_transfer_s, link);
if (connConnect(link->rdb_transfer_s, link->host, link->port, server.bind_source_addr,
dualChannelFullSyncWithSource) == C_ERR) {
serverLog(LL_WARNING, "Unable to connect to Primary: %s", connGetLastError(link->transfer_s));
Expand Down Expand Up @@ -4038,6 +4039,8 @@ void replicationUnsetPrimary(void) {
/* Clear primary_host first, since the freeClient calls
* replicationHandlePrimaryDisconnection which can attempt to re-connect. */
freeReplicationLink(server.primary_replication_link);
server.primary_replication_link = NULL;

replicationDiscardCachedPrimary();
/* When a replica is turned into a primary, the current replication ID
* (that was inherited from the primary at synchronization time) is
Expand Down

0 comments on commit 2f07e9a

Please sign in to comment.