Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
naglera authored and amitnagl committed Apr 9, 2024
1 parent ad361c2 commit 9454ec2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -1810,13 +1810,14 @@ int freeClientsInAsyncFreeQueue(void) {
while ((ln = listNext(&li)) != NULL) {
client *c = listNodeValue(ln);

if (c->flags & CLIENT_PROTECTED_RDB_CHANNEL) { /* Check if we can remove RDB connection protection. */
if (c->flags & CLIENT_PROTECTED_RDB_CHANNEL) {
/* Check if we can remove RDB connection protection. */
if (!c->rdb_client_disconnect_time) {
c->rdb_client_disconnect_time = server.unixtime;
continue;
}
if (server.unixtime - c->rdb_client_disconnect_time > server.wait_before_rdb_client_free) {
serverLog(LL_NOTICE, "Replica main connection failed to establish PSYNC within the grace period. Freeing RDB client %lu.", c->id);
serverLog(LL_NOTICE, "Replica main connection failed to establish PSYNC within the grace period (%ld seconds). Freeing RDB client %llu.", (long int)(server.unixtime - c->rdb_client_disconnect_time), (unsigned long long)c->id);
c->flags &= ~CLIENT_PROTECTED_RDB_CHANNEL;
}
}
Expand Down Expand Up @@ -2736,7 +2737,7 @@ void readQueryFromClient(connection *conn) {
sds info = catClientInfoString(sdsempty(), c);
serverLog(LL_VERBOSE, "Client closed connection %s", info);
if (c->flags & CLIENT_PROTECTED_RDB_CHANNEL) {
serverLog(LL_VERBOSE, "Postpone RDB client (%lu) free for %d seconds", c->id, server.wait_before_rdb_client_free);
serverLog(LL_VERBOSE, "Postpone RDB client (%llu) free for %d seconds", (unsigned long long)c->id, server.wait_before_rdb_client_free);
}
sdsfree(info);
}
Expand All @@ -2751,7 +2752,7 @@ void readQueryFromClient(connection *conn) {
c->lastinteraction = server.unixtime;
if (c->flags & CLIENT_MASTER) {
c->read_reploff += nread;
atomicIncr(server.stat_total_reads_processed, nread);
atomicIncr(server.stat_net_repl_input_bytes, nread);
} else {
atomicIncr(server.stat_net_input_bytes, nread);
}
Expand Down
2 changes: 1 addition & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -6024,7 +6024,7 @@ sds genRedisInfoString(dict *section_dict, int all_sections, int everything) {
}
}
info = sdscatprintf(info, FMTARGS(
"slaves_waiting_psync:%llu\r\n", raxSize(server.slaves_waiting_psync),
"slaves_waiting_psync:%llu\r\n", (unsigned long long)raxSize(server.slaves_waiting_psync),
"master_failover_state:%s\r\n", getFailoverStateString(),
"master_replid:%s\r\n", server.replid,
"master_replid2:%s\r\n", server.replid2,
Expand Down
2 changes: 1 addition & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ struct valkeyServer {
list *clients_pending_write; /* There is to write or install handler. */
list *clients_pending_read; /* Client has pending read socket buffers. */
list *slaves, *monitors; /* List of slaves and MONITORs */
rax *slaves_waiting_psync; /* Radis tree using rdb-client id as keys and rdb-client as values.
rax *slaves_waiting_psync; /* Radix tree using rdb-client id as keys and rdb-client as values.
* This rax contains slaves for the period from the beginning of
* their RDB connection to the end of their main connection's
* partial synchronization. */
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/replication.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ start_server {tags {"repl rdb-channel external:skip"}} {
}

# Sync should fail once the replica ask for PSYNC using main channel
set res [wait_for_log_messages -1 {"*Replica main connection failed to establish PSYNC within the grace period*"} 0 2000 1]
set res [wait_for_log_messages -1 {"*Replica main connection failed to establish PSYNC within the grace period*"} 0 4000 1]

# Should succeed on retry
verify_replica_online $master 0 500
Expand Down

0 comments on commit 9454ec2

Please sign in to comment.