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
61451b02
Unverified
Commit
61451b02
authored
Jul 31, 2022
by
Huang Zhw
Committed by
GitHub
Jul 31, 2022
Browse files
tracking pending invalidation message of flushdb sent by (#11068)
trackingHandlePendingKeyInvalidations should use proto.
parent
90f35cea
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/tracking.c
View file @
61451b02
...
@@ -423,9 +423,15 @@ void trackingHandlePendingKeyInvalidations() {
...
@@ -423,9 +423,15 @@ void trackingHandlePendingKeyInvalidations() {
robj
*
key
=
listNodeValue
(
ln
);
robj
*
key
=
listNodeValue
(
ln
);
/* current_client maybe freed, so we need to send invalidation
/* current_client maybe freed, so we need to send invalidation
* message only when current_client is still alive */
* message only when current_client is still alive */
if
(
server
.
current_client
!=
NULL
)
if
(
server
.
current_client
!=
NULL
)
{
sendTrackingMessage
(
server
.
current_client
,(
char
*
)
key
->
ptr
,
sdslen
(
key
->
ptr
),
0
);
if
(
key
!=
NULL
)
{
decrRefCount
(
key
);
sendTrackingMessage
(
server
.
current_client
,(
char
*
)
key
->
ptr
,
sdslen
(
key
->
ptr
),
0
);
}
else
{
sendTrackingMessage
(
server
.
current_client
,
shared
.
null
[
server
.
current_client
->
resp
]
->
ptr
,
sdslen
(
shared
.
null
[
server
.
current_client
->
resp
]
->
ptr
),
1
);
}
}
if
(
key
!=
NULL
)
decrRefCount
(
key
);
}
}
listEmpty
(
server
.
tracking_pending_keys
);
listEmpty
(
server
.
tracking_pending_keys
);
}
}
...
@@ -455,8 +461,8 @@ void trackingInvalidateKeysOnFlush(int async) {
...
@@ -455,8 +461,8 @@ void trackingInvalidateKeysOnFlush(int async) {
client
*
c
=
listNodeValue
(
ln
);
client
*
c
=
listNodeValue
(
ln
);
if
(
c
->
flags
&
CLIENT_TRACKING
)
{
if
(
c
->
flags
&
CLIENT_TRACKING
)
{
if
(
c
==
server
.
current_client
)
{
if
(
c
==
server
.
current_client
)
{
incrRefCount
(
shared
.
null
[
c
->
resp
]);
/* We use a special NULL to indicate that we should send null */
listAddNodeTail
(
server
.
tracking_pending_keys
,
shared
.
null
[
c
->
resp
]
);
listAddNodeTail
(
server
.
tracking_pending_keys
,
NULL
);
}
else
{
}
else
{
sendTrackingMessage
(
c
,
shared
.
null
[
c
->
resp
]
->
ptr
,
sdslen
(
shared
.
null
[
c
->
resp
]
->
ptr
),
1
);
sendTrackingMessage
(
c
,
shared
.
null
[
c
->
resp
]
->
ptr
,
sdslen
(
shared
.
null
[
c
->
resp
]
->
ptr
),
1
);
}
}
...
...
tests/unit/tracking.tcl
View file @
61451b02
...
@@ -560,7 +560,7 @@ start_server {tags {"tracking network"}} {
...
@@ -560,7 +560,7 @@ start_server {tags {"tracking network"}} {
assert_equal $res
{
OK
}
assert_equal $res
{
OK
}
# Consume the invalidate message which is after command response
# Consume the invalidate message which is after command response
r read
r read
}
{
invalidate
*_*
}
}
{
invalidate
{}
}
# Keys are defined to be evicted 100 at a time by default.
# Keys are defined to be evicted 100 at a time by default.
# If after eviction the number of keys still surpasses the limit
# If after eviction the number of keys still surpasses the limit
...
...
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