Skip to content

Commit dd73792

Browse files
committed
Fix comments
Move logs, rename slave to replica, nit Signed-off-by: naglera <[email protected]>
1 parent 8ac6b85 commit dd73792

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/networking.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,13 +1620,10 @@ void freeClient(client *c) {
16201620

16211621
/* Log link disconnection with slave */
16221622
if (getClientType(c) == CLIENT_TYPE_SLAVE) {
1623-
if (c->flags & CLIENT_REPL_RDB_CHANNEL) {
1624-
serverLog(LL_NOTICE,"Replica %s rdb channel disconnected.",
1623+
serverLog(LL_NOTICE, c->flags & CLIENT_REPL_RDB_CHANNEL ?
1624+
"Replica %s rdb channel disconnected.":
1625+
"Connection with replica %s lost.",
16251626
replicationGetSlaveName(c));
1626-
} else {
1627-
serverLog(LL_NOTICE,"Connection with replica %s lost.",
1628-
replicationGetSlaveName(c));
1629-
}
16301627
}
16311628

16321629
/* Free the query buffer */
@@ -1818,6 +1815,8 @@ int freeClientsInAsyncFreeQueue(void) {
18181815
/* Check if we can remove RDB connection protection. */
18191816
if (!c->rdb_client_disconnect_time) {
18201817
c->rdb_client_disconnect_time = server.unixtime;
1818+
serverLog(LL_VERBOSE, "Postpone RDB client id=%llu (%s) free for %d seconds",
1819+
(unsigned long long)c->id, replicationGetSlaveName(c), server.wait_before_rdb_client_free);
18211820
continue;
18221821
}
18231822
if (server.unixtime - c->rdb_client_disconnect_time > server.wait_before_rdb_client_free) {
@@ -2678,7 +2677,7 @@ void readQueryFromClient(connection *conn) {
26782677
size_t qblen, readlen;
26792678

26802679
/* If the replica RDB client is marked as closed ASAP, do not try to read from it */
2681-
if ((c->flags & CLIENT_CLOSE_ASAP) && (c->flags & CLIENT_PROTECTED_RDB_CHANNEL)) return;
2680+
if (c->flags & CLIENT_CLOSE_ASAP) return;
26822681

26832682
/* Check if we want to read from the client later when exiting from
26842683
* the event loop. This is the case if threaded I/O is enabled. */
@@ -2741,9 +2740,6 @@ void readQueryFromClient(connection *conn) {
27412740
if (server.verbosity <= LL_VERBOSE) {
27422741
sds info = catClientInfoString(sdsempty(), c);
27432742
serverLog(LL_VERBOSE, "Client closed connection %s", info);
2744-
if (c->flags & CLIENT_PROTECTED_RDB_CHANNEL) {
2745-
serverLog(LL_VERBOSE, "Postpone RDB client id=%llu (%s) free for %d seconds", (unsigned long long)c->id, replicationGetSlaveName(c), server.wait_before_rdb_client_free);
2746-
}
27472743
sdsfree(info);
27482744
}
27492745
freeClientAsync(c);

src/server.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ typedef enum {
465465
REPL_STATE_CONNECTED, /* Connected to master */
466466
} repl_state;
467467

468-
/* Slave rdb-channel replication state. Used in server.repl_rdb_conn_state for
469-
* slaves to remember what to do next. */
468+
/* Replica rdb-channel replication state. Used in server.repl_rdb_conn_state for
469+
* replicas to remember what to do next. */
470470
typedef enum {
471471
REPL_RDB_CONN_STATE_NONE = 0, /* No active replication */
472472
REPL_RDB_CONN_SEND_HANDSHAKE, /* Send handshake sequence to master */
@@ -1658,7 +1658,7 @@ struct valkeyServer {
16581658
list *clients_pending_read; /* Client has pending read socket buffers. */
16591659
list *slaves, *monitors; /* List of slaves and MONITORs */
16601660
rax *replicas_waiting_psync; /* Radix tree using rdb-client id as keys and rdb-client as values.
1661-
* This rax contains slaves for the period from the beginning of
1661+
* This rax contains replicas for the period from the beginning of
16621662
* their RDB connection to the end of their main connection's
16631663
* partial synchronization. */
16641664
client *current_client; /* The client that triggered the command execution (External or AOF). */

0 commit comments

Comments
 (0)