Skip to content

Commit

Permalink
run 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 17, 2024
1 parent ebd7776 commit 9b2361e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,8 @@ void freeClient(client *c) {
/* Log link disconnection with replica */
if (getClientType(c) == CLIENT_TYPE_REPLICA) {
serverLog(LL_NOTICE,
c->flag.repl_rdb_channel ? "Replica %s rdb channel disconnected." : "Connection with replica %s lost.",
c->flag.repl_rdb_channel ? "Replica %s rdb channel disconnected."
: "Connection with replica %s lost.",
replicationGetReplicaName(c));
}

Expand Down
4 changes: 2 additions & 2 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -2596,8 +2596,8 @@ static void fullSyncWithPrimary(connection *conn) {
}
/* Send replica lisening port to primary for clarification */
sds portstr = getReplicaPortString();
err = sendCommand(conn, "REPLCONF", "capa", "eof", "rdb-only", "1", "rdb-channel", "1", "listening-port", portstr,
NULL);
err = sendCommand(conn, "REPLCONF", "capa", "eof", "rdb-only", "1", "rdb-channel", "1", "listening-port",
portstr, NULL);
sdsfree(portstr);
if (err) {
serverLog(LL_WARNING, "Sending command to primary in dual channel replication handshake: %s", err);
Expand Down
2 changes: 1 addition & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -5813,7 +5813,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) {
"offset=%lld,lag=%ld,type=%s\r\n",
replica_id, replica_ip, replica->replica_listening_port, state,
replica->repl_ack_off, lag,
replica->flag.repl_rdb_channel ? "rdb-channel"
replica->flag.repl_rdb_channel ? "rdb-channel"
: replica->repl_state == REPLICA_STATE_BG_RDB_LOAD ? "main-channel"
: "replica");
replica_id++;
Expand Down
33 changes: 18 additions & 15 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ typedef enum {
#define REPLICA_REQ_NONE 0
#define REPLICA_REQ_RDB_EXCLUDE_DATA (1 << 0) /* Exclude data from RDB */
#define REPLICA_REQ_RDB_EXCLUDE_FUNCTIONS (1 << 1) /* Exclude functions from RDB */
#define REPLICA_REQ_RDB_CHANNEL (1 << 2) /* Use dual-channel-replication */
#define REPLICA_REQ_RDB_CHANNEL (1 << 2) /* Use dual-channel-replication */
/* Mask of all bits in the replica requirements bitfield that represent non-standard (filtered) RDB requirements */
#define REPLICA_REQ_RDB_MASK (REPLICA_REQ_RDB_EXCLUDE_DATA | REPLICA_REQ_RDB_EXCLUDE_FUNCTIONS)

Expand Down Expand Up @@ -1208,19 +1208,22 @@ typedef struct ClientFlags {
uint64_t authenticated : 1; /* Indicate a client has successfully authenticated */
uint64_t
protected_rdb_channel : 1; /* Dual channel replication sync: Protects the RDB client from premature \
* release during full sync. This flag is used to ensure that the RDB client, which \
* references the first replication data block required by the replica, is not \
* released prematurely. Protecting the client is crucial for prevention of \
* synchronization failures: \
* If the RDB client is released before the replica initiates PSYNC, the primary \
* will reduce the reference count (o->refcount) of the block needed by the replica. \
* This could potentially lead to the removal of the required data block, resulting \
* in synchronization failures. Such failures could occur even in scenarios where \
* the replica only needs an additional 4KB beyond the minimum size of the repl_backlog.
* By using this flag, we ensure that the RDB client remains intact until the replica \
* has successfully initiated PSYNC. */
uint64_t repl_rdb_channel : 1; /* Dual channel replication sync: track a connection which is used for rdb snapshot */
uint64_t reserved : 7; /* Reserved for future use */
* release during full sync. This flag is used to ensure that the RDB client, which \
* references the first replication data block required by the replica, is not \
* released prematurely. Protecting the client is crucial for prevention of \
* synchronization failures: \
* If the RDB client is released before the replica initiates PSYNC, the primary \
* will reduce the reference count (o->refcount) of the block needed by the replica.
* \
* This could potentially lead to the removal of the required data block, resulting \
* in synchronization failures. Such failures could occur even in scenarios where \
* the replica only needs an additional 4KB beyond the minimum size of the
* repl_backlog.
* By using this flag, we ensure that the RDB client remains intact until the replica
* \ has successfully initiated PSYNC. */
uint64_t
repl_rdb_channel : 1; /* Dual channel replication sync: track a connection which is used for rdb snapshot */
uint64_t reserved : 7; /* Reserved for future use */
} ClientFlags;

typedef struct client {
Expand Down Expand Up @@ -2020,7 +2023,7 @@ struct valkeyServer {
client *cached_primary; /* Cached primary to be reused for PSYNC. */
int repl_syncio_timeout; /* Timeout for synchronous I/O calls */
int repl_state; /* Replication status if the instance is a replica */
int repl_rdb_channel_state; /* State of the replica's rdb channel during dual-channel-replication */
int repl_rdb_channel_state; /* State of the replica's rdb channel during dual-channel-replication */
off_t repl_transfer_size; /* Size of RDB to read from primary during sync. */
off_t repl_transfer_read; /* Amount of RDB read from primary during sync. */
off_t repl_transfer_last_fsync_off; /* Offset when we fsync-ed last time. */
Expand Down

0 comments on commit 9b2361e

Please sign in to comment.