Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
2cc78d11
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2cc78d11
编写于
11月 02, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1845 add some logs
上级
e2cc48af
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
13 deletion
+13
-13
src/wal/src/walMgmt.c
src/wal/src/walMgmt.c
+1
-1
src/wal/src/walWrite.c
src/wal/src/walWrite.c
+12
-12
未找到文件。
src/wal/src/walMgmt.c
浏览文件 @
2cc78d11
...
...
@@ -141,7 +141,7 @@ void walClose(void *handle) {
static
int32_t
walInitObj
(
SWal
*
pWal
)
{
if
(
taosMkDir
(
pWal
->
path
,
0755
)
!=
0
)
{
wError
(
"vgId:%d,
file
:%s, failed to create directory since %s"
,
pWal
->
vgId
,
pWal
->
path
,
strerror
(
errno
));
wError
(
"vgId:%d,
path
:%s, failed to create directory since %s"
,
pWal
->
vgId
,
pWal
->
path
,
strerror
(
errno
));
return
TAOS_SYSTEM_ERROR
(
errno
);
}
...
...
src/wal/src/walWrite.c
浏览文件 @
2cc78d11
...
...
@@ -93,8 +93,9 @@ int32_t walWrite(void *handle, SWalHead *pHead) {
code
=
TAOS_SYSTEM_ERROR
(
errno
);
wError
(
"vgId:%d, file:%s, failed to write since %s"
,
pWal
->
vgId
,
pWal
->
name
,
strerror
(
errno
));
}
else
{
wTrace
(
"vgId:%d, fileId:%"
PRId64
" fd:%d, write wal ver:%"
PRId64
", head ver:%"
PRIu64
", len:%d "
,
pWal
->
vgId
,
pWal
->
fileId
,
pWal
->
fd
,
pWal
->
version
,
pHead
->
version
,
pHead
->
len
);
pWal
->
version
=
pHead
->
version
;
wTrace
(
"vgId:%d, write version:%"
PRId64
", fileId:%"
PRId64
,
pWal
->
vgId
,
pWal
->
version
,
pWal
->
fileId
);
}
pthread_mutex_unlock
(
&
pWal
->
mutex
);
...
...
@@ -132,7 +133,7 @@ int32_t walRestore(void *handle, void *pVnode, int32_t (*writeFp)(void *, void *
wDebug
(
"vgId:%d, file:%s, will be restored"
,
pWal
->
vgId
,
walName
);
int32_t
code
=
walRestoreWalFile
(
pWal
,
pVnode
,
writeFp
,
walName
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
w
Debug
(
"vgId:%d, file:%s, failed to restore since %s"
,
pWal
->
vgId
,
walName
,
tstrerror
(
code
));
w
Error
(
"vgId:%d, file:%s, failed to restore since %s"
,
pWal
->
vgId
,
walName
,
tstrerror
(
code
));
continue
;
}
...
...
@@ -205,7 +206,7 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
wDebug
(
"vgId:%d, file:%s, start to restore"
,
pWal
->
vgId
,
name
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
size_t
offset
=
0
;
int64_t
offset
=
0
;
SWalHead
*
pHead
=
buffer
;
while
(
1
)
{
...
...
@@ -213,21 +214,20 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
if
(
ret
==
0
)
break
;
if
(
ret
<
0
)
{
wError
(
"vgId:%d, file:%s, failed to read wal head
part
since %s"
,
pWal
->
vgId
,
name
,
strerror
(
errno
));
wError
(
"vgId:%d, file:%s, failed to read wal head since %s"
,
pWal
->
vgId
,
name
,
strerror
(
errno
));
code
=
TAOS_SYSTEM_ERROR
(
errno
);
break
;
}
if
(
ret
<
sizeof
(
SWalHead
))
{
wError
(
"vgId:%d, file:%s, failed to read wal head since %s, read size:%d, skip the rest of file"
,
pWal
->
vgId
,
name
,
strerror
(
errno
),
ret
);
wError
(
"vgId:%d, file:%s, failed to read wal head, ret is %d"
,
pWal
->
vgId
,
name
,
ret
);
taosFtruncate
(
fd
,
offset
);
fsync
(
fd
);
break
;
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
pHead
,
sizeof
(
SWalHead
)))
{
wError
(
"vgId:%d, file:%s, wal head cksum is messed up,
skip the rest of file"
,
pWal
->
vgId
,
name
);
wError
(
"vgId:%d, file:%s, wal head cksum is messed up,
offset:%"
PRId64
,
pWal
->
vgId
,
name
,
offset
);
code
=
TSDB_CODE_WAL_FILE_CORRUPTED
;
ASSERT
(
false
);
break
;
...
...
@@ -247,14 +247,13 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
ret
=
taosTRead
(
fd
,
pHead
->
cont
,
pHead
->
len
);
if
(
ret
<
0
)
{
wError
(
"vgId:%d, file:%s
failed to read wal body part
since %s"
,
pWal
->
vgId
,
name
,
strerror
(
errno
));
wError
(
"vgId:%d, file:%s
, failed to read wal body
since %s"
,
pWal
->
vgId
,
name
,
strerror
(
errno
));
code
=
TAOS_SYSTEM_ERROR
(
errno
);
break
;
}
if
(
ret
<
pHead
->
len
)
{
wError
(
"vgId:%d, file:%s, failed to read body since %s, read size:%d len:%d , skip the rest of file"
,
pWal
->
vgId
,
name
,
strerror
(
errno
),
ret
,
pHead
->
len
);
wError
(
"vgId:%d, file:%s, failed to read wal body, ret:%d len:%d"
,
pWal
->
vgId
,
name
,
ret
,
pHead
->
len
);
taosFtruncate
(
fd
,
offset
);
fsync
(
fd
);
break
;
...
...
@@ -262,9 +261,10 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
offset
=
offset
+
sizeof
(
SWalHead
)
+
pHead
->
len
;
if
(
pWal
->
keep
)
pWal
->
version
=
pHead
->
version
;
wTrace
(
"vgId:%d, fileId:%"
PRId64
", restore wal ver:%"
PRIu64
", head ver:%"
PRIu64
" len:%d"
,
pWal
->
vgId
,
pWal
->
fileId
,
pWal
->
version
,
pHead
->
version
,
pHead
->
len
);
wTrace
(
"vgId:%d, restore version:%"
PRIu64
", fileId:%"
PRId64
,
pWal
->
vgId
,
pWal
->
version
,
pWal
->
fileId
)
;
if
(
pWal
->
keep
)
pWal
->
version
=
pHead
->
version
;
(
*
writeFp
)(
pVnode
,
pHead
,
TAOS_QTYPE_WAL
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录