Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
762fbcb6
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
762fbcb6
编写于
2月 16, 2020
作者:
M
Madelyn Olson
提交者:
antirez
2月 27, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Minor CSC fixes and fixed documentation
上级
349aa245
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
17 deletion
+16
-17
src/networking.c
src/networking.c
+8
-3
src/tracking.c
src/tracking.c
+8
-14
未找到文件。
src/networking.c
浏览文件 @
762fbcb6
...
...
@@ -2044,7 +2044,7 @@ void clientCommand(client *c) {
"REPLY (on|off|skip) -- Control the replies sent to the current connection."
,
"SETNAME <name> -- Assign the name <name> to the current connection."
,
"UNBLOCK <clientid> [TIMEOUT|ERROR] -- Unblock the specified blocked client."
,
"TRACKING (on|off) [REDIRECT <id>] -- Enable client keys tracking for client side caching."
,
"TRACKING (on|off) [REDIRECT <id>]
[BCAST] [PREFIX first] [PREFIX second] ...
-- Enable client keys tracking for client side caching."
,
"GETREDIR -- Return the client ID we are redirecting to when tracking is enabled."
,
NULL
};
...
...
@@ -2234,17 +2234,22 @@ NULL
if
(
!
strcasecmp
(
c
->
argv
[
j
]
->
ptr
,
"redirect"
)
&&
moreargs
)
{
j
++
;
if
(
getLongLongFromObjectOrReply
(
c
,
c
->
argv
[
j
],
&
redir
,
NULL
)
!=
C_OK
)
return
;
C_OK
)
{
zfree
(
prefix
);
return
;
}
/* We will require the client with the specified ID to exist
* right now, even if it is possible that it gets disconnected
* later. Still a valid sanity check. */
if
(
lookupClientByID
(
redir
)
==
NULL
)
{
addReplyError
(
c
,
"The client ID you want redirect to "
"does not exist"
);
zfree
(
prefix
);
return
;
}
}
else
if
(
!
strcasecmp
(
c
->
argv
[
j
]
->
ptr
,
"bcast"
))
{
bcast
++
;
bcast
=
1
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
j
]
->
ptr
,
"prefix"
)
&&
moreargs
)
{
j
++
;
prefix
=
zrealloc
(
prefix
,
sizeof
(
robj
*
)
*
(
numprefix
+
1
));
...
...
src/tracking.c
浏览文件 @
762fbcb6
...
...
@@ -44,7 +44,7 @@
rax
*
TrackingTable
=
NULL
;
rax
*
PrefixTable
=
NULL
;
uint64_t
TrackingTableTotalItems
=
0
;
/* Total number of IDs stored across
the whole tracking table. This gives
n
the whole tracking table. This gives
an hint about the total memory we
are using server side for CSC. */
robj
*
TrackingChannelName
;
...
...
@@ -145,9 +145,9 @@ void enableTracking(client *c, uint64_t redirect_to, int bcast, robj **prefix, s
}
}
/* This function is called after the excution of a readonly command in the
/* This function is called after the ex
e
cution of a readonly command in the
* case the client 'c' has keys tracking enabled. It will populate the
* tracking ivalidation table according to the keys the user fetched, so that
* tracking i
n
validation table according to the keys the user fetched, so that
* Redis will know what are the clients that should receive an invalidation
* message with certain groups of keys are modified. */
void
trackingRememberKeys
(
client
*
c
)
{
...
...
@@ -292,19 +292,12 @@ void trackingInvalidateKey(robj *keyobj) {
}
/* This function is called when one or all the Redis databases are flushed
* (dbid == -1 in case of FLUSHALL). Caching
slot
s are not specific for
* each DB but are global: currently what we do is send
ing
a special
* (dbid == -1 in case of FLUSHALL). Caching
key
s are not specific for
* each DB but are global: currently what we do is send a special
* notification to clients with tracking enabled, invalidating the caching
*
slot "-1
", which means, "all the keys", in order to avoid flooding clients
*
key "
", which means, "all the keys", in order to avoid flooding clients
* with many invalidation messages for all the keys they may hold.
*
* However trying to flush the tracking table here is very costly:
* we need scanning 16 million caching slots in the table to check
* if they are used, this introduces a big delay. So what we do is to really
* flush the table in the case of FLUSHALL. When a FLUSHDB is called instead
* we just send the invalidation message to all the clients, but don't
* flush the table: it will slowly get garbage collected as more keys
* are modified in the used caching slots. */
*/
void
freeTrackingRadixTree
(
void
*
rt
)
{
raxFree
(
rt
);
}
...
...
@@ -325,6 +318,7 @@ void trackingInvalidateKeysOnFlush(int dbid) {
/* In case of FLUSHALL, reclaim all the memory used by tracking. */
if
(
dbid
==
-
1
&&
TrackingTable
)
{
raxFreeWithCallback
(
TrackingTable
,
freeTrackingRadixTree
);
TrackingTable
=
raxNew
();
TrackingTableTotalItems
=
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录