Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
72aa3762
Unverified
Commit
72aa3762
authored
Apr 25, 2021
by
Huang Zhw
Committed by
GitHub
Apr 25, 2021
Browse files
Fix comments and typos in sentinel.c. (#8801)
parent
8423b77f
Changes
4
Hide whitespace changes
Inline
Side-by-side
sentinel.conf
View file @
72aa3762
...
@@ -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
...
...
src/cluster.c
View file @
72aa3762
...
@@ -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 fie
n
d and queue the message in the
/* Ready to send... fix the totlen fie
l
d 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 g
a
ol of the manual failover is to perform a fast failover without
* The go
a
l 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.
* -------------------------------------------------------------------------- */
* -------------------------------------------------------------------------- */
...
...
src/replication.c
View file @
72aa3762
...
@@ -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
...
...
src/sentinel.c
View file @
72aa3762
...
@@ -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. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment