Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tonvia
TDengine
提交
9c73bb0d
T
TDengine
项目概览
Tonvia
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c73bb0d
编写于
8月 13, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code optimization
上级
c0612305
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
6 deletion
+5
-6
src/inc/taoserror.h
src/inc/taoserror.h
+0
-1
src/util/src/terror.c
src/util/src/terror.c
+0
-1
src/wal/src/walWrite.c
src/wal/src/walWrite.c
+5
-4
未找到文件。
src/inc/taoserror.h
浏览文件 @
9c73bb0d
...
...
@@ -306,7 +306,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_WAL_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x1000) //"Unexpected generic error in wal")
#define TSDB_CODE_WAL_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x1001) //"WAL file is corrupted")
#define TSDB_CODE_WAL_SIZE_LIMIT TAOS_DEF_ERROR_CODE(0, 0x1002) //"WAL size exceeds limit")
#define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1003) //"WAL out of memory")
// http
#define TSDB_CODE_HTTP_SERVER_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x1100) //"http server is not onlin")
...
...
src/util/src/terror.c
浏览文件 @
9c73bb0d
...
...
@@ -314,7 +314,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_MSGTYPE, "Invalid msg type")
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_APP_ERROR
,
"Unexpected generic error in wal"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_FILE_CORRUPTED
,
"WAL file is corrupted"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_SIZE_LIMIT
,
"WAL size exceeds limit"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_OUT_OF_MEMORY
,
"WAL out of memory"
)
// http
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_SERVER_OFFLINE
,
"http server is not onlin"
)
...
...
src/wal/src/walWrite.c
浏览文件 @
9c73bb0d
...
...
@@ -123,7 +123,7 @@ static void walUpdateChecksum(SWalHead *pHead) {
static
int
walValidateChecksum
(
SWalHead
*
pHead
)
{
if
(
pHead
->
sver
==
0
)
{
// for compatible with wal before sver 1
return
taosCheckChecksumWhole
((
uint8_t
*
)
pHead
,
sizeof
(
*
pHead
));
}
else
if
(
pHead
->
sver
==
2
||
pHead
->
sver
=
=
1
)
{
}
else
if
(
pHead
->
sver
>
=
1
)
{
uint32_t
cksum
=
pHead
->
cksum
;
pHead
->
cksum
=
0
;
return
taosCheckChecksum
((
uint8_t
*
)
pHead
,
sizeof
(
*
pHead
)
+
pHead
->
len
,
cksum
);
...
...
@@ -282,7 +282,7 @@ static int32_t walSkipCorruptedRecord(SWal *pWal, SWalHead *pHead, int64_t tfd,
return
TSDB_CODE_SUCCESS
;
}
if
(
pHead
->
sver
==
2
||
pHead
->
sver
=
=
1
)
{
if
(
pHead
->
sver
>
=
1
)
{
if
(
tfRead
(
tfd
,
pHead
->
cont
,
pHead
->
len
)
<
pHead
->
len
)
{
wError
(
"vgId:%d, read to end of corrupted wal file, offset:%"
PRId64
,
pWal
->
vgId
,
pos
);
return
TSDB_CODE_WAL_FILE_CORRUPTED
;
...
...
@@ -364,7 +364,7 @@ static int walSMemRowCheck(SWalHead *pHead) {
SWalHead
*
pWalHead
=
(
SWalHead
*
)
calloc
(
sizeof
(
SWalHead
)
+
pHead
->
len
+
nTotalRows
*
sizeof
(
uint8_t
),
1
);
if
(
pWalHead
==
NULL
)
{
return
TSDB_CODE_WAL_OUT_OF_MEMORY
;
return
-
1
;
}
memcpy
(
pWalHead
,
pHead
,
sizeof
(
SWalHead
)
+
sizeof
(
SSubmitMsg
));
...
...
@@ -461,7 +461,7 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
continue
;
}
if
((
pHead
->
sver
==
2
||
pHead
->
sver
=
=
1
)
&&
!
walValidateChecksum
(
pHead
))
{
if
((
pHead
->
sver
>
=
1
)
&&
!
walValidateChecksum
(
pHead
))
{
wError
(
"vgId:%d, file:%s, wal whole cksum is messed up, hver:%"
PRIu64
" len:%d offset:%"
PRId64
,
pWal
->
vgId
,
name
,
pHead
->
version
,
pHead
->
len
,
offset
);
code
=
walSkipCorruptedRecord
(
pWal
,
pHead
,
tfd
,
&
offset
);
...
...
@@ -517,6 +517,7 @@ static int32_t walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp, ch
if
(
0
!=
walSMemRowCheck
(
pHead
))
{
wError
(
"vgId:%d, restore wal, fileId:%"
PRId64
" hver:%"
PRIu64
" wver:%"
PRIu64
" len:%d offset:%"
PRId64
,
pWal
->
vgId
,
fileId
,
pHead
->
version
,
pWal
->
version
,
pHead
->
len
,
offset
);
return
TAOS_SYSTEM_ERROR
(
errno
);
}
(
*
writeFp
)(
pVnode
,
pHead
,
TAOS_QTYPE_WAL
,
NULL
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录