Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
Move logs, rename slave to replica, nit

Signed-off-by: naglera <[email protected]>
  • Loading branch information
naglera committed Jun 25, 2024
1 parent 8ac6b85 commit dd73792
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
16 changes: 6 additions & 10 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -1620,13 +1620,10 @@ void freeClient(client *c) {

/* Log link disconnection with slave */
if (getClientType(c) == CLIENT_TYPE_SLAVE) {
if (c->flags & CLIENT_REPL_RDB_CHANNEL) {
serverLog(LL_NOTICE,"Replica %s rdb channel disconnected.",
serverLog(LL_NOTICE, c->flags & CLIENT_REPL_RDB_CHANNEL ?
"Replica %s rdb channel disconnected.":
"Connection with replica %s lost.",
replicationGetSlaveName(c));
} else {
serverLog(LL_NOTICE,"Connection with replica %s lost.",
replicationGetSlaveName(c));
}
}

/* Free the query buffer */
Expand Down Expand Up @@ -1818,6 +1815,8 @@ int freeClientsInAsyncFreeQueue(void) {
/* Check if we can remove RDB connection protection. */
if (!c->rdb_client_disconnect_time) {
c->rdb_client_disconnect_time = server.unixtime;
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);
continue;
}
if (server.unixtime - c->rdb_client_disconnect_time > server.wait_before_rdb_client_free) {
Expand Down Expand Up @@ -2678,7 +2677,7 @@ void readQueryFromClient(connection *conn) {
size_t qblen, readlen;

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

/* Check if we want to read from the client later when exiting from
* the event loop. This is the case if threaded I/O is enabled. */
Expand Down Expand Up @@ -2741,9 +2740,6 @@ void readQueryFromClient(connection *conn) {
if (server.verbosity <= LL_VERBOSE) {
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 id=%llu (%s) free for %d seconds", (unsigned long long)c->id, replicationGetSlaveName(c), server.wait_before_rdb_client_free);
}
sdsfree(info);
}
freeClientAsync(c);
Expand Down
6 changes: 3 additions & 3 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ typedef enum {
REPL_STATE_CONNECTED, /* Connected to master */
} repl_state;

/* Slave rdb-channel replication state. Used in server.repl_rdb_conn_state for
* slaves to remember what to do next. */
/* Replica rdb-channel replication state. Used in server.repl_rdb_conn_state for
* replicas to remember what to do next. */
typedef enum {
REPL_RDB_CONN_STATE_NONE = 0, /* No active replication */
REPL_RDB_CONN_SEND_HANDSHAKE, /* Send handshake sequence to master */
Expand Down Expand Up @@ -1658,7 +1658,7 @@ struct valkeyServer {
list *clients_pending_read; /* Client has pending read socket buffers. */
list *slaves, *monitors; /* List of slaves and MONITORs */
rax *replicas_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
* This rax contains replicas for the period from the beginning of
* their RDB connection to the end of their main connection's
* partial synchronization. */
client *current_client; /* The client that triggered the command execution (External or AOF). */
Expand Down

0 comments on commit dd73792

Please sign in to comment.