diff --git a/src/config.c b/src/config.c index e83c0ee0e5..2ca420477d 100644 --- a/src/config.c +++ b/src/config.c @@ -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), diff --git a/src/debug.c b/src/debug.c index a4e92ae321..6291bad546 100644 --- a/src/debug.c +++ b/src/debug.c @@ -497,7 +497,7 @@ void debugCommand(client *c) { "SLEEP-AFTER-FORK ", " Stop the server's main process for after forking.", "WAIT-BEFORE-RDB-CLIENT-FREE ", - " 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}; diff --git a/src/networking.c b/src/networking.c index 5496b08fe2..3041a11586 100644 --- a/src/networking.c +++ b/src/networking.c @@ -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; } @@ -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)); } @@ -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 */ @@ -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; } } @@ -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); diff --git a/src/rdb.c b/src/rdb.c index 23bb46611a..d5eb4859a0 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -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; @@ -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 */ diff --git a/src/replication.c b/src/replication.c index 9d1fa5db5e..96645a933b 100644 --- a/src/replication.c +++ b/src/replication.c @@ -54,8 +54,8 @@ int cancelReplicationHandshake(int reconnect); void syncWithPrimary(connection *conn); void replicationSteadyStateInit(void); void setupMainConnForPsync(connection *conn); -void completeTaskRDBChannelSyncMainConn(connection *conn); -void completeTaskRDBChannelSyncRdbConn(connection *conn); +void completeTaskRDBConnectionSyncMainConn(connection *conn); +void completeTaskRDBConnectionSyncRdbConn(connection *conn); void replicationAbortSyncTransfer(void); /* We take a global flag to remember if this instance generated an RDB @@ -199,7 +199,7 @@ void rebaseReplicationBuffer(long long base_repl_offset) { } /* Replication: Primary side - connections association. - * On rdb-channel sync, connection association is used to keep replication data in + * On rdb-connection sync, connection association is used to keep replication data in * the backlog until the replica requests PSYNC. Association happens in two forms, * if there's an existing buffer block at the fork time, the replica is attached * to the tail, if there is no tail, the replica will be attached when a new @@ -224,7 +224,7 @@ void addReplicaToPsyncWaitingRax(client* replica) { tail? "with repl-backlog tail": "repl-backlog is empty"); replica->ref_repl_buf_node = tail? ln: NULL; /* Prevent rdb client from being freed before psync is established. */ - replica->flags |= CLIENT_PROTECTED_RDB_CHANNEL; + replica->flags |= CLIENT_PROTECTED_RDB_CONN; uint64_t id = htonu64(replica->id); raxInsert(server.replicas_waiting_psync,(unsigned char*)&id,sizeof(id),replica,NULL); } @@ -261,7 +261,7 @@ void removeReplicaFromPsyncWaitingRax(client* replica) { o->refcount--; } peer_replica->ref_repl_buf_node = NULL; - peer_replica->flags &= ~CLIENT_PROTECTED_RDB_CHANNEL; + peer_replica->flags &= ~CLIENT_PROTECTED_RDB_CONN; serverLog(LL_DEBUG, "Remove psync waiting replica %s with cid %llu, repl buffer block %s", replicationGetReplicaName(replica), (long long unsigned int)replica->associated_rdb_client_id, o? "ref count decreased": "doesn't exist"); uint64_t id = htonu64(peer_replica->id); @@ -377,7 +377,7 @@ void incrementalTrimReplicationBacklog(size_t max_blocks) { /* Free replication buffer blocks that are referenced by this client. */ void freeReplicaReferencedReplBuffer(client *replica) { - if (replica->flags & CLIENT_REPL_RDB_CHANNEL) { + if (replica->flags & CLIENT_REPL_RDB_CONN) { uint64_t id = htonu64(replica->id); if(raxRemove(server.replicas_waiting_psync,(unsigned char*)&id,sizeof(id),NULL)) { serverLog(LL_DEBUG, "Remove psync waiting replica %s with cid %llu from replicas rax.", @@ -471,7 +471,7 @@ void feedReplicationBuffer(char *s, size_t len) { while((ln = listNext(&li))) { client *replica = ln->value; if (!canFeedReplicaReplBuffer(replica) && - !(replica->flags & CLIENT_PROTECTED_RDB_CHANNEL)) continue; + !(replica->flags & CLIENT_PROTECTED_RDB_CONN)) continue; /* Update shared replication buffer start position. */ if (replica->ref_repl_buf_node == NULL) { replica->ref_repl_buf_node = start_node; @@ -862,7 +862,7 @@ int primaryTryPartialResynchronization(client *c, long long psync_offset) { * 2) Inform the client we can continue with +CONTINUE * 3) Send the backlog data (from the offset to the end) to the replica. */ c->flags |= CLIENT_REPLICA; - if (c->flags & CLIENT_REPL_MAIN_CHANNEL && lookupRdbClientByID(c->associated_rdb_client_id)) { + if (c->flags & CLIENT_REPL_MAIN_CONN && lookupRdbClientByID(c->associated_rdb_client_id)) { c->repl_state = REPLICA_STATE_BG_RDB_LOAD; removeReplicaFromPsyncWaitingRax(c); } else { @@ -1092,9 +1092,9 @@ void syncCommand(client *c) { * resync on purpose when they are not able to partially * resync. */ if (primary_replid[0] != '?') server.stat_sync_partial_err++; - if (c->replica_capa & REPLICA_CAPA_RDB_CHANNEL) { - c->flags |= CLIENT_REPL_MAIN_CHANNEL; - serverLog(LL_NOTICE,"Replica %s is capable of rdb-channel synchronization, and partial sync isn't possible. " + if (c->replica_capa & REPLICA_CAPA_RDB_CONN) { + c->flags |= CLIENT_REPL_MAIN_CONN; + serverLog(LL_NOTICE,"Replica %s is capable of rdb-connection synchronization, and partial sync isn't possible. " "Full sync will continue with dedicated RDB connection.", replicationGetReplicaName(c)); if (connWrite(c->conn,"+FULLSYNCNEEDED\r\n",17) != 17) { freeClientAsync(c); @@ -1211,11 +1211,11 @@ void syncCommand(client *c) { * the primary can accurately lists replicas and their listening ports in the * INFO output. * - * - capa + * - capa * What is the capabilities of this instance. * eof: supports EOF-style RDB transfer for diskless replication. * psync2: supports PSYNC v2, so understands +CONTINUE . - * dual-channel: supports full sync using rdb channel. + * dual-conn: supports full sync using rdb connection. * * - ack [fack ] * Replica informs the primary the amount of replication stream that it @@ -1237,7 +1237,7 @@ void syncCommand(client *c) { * - version * The replica reports its version. * - * - rdb-channel <1|0> + * - rdb-conn <1|0> * Used to identify the client as a replica's rdb connection in an rdb connection * sync session. * */ @@ -1276,11 +1276,11 @@ void replconfCommand(client *c) { c->replica_capa |= REPLICA_CAPA_EOF; else if (!strcasecmp(c->argv[j + 1]->ptr, "psync2")) c->replica_capa |= REPLICA_CAPA_PSYNC2; - else if (!strcasecmp(c->argv[j+1]->ptr,"dual-channel") && - server.rdb_channel_enabled && server.repl_diskless_sync) { - /* If rdb-channel is disable on this primary, treat this command as unrecognized + else if (!strcasecmp(c->argv[j+1]->ptr,"dual-conn") && + server.rdb_conn_enabled && server.repl_diskless_sync) { + /* If rdb-connection is disable on this primary, treat this command as unrecognized * replconf option. */ - c->replica_capa |= REPLICA_CAPA_RDB_CHANNEL; + c->replica_capa |= REPLICA_CAPA_RDB_CONN; } } else if (!strcasecmp(c->argv[j]->ptr, "ack")) { /* REPLCONF ACK is used by replica to inform the primary the amount @@ -1309,7 +1309,7 @@ void replconfCommand(client *c) { if (c->repl_start_cmd_stream_on_ack && c->repl_state == REPLICA_STATE_ONLINE) replicaStartCommandStream(c); if (c->repl_state == REPLICA_STATE_BG_RDB_LOAD) { - c->flags &= ~CLIENT_REPL_MAIN_CHANNEL; + c->flags &= ~CLIENT_REPL_MAIN_CONN; replicaPutOnline(c); } /* Note: this command does not reply anything! */ @@ -1371,11 +1371,11 @@ void replconfCommand(client *c) { return; } if (start_with_offset == 1) { - c->flags |= CLIENT_REPL_RDB_CHANNEL; - c->replica_req |= REPLICA_REQ_RDB_CHANNEL; + c->flags |= CLIENT_REPL_RDB_CONN; + c->replica_req |= REPLICA_REQ_RDB_CONN; } else { - c->flags &= ~CLIENT_REPL_RDB_CHANNEL; - c->replica_req &= ~REPLICA_REQ_RDB_CHANNEL; + c->flags &= ~CLIENT_REPL_RDB_CONN; + c->replica_req &= ~REPLICA_REQ_RDB_CONN; } } else if (!strcasecmp(c->argv[j]->ptr, "set-rdb-client-id")) { /* REPLCONF identify is used to identify the current replica main connection with existing @@ -2335,9 +2335,9 @@ void readSyncBulkPayload(connection *conn) { /* Final setup of the connected replica <- primary link */ if (conn == server.repl_rdb_transfer_s) { - /* In case of full-sync using rdb channel, the primary client was already created for psync purposes + /* In case of full-sync using rdb connection, the primary client was already created for psync purposes * Instead of creating a new client we will use the one created for partial sync */ - completeTaskRDBChannelSyncRdbConn(conn); + completeTaskRDBConnectionSyncRdbConn(conn); } else { replicationCreatePrimaryClient(server.repl_transfer_s, rsi.repl_stream_db); server.repl_state = REPL_STATE_CONNECTED; @@ -2546,8 +2546,8 @@ int sendCurrentOffsetToReplica(client* replica) { } /* Replication: Replica side. - * This connection handler is used to initialize the RDB connection (repl-rdb-channel sync). - * Once a replica with repl rdb-channel enabled, denied from PSYNC with its primary, + * This connection handler is used to initialize the RDB connection (repl-rdb-connection sync). + * Once a replica with repl rdb-connection enabled, denied from PSYNC with its primary, * fullSyncWithPrimary begins its role. The connection handler prepare server.repl_rdb_transfer_s * for a rdb stream, and server.repl_transfer_s for increamental replication data stream. */ void fullSyncWithPrimary(connection* conn) { @@ -2561,7 +2561,7 @@ void fullSyncWithPrimary(connection* conn) { /* Check for errors in the socket: after a non blocking connect() we * may find that the socket is in error state. */ if (connGetState(conn) != CONN_STATE_CONNECTED) { - serverLog(LL_WARNING,"Error condition on socket for RDB-CHANNEL-SYNC: %s", + serverLog(LL_WARNING,"Error condition on socket for RDB-CONNECTION-SYNC: %s", connGetLastError(conn)); goto error; } @@ -2624,7 +2624,7 @@ void fullSyncWithPrimary(connection* conn) { if (err == NULL) goto no_response_error; if (err[0] == '-') { - serverLog(LL_NOTICE, "Server does not support sync with offset, RDB Channel Sync approach cannot be used: %s", err); + serverLog(LL_NOTICE, "Server does not support sync with offset, RDB connection sync approach cannot be used: %s", err); goto error; } sdsfree(err); @@ -2639,7 +2639,7 @@ void fullSyncWithPrimary(connection* conn) { server.repl_rdb_conn_state = REPL_RDB_CONN_RECEIVE_ENDOFF; return; } - /* Receive primary rdb-channel end offset response */ + /* Receive primary rdb-conn end offset response */ if (server.repl_rdb_conn_state == REPL_RDB_CONN_RECEIVE_ENDOFF) { int64_t rdb_client_id; err = receiveSynchronousResponse(conn); @@ -2708,7 +2708,7 @@ void fullSyncWithPrimary(connection* conn) { return; write_error: /* Handle sendCommand() errors. */ - serverLog(LL_WARNING, "Sending command to primary in rdb channel replication handshake: %s", err); + serverLog(LL_WARNING, "Sending command to primary in rdb connection replication handshake: %s", err); sdsfree(err); goto error; } @@ -2853,7 +2853,7 @@ int streamReplDataBufToDb(client *c) { /* Replication: Replica side. * After done loading the snapshot using the rdb-connection prepare this replica for steady state by * initializing the primary client, amd stream local increamental buffer into memory. */ -void rdbChannelSyncSuccess(void) { +void rdbConnectionSyncSuccess(void) { server.primary_initial_offset = server.repl_provisional_primary.reploff; replicationResurrectProvisionalPrimary(); /* Wait for the accumulated buffer to be processed before reading any more replication updates */ @@ -2873,7 +2873,7 @@ void rdbChannelSyncSuccess(void) { /* Replication: Replica side. * Main connection successfully established psync with primary. The 'conn' argument must be the main * connection. Check whether the rdb connection has completed its part and act accordingly. */ -void completeTaskRDBChannelSyncMainConn(connection *conn) { +void completeTaskRDBConnectionSyncMainConn(connection *conn) { serverAssert(conn == server.repl_transfer_s && server.repl_state == REPL_STATE_RECEIVE_PSYNC_REPLY); if (server.repl_rdb_conn_state < REPL_RDB_CONN_RDB_LOADED) { /* RDB is still loading */ @@ -2887,17 +2887,17 @@ void completeTaskRDBChannelSyncMainConn(connection *conn) { } if (server.repl_rdb_conn_state == REPL_RDB_CONN_RDB_LOADED) { /* RDB is loaded */ - serverLog(LL_DEBUG, "RDB channel sync - psync established after rdb load"); - rdbChannelSyncSuccess(); + serverLog(LL_DEBUG, "RDB connection sync - psync established after rdb load"); + rdbConnectionSyncSuccess(); return; } - serverPanic("Unrecognized rdb channel replication state %d", server.repl_rdb_conn_state); + serverPanic("Unrecognized rdb connection replication state %d", server.repl_rdb_conn_state); } /* Replication: Replica side. * Rdb connection done loading rdb. The 'conn' argument must be the rdb connection. Check whether the * main connection has completed its part and act accordingly. */ -void completeTaskRDBChannelSyncRdbConn(connection *conn) { +void completeTaskRDBConnectionSyncRdbConn(connection *conn) { serverAssert(conn == server.repl_rdb_transfer_s && server.repl_rdb_conn_state == REPL_RDB_CONN_RDB_LOAD); /* RDB connection */ if (server.repl_state < REPL_STATE_TRANSFER) { @@ -2907,7 +2907,7 @@ void completeTaskRDBChannelSyncRdbConn(connection *conn) { } if (server.repl_state == REPL_STATE_TRANSFER) { connSetReadHandler(server.repl_transfer_s, NULL); - rdbChannelSyncSuccess(); + rdbConnectionSyncSuccess(); return; } serverPanic("Unrecognized replication state %d using rdb connection", server.repl_state); @@ -2983,10 +2983,10 @@ int replicaTryPartialResynchronization(connection *conn, int read_reply) { server.primary_initial_offset = -1; if (server.repl_rdb_conn_state != REPL_RDB_CONN_STATE_NONE) { - /* While in rdb-channel-sync, we should use our prepared repl id and offset. */ + /* While in rdb-connection-sync, 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 connection (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); @@ -3035,8 +3035,8 @@ int replicaTryPartialResynchronization(connection *conn, int read_reply) { if (!strncmp(reply, "+FULLRESYNC", 11)) { char *replid = NULL, *offset = NULL; - if (server.rdb_channel_enabled) { - server.primary_supports_rdb_channel = 0; + if (server.rdb_conn_enabled) { + server.primary_supports_rdb_connection = 0; } /* FULL RESYNC, parse the reply in order to extract the replid @@ -3135,9 +3135,9 @@ int replicaTryPartialResynchronization(connection *conn, int read_reply) { if (!strncmp(reply, "+FULLSYNCNEEDED", 15)) { /* A response of +FULLSYNCNEEDED from the primary implies that partial * synchronization is not possible and that the primary supports full - * sync using dedicated RDB channel. Full sync will continue that way. */ - server.primary_supports_rdb_channel = 1; - serverLog(LL_NOTICE, "PSYNC is not possible, initialize RDB channel."); + * sync using dedicated RDB connection. Full sync will continue that way. */ + server.primary_supports_rdb_connection = 1; + serverLog(LL_NOTICE, "PSYNC is not possible, initialize RDB connection."); sdsfree(reply); return PSYNC_FULLRESYNC_RDB_CONN; } @@ -3156,7 +3156,7 @@ int replicaTryPartialResynchronization(connection *conn, int read_reply) { } /* Replication: Replica side. - * This connection handler fires after rdb-channel was initialized. We use it + * This connection handler fires after rdb-connection was initialized. We use it * to adjust the replica main for loading incremental changes into the local buffer. */ void setupMainConnForPsync(connection *conn) { int psync_result = -1; @@ -3201,7 +3201,7 @@ void setupMainConnForPsync(connection *conn) { if (server.supervised_mode == SUPERVISED_SYSTEMD) { serverCommunicateSystemd("STATUS=Primary <-> REPLICA sync: Partial Resynchronization accepted. Ready to accept connections in read-write mode.\n"); } - completeTaskRDBChannelSyncMainConn(conn); + completeTaskRDBConnectionSyncMainConn(conn); return; } @@ -3212,7 +3212,7 @@ void setupMainConnForPsync(connection *conn) { } /* - * RDB-Channel for full sync + * RDB connection for full sync * * * Motivation * * - Reduce primary memory load. We do that by moving the COB tracking to the replica side. This also decrease @@ -3226,11 +3226,11 @@ void setupMainConnForPsync(connection *conn) { * child-proc -> main-proc pipeline, thus freeing up the main process to process clients queries. * * * High level interface design * - * - RDB-Channel sync begins when the replica sends a REPLCONF MAINCONN to the primary during initial - * handshake. This allows the replica to verify whether the primary supports rdb-channel sync and, if + * - RDB-connection sync begins when the replica sends a REPLCONF MAINCONN to the primary during initial + * handshake. This allows the replica to verify whether the primary supports rdb-connection sync and, if * so, state that this is the replica's main connection, which is not used for snapshot transfer. * - When replica lacks sufficient data for PSYNC, the primary will send +FULLSYNCNEEDED response instead - * of RDB data. As a next step, the replica creates a new connection (rdb-channel) and configures it against + * of RDB data. As a next step, the replica creates a new connection (rdb-connection) and configures it against * the primary with the appropriate capabilities and requirements. The replica then requests a sync * using the RDB connection. * - Prior to forking, the primary sends the replica the snapshot's end repl-offset, and attaches the replica @@ -3243,7 +3243,7 @@ void setupMainConnForPsync(connection *conn) { * changes into memory. Repl steady state continues normally. * * * Replica state machine * - * ┌───────────────────┐ RDB Channel Sync + * ┌───────────────────┐ RDB connection sync * │RECEIVE_PING_REPLY │ ┌──────────────────────────────────────────────────────────────┐ * └────────┬──────────┘ │ RDB connection states Main connection state │ * │+PONG │ ┌────────────────────────────┐ ┌───────────────────┐ │ @@ -3388,10 +3388,10 @@ void syncWithPrimary(connection *conn) { if (err) goto write_error; } - /* When using rdb-channel for sync, announce that the replica is capable - * of rdb channel sync. */ - if (server.rdb_channel_enabled) { - err = sendCommand(conn,"REPLCONF", "capa" ,"dual-channel", NULL); + /* When using rdb-connection for sync, announce that the replica is capable + * of rdb connection sync. */ + if (server.rdb_conn_enabled) { + err = sendCommand(conn,"REPLCONF", "capa" ,"dual-conn", NULL); } /* Inform the primary of our (replica) capabilities. @@ -3466,7 +3466,7 @@ void syncWithPrimary(connection *conn) { return; } - if (server.repl_state == REPL_STATE_RECEIVE_NO_FULLSYNC_REPLY && !server.rdb_channel_enabled) { + if (server.repl_state == REPL_STATE_RECEIVE_NO_FULLSYNC_REPLY && !server.rdb_conn_enabled) { server.repl_state = REPL_STATE_RECEIVE_CAPA_REPLY; } @@ -3474,7 +3474,7 @@ void syncWithPrimary(connection *conn) { err = receiveSynchronousResponse(conn); if (err == NULL) goto error; else if (err[0] == '-') { - serverLog(LL_NOTICE,"(Non critical) Primary is not capable of rdb-channel sync"); + serverLog(LL_NOTICE,"(Non critical) Primary is not capable of rdb-connection sync"); } sdsfree(err); server.repl_state = REPL_STATE_RECEIVE_CAPA_REPLY; @@ -3599,8 +3599,8 @@ void syncWithPrimary(connection *conn) { server.repl_transfer_fd = dfd; } - /* Using rdb-channel sync, the primary responded +FULLSYNCNEEDED. We need to - * initialize the RDB channel. */ + /* Using rdb-connection sync, the primary responded +FULLSYNCNEEDED. We need to + * initialize the RDB connection. */ if (psync_result == PSYNC_FULLRESYNC_RDB_CONN) { /* Create a full sync connection */ server.repl_rdb_transfer_s = connCreate(connTypeOfReplication()); @@ -3780,9 +3780,9 @@ void replicationSetPrimary(char *ip, int port) { moduleFireServerEvent(VALKEYMODULE_EVENT_PRIMARY_LINK_CHANGE, VALKEYMODULE_SUBEVENT_PRIMARY_LINK_DOWN, NULL); server.repl_state = REPL_STATE_CONNECT; - /* Allow trying rdb-channel sync with the new primary. If newprimaryr doesn't - * support rdb-channel sync, we will set to 0 afterwards. */ - server.primary_supports_rdb_channel = -1; + /* Allow trying rdb-connection sync with the new primary. If newprimaryr doesn't + * support rdb-connection sync, we will set to 0 afterwards. */ + server.primary_supports_rdb_connection = -1; serverLog(LL_NOTICE, "Connecting to Primary %s:%d", server.primary_host, server.primary_port); connectWithPrimary(); } @@ -4163,7 +4163,7 @@ void replicationSteadyStateInit(void) { /* Replication: Replica side. * Turn the provisional primary into the current primary. - * This function is called after rdb-channel sync is finished successfully. */ + * This function is called after rdb-connection sync is finished successfully. */ void replicationResurrectProvisionalPrimary(void) { /* Create a primary client, but do not initialize the read handler yet, as this replica still has a local buffer to drain. */ replicationCreatePrimaryClientWithHandler(server.repl_transfer_s, server.repl_provisional_primary.dbid, NULL); diff --git a/src/server.c b/src/server.c index 4208bbb0fe..948b6622f3 100644 --- a/src/server.c +++ b/src/server.c @@ -2660,7 +2660,7 @@ void initServer(void) { server.cron_malloc_stats.allocator_active = 0; server.cron_malloc_stats.allocator_resident = 0; server.lastbgsave_status = C_OK; - server.primary_supports_rdb_channel = -1; + server.primary_supports_rdb_connection = -1; server.aof_last_write_status = C_OK; server.aof_last_write_errno = 0; server.repl_good_replicas_count = 0; @@ -5796,7 +5796,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "slave%d:ip=%s,port=%d,state=%s," "offset=%lld,lag=%ld,type=%s\r\n", replica_id, replica_ip, replica->replica_listening_port, state, - replica->repl_ack_off, lag, replica->flags & CLIENT_REPL_RDB_CHANNEL ? "rdb-conn": + replica->repl_ack_off, lag, replica->flags & CLIENT_REPL_RDB_CONN ? "rdb-conn": replica->repl_state == REPLICA_STATE_BG_RDB_LOAD ? "main-conn": "replica"); replica_id++; } diff --git a/src/server.h b/src/server.h index 1315a40a37..2f1e2edb70 100644 --- a/src/server.h +++ b/src/server.h @@ -140,7 +140,7 @@ struct hdr_histogram; #define CONFIG_MIN_RESERVED_FDS 32 #define CONFIG_DEFAULT_PROC_TITLE_TEMPLATE "{title} {listen-addr} {server-mode}" #define DEFAULT_WAIT_BEFORE_RDB_CLIENT_FREE 60 /* Grace period in seconds for replica main - channel to establish psync. */ + connection to establish psync. */ #define INCREMENTAL_REHASHING_THRESHOLD_US 1000 /* Bucket sizes for client eviction pools. Each bucket stores clients with @@ -431,11 +431,11 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT]; #define CLIENT_REPLICATION_DONE (1ULL << 51) /* Indicate that replication has been done on the client */ #define CLIENT_AUTHENTICATED (1ULL << 52) /* Indicate a client has successfully authenticated */ -#define CLIENT_REPL_MAIN_CHANNEL (1ULL<<52) /* RDB Channel: track a connection +#define CLIENT_REPL_MAIN_CONN (1ULL<<52) /* RDB connection: track a connection which is used for online replication data */ -#define CLIENT_REPL_RDB_CHANNEL (1ULL<<53) /* RDB Channel: track a connection +#define CLIENT_REPL_RDB_CONN (1ULL<<53) /* RDB connection: track a connection which is used for rdb snapshot */ -#define CLIENT_PROTECTED_RDB_CHANNEL (1ULL<<54) /* RDB Channel: Protects the RDB client from premature +#define CLIENT_PROTECTED_RDB_CONN (1ULL<<54) /* RDB connection: 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 @@ -491,7 +491,7 @@ typedef enum { 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_NO_FULLSYNC_REPLY, /* If using rdb-channel for sync, mark main connection as psync conn */ + REPL_STATE_RECEIVE_NO_FULLSYNC_REPLY, /* If using rdb-connection for sync, mark main connection as psync conn */ REPL_STATE_RECEIVE_CAPA_REPLY, /* Wait for REPLCONF reply */ REPL_STATE_RECEIVE_VERSION_REPLY, /* Wait for REPLCONF reply */ REPL_STATE_SEND_PSYNC, /* Send PSYNC */ @@ -501,7 +501,7 @@ typedef enum { REPL_STATE_CONNECTED, /* Connected to primary */ } repl_state; -/* Replica rdb-channel replication state. Used in server.repl_rdb_conn_state for +/* Replica rdb-connection replication state. Used in server.repl_rdb_conn_state for * replicas to remember what to do next. */ typedef enum { REPL_RDB_CONN_STATE_NONE = 0, /* No active replication */ @@ -509,7 +509,7 @@ typedef enum { REPL_RDB_CONN_RECEIVE_AUTH_REPLY, /* Wait for AUTH reply */ REPL_RDB_CONN_RECEIVE_REPLCONF_REPLY, /* Wait for REPLCONF reply */ REPL_RDB_CONN_RECEIVE_ENDOFF, /* Wait for $ENDOFF reply */ - REPL_RDB_CONN_RDB_LOAD, /* Loading rdb using rdb channel */ + REPL_RDB_CONN_RDB_LOAD, /* Loading rdb using rdb connection */ REPL_RDB_CONN_RDB_LOADED, } repl_rdb_conn_state; @@ -532,19 +532,19 @@ typedef enum { #define REPLICA_STATE_RDB_TRANSMITTED \ 10 /* RDB file transmitted - This state is used only for \ * a replica that only wants RDB without replication buffer */ -#define REPLICA_STATE_BG_RDB_LOAD 11 /* Main connection of a replica which uses rdb-channel-sync. */ +#define REPLICA_STATE_BG_RDB_LOAD 11 /* Main connection of a replica which uses rdb-connection-sync. */ /* 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_RDB_CHANNEL (1<<2) /* Supports RDB channel sync */ +#define REPLICA_CAPA_RDB_CONN (1<<2) /* Supports RDB connection sync */ /* Replica requirements */ #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 rdb-channel sync */ +#define REPLICA_REQ_RDB_CONN (1 << 2) /* Use rdb-connection sync */ /* 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) @@ -1037,7 +1037,7 @@ typedef struct replBufBlock { char buf[]; } replBufBlock; -/* Link list block, used by replDataBuf during rdb-channel sync to store +/* Link list block, used by replDataBuf during rdb-connection sync to store * replication data */ typedef struct replDataBufBlock { size_t size, used; @@ -1928,7 +1928,7 @@ struct valkeyServer { int rdb_bgsave_scheduled; /* BGSAVE when possible if true. */ int rdb_child_type; /* Type of save by active child. */ int lastbgsave_status; /* C_OK or C_ERR */ - int primary_supports_rdb_channel;/* Track whether the primary is able to sync using rdb channel. + int primary_supports_rdb_connection;/* Track whether the primary is able to sync using rdb connection. * -1 = unknown, 0 = no, 1 = yes. */ int stop_writes_on_bgsave_err; /* Don't allow writes if can't BGSAVE */ int rdb_pipe_read; /* RDB pipe used to transfer the rdb data */ @@ -1980,7 +1980,7 @@ struct valkeyServer { int repl_ping_replica_period; /* Primary pings the replica every N seconds */ replBacklog *repl_backlog; /* Replication backlog for partial syncs */ long long repl_backlog_size; /* Backlog circular buffer size */ - replDataBuf pending_repl_data; /* Replication data buffer for rdb-channel sync */ + replDataBuf pending_repl_data; /* Replication data buffer for rdb-connection sync */ time_t repl_backlog_time_limit; /* Time without replicas after the backlog gets released. */ time_t repl_no_replicas_since; /* We have no replicas since that time. @@ -1994,9 +1994,9 @@ struct valkeyServer { int repl_diskless_sync_delay; /* Delay to start a diskless repl BGSAVE. */ int repl_diskless_sync_max_replicas; /* Max replicas for diskless repl BGSAVE * delay (start sooner if they all connect). */ - int rdb_channel_enabled; /* Config used to determine if the replica should - * use rdb channel for full syncs. */ - int wait_before_rdb_client_free;/* Grace period in seconds for replica main channel + int rdb_conn_enabled; /* Config used to determine if the replica should + * use rdb connection for full syncs. */ + int wait_before_rdb_client_free;/* Grace period in seconds for replica main connection * to establish psync. */ int debug_sleep_after_fork; /* Debug param that force the main connection to * sleep for N seconds after fork() in repl. */ @@ -2021,7 +2021,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_conn_state; /* State of the replica's rdb channel during rdb-channel sync */ + int repl_rdb_conn_state; /* State of the replica's rdb connection during rdb-connection sync */ 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. */ diff --git a/tests/integration/psync2-master-restart.tcl b/tests/integration/psync2-master-restart.tcl index c0d06afa6f..d6d6ad89fb 100644 --- a/tests/integration/psync2-master-restart.tcl +++ b/tests/integration/psync2-master-restart.tcl @@ -203,7 +203,7 @@ start_server {} { } else { fail "Replicas didn't sync after master restart" } - set rdbchannel [lindex [r config get repl-rdb-channel] 1] + set rdbchannel [lindex [r config get repl-rdb-connection] 1] set psync_count 0 if {$rdbchannel == "yes"} { # Expect one fake psync diff --git a/tests/integration/repl-rdb-channel.tcl b/tests/integration/repl-rdb-connection.tcl similarity index 87% rename from tests/integration/repl-rdb-channel.tcl rename to tests/integration/repl-rdb-connection.tcl index 1588f81fe0..3d0306c043 100644 --- a/tests/integration/repl-rdb-channel.tcl +++ b/tests/integration/repl-rdb-connection.tcl @@ -5,7 +5,7 @@ proc log_file_matches {log pattern} { string match $pattern $content } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set replica [srv 0 client] set replica_host [srv 0 host] set replica_port [srv 0 port] @@ -19,13 +19,13 @@ start_server {tags {"repl rdb-channel external:skip"}} { # operation, so that the replica remains in the handshake state. $master config set repl-diskless-sync yes $master config set repl-diskless-sync-delay 1000 - $master config set repl-rdb-channel yes + $master config set repl-rdb-connection yes # Start the replication process... - $replica config set repl-rdb-channel yes + $replica config set repl-rdb-connection yes $replica slaveof $master_host $master_port - test {Test repl-rdb-channel replica enters handshake} { + test {Test repl-rdb-connection replica enters handshake} { wait_for_condition 50 1000 { [string match *handshake* [$replica role]] } else { @@ -33,7 +33,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { } } - test {Test repl-rdb-channel enters wait_bgsave} { + test {Test repl-rdb-connection enters wait_bgsave} { wait_for_condition 50 1000 { [string match *state=wait_bgsave* [$master info replication]] } else { @@ -43,7 +43,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { $master config set repl-diskless-sync-delay 0 - test {Test repl-rdb-channel replica is able to sync} { + test {Test repl-rdb-connection replica is able to sync} { verify_replica_online $master 0 500 wait_for_condition 50 1000 { [string match *connected_slaves:1* [$master info]] @@ -61,7 +61,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { } } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set replica [srv 0 client] set replica_host [srv 0 host] set replica_port [srv 0 port] @@ -72,8 +72,8 @@ start_server {tags {"repl rdb-channel external:skip"}} { set master_port [srv 0 port] $master config set rdb-key-save-delay 200 - $master config set repl-rdb-channel yes - $replica config set repl-rdb-channel yes + $master config set repl-rdb-connection yes + $replica config set repl-rdb-connection yes $replica config set repl-diskless-sync no populate 1000 master 10000 @@ -92,7 +92,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { set before_used [s 0 used_memory] - test {Primary memory usage does not increase during rdb-channel sync} { + test {Primary memory usage does not increase during rdb-connection sync} { $replica slaveof $master_host $master_port # Verify used_memory stays low through all the sync @@ -135,7 +135,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { test {Rollback to nornal sync} { $replica slaveof no one - $replica config set repl-rdb-channel no + $replica config set repl-rdb-connection no $master set newkey newval set sync_full [s 0 sync_full] @@ -149,7 +149,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { } } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { foreach start_with_rdb_sync_enabled {yes no} { set replica [srv 0 client] set replica_host [srv 0 host] @@ -162,9 +162,9 @@ start_server {tags {"repl rdb-channel external:skip"}} { $master config set repl-diskless-sync yes $master config set client-output-buffer-limit "replica 1100k 0 0" - $replica config set repl-rdb-channel $start_with_rdb_sync_enabled + $replica config set repl-rdb-connection $start_with_rdb_sync_enabled - test "Test enable disable repl-rdb-channel start with $start_with_rdb_sync_enabled" { + test "Test enable disable repl-rdb-connection start with $start_with_rdb_sync_enabled" { # Set master shared replication buffer size to a bit more then the size of # a replication buffer block. @@ -179,9 +179,9 @@ start_server {tags {"repl rdb-channel external:skip"}} { $replica slaveof no one if {$start_with_rdb_sync_enabled == "yes"} { # disable rdb channel sync - $replica config set repl-rdb-channel no + $replica config set repl-rdb-connection no } else { - $replica config set repl-rdb-channel yes + $replica config set repl-rdb-connection yes } # Force replica to full sync next time @@ -201,7 +201,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { } } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set replica1 [srv 0 client] set replica1_host [srv 0 host] set replica1_port [srv 0 port] @@ -222,16 +222,16 @@ start_server {tags {"repl rdb-channel external:skip"}} { $master config set repl-diskless-sync yes $master config set repl-diskless-sync-delay 5; # allow both replicas to ask for sync - $master config set repl-rdb-channel yes + $master config set repl-rdb-connection yes - $replica1 config set repl-rdb-channel yes - $replica2 config set repl-rdb-channel yes + $replica1 config set repl-rdb-connection yes + $replica2 config set repl-rdb-connection yes $replica1 config set repl-diskless-sync no $replica2 config set repl-diskless-sync no $replica1 config set loglevel debug $replica2 config set loglevel debug - test "Two replicas in one sync session with repl-rdb-channel" { + test "Two replicas in one sync session with repl-rdb-connection" { $replica1 slaveof $master_host $master_port $replica2 slaveof $master_host $master_port @@ -256,12 +256,12 @@ start_server {tags {"repl rdb-channel external:skip"}} { $replica1 slaveof no one $replica2 slaveof no one - $replica1 config set repl-rdb-channel yes - $replica2 config set repl-rdb-channel no + $replica1 config set repl-rdb-connection yes + $replica2 config set repl-rdb-connection no $master set key2 val2 - test "Test one replica with repl-rdb-channel enabled one with disabled" { + test "Test one replica with repl-rdb-connection enabled one with disabled" { $replica1 slaveof $master_host $master_port $replica2 slaveof $master_host $master_port @@ -286,14 +286,14 @@ start_server {tags {"repl rdb-channel external:skip"}} { # At this point we have about 10k keys in the db, # We expect that the next full sync will take 5 seconds (10k*500)ms # It will give us enough time to fill the replica buffer. - $replica1 config set repl-rdb-channel yes + $replica1 config set repl-rdb-connection yes $replica1 config set client-output-buffer-limit "replica 16383 16383 0" $replica1 config set loglevel debug $replica1 slaveof $master_host $master_port # Wait for replica to establish psync using main connection wait_for_condition 50 1000 { - [log_file_matches $replica1_log "*Master accepted a Partial Resynchronization, RDB load in background.*"] + [log_file_matches $replica1_log "*Primary accepted a Partial Resynchronization, RDB load in background.*"] } else { fail "Psync hasn't been established" } @@ -325,7 +325,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { set cur_psync [status $master sync_partial_ok] $master config set repl-diskless-sync no - $replica1 config set repl-rdb-channel yes + $replica1 config set repl-rdb-connection yes $replica1 slaveof $master_host $master_port # Wait for mitigation and resync @@ -337,14 +337,14 @@ start_server {tags {"repl rdb-channel external:skip"}} { fail "Replica is not synced" } - # Verify that we did not use rdb-channel sync + # Verify that we did not use rdb-connection sync assert {[status $master sync_partial_ok] == $cur_psync} } } } } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set replica [srv 0 client] set replica_host [srv 0 host] set replica_port [srv 0 port] @@ -359,12 +359,12 @@ start_server {tags {"repl rdb-channel external:skip"}} { $master config set repl-diskless-sync yes $master debug sleep-after-fork [expr {5 * [expr {10 ** 6}]}];# Stop master after fork for 5 seconds - $master config set repl-rdb-channel yes + $master config set repl-rdb-connection yes - $replica config set repl-rdb-channel yes + $replica config set repl-rdb-connection yes $replica config set loglevel debug - test "Test rdb-channel psync established after rdb load" { + test "Test rdb-connection psync established after rdb load" { $replica slaveof $master_host $master_port verify_replica_online $master 0 500 @@ -375,14 +375,14 @@ start_server {tags {"repl rdb-channel external:skip"}} { } wait_for_value_to_propegate_to_replica $master $replica "key1" # Confirm the occurrence of a race condition. - set res [wait_for_log_messages -1 {"*RDB channel sync - psync established after rdb load*"} $loglines 2000 1] + set res [wait_for_log_messages -1 {"*RDB connection sync - psync established after rdb load*"} $loglines 2000 1] set loglines [lindex $res 1] incr $loglines } } } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set replica [srv 0 client] set replica_host [srv 0 host] set replica_port [srv 0 port] @@ -395,7 +395,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { set loglines [count_log_lines -1] $master config set repl-diskless-sync yes - $master config set repl-rdb-channel yes + $master config set repl-rdb-connection yes $master config set repl-backlog-size $backlog_size $master config set loglevel debug $master config set repl-timeout 10 @@ -406,19 +406,19 @@ start_server {tags {"repl rdb-channel external:skip"}} { set load_handle2 [start_one_key_write_load $master_host $master_port 100 "mykey2"] set load_handle3 [start_one_key_write_load $master_host $master_port 100 "mykey3"] - $replica config set repl-rdb-channel yes + $replica config set repl-rdb-connection yes $replica config set loglevel debug $replica config set repl-timeout 10 # Stop replica after master fork for 5 seconds $replica debug sleep-after-fork [expr {5 * [expr {10 ** 6}]}] - test "Test rdb-channel connection peering - replica able to establish psync" { + test "Test rdb-connection connection peering - replica able to establish psync" { $replica slaveof $master_host $master_port # Verify repl backlog can grow wait_for_condition 1000 10 { [s 0 mem_total_replication_buffers] > [expr {2 * $backlog_size}] } else { - fail "Master should allow backlog to grow beyond its limits during rdb-channel sync handshake" + fail "Master should allow backlog to grow beyond its limits during rdb-connection sync handshake" } verify_replica_online $master 0 500 @@ -436,7 +436,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { } } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set replica1 [srv 0 client] set replica1_host [srv 0 host] set replica1_port [srv 0 port] @@ -454,7 +454,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { set loglines [count_log_lines -1] $master config set repl-diskless-sync yes - $master config set repl-rdb-channel yes + $master config set repl-rdb-connection yes $master config set repl-backlog-size $backlog_size $master config set loglevel debug $master config set repl-timeout 10 @@ -463,8 +463,8 @@ start_server {tags {"repl rdb-channel external:skip"}} { set load_handle0 [start_write_load $master_host $master_port 20] - $replica1 config set repl-rdb-channel yes - $replica2 config set repl-rdb-channel yes + $replica1 config set repl-rdb-connection yes + $replica2 config set repl-rdb-connection yes $replica1 config set loglevel debug $replica2 config set loglevel debug $replica1 config set repl-timeout 10 @@ -473,7 +473,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { # Stop replica after master fork for 2 seconds $replica1 debug sleep-after-fork [expr {2 * [expr {10 ** 6}]}] $replica2 debug sleep-after-fork [expr {2 * [expr {10 ** 6}]}] - test "Test rdb-channel connection peering - start with empty backlog (retrospect)" { + test "Test rdb-connection connection peering - start with empty backlog (retrospect)" { $replica1 slaveof $master_host $master_port set res [wait_for_log_messages 0 {"*Add replica * repl-backlog is empty*"} $loglines 2000 1] set res [wait_for_log_messages 0 {"*Retrospect attach replica*"} $loglines 2000 1] @@ -489,7 +489,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { assert [string match *replicas_waiting_psync:0* [$master info replication]] } - test "Test rdb-channel connection peering - start with backlog" { + test "Test rdb-connection connection peering - start with backlog" { $replica2 slaveof $master_host $master_port set res [wait_for_log_messages 0 {"*Add replica * with repl-backlog tail*"} $loglines 2000 1] set loglines [lindex $res 1] @@ -517,13 +517,13 @@ proc stop_bg_server_sleep {handle} { catch {exec /bin/kill -9 $handle} } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set master [srv 0 client] set master_host [srv 0 host] set master_port [srv 0 port] $master config set repl-diskless-sync yes - $master config set repl-rdb-channel yes + $master config set repl-rdb-connection yes $master config set repl-backlog-size [expr {10 ** 6}] $master config set loglevel debug $master config set repl-timeout 10 @@ -542,11 +542,11 @@ start_server {tags {"repl rdb-channel external:skip"}} { set load_handle0 [start_write_load $master_host $master_port 20] - $replica config set repl-rdb-channel yes + $replica config set repl-rdb-connection yes $replica config set loglevel debug $replica config set repl-timeout 10 - test "Test rdb-channel psync established after rdb load, master keep repl-block" { + test "Test rdb-connection psync established after rdb load, master keep repl-block" { $replica slaveof $master_host $master_port set res [wait_for_log_messages 0 {"*Done loading RDB*"} $loglines 2000 1] set loglines [lindex $res 1] @@ -580,11 +580,11 @@ start_server {tags {"repl rdb-channel external:skip"}} { set load_handle0 [start_write_load $master_host $master_port 20] - $replica config set repl-rdb-channel yes + $replica config set repl-rdb-connection yes $replica config set loglevel debug $replica config set repl-timeout 10 - test "Test rdb-channel psync established after rdb load, master dismiss repl-block" { + test "Test rdb-connection psync established after rdb load, master dismiss repl-block" { $replica slaveof $master_host $master_port set res [wait_for_log_messages 0 {"*Done loading RDB*"} $loglines 2000 1] set loglines [lindex $res 1] @@ -615,14 +615,14 @@ start_server {tags {"repl rdb-channel external:skip"}} { } } -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set master [srv 0 client] set master_host [srv 0 host] set master_port [srv 0 port] set loglines [count_log_lines 0] $master config set repl-diskless-sync yes - $master config set repl-rdb-channel yes + $master config set repl-rdb-connection yes $master config set client-output-buffer-limit "replica 1100k 0 0" $master config set loglevel debug # generate small db @@ -639,11 +639,11 @@ start_server {tags {"repl rdb-channel external:skip"}} { set load_handle1 [start_write_load $master_host $master_port 20] set load_handle2 [start_write_load $master_host $master_port 20] - $replica config set repl-rdb-channel yes + $replica config set repl-rdb-connection yes $replica config set loglevel debug $replica config set repl-timeout 10 - test "Test rdb-channel master gets cob overrun before established psync" { + test "Test rdb-connection master gets cob overrun before established psync" { $replica slaveof $master_host $master_port wait_for_log_messages 0 {"*Done loading RDB*"} 0 2000 1 @@ -670,7 +670,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { $master config set rdb-key-save-delay 10000 $master debug sleep-after-fork 0 - test "Test rdb-channel master gets cob overrun during replica rdb load" { + test "Test rdb-connection master gets cob overrun during replica rdb load" { $replica slaveof $master_host $master_port wait_for_log_messages -1 {"*Client * closed * for overcoming of output buffer limits.*"} $loglines 2000 1 @@ -689,14 +689,14 @@ start_server {tags {"repl rdb-channel external:skip"}} { } foreach rdbchan {yes no} { -start_server {tags {"repl rdb-channel external:skip"}} { +start_server {tags {"repl rdb-connection external:skip"}} { set master [srv 0 client] set master_host [srv 0 host] set master_port [srv 0 port] set loglines [count_log_lines 0] $master config set repl-diskless-sync yes - $master config set repl-rdb-channel yes + $master config set repl-rdb-connection yes $master config set loglevel debug $master config set repl-diskless-sync-delay 5 @@ -704,20 +704,20 @@ start_server {tags {"repl rdb-channel external:skip"}} { $master debug populate 10000 master 1 $master config set rdb-key-save-delay 500 - $master config set repl-rdb-channel $rdbchan + $master config set repl-rdb-connection $rdbchan start_server {} { set replica1 [srv 0 client] - $replica1 config set repl-rdb-channel $rdbchan + $replica1 config set repl-rdb-connection $rdbchan $replica1 config set loglevel debug start_server {} { set replica2 [srv 0 client] - $replica2 config set repl-rdb-channel $rdbchan + $replica2 config set repl-rdb-connection $rdbchan $replica2 config set loglevel debug $replica2 config set repl-timeout 60 set load_handle [start_one_key_write_load $master_host $master_port 100 "mykey1"] - test "Sync should continue if not all slaves dropped rdb-channel $rdbchan" { + test "Sync should continue if not all slaves dropped rdb-connection $rdbchan" { $replica1 slaveof $master_host $master_port $replica2 slaveof $master_host $master_port @@ -753,7 +753,7 @@ start_server {tags {"repl rdb-channel external:skip"}} { $master debug populate 1000000 master 1 $master config set rdb-key-save-delay 100 - test "Master abort sync if all slaves dropped rdb-channel $rdbchan" { + test "Master abort sync if all slaves dropped rdb-connection $rdbchan" { set cur_psync [status $master sync_partial_ok] $replica2 slaveof $master_host $master_port diff --git a/tests/integration/replication-buffer.tcl b/tests/integration/replication-buffer.tcl index 27956290bc..e515a400d8 100644 --- a/tests/integration/replication-buffer.tcl +++ b/tests/integration/replication-buffer.tcl @@ -9,9 +9,9 @@ start_server {} { set replica1 [srv -3 client] set replica2 [srv -2 client] set replica3 [srv -1 client] - $replica1 config set repl-rdb-channel $rdbchann - $replica2 config set repl-rdb-channel $rdbchann - $replica3 config set repl-rdb-channel $rdbchann + $replica1 config set repl-rdb-connection $rdbchann + $replica2 config set repl-rdb-connection $rdbchann + $replica3 config set repl-rdb-connection $rdbchann set master [srv 0 client] set master_host [srv 0 host] @@ -22,7 +22,7 @@ start_server {} { $master config set repl-diskless-sync-delay 5 $master config set repl-diskless-sync-max-replicas 1 $master config set client-output-buffer-limit "replica 0 0 0" - $master config set repl-rdb-channel $rdbchann + $master config set repl-rdb-connection $rdbchann # Make sure replica3 is synchronized with master $replica3 replicaof $master_host $master_port @@ -53,7 +53,7 @@ start_server {} { set repl_buf_mem [s mem_total_replication_buffers] set extra_mem [expr {[s used_memory]-$before_used-1024*1024}] if {$rdbchann == "yes"} { - # master's replication buffers should not grow during rdb-channel-sync + # master's replication buffers should not grow during rdb-connection-sync assert {$extra_mem < 1024*1024} assert {$repl_buf_mem < 1024*1024} } else { @@ -87,7 +87,7 @@ start_server {} { fail "replica2 doesn't disconnect with master" } if {$rdbchann == "yes"} { - # master's replication buffers should not grow during rdb-channel-sync + # master's replication buffers should not grow during rdb-connection-sync assert {1024*512 > [s mem_total_replication_buffers]} } else { assert {[expr $repl_buf_mem - 1024*1024] > [s mem_total_replication_buffers]} @@ -113,7 +113,7 @@ start_server {} { set replica1_pid [s -2 process_id] set replica2 [srv -1 client] set replica2_pid [s -1 process_id] - $replica1 config set repl-rdb-channel $rdbchannel + $replica1 config set repl-rdb-connection $rdbchannel set master [srv 0 client] set master_host [srv 0 host] @@ -122,7 +122,7 @@ start_server {} { $master config set save "" $master config set repl-backlog-size 16384 $master config set client-output-buffer-limit "replica 0 0 0" - $master config set repl-rdb-channel $rdbchannel + $master config set repl-rdb-connection $rdbchannel # Executing 'debug digest' on master which has many keys costs much time # (especially in valgrind), this causes that replica1 and replica2 disconnect @@ -131,7 +131,7 @@ start_server {} { $replica1 config set repl-timeout 1000 $replica2 config set repl-timeout 1000 $replica2 config set client-output-buffer-limit "replica 0 0 0" - $replica2 config set repl-rdb-channel $rdbchannel + $replica2 config set repl-rdb-connection $rdbchannel $replica1 replicaof $master_host $master_port wait_for_sync $replica1 @@ -234,10 +234,10 @@ test "Partial resynchronization is successful even client-output-buffer-limit is r config set save "" r config set repl-backlog-size 100mb r config set client-output-buffer-limit "replica 512k 0 0" - r config set repl-rdb-channel $rdbchann + r config set repl-rdb-connection $rdbchann set replica [srv -1 client] - $replica config set repl-rdb-channel $rdbchann + $replica config set repl-rdb-connection $rdbchann $replica replicaof [srv 0 host] [srv 0 port] wait_for_sync $replica @@ -301,8 +301,8 @@ test "Replica client-output-buffer size is limited to backlog_limit/16 when no r $master config set repl-backlog-size 16384 $master config set client-output-buffer-limit "replica 32768 32768 60" - $master config set repl-rdb-channel $rdbchann - $replica config set repl-rdb-channel $rdbchann + $master config set repl-rdb-connection $rdbchann + $replica config set repl-rdb-connection $rdbchann # Key has has to be larger than replica client-output-buffer limit. set keysize [expr 256*1024] diff --git a/tests/integration/replication-psync.tcl b/tests/integration/replication-psync.tcl index a01101a3a9..769d8217ff 100644 --- a/tests/integration/replication-psync.tcl +++ b/tests/integration/replication-psync.tcl @@ -21,9 +21,9 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond mdl sdl rdbc $master config set repl-backlog-ttl $backlog_ttl $master config set repl-diskless-sync $mdl $master config set repl-diskless-sync-delay 1 - $master config set repl-rdb-channel $rdbchann + $master config set repl-rdb-connection $rdbchann $slave config set repl-diskless-load $sdl - $slave config set repl-rdb-channel $rdbchann + $slave config set repl-rdb-connection $rdbchann set load_handle0 [start_bg_complex_data $master_host $master_port 9 100000] set load_handle1 [start_bg_complex_data $master_host $master_port 11 100000] @@ -48,7 +48,7 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond mdl sdl rdbc } } - test "Test replication partial resync: $descr (diskless: $mdl, $sdl, rdb-channel: $rdbchann, reconnect: $reconnect)" { + test "Test replication partial resync: $descr (diskless: $mdl, $sdl, rdb-connection: $rdbchann, reconnect: $reconnect)" { # Now while the clients are writing data, break the master-slave # link multiple times. if ($reconnect) { diff --git a/tests/integration/replication.tcl b/tests/integration/replication.tcl index 99203f2862..6de330959f 100644 --- a/tests/integration/replication.tcl +++ b/tests/integration/replication.tcl @@ -316,7 +316,7 @@ foreach mdl {no yes} rdbchannel {no yes} { lappend slaves [srv 0 client] start_server {overrides {save {}}} { lappend slaves [srv 0 client] - test "Connect multiple replicas at the same time (issue #141), master diskless=$mdl, replica diskless=$sdl repl-rdb-channel=$rdbchannel" { + test "Connect multiple replicas at the same time (issue #141), master diskless=$mdl, replica diskless=$sdl repl-rdb-connection=$rdbchannel" { # start load handles only inside the test, so that the test can be skipped set load_handle0 [start_bg_complex_data $master_host $master_port 9 100000000] set load_handle1 [start_bg_complex_data $master_host $master_port 11 100000000] @@ -325,11 +325,11 @@ foreach mdl {no yes} rdbchannel {no yes} { set load_handle4 [start_write_load $master_host $master_port 4] after 5000 ;# wait for some data to accumulate so that we have RDB part for the fork - $master config set repl-rdb-channel $rdbchannel + $master config set repl-rdb-connection $rdbchannel # Send SLAVEOF commands to slaves - [lindex $slaves 0] config set repl-rdb-channel $rdbchannel - [lindex $slaves 1] config set repl-rdb-channel $rdbchannel - [lindex $slaves 2] config set repl-rdb-channel $rdbchannel + [lindex $slaves 0] config set repl-rdb-connection $rdbchannel + [lindex $slaves 1] config set repl-rdb-connection $rdbchannel + [lindex $slaves 2] config set repl-rdb-connection $rdbchannel [lindex $slaves 0] config set repl-diskless-load $sdl [lindex $slaves 1] config set repl-diskless-load $sdl [lindex $slaves 2] config set repl-diskless-load $sdl @@ -456,10 +456,10 @@ foreach testType {Successful Aborted} rdbchannel {yes no} { $master config set repl-diskless-sync yes $master config set repl-diskless-sync-delay 0 $master config set save "" - $master config set repl-rdb-channel $rdbchannel + $master config set repl-rdb-connection $rdbchannel $replica config set repl-diskless-load swapdb $replica config set save "" - $replica config set repl-rdb-channel $rdbchannel + $replica config set repl-rdb-connection $rdbchannel # Put different data sets on the master and replica # We need to put large keys on the master since the replica replies to info only once in 2mb @@ -479,7 +479,7 @@ foreach testType {Successful Aborted} rdbchannel {yes no} { # Start the replication process $replica replicaof $master_host $master_port - test "Diskless load swapdb (different replid): replica enter loading repl-rdb-channel=$rdbchannel" { + test "Diskless load swapdb (different replid): replica enter loading repl-rdb-connection=$rdbchannel" { # Wait for the replica to start reading the rdb wait_for_condition 100 100 { [s -1 loading] eq 1 @@ -503,7 +503,7 @@ foreach testType {Successful Aborted} rdbchannel {yes no} { fail "Replica didn't disconnect" } - test "Diskless load swapdb (different replid): old database is exposed after replication fails rdb-channel=$rdbchannel" { + test "Diskless load swapdb (different replid): old database is exposed after replication fails rdb-connection=$rdbchannel" { # Ensure we see old values from replica assert_equal [$replica get mykey] "myvalue" @@ -525,7 +525,7 @@ foreach testType {Successful Aborted} rdbchannel {yes no} { fail "Master <-> Replica didn't finish sync" } - test "Diskless load swapdb (different replid): new database is exposed after swapping rdb-channel=$rdbchannel" { + test "Diskless load swapdb (different replid): new database is exposed after swapping rdb-connection=$rdbchannel" { # Ensure we don't see anymore the key that was stored only to replica and also that we don't get LOADING status assert_equal [$replica GET mykey] "" @@ -556,7 +556,7 @@ foreach testType {Successful Aborted} { $master config set save "" $replica config set repl-diskless-load swapdb $replica config set save "" - $replica config set repl-rdb-channel no; # Doesn't work with swapdb + $replica config set repl-rdb-connection no; # Doesn't work with swapdb # Set replica writable so we can check that a key we manually added is served # during replication and after failure, but disappears on success @@ -861,7 +861,7 @@ start_server {tags {"repl external:skip"} overrides {save ""}} { $master config set repl-diskless-sync yes $master config set repl-diskless-sync-delay 5 $master config set repl-diskless-sync-max-replicas 2 - $master config set repl-rdb-channel "no"; # rdb-channel doesn't use pipe + $master config set repl-rdb-connection "no"; # rdb-connection doesn't use pipe set master_host [srv 0 host] set master_port [srv 0 port] set master_pid [srv 0 pid] @@ -1052,7 +1052,7 @@ test "diskless replication child being killed is collected" { } {} {external:skip} foreach mdl {yes no} rdbchannel {yes no} { - test "replication child dies when parent is killed - diskless: $mdl repl-rdb-channel: $rdbchannel" { + test "replication child dies when parent is killed - diskless: $mdl repl-rdb-connection: $rdbchannel" { # when master is killed, make sure the fork child can detect that and exit start_server {tags {"repl"} overrides {save ""}} { set master [srv 0 client] @@ -1066,7 +1066,7 @@ foreach mdl {yes no} rdbchannel {yes no} { $master debug populate 10000 start_server {overrides {save ""}} { set replica [srv 0 client] - $replica config set repl-rdb-channel $rdbchannel + $replica config set repl-rdb-connection $rdbchannel $replica replicaof $master_host $master_port # wait for rdb child to start @@ -1251,7 +1251,7 @@ foreach rdbchannel {yes no} { set master1 [srv 0 client] set master1_host [srv 0 host] set master1_port [srv 0 port] - $master1 config set repl-rdb-channel $rdbchannel + $master1 config set repl-rdb-connection $rdbchannel r set a b start_server {} { @@ -1261,16 +1261,16 @@ foreach rdbchannel {yes no} { # Take 10s for dumping RDB $master2 debug populate 10 master2 10 $master2 config set rdb-key-save-delay 1000000 - $master2 config set repl-rdb-channel $rdbchannel + $master2 config set repl-rdb-connection $rdbchannel start_server {} { set sub_replica [srv 0 client] - $sub_replica config set repl-rdb-channel $rdbchannel + $sub_replica config set repl-rdb-connection $rdbchannel start_server {} { # Full sync with master1 set replica [srv 0 client] - $replica config set repl-rdb-channel $rdbchannel + $replica config set repl-rdb-connection $rdbchannel r slaveof $master1_host $master1_port wait_for_sync r assert_equal "b" [r get a] @@ -1290,14 +1290,14 @@ foreach rdbchannel {yes no} { } catch {$master2 shutdown nosave} - test "Don't disconnect with replicas before loading transferred RDB when full sync with rdb-channel $rdbchannel" { + test "Don't disconnect with replicas before loading transferred RDB when full sync with rdb-connection $rdbchannel" { assert ![log_file_matches [srv -1 stdout] "*Connection with master lost*"] # The replication id is not changed in entire replication chain assert_equal [s master_replid] [s -3 master_replid] assert_equal [s master_replid] [s -1 master_replid] } - test "Discard cache master before loading transferred RDB when full sync with rdb-channel $rdbchannel" { + test "Discard cache master before loading transferred RDB when full sync with rdb-connection $rdbchannel" { set full_sync [s -3 sync_full] set partial_sync [s -3 sync_partial_ok] # Partial sync with master1 diff --git a/tests/unit/auth.tcl b/tests/unit/auth.tcl index b693865321..e10cdaa039 100644 --- a/tests/unit/auth.tcl +++ b/tests/unit/auth.tcl @@ -68,11 +68,11 @@ start_server {tags {"auth_binary_password external:skip"}} { test "primaryauth test with binary password rdbchannel = $rdbchann" { $master config set requirepass "abc\x00def" - $master config set repl-rdb-channel $rdbchann + $master config set repl-rdb-connection $rdbchann # Configure the replica with masterauth set loglines [count_log_lines 0] $slave config set primaryauth "abc" - $slave config set repl-rdb-channel $rdbchann + $slave config set repl-rdb-connection $rdbchann $slave slaveof $master_host $master_port # Verify replica is not able to sync with master