Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hanoi2005
redis
提交
4e141d5a
R
redis
项目概览
hanoi2005
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
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,发现更多精彩内容 >>
提交
4e141d5a
编写于
10月 30, 2009
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
append only mode is now able to translate EXPIRE into EXPIREAT transparently
上级
0154acdc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
7 deletion
+34
-7
redis.c
redis.c
+25
-1
redis.conf
redis.conf
+9
-6
未找到文件。
redis.c
浏览文件 @
4e141d5a
...
...
@@ -1036,7 +1036,7 @@ static void initServerConfig() {
server
.
glueoutputbuf
=
1
;
server
.
daemonize
=
0
;
server
.
appendonly
=
0
;
server
.
appendfsync
=
APPENDFSYNC_
NO
;
server
.
appendfsync
=
APPENDFSYNC_
ALWAYS
;
server
.
lastfsync
=
time
(
NULL
);
server
.
appendfd
=
-
1
;
server
.
appendseldb
=
-
1
;
/* Make sure the first time will not match */
...
...
@@ -1672,6 +1672,7 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
int
j
;
ssize_t
nwritten
;
time_t
now
;
robj
*
tmpargv
[
3
];
/* The DB this command was targetting is not the same as the last command
* we appendend. To issue a SELECT command is needed. */
...
...
@@ -1683,6 +1684,21 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
strlen
(
seldb
),
seldb
);
server
.
appendseldb
=
dictid
;
}
/* "Fix" the argv vector if the command is EXPIRE. We want to translate
* EXPIREs into EXPIREATs calls */
if
(
cmd
->
proc
==
expireCommand
)
{
long
when
;
tmpargv
[
0
]
=
createStringObject
(
"EXPIREAT"
,
8
);
tmpargv
[
1
]
=
argv
[
1
];
incrRefCount
(
argv
[
1
]);
when
=
time
(
NULL
)
+
strtol
(
argv
[
2
]
->
ptr
,
NULL
,
10
);
tmpargv
[
2
]
=
createObject
(
REDIS_STRING
,
sdscatprintf
(
sdsempty
(),
"%ld"
,
when
));
argv
=
tmpargv
;
}
/* Append the actual command */
buf
=
sdscatprintf
(
buf
,
"*%d
\r\n
"
,
argc
);
for
(
j
=
0
;
j
<
argc
;
j
++
)
{
...
...
@@ -1696,6 +1712,13 @@ static void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv
if
(
o
!=
argv
[
j
])
decrRefCount
(
o
);
}
/* Free the objects from the modified argv for EXPIREAT */
if
(
cmd
->
proc
==
expireCommand
)
{
for
(
j
=
0
;
j
<
3
;
j
++
)
decrRefCount
(
argv
[
j
]);
}
/* We want to perform a single write. This should be guaranteed atomic
* at least if the filesystem we are writing is a real physical one.
* While this will save us against the server being killed I don't think
...
...
@@ -5450,6 +5473,7 @@ static struct redisFunctionSym symsTable[] = {
{
"zremCommand"
,(
unsigned
long
)
zremCommand
},
{
"rdbSaveDoubleValue"
,(
unsigned
long
)
rdbSaveDoubleValue
},
{
"rdbLoadDoubleValue"
,(
unsigned
long
)
rdbLoadDoubleValue
},
{
"feedAppendOnlyFile"
,(
unsigned
long
)
feedAppendOnlyFile
},
{
NULL
,
0
}
};
...
...
redis.conf
浏览文件 @
4e141d5a
...
...
@@ -124,9 +124,9 @@ databases 16
#
# The name of the append only file is "appendonly.log"
# appendonly yes
appendonly
no
# The fsync() call
s
tells the Operating System to actually write data on disk
# The fsync() call tells the Operating System to actually write data on disk
# instead to wait for more data in the output buffer. Some OS will really flush
# data on disk, some other OS will just try to do it ASAP.
#
...
...
@@ -136,12 +136,15 @@ databases 16
# always: fsync after every write to the append only log . Slow, Safest.
# everysec: fsync only if one second passed since the last fsync. Compromise.
#
# The default is "no" since it's faster and anyway safer than snapshots from
# the point of view of durability of the latest records modified.
# The default is "always" that's the safer of the options. It's up to you to
# understand if you can relax this to "everysec" that will fsync every second
# or to "no" that will let the operating system flush the output buffer when
# it want, for better performances (but if you can live with the idea of
# some data loss consider the default persistence mode that's snapshotting).
appendfsync
no
# appendfsync always
appendfsync
always
# appendfsync everysec
# appendfsync no
############################### ADVANCED CONFIG ###############################
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录