Unverified Commit 72aa3762 authored by Huang Zhw's avatar Huang Zhw Committed by GitHub
Browse files

Fix comments and typos in sentinel.c. (#8801)

parent 8423b77f
...@@ -275,7 +275,7 @@ sentinel failover-timeout mymaster 180000 ...@@ -275,7 +275,7 @@ sentinel failover-timeout mymaster 180000
# #
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port> # <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
# #
# <state> is currently always "failover" # <state> is currently always "start"
# <role> is either "leader" or "observer" # <role> is either "leader" or "observer"
# #
# The arguments from-ip, from-port, to-ip, to-port are used to communicate # The arguments from-ip, from-port, to-ip, to-port are used to communicate
......
...@@ -1740,7 +1740,7 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc ...@@ -1740,7 +1740,7 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc
} }
/* When this function is called, there is a packet to process starting /* When this function is called, there is a packet to process starting
* at node->rcvbuf. Releasing the buffer is up to the caller, so this * at link->rcvbuf. Releasing the buffer is up to the caller, so this
* function should just handle the higher level stuff of processing the * function should just handle the higher level stuff of processing the
* packet, modifying the cluster state if needed. * packet, modifying the cluster state if needed.
* *
...@@ -2499,7 +2499,8 @@ void clusterBuildMessageHdr(clusterMsg *hdr, int type) { ...@@ -2499,7 +2499,8 @@ void clusterBuildMessageHdr(clusterMsg *hdr, int type) {
totlen += sizeof(clusterMsgDataUpdate); totlen += sizeof(clusterMsgDataUpdate);
} }
hdr->totlen = htonl(totlen); hdr->totlen = htonl(totlen);
/* For PING, PONG, and MEET, fixing the totlen field is up to the caller. */ /* For PING, PONG, MEET and other variable length messages fixing the
* totlen field is up to the caller. */
} }
/* Return non zero if the node is already present in the gossip section of the /* Return non zero if the node is already present in the gossip section of the
...@@ -2650,7 +2651,7 @@ void clusterSendPing(clusterLink *link, int type) { ...@@ -2650,7 +2651,7 @@ void clusterSendPing(clusterLink *link, int type) {
dictReleaseIterator(di); dictReleaseIterator(di);
} }
/* Ready to send... fix the totlen fiend and queue the message in the /* Ready to send... fix the totlen field and queue the message in the
* output buffer. */ * output buffer. */
totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData); totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
totlen += (sizeof(clusterMsgDataGossip)*gossipcount); totlen += (sizeof(clusterMsgDataGossip)*gossipcount);
...@@ -3438,7 +3439,7 @@ void clusterHandleSlaveMigration(int max_slaves) { ...@@ -3438,7 +3439,7 @@ void clusterHandleSlaveMigration(int max_slaves) {
* the PAUSED flag, so that the slave will set mf_master_offset when receiving * the PAUSED flag, so that the slave will set mf_master_offset when receiving
* a packet from the master with this flag set. * a packet from the master with this flag set.
* *
* The gaol of the manual failover is to perform a fast failover without * The goal of the manual failover is to perform a fast failover without
* data loss due to the asynchronous master-slave replication. * data loss due to the asynchronous master-slave replication.
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
......
...@@ -770,8 +770,8 @@ void syncCommand(client *c) { ...@@ -770,8 +770,8 @@ void syncCommand(client *c) {
/* Try a partial resynchronization if this is a PSYNC command. /* Try a partial resynchronization if this is a PSYNC command.
* If it fails, we continue with usual full resynchronization, however * If it fails, we continue with usual full resynchronization, however
* when this happens masterTryPartialResynchronization() already * when this happens replicationSetupSlaveForFullResync will replied
* replied with: * with:
* *
* +FULLRESYNC <replid> <offset> * +FULLRESYNC <replid> <offset>
* *
...@@ -1055,7 +1055,7 @@ void removeRDBUsedToSyncReplicas(void) { ...@@ -1055,7 +1055,7 @@ void removeRDBUsedToSyncReplicas(void) {
* RDBGeneratedByReplication flag in case it was set. Otherwise if the * RDBGeneratedByReplication flag in case it was set. Otherwise if the
* feature was enabled, but gets disabled later with CONFIG SET, the * feature was enabled, but gets disabled later with CONFIG SET, the
* flag may remain set to one: then next time the feature is re-enabled * flag may remain set to one: then next time the feature is re-enabled
* via CONFIG SET we have have it set even if no RDB was generated * via CONFIG SET we have it set even if no RDB was generated
* because of replication recently. */ * because of replication recently. */
if (!server.rdb_del_sync_files) { if (!server.rdb_del_sync_files) {
RDBGeneratedByReplication = 0; RDBGeneratedByReplication = 0;
...@@ -2149,7 +2149,7 @@ int slaveTryPartialResynchronization(connection *conn, int read_reply) { ...@@ -2149,7 +2149,7 @@ int slaveTryPartialResynchronization(connection *conn, int read_reply) {
"Successful partial resynchronization with master."); "Successful partial resynchronization with master.");
/* Check the new replication ID advertised by the master. If it /* Check the new replication ID advertised by the master. If it
* changed, we need to set the new ID as primary ID, and set or * changed, we need to set the new ID as primary ID, and set
* secondary ID as the old master ID up to the current offset, so * secondary ID as the old master ID up to the current offset, so
* that our sub-slaves will be able to PSYNC with us after a * that our sub-slaves will be able to PSYNC with us after a
* disconnection. */ * disconnection. */
...@@ -2676,11 +2676,7 @@ void replicationUnsetMaster(void) { ...@@ -2676,11 +2676,7 @@ void replicationUnsetMaster(void) {
/* When a slave is turned into a master, the current replication ID /* When a slave is turned into a master, the current replication ID
* (that was inherited from the master at synchronization time) is * (that was inherited from the master at synchronization time) is
* used as secondary ID up to the current offset, and a new replication * used as secondary ID up to the current offset, and a new replication
* ID is created to continue with a new replication history. * ID is created to continue with a new replication history. */
*
* NOTE: this function MUST be called after we call
* freeClient(server.master), since there we adjust the replication
* offset trimming the final PINGs. See Github issue #7320. */
shiftReplicationId(); shiftReplicationId();
/* Disconnecting all the slaves is required: we need to inform slaves /* Disconnecting all the slaves is required: we need to inform slaves
* of the replication ID change (see shiftReplicationId() call). However * of the replication ID change (see shiftReplicationId() call). However
......
...@@ -1019,7 +1019,7 @@ void sentinelPendingScriptsCommand(client *c) { ...@@ -1019,7 +1019,7 @@ void sentinelPendingScriptsCommand(client *c) {
* *
* It is called every time a failover is performed. * It is called every time a failover is performed.
* *
* <state> is currently always "failover". * <state> is currently always "start".
* <role> is either "leader" or "observer". * <role> is either "leader" or "observer".
* *
* from/to fields are respectively master -> promoted slave addresses for * from/to fields are respectively master -> promoted slave addresses for
...@@ -1275,8 +1275,8 @@ void sentinelDisconnectCallback(const redisAsyncContext *c, int status) { ...@@ -1275,8 +1275,8 @@ void sentinelDisconnectCallback(const redisAsyncContext *c, int status) {
* if SRI_SLAVE or SRI_SENTINEL is set then 'master' must be not NULL and the * if SRI_SLAVE or SRI_SENTINEL is set then 'master' must be not NULL and the
* instance is added into master->slaves or master->sentinels table. * instance is added into master->slaves or master->sentinels table.
* *
* If the instance is a slave or sentinel, the name parameter is ignored and * If the instance is a slave, the name parameter is ignored and is created
* is created automatically as hostname:port. * automatically as ip/hostname:port.
* *
* The function fails if hostname can't be resolved or port is out of range. * The function fails if hostname can't be resolved or port is out of range.
* When this happens NULL is returned and errno is set accordingly to the * When this happens NULL is returned and errno is set accordingly to the
...@@ -4998,7 +4998,7 @@ void sentinelAbortFailover(sentinelRedisInstance *ri) { ...@@ -4998,7 +4998,7 @@ void sentinelAbortFailover(sentinelRedisInstance *ri) {
/* ======================== SENTINEL timer handler ========================== /* ======================== SENTINEL timer handler ==========================
* This is the "main" our Sentinel, being sentinel completely non blocking * This is the "main" our Sentinel, being sentinel completely non blocking
* in design. The function is called every second. * in design.
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
/* Perform scheduled operations for the specified Redis instance. */ /* Perform scheduled operations for the specified Redis instance. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment