Skip to content

Commit

Permalink
Log unexpected $ENDOFF responses in dual channel replication (valkey-…
Browse files Browse the repository at this point in the history
…io#839)

I've tried to test a dual channel replication but forgot to add +sync
for my replication user. As a result replica entered silent cycle like
this:
```
* Connecting to PRIMARY 127.0.0.1:6379
* PRIMARY <-> REPLICA sync started
* Non blocking connect for SYNC fired the event.
* Primary replied to PING, replication can continue...
* Trying a partial resynchronization (request ...)
* PSYNC is not possible, initialize RDB channel.
* Aborting dual channel sync
```

And primary got endless cycle like this:
```
* Replica 127.0.0.1:6380 asks for synchronization
* Partial resynchronization not accepted: Replication ID mismatch (Replica asked for '...', my replication IDs are '...' and '...')
* Replica 127.0.0.1:6380 is capable of dual channel synchronization, and partial sync isn't possible. Full sync will continue with dedicated RDB channel.
```

There was no way to understand that replication user is missing +sync
acl on notice log level. With this one-line change we get a warning
message in our replica log.

---------

Signed-off-by: secwall <secwall@yandex-team.ru>
Signed-off-by: mwish <maplewish117@gmail.com>
  • Loading branch information
secwall authored and mapleFU committed Aug 22, 2024
1 parent 9e97073 commit 5fe1941
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -2679,6 +2679,7 @@ static void fullSyncWithPrimary(connection *conn) {
/* Parse end offset response */
char *endoff_format = "$ENDOFF:%lld %40s %d %llu";
if (sscanf(err, endoff_format, &reploffset, primary_replid, &dbid, &rdb_client_id) != 4) {
serverLog(LL_WARNING, "Received unexpected $ENDOFF response: %s", err);
goto error;
}
sdsfree(err);
Expand Down

0 comments on commit 5fe1941

Please sign in to comment.