Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hanoi2005
redis
提交
537f3053
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,发现更多精彩内容 >>
提交
537f3053
编写于
9月 05, 2014
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
AOF loading: split handling of format errors from unexpected EOF.
上级
667e2991
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
8 deletion
+11
-8
src/aof.c
src/aof.c
+10
-7
tests/integration/aof.tcl
tests/integration/aof.tcl
+1
-1
未找到文件。
src/aof.c
浏览文件 @
537f3053
...
...
@@ -601,7 +601,7 @@ int loadAppendOnlyFile(char *filename) {
argsds
=
sdsnewlen
(
NULL
,
len
);
if
(
len
&&
fread
(
argsds
,
len
,
1
,
fp
)
==
0
)
goto
fmterr
;
argv
[
j
]
=
createObject
(
REDIS_STRING
,
argsds
);
if
(
fread
(
buf
,
2
,
1
,
fp
)
==
0
)
goto
fmt
err
;
/* discard CRLF */
if
(
fread
(
buf
,
2
,
1
,
fp
)
==
0
)
goto
read
err
;
/* discard CRLF */
}
/* Command lookup */
...
...
@@ -629,7 +629,7 @@ int loadAppendOnlyFile(char *filename) {
/* This point can only be reached when EOF is reached without errors.
* If the client is in the middle of a MULTI/EXEC, log error and quit. */
if
(
fakeClient
->
flags
&
REDIS_MULTI
)
goto
readerr
;
if
(
fakeClient
->
flags
&
REDIS_MULTI
)
goto
uxeof
;
fclose
(
fp
);
freeFakeClient
(
fakeClient
);
...
...
@@ -639,14 +639,17 @@ int loadAppendOnlyFile(char *filename) {
server
.
aof_rewrite_base_size
=
server
.
aof_current_size
;
return
REDIS_OK
;
readerr:
if
(
feof
(
fp
))
{
redisLog
(
REDIS_WARNING
,
"Unexpected end of file reading the append only file"
);
}
else
{
readerr:
/* Read error. If feof(fp) is true, fall through to unexpected EOF. */
if
(
!
feof
(
fp
))
{
redisLog
(
REDIS_WARNING
,
"Unrecoverable error reading the append only file: %s"
,
strerror
(
errno
));
exit
(
1
);
}
uxeof:
/* Unexpected AOF end of file. */
redisLog
(
REDIS_WARNING
,
"Unexpected end of file reading the append only file"
);
exit
(
1
);
fmterr:
fmterr:
/* Format error. */
redisLog
(
REDIS_WARNING
,
"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>"
);
exit
(
1
);
}
...
...
tests/integration/aof.tcl
浏览文件 @
537f3053
...
...
@@ -56,7 +56,7 @@ tags {"aof"} {
start_server_aof
[
list dir $server_path
]
{
test
"Short read: Server should have logged an error"
{
set pattern
"*
Bad file format
reading the append only file*"
set pattern
"*
Unexpected end of file
reading the append only file*"
set retry 10
while
{
$retry
}
{
set result
[
exec tail -n1 <
[
dict get $srv stdout
]]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录