Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
4e538759
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,发现更多精彩内容 >>
提交
4e538759
编写于
6月 01, 2010
作者:
A
antirez
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'smallkeys' of github.com:antirez/redis into smallkeys
上级
a4798f73
e4ed181d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
20 addition
and
10 deletion
+20
-10
redis.c
redis.c
+20
-10
未找到文件。
redis.c
浏览文件 @
4e538759
...
...
@@ -90,7 +90,7 @@
#define REDIS_STATIC_ARGS 8
#define REDIS_DEFAULT_DBNUM 16
#define REDIS_CONFIGLINE_MAX 1024
#define REDIS_OBJFREELIST_MAX
100000
0
/* Max number of objects to cache */
#define REDIS_OBJFREELIST_MAX 0
/* Max number of objects to cache */
#define REDIS_MAX_SYNC_TIME 60
/* Slave can't take more to sync */
#define REDIS_EXPIRELOOKUPS_PER_CRON 10
/* lookup 10 expires per loop */
#define REDIS_MAX_WRITE_PER_EVENT (1024*64)
...
...
@@ -3099,10 +3099,18 @@ static void decrRefCount(void *obj) {
}
if
(
o
->
refcount
<=
0
)
redisPanic
(
"decrRefCount against refcount <= 0"
);
/* Object is in memory, or in the process of being swapped out. */
if
(
--
(
o
->
refcount
)
==
0
)
{
/* Object is in memory, or in the process of being swapped out.
*
* If the object is being swapped out, abort the operation on
* decrRefCount even if the refcount does not drop to 0: the object
* is referenced at least two times, as value of the key AND as
* job->val in the iojob. So if we don't invalidate the iojob, when it is
* done but the relevant key was removed in the meantime, the
* complete jobs handler will not find the key about the job and the
* assert will fail. */
if
(
server
.
vm_enabled
&&
o
->
storage
==
REDIS_VM_SWAPPING
)
vmCancelThreadedIOJob
(
obj
);
vmCancelThreadedIOJob
(
o
);
if
(
--
(
o
->
refcount
)
==
0
)
{
switch
(
o
->
type
)
{
case
REDIS_STRING
:
freeStringObject
(
o
);
break
;
case
REDIS_LIST
:
freeListObject
(
o
);
break
;
...
...
@@ -9411,11 +9419,9 @@ static void freeIOJob(iojob *j) {
j
->
type
==
REDIS_IOJOB_DO_SWAP
||
j
->
type
==
REDIS_IOJOB_LOAD
)
&&
j
->
val
!=
NULL
)
{
/* Our value object was successfully swapped if
* refcount == 1 and storage == REDIS_VM_SWAPPING,
* we fix the storage type, otherwise decrRefCount() will try to
/* we fix the storage type, otherwise decrRefCount() will try to
* kill the I/O thread Job (that does no longer exists). */
if
(
j
->
val
->
refcount
==
1
&&
j
->
val
->
storage
==
REDIS_VM_SWAPPING
)
if
(
j
->
val
->
storage
==
REDIS_VM_SWAPPING
)
j
->
val
->
storage
=
REDIS_VM_MEMORY
;
decrRefCount
(
j
->
val
);
}
...
...
@@ -9464,7 +9470,7 @@ static void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
* can do just here to avoid race conditions and/or invasive locks */
redisLog
(
REDIS_DEBUG
,
"COMPLETED Job type: %d, ID %p, key: %s"
,
j
->
type
,
(
void
*
)
j
->
id
,
(
unsigned
char
*
)
j
->
key
->
ptr
);
de
=
dictFind
(
j
->
db
->
dict
,
j
->
key
);
a
ssert
(
de
!=
NULL
);
redisA
ssert
(
de
!=
NULL
);
if
(
j
->
type
==
REDIS_IOJOB_LOAD
)
{
redisDb
*
db
;
vmpointer
*
vp
=
dictGetEntryVal
(
de
);
...
...
@@ -9520,6 +9526,9 @@ static void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
vp
->
page
=
j
->
page
;
vp
->
usedpages
=
j
->
pages
;
dictGetEntryVal
(
de
)
=
vp
;
/* Fix the storage otherwise decrRefCount will attempt to
* remove the associated I/O job */
j
->
val
->
storage
=
REDIS_VM_MEMORY
;
decrRefCount
(
j
->
val
);
redisLog
(
REDIS_DEBUG
,
"VM: object %s swapped out at %lld (%lld pages) (threaded)"
,
...
...
@@ -9638,6 +9647,7 @@ again:
else
if
(
o
->
storage
==
REDIS_VM_SWAPPING
)
o
->
storage
=
REDIS_VM_MEMORY
;
unlockThreadedIO
();
redisLog
(
REDIS_DEBUG
,
"*** DONE"
);
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录