Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
77f4c3b5
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看板
提交
77f4c3b5
编写于
5月 12, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: set commit table when move blk idx between different last file
上级
17fe1d44
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
6 deletion
+36
-6
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+36
-6
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
77f4c3b5
...
...
@@ -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
);
...
...
@@ -889,9 +890,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
);
...
...
@@ -901,30 +904,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
)
{
...
...
@@ -1321,6 +1343,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
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录