From 1c50c6e82c6d371a6c4a54a8f0f652504ea89467 Mon Sep 17 00:00:00 2001 From: naglera Date: Wed, 17 Jul 2024 09:44:40 +0000 Subject: [PATCH] run clang format Signed-off-by: naglera --- src/networking.c | 3 ++- src/replication.c | 4 ++-- src/server.c | 2 +- src/server.h | 30 ++++++++++++++++-------------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/networking.c b/src/networking.c index c09343374b..cc268ba0e1 100644 --- a/src/networking.c +++ b/src/networking.c @@ -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)); } diff --git a/src/replication.c b/src/replication.c index f6fbbbf28b..5ecf9040ad 100644 --- a/src/replication.c +++ b/src/replication.c @@ -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); diff --git a/src/server.c b/src/server.c index 4e02dca67d..06dd8bc976 100644 --- a/src/server.c +++ b/src/server.c @@ -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++; diff --git a/src/server.h b/src/server.h index 9290c4ac1a..f55debdb86 100644 --- a/src/server.h +++ b/src/server.h @@ -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) @@ -1208,19 +1208,21 @@ 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. */ + * 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 */ + uint64_t reserved : 7; /* Reserved for future use */ } ClientFlags; typedef struct client { @@ -2020,7 +2022,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. */