Skip to content

Commit

Permalink
Use rdb-connection terms instead of rdb-channel
Browse files Browse the repository at this point in the history
Signed-off-by: naglera <[email protected]>
  • Loading branch information
naglera committed Jun 27, 2024
1 parent 72aef9b commit 990845e
Show file tree
Hide file tree
Showing 13 changed files with 196 additions and 196 deletions.
2 changes: 1 addition & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -3039,7 +3039,7 @@ standardConfig static_configs[] = {
createBoolConfig("lazyfree-lazy-user-flush", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.lazyfree_lazy_user_flush, 0, NULL, NULL),
createBoolConfig("repl-disable-tcp-nodelay", NULL, MODIFIABLE_CONFIG, server.repl_disable_tcp_nodelay, 0, NULL, NULL),
createBoolConfig("repl-diskless-sync", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.repl_diskless_sync, 1, NULL, NULL),
createBoolConfig("repl-rdb-channel", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.rdb_channel_enabled, 0, NULL, NULL),
createBoolConfig("repl-rdb-connection", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.rdb_conn_enabled, 0, NULL, NULL),
createBoolConfig("aof-rewrite-incremental-fsync", NULL, MODIFIABLE_CONFIG, server.aof_rewrite_incremental_fsync, 1, NULL, NULL),
createBoolConfig("no-appendfsync-on-rewrite", NULL, MODIFIABLE_CONFIG, server.aof_no_fsync_on_rewrite, 0, NULL, NULL),
createBoolConfig("cluster-require-full-coverage", NULL, MODIFIABLE_CONFIG, server.cluster_require_full_coverage, 1, NULL, NULL),
Expand Down
2 changes: 1 addition & 1 deletion src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void debugCommand(client *c) {
"SLEEP-AFTER-FORK <micro seconds>",
" Stop the server's main process for <seconds> after forking.",
"WAIT-BEFORE-RDB-CLIENT-FREE <seconds>",
" Grace period in seconds for replica main channel to establish psync.",
" Grace period in seconds for replica main connection to establish psync.",
"DICT-RESIZING <0|1>",
" Enable or disable the main dict and expire dict resizing.",
NULL};
Expand Down
16 changes: 8 additions & 8 deletions src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ void freeClient(client *c) {

/* If a client is protected, yet we need to free it right now, make sure
* to at least use asynchronous freeing. */
if ((c->flags & CLIENT_PROTECTED) || (c->flags & CLIENT_PROTECTED_RDB_CHANNEL)) {
if ((c->flags & CLIENT_PROTECTED) || (c->flags & CLIENT_PROTECTED_RDB_CONN)) {
freeClientAsync(c);
return;
}
Expand Down Expand Up @@ -1622,8 +1622,8 @@ void freeClient(client *c) {

/* Log link disconnection with replica */
if (getClientType(c) == CLIENT_TYPE_REPLICA) {
serverLog(LL_NOTICE, c->flags & CLIENT_REPL_RDB_CHANNEL ?
"Replica %s rdb channel disconnected.":
serverLog(LL_NOTICE, c->flags & CLIENT_REPL_RDB_CONN ?
"Replica %s rdb connection disconnected.":
"Connection with replica %s lost.",
replicationGetReplicaName(c));
}
Expand Down Expand Up @@ -1809,8 +1809,8 @@ int freeClientsInAsyncFreeQueue(void) {
while ((ln = listNext(&li)) != NULL) {
client *c = listNodeValue(ln);

if (c->flags & CLIENT_PROTECTED_RDB_CHANNEL) {
/* Check if it's safe to remove RDB channel protection during synchronization
if (c->flags & CLIENT_PROTECTED_RDB_CONN) {
/* Check if it's safe to remove RDB connection protection during synchronization
* The primary gives a grace period before freeing this client because
* it serves as a reference to the first required replication data block for
* this replica */
Expand All @@ -1822,7 +1822,7 @@ int freeClientsInAsyncFreeQueue(void) {
}
if (server.unixtime - c->rdb_client_disconnect_time > server.wait_before_rdb_client_free) {
serverLog(LL_NOTICE, "Replica main connection failed to establish PSYNC within the grace period (%ld seconds). Freeing RDB client %llu.", (long int)(server.unixtime - c->rdb_client_disconnect_time), (unsigned long long)c->id);
c->flags &= ~CLIENT_PROTECTED_RDB_CHANNEL;
c->flags &= ~CLIENT_PROTECTED_RDB_CONN;
}
}

Expand Down Expand Up @@ -4024,11 +4024,11 @@ int closeClientOnOutputBufferLimitReached(client *c, int async) {
serverAssert(c->reply_bytes < SIZE_MAX - (1024 * 64));
/* Note that c->reply_bytes is irrelevant for replica clients
* (they use the global repl buffers). */
if ((c->reply_bytes == 0 && getClientType(c) != CLIENT_TYPE_REPLICA) || (c->flags & CLIENT_CLOSE_ASAP && !(c->flags & CLIENT_PROTECTED_RDB_CHANNEL))) return 0;
if ((c->reply_bytes == 0 && getClientType(c) != CLIENT_TYPE_REPLICA) || (c->flags & CLIENT_CLOSE_ASAP && !(c->flags & CLIENT_PROTECTED_RDB_CONN))) return 0;
if (checkClientOutputBufferLimits(c)) {
sds client = catClientInfoString(sdsempty(), c);
/* Remove RDB connection protection on COB overrun */
c->flags &= ~CLIENT_PROTECTED_RDB_CHANNEL;
c->flags &= ~CLIENT_PROTECTED_RDB_CONN;

if (async) {
freeClientAsync(c);
Expand Down
4 changes: 2 additions & 2 deletions src/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3504,7 +3504,7 @@ int rdbSaveToReplicasSockets(int req, rdbSaveInfo *rsi) {
listIter li;
pid_t childpid;
int pipefds[2], rdb_pipe_write, safe_to_exit_pipe;
int direct = (req & REPLICA_REQ_RDB_CHANNEL);
int direct = (req & REPLICA_REQ_RDB_CONN);

if (hasActiveChildProcess()) return C_ERR;

Expand Down Expand Up @@ -3553,7 +3553,7 @@ int rdbSaveToReplicasSockets(int req, rdbSaveInfo *rsi) {
/* Put the socket in blocking mode to simplify RDB transfer. */
connBlock(replica->conn);
connSendTimeout(replica->conn, server.repl_timeout * 1000);
/* This replica uses diskless rdb channel sync, hence we need
/* This replica uses diskless rdb connection sync, hence we need
* to inform it with the save end offset.*/
sendCurrentOffsetToReplica(replica);
/* Make sure repl traffic is appended to the replication backlog */
Expand Down
Loading

0 comments on commit 990845e

Please sign in to comment.