Skip to content

Commit

Permalink
Clang format
Browse files Browse the repository at this point in the history
Signed-off-by: naglera <[email protected]>
  • Loading branch information
naglera committed Jul 16, 2024
1 parent ea8b684 commit dda1600
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
3 changes: 1 addition & 2 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -1645,8 +1645,7 @@ void freeClient(client *c) {
/* Log link disconnection with replica */
if (getClientType(c) == CLIENT_TYPE_REPLICA) {
serverLog(LL_NOTICE,
c->flag.repl_rdb_chan ? "Replica %s rdb channel disconnected."
: "Connection with replica %s lost.",
c->flag.repl_rdb_chan ? "Replica %s rdb channel disconnected." : "Connection with replica %s lost.",
replicationGetReplicaName(c));
}

Expand Down
14 changes: 7 additions & 7 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -2641,8 +2641,7 @@ static void fullSyncWithPrimary(connection *conn) {

if (err[0] == '-') {
serverLog(LL_NOTICE,
"Server does not support sync with offset, dual channel sync approach cannot be used: %s",
err);
"Server does not support sync with offset, dual channel sync approach cannot be used: %s", err);
goto error;
}
if (connSyncWrite(conn, "SYNC\r\n", 6, server.repl_syncio_timeout * 1000) == -1) {
Expand Down Expand Up @@ -2875,7 +2874,7 @@ void dualChannelSyncSuccess(void) {
}

/* Replication: Replica side.
* Main channel successfully established psync with primary. Check whether the rdb channel
* Main channel successfully established psync with primary. Check whether the rdb channel
* has completed its part and act accordingly. */
void dualChannelSyncHandlePsync(void) {
serverAssert(server.repl_state == REPL_STATE_RECEIVE_PSYNC_REPLY);
Expand All @@ -2898,7 +2897,7 @@ void dualChannelSyncHandlePsync(void) {
}

/* Replication: Replica side.
* RDB channel done loading the RDB. Check whether the main channel has completed its part
* RDB channel done loading the RDB. Check whether the main channel has completed its part
* and act accordingly. */
void dualChannelSyncHandleRdbLoadCompletion(void) {
serverAssert(server.repl_rdb_chan_state == REPL_DUAL_CHAN_RDB_LOAD);
Expand Down Expand Up @@ -2986,8 +2985,8 @@ int replicaTryPartialResynchronization(connection *conn, int read_reply) {
/* While in dual channel replication, we should use our prepared repl id and offset. */
psync_replid = server.repl_provisional_primary.replid;
snprintf(psync_offset, sizeof(psync_offset), "%lld", server.repl_provisional_primary.reploff + 1);
serverLog(LL_NOTICE, "Trying a partial resynchronization using main channel (request %s:%s).",
psync_replid, psync_offset);
serverLog(LL_NOTICE, "Trying a partial resynchronization using main channel (request %s:%s).", psync_replid,
psync_offset);
} else if (server.cached_primary) {
psync_replid = server.cached_primary->replid;
snprintf(psync_offset, sizeof(psync_offset), "%lld", server.cached_primary->reploff + 1);
Expand Down Expand Up @@ -3206,7 +3205,8 @@ void setupMainConnForPsync(connection *conn) {

error:
sdsfree(err);
/* The dual-channel sync session must be aborted for any psync_result other than PSYNC_CONTINUE or PSYNC_WAIT_REPLY. */
/* The dual-channel sync session must be aborted for any psync_result other than PSYNC_CONTINUE or PSYNC_WAIT_REPLY.
*/
serverLog(LL_WARNING, "Aborting dual channel sync. Main channel psync result %d", psync_result);
cancelReplicationHandshake(1);
}
Expand Down
28 changes: 14 additions & 14 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,16 +388,16 @@ typedef enum {
REPL_STATE_CONNECT, /* Must connect to primary */
REPL_STATE_CONNECTING, /* Connecting to primary */
/* --- Handshake states, must be ordered --- */
REPL_STATE_RECEIVE_PING_REPLY, /* Wait for PING reply */
REPL_STATE_SEND_HANDSHAKE, /* Send handshake sequence to primary */
REPL_STATE_RECEIVE_AUTH_REPLY, /* Wait for AUTH reply */
REPL_STATE_RECEIVE_PORT_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_RECEIVE_IP_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_RECEIVE_PING_REPLY, /* Wait for PING reply */
REPL_STATE_SEND_HANDSHAKE, /* Send handshake sequence to primary */
REPL_STATE_RECEIVE_AUTH_REPLY, /* Wait for AUTH reply */
REPL_STATE_RECEIVE_PORT_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_RECEIVE_IP_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_RECEIVE_DUAL_CHANNEL_REPLY, /* If using dual-channel sync, mark main channel */
REPL_STATE_RECEIVE_CAPA_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_RECEIVE_VERSION_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_SEND_PSYNC, /* Send PSYNC */
REPL_STATE_RECEIVE_PSYNC_REPLY, /* Wait for PSYNC reply */
REPL_STATE_RECEIVE_CAPA_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_RECEIVE_VERSION_REPLY, /* Wait for REPLCONF reply */
REPL_STATE_SEND_PSYNC, /* Send PSYNC */
REPL_STATE_RECEIVE_PSYNC_REPLY, /* Wait for PSYNC reply */
/* --- End of handshake states --- */
REPL_STATE_TRANSFER, /* Receiving .rdb from primary */
REPL_STATE_CONNECTED, /* Connected to primary */
Expand Down Expand Up @@ -438,8 +438,8 @@ typedef enum {

/* Replica capabilities. */
#define REPLICA_CAPA_NONE 0
#define REPLICA_CAPA_EOF (1 << 0) /* Can parse the RDB EOF streaming format. */
#define REPLICA_CAPA_PSYNC2 (1 << 1) /* Supports PSYNC2 protocol. */
#define REPLICA_CAPA_EOF (1 << 0) /* Can parse the RDB EOF streaming format. */
#define REPLICA_CAPA_PSYNC2 (1 << 1) /* Supports PSYNC2 protocol. */
#define REPLICA_CAPA_DUAL_CHANNEL (1 << 2) /* Supports dual channel replication sync */

/* Replica requirements */
Expand Down Expand Up @@ -1220,7 +1220,7 @@ typedef struct ClientFlags {
* By using this flag, we ensure that the RDB client remains intact until the replica \
* has successfully initiated PSYNC. */
uint64_t repl_rdb_chan : 1; /* Dual channel replication sync: track a connection which is used for rdb snapshot */
uint64_t reserved : 7; /* Reserved for future use */
uint64_t reserved : 7; /* Reserved for future use */
} ClientFlags;

typedef struct client {
Expand Down Expand Up @@ -1699,10 +1699,10 @@ struct valkeyServer {
list *clients_pending_io_read; /* List of clients with pending read to be process by I/O threads. */
list *clients_pending_io_write; /* List of clients with pending write to be process by I/O threads. */
list *replicas, *monitors; /* List of replicas and MONITORs */
rax *replicas_waiting_psync; /* Radix tree for tracking replicas awaiting partial synchronization.
rax *replicas_waiting_psync; /* Radix tree for tracking replicas awaiting partial synchronization.
* Key: RDB client ID
* Value: RDB client object
* This structure holds dual-channel sync replicas from the start of their
* This structure holds dual-channel sync replicas from the start of their
* RDB transfer until their main channel establishes partial synchronization. */
client *current_client; /* The client that triggered the command execution (External or AOF). */
client *executing_client; /* The client executing the current command (possibly script or module). */
Expand Down

0 comments on commit dda1600

Please sign in to comment.