Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eff8656c
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
eff8656c
编写于
5月 12, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into fix/hzcheng_3.0
上级
62b2cced
78e74332
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
9 deletion
+47
-9
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+36
-6
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+10
-3
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+1
-0
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
eff8656c
...
...
@@ -70,6 +70,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid);
static
void
tsdbResetCommitFile
(
SCommitH
*
pCommith
);
static
int
tsdbSetAndOpenCommitFile
(
SCommitH
*
pCommith
,
SDFileSet
*
pSet
,
int
fid
);
static
int
tsdbCommitToTable
(
SCommitH
*
pCommith
,
int
tid
);
static
bool
tsdbCommitIsSameFile
(
SCommitH
*
pCommith
,
int
bidx
);
static
int
tsdbMoveBlkIdx
(
SCommitH
*
pCommith
,
SBlockIdx
*
pIdx
);
static
int
tsdbSetCommitTable
(
SCommitH
*
pCommith
,
STable
*
pTable
);
static
int
tsdbComparKeyBlock
(
const
void
*
arg1
,
const
void
*
arg2
);
...
...
@@ -891,9 +892,11 @@ static int tsdbCommitToTable(SCommitH *pCommith, int tid) {
}
static
int
tsdbMoveBlkIdx
(
SCommitH
*
pCommith
,
SBlockIdx
*
pIdx
)
{
SReadH
*
pReadh
=
&
pCommith
->
readh
;
int
nBlocks
=
pIdx
->
numOfBlocks
;
int
bidx
=
0
;
SReadH
*
pReadh
=
&
pCommith
->
readh
;
STsdb
*
pTsdb
=
TSDB_READ_REPO
(
pReadh
);
STSchema
*
pTSchema
=
NULL
;
int
nBlocks
=
pIdx
->
numOfBlocks
;
int
bidx
=
0
;
tsdbResetCommitTable
(
pCommith
);
...
...
@@ -903,30 +906,49 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
return
-
1
;
}
STable
table
=
{.
tid
=
pIdx
->
uid
,
.
uid
=
pIdx
->
uid
,
.
pSchema
=
NULL
};
pCommith
->
pTable
=
&
table
;
while
(
bidx
<
nBlocks
)
{
if
(
!
pTSchema
&&
!
tsdbCommitIsSameFile
(
pCommith
,
bidx
))
{
// Set commit table
pTSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdb
),
pIdx
->
uid
,
0
);
// TODO: schema version
if
(
!
pTSchema
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
table
.
pSchema
=
pTSchema
;
if
(
tsdbSetCommitTable
(
pCommith
,
&
table
)
<
0
)
{
taosMemoryFreeClear
(
pTSchema
);
return
-
1
;
}
}
if
(
tsdbMoveBlock
(
pCommith
,
bidx
)
<
0
)
{
tsdbError
(
"vgId:%d failed to move block into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
taosMemoryFreeClear
(
pTSchema
);
return
-
1
;
}
++
bidx
;
}
STable
table
=
{.
tid
=
pIdx
->
uid
,
.
uid
=
pIdx
->
uid
,
.
pSchema
=
NULL
};
TSDB_COMMIT_TABLE
(
pCommith
)
=
&
table
;
if
(
tsdbWriteBlockInfo
(
pCommith
)
<
0
)
{
tsdbError
(
"vgId:%d failed to write SBlockInfo part into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
taosMemoryFreeClear
(
pTSchema
);
return
-
1
;
}
taosMemoryFreeClear
(
pTSchema
);
return
0
;
}
static
int
tsdbSetCommitTable
(
SCommitH
*
pCommith
,
STable
*
pTable
)
{
STSchema
*
pSchema
=
tsdbGetTableSchemaImpl
(
pTable
,
false
,
false
,
-
1
);
pCommith
->
pTable
=
pTable
;
if
(
tdInitDataCols
(
pCommith
->
pDataCols
,
pSchema
)
<
0
)
{
...
...
@@ -1323,6 +1345,14 @@ static int tsdbMergeMemData(SCommitH *pCommith, SCommitIter *pIter, int bidx) {
return
0
;
}
static
bool
tsdbCommitIsSameFile
(
SCommitH
*
pCommith
,
int
bidx
)
{
SBlock
*
pBlock
=
pCommith
->
readh
.
pBlkInfo
->
blocks
+
bidx
;
if
(
pBlock
->
last
)
{
return
pCommith
->
isLFileSame
;
}
return
pCommith
->
isDFileSame
;
}
static
int
tsdbMoveBlock
(
SCommitH
*
pCommith
,
int
bidx
)
{
SBlock
*
pBlock
=
pCommith
->
readh
.
pBlkInfo
->
blocks
+
bidx
;
SDFile
*
pDFile
;
...
...
source/libs/wal/src/walRead.c
浏览文件 @
eff8656c
...
...
@@ -130,6 +130,7 @@ static int32_t walReadSeekVer(SWalReadHandle *pRead, int64_t ver) {
}
}
// code set inner
if
(
walReadSeekFilePos
(
pRead
,
pRet
->
firstVer
,
ver
)
<
0
)
{
return
-
1
;
}
...
...
@@ -249,16 +250,22 @@ int32_t walReadWithHandle(SWalReadHandle *pRead, int64_t ver) {
// TODO: check wal life
if
(
pRead
->
curVersion
!=
ver
)
{
if
(
walReadSeekVer
(
pRead
,
ver
)
<
0
)
{
terrno
=
TSDB_CODE_WAL_INVALID_VER
;
wError
(
"unexpected wal log version: % "
PRId64
", since seek error"
,
ver
);
return
-
1
;
}
}
if
(
!
taosValidFile
(
pRead
->
pReadLogTFile
))
{
return
-
1
;
}
/*if (!taosValidFile(pRead->pReadLogTFile)) {*/
/*return -1;*/
/*}*/
code
=
taosReadFile
(
pRead
->
pReadLogTFile
,
pRead
->
pHead
,
sizeof
(
SWalHead
));
if
(
code
!=
sizeof
(
SWalHead
))
{
if
(
code
<
0
)
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
else
terrno
=
TSDB_CODE_WAL_FILE_CORRUPTED
;
return
-
1
;
}
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
eff8656c
...
...
@@ -225,6 +225,7 @@ int walRoll(SWal *pWal) {
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
// terrno set inner
code
=
walRollFileInfo
(
pWal
);
if
(
code
!=
0
)
{
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录