Minor comments cleanup around replication.c (#1154)

Typo, comment cleanups.

Signed-off-by: Binbin <binloveplay1314@qq.com>
This commit is contained in:
Binbin 2024-10-14 12:37:19 +08:00 committed by GitHub
parent e50f31ef3a
commit 1a5c80fe90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2470,7 +2470,7 @@ char *sendCommand(connection *conn, ...) {
size_t argslen = 0; size_t argslen = 0;
char *arg; char *arg;
/* Create the command to send to the primarprimaryuse binary /* Create the command to send to the primary, we use binary
* protocol to make sure correct arguments are sent. This function * protocol to make sure correct arguments are sent. This function
* is not safe for all binary data. */ * is not safe for all binary data. */
va_start(ap, conn); va_start(ap, conn);
@ -2592,7 +2592,7 @@ int sendCurrentOffsetToReplica(client *replica) {
* This connection handler is used to initialize the RDB connection (dual-channel-replication). * This connection handler is used to initialize the RDB connection (dual-channel-replication).
* Once a replica with dual-channel-replication enabled, denied from PSYNC with its primary, * Once a replica with dual-channel-replication enabled, denied from PSYNC with its primary,
* fullSyncWithPrimary begins its role. The connection handler prepares server.repl_rdb_transfer_s * fullSyncWithPrimary begins its role. The connection handler prepares server.repl_rdb_transfer_s
* for a rdb stream, and server.repl_transfer_s for increamental replication data stream. */ * for a rdb stream, and server.repl_transfer_s for incremental replication data stream. */
static void fullSyncWithPrimary(connection *conn) { static void fullSyncWithPrimary(connection *conn) {
char *err = NULL; char *err = NULL;
serverAssert(conn == server.repl_rdb_transfer_s); serverAssert(conn == server.repl_rdb_transfer_s);
@ -2629,7 +2629,7 @@ static void fullSyncWithPrimary(connection *conn) {
return; return;
} }
} }
/* Send replica lisening port to primary for clarification */ /* Send replica listening port to primary for clarification */
sds portstr = getReplicaPortString(); sds portstr = getReplicaPortString();
err = sendCommand(conn, "REPLCONF", "capa", "eof", "rdb-only", "1", "rdb-channel", "1", "listening-port", err = sendCommand(conn, "REPLCONF", "capa", "eof", "rdb-only", "1", "rdb-channel", "1", "listening-port",
portstr, NULL); portstr, NULL);
@ -2893,7 +2893,7 @@ int streamReplDataBufToDb(client *c) {
/* Replication: Replica side. /* Replication: Replica side.
* After done loading the snapshot using the rdb-channel prepare this replica for steady state by * After done loading the snapshot using the rdb-channel prepare this replica for steady state by
* initializing the primary client, amd stream local increamental buffer into memory. */ * initializing the primary client, amd stream local incremental buffer into memory. */
void dualChannelSyncSuccess(void) { void dualChannelSyncSuccess(void) {
server.primary_initial_offset = server.repl_provisional_primary.reploff; server.primary_initial_offset = server.repl_provisional_primary.reploff;
replicationResurrectProvisionalPrimary(); replicationResurrectProvisionalPrimary();
@ -3237,10 +3237,10 @@ void setupMainConnForPsync(connection *conn) {
if (psync_result == PSYNC_WAIT_REPLY) return; /* Try again later... */ if (psync_result == PSYNC_WAIT_REPLY) return; /* Try again later... */
if (psync_result == PSYNC_CONTINUE) { if (psync_result == PSYNC_CONTINUE) {
serverLog(LL_NOTICE, "Primary <-> REPLICA sync: Primary accepted a Partial Resynchronization%s", serverLog(LL_NOTICE, "PRIMARY <-> REPLICA sync: Primary accepted a Partial Resynchronization%s",
server.repl_rdb_transfer_s != NULL ? ", RDB load in background." : "."); server.repl_rdb_transfer_s != NULL ? ", RDB load in background." : ".");
if (server.supervised_mode == SUPERVISED_SYSTEMD) { if (server.supervised_mode == SUPERVISED_SYSTEMD) {
serverCommunicateSystemd("STATUS=Primary <-> REPLICA sync: Partial Resynchronization accepted. Ready to " serverCommunicateSystemd("STATUS=PRIMARY <-> REPLICA sync: Partial Resynchronization accepted. Ready to "
"accept connections in read-write mode.\n"); "accept connections in read-write mode.\n");
} }
dualChannelSyncHandlePsync(); dualChannelSyncHandlePsync();
@ -3262,7 +3262,7 @@ error:
* - Reduce primary memory load. We do that by moving the COB tracking to the replica side. This also decrease * - Reduce primary memory load. We do that by moving the COB tracking to the replica side. This also decrease
* the chance for COB overruns. Note that primary's input buffer limits at the replica side are less restricted * the chance for COB overruns. Note that primary's input buffer limits at the replica side are less restricted
* then primary's COB as the replica plays less critical part in the replication group. While increasing the * then primary's COB as the replica plays less critical part in the replication group. While increasing the
* primarys COB may end up with primary reaching swap and clients suffering, at replica side were more at * primary's COB may end up with primary reaching swap and clients suffering, at replica side we're more at
* ease with it. Larger COB means better chance to sync successfully. * ease with it. Larger COB means better chance to sync successfully.
* - Reduce primary main process CPU load. By opening a new, dedicated channel for the RDB transfer, child * - Reduce primary main process CPU load. By opening a new, dedicated channel for the RDB transfer, child
* processes can have direct access to the new channel. Due to TLS connection restrictions, this was not * processes can have direct access to the new channel. Due to TLS connection restrictions, this was not
@ -3299,21 +3299,21 @@ error:
* RECEIVE_AUTH_REPLY * RECEIVE_AUTH_REPLY
* +OK +OK * +OK +OK
* +OK * +OK
* DUAL_CHANNEL_RECEIVE_REPLCONF_. SEND_PSYNC * DUAL_CHANNEL_RECEIVE_REPLCONF_REPLYSEND_PSYNC
* RECEIVE_PORT_REPLY * RECEIVE_PORT_REPLY
* +OK PSYNC use snapshot * +OK PSYNC use snapshot
* +OK end-offset provided * +OK end-offset provided
* DUAL_CHANNEL_RECEIVE_EN. by the primary * DUAL_CHANNEL_RECEIVE_ENDOFF by the primary
* RECEIVE_IP_REPLY * RECEIVE_IP_REPLY
* $ENDOFF RECEIVE_PSYNC_REPLY * $ENDOFF RECEIVE_PSYNC_REPLY
* +OK *
* +CONTINUE * +CONTINUE
* RECEIVE_IP_REPLY *
* DUAL_CHANNEL_RDB_LOAD TRANSFER * DUAL_CHANNEL_RDB_LOAD TRANSFER
* +OK * +OK
* Done loading * Done loading
* RECEIVE_CAPA_REPLY * RECEIVE_CAPA_REPLY
* DUAL_CHANNEL_RDB_LOADE. * DUAL_CHANNEL_RDB_LOADED
* *
* *
* SEND_PSYNC Replica loads local replication * SEND_PSYNC Replica loads local replication