Skip to content

Commit

Permalink
Fix comments and typos in sentinel.c. (redis#8801)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhw authored Apr 25, 2021
1 parent 8423b77 commit 72aa376
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion sentinel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ sentinel failover-timeout mymaster 180000
#
# <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"
#
# The arguments from-ip, from-port, to-ip, to-port are used to communicate
Expand Down
9 changes: 5 additions & 4 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc
}

/* 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
* packet, modifying the cluster state if needed.
*
Expand Down Expand Up @@ -2499,7 +2499,8 @@ void clusterBuildMessageHdr(clusterMsg *hdr, int type) {
totlen += sizeof(clusterMsgDataUpdate);
}
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
Expand Down Expand Up @@ -2650,7 +2651,7 @@ void clusterSendPing(clusterLink *link, int type) {
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. */
totlen = sizeof(clusterMsg)-sizeof(union clusterMsgData);
totlen += (sizeof(clusterMsgDataGossip)*gossipcount);
Expand Down Expand Up @@ -3438,7 +3439,7 @@ void clusterHandleSlaveMigration(int max_slaves) {
* the PAUSED flag, so that the slave will set mf_master_offset when receiving
* 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.
* -------------------------------------------------------------------------- */

Expand Down
14 changes: 5 additions & 9 deletions src/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,8 @@ void syncCommand(client *c) {

/* Try a partial resynchronization if this is a PSYNC command.
* If it fails, we continue with usual full resynchronization, however
* when this happens masterTryPartialResynchronization() already
* replied with:
* when this happens replicationSetupSlaveForFullResync will replied
* with:
*
* +FULLRESYNC <replid> <offset>
*
Expand Down Expand Up @@ -1055,7 +1055,7 @@ void removeRDBUsedToSyncReplicas(void) {
* RDBGeneratedByReplication flag in case it was set. Otherwise if 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
* 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. */
if (!server.rdb_del_sync_files) {
RDBGeneratedByReplication = 0;
Expand Down Expand Up @@ -2149,7 +2149,7 @@ int slaveTryPartialResynchronization(connection *conn, int read_reply) {
"Successful partial resynchronization with master.");

/* 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
* that our sub-slaves will be able to PSYNC with us after a
* disconnection. */
Expand Down Expand Up @@ -2676,11 +2676,7 @@ void replicationUnsetMaster(void) {
/* When a slave is turned into a master, the current replication ID
* (that was inherited from the master at synchronization time) is
* used as secondary ID up to the current offset, and a new replication
* 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. */
* ID is created to continue with a new replication history. */
shiftReplicationId();
/* Disconnecting all the slaves is required: we need to inform slaves
* of the replication ID change (see shiftReplicationId() call). However
Expand Down
8 changes: 4 additions & 4 deletions src/sentinel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ void sentinelPendingScriptsCommand(client *c) {
*
* 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".
*
* from/to fields are respectively master -> promoted slave addresses for
Expand Down Expand Up @@ -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
* instance is added into master->slaves or master->sentinels table.
*
* If the instance is a slave or sentinel, the name parameter is ignored and
* is created automatically as hostname:port.
* If the instance is a slave, the name parameter is ignored and is created
* automatically as ip/hostname:port.
*
* 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
Expand Down Expand Up @@ -4998,7 +4998,7 @@ void sentinelAbortFailover(sentinelRedisInstance *ri) {

/* ======================== SENTINEL timer handler ==========================
* 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. */
Expand Down

0 comments on commit 72aa376

Please sign in to comment.