Skip to content

Commit a087cc1

Browse files
authored
Add psync offset range information to the failed psync log (#2877)
Although we can infer this infomartion from the replica logs, i think this still would be useful to see this information directly in the primary logs. So now we can see the psync offset range when psync fails and then we can analyze and adjust the value of repl-backlog-size. Signed-off-by: Binbin <[email protected]>
1 parent 761fba2 commit a087cc1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/replication.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,13 +863,15 @@ int primaryTryPartialResynchronization(client *c, long long psync_offset) {
863863
if (!server.repl_backlog || psync_offset < server.repl_backlog->offset ||
864864
psync_offset > (server.repl_backlog->offset + server.repl_backlog->histlen)) {
865865
serverLog(LL_NOTICE,
866-
"Unable to partial resync with replica %s for lack of backlog (Replica request was: %lld).",
867-
replicationGetReplicaName(c), psync_offset);
866+
"Unable to partial resync with replica %s for lack of backlog (Replica request was %s:%lld, "
867+
"and I can only reply with the range [%lld, %lld]).",
868+
replicationGetReplicaName(c), primary_replid, psync_offset, server.repl_backlog->offset,
869+
server.repl_backlog->offset + server.repl_backlog->histlen);
868870
if (psync_offset > server.primary_repl_offset) {
869871
serverLog(LL_WARNING,
870-
"Warning: replica %s tried to PSYNC with an offset that is greater than the primary replication "
871-
"offset.",
872-
replicationGetReplicaName(c));
872+
"Warning: replica %s tried to PSYNC with an offset (%lld) that is greater than "
873+
"the primary replication offset (%lld)",
874+
replicationGetReplicaName(c), psync_offset, server.primary_repl_offset);
873875
}
874876
goto need_full_resync;
875877
}

0 commit comments

Comments
 (0)