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
065872e0
Unverified
Commit
065872e0
authored
Nov 19, 2019
by
Salvatore Sanfilippo
Committed by
GitHub
Nov 19, 2019
Browse files
Merge pull request #6551 from pvalsecc/sentinel_kill_pubsub
Redis sentinel kill pubsub client connections as well
parents
446f24e6
9593ffde
Changes
1
Show whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
065872e0
...
@@ -465,6 +465,12 @@ struct redisCommand sentinelcmds[] = {
...
@@ -465,6 +465,12 @@ struct redisCommand sentinelcmds[] = {
{
"hello"
,
helloCommand
,
-
2
,
"no-script fast"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
}
{
"hello"
,
helloCommand
,
-
2
,
"no-script fast"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
}
};
};
/* List of client types that are killed when an instance becomes a slave */
const
char
*
killedClientTypes
[]
=
{
"normal"
,
"pubsub"
};
/* This function overwrites a few normal Redis config default with Sentinel
/* This function overwrites a few normal Redis config default with Sentinel
* specific defaults. */
* specific defaults. */
void
initSentinelConfig
(
void
)
{
void
initSentinelConfig
(
void
)
{
...
@@ -3949,6 +3955,7 @@ char *sentinelGetLeader(sentinelRedisInstance *master, uint64_t epoch) {
...
@@ -3949,6 +3955,7 @@ char *sentinelGetLeader(sentinelRedisInstance *master, uint64_t epoch) {
int
sentinelSendSlaveOf
(
sentinelRedisInstance
*
ri
,
char
*
host
,
int
port
)
{
int
sentinelSendSlaveOf
(
sentinelRedisInstance
*
ri
,
char
*
host
,
int
port
)
{
char
portstr
[
32
];
char
portstr
[
32
];
int
retval
;
int
retval
;
unsigned
int
curType
;
ll2string
(
portstr
,
sizeof
(
portstr
),
port
);
ll2string
(
portstr
,
sizeof
(
portstr
),
port
);
...
@@ -3993,11 +4000,14 @@ int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) {
...
@@ -3993,11 +4000,14 @@ int sentinelSendSlaveOf(sentinelRedisInstance *ri, char *host, int port) {
* an issue because CLIENT is variadic command, so Redis will not
* an issue because CLIENT is variadic command, so Redis will not
* recognized as a syntax error, and the transaction will not fail (but
* recognized as a syntax error, and the transaction will not fail (but
* only the unsupported command will fail). */
* only the unsupported command will fail). */
for
(
curType
=
0
;
curType
<
sizeof
(
killedClientTypes
)
/
sizeof
(
killedClientTypes
[
0
]);
++
curType
)
{
retval
=
redisAsyncCommand
(
ri
->
link
->
cc
,
retval
=
redisAsyncCommand
(
ri
->
link
->
cc
,
sentinelDiscardReplyCallback
,
ri
,
"%s KILL TYPE normal"
,
sentinelDiscardReplyCallback
,
ri
,
"%s KILL TYPE %s"
,
sentinelInstanceMapCommand
(
ri
,
"CLIENT"
));
sentinelInstanceMapCommand
(
ri
,
"CLIENT"
),
killedClientTypes
[
curType
]);
if
(
retval
==
C_ERR
)
return
retval
;
if
(
retval
==
C_ERR
)
return
retval
;
ri
->
link
->
pending_commands
++
;
ri
->
link
->
pending_commands
++
;
}
retval
=
redisAsyncCommand
(
ri
->
link
->
cc
,
retval
=
redisAsyncCommand
(
ri
->
link
->
cc
,
sentinelDiscardReplyCallback
,
ri
,
"%s"
,
sentinelDiscardReplyCallback
,
ri
,
"%s"
,
...
...
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