Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b64daf73
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看板
提交
b64daf73
编写于
4月 09, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-100
上级
3dfe486d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
5 addition
and
27 deletion
+5
-27
src/vnode/tsdb/src/tsdbRWHelper.c
src/vnode/tsdb/src/tsdbRWHelper.c
+5
-27
未找到文件。
src/vnode/tsdb/src/tsdbRWHelper.c
浏览文件 @
b64daf73
...
...
@@ -41,6 +41,8 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa
static
int
nRowsLEThan
(
SDataCols
*
pDataCols
,
int
maxKey
);
static
int
tsdbGetRowsCanBeMergedWithBlock
(
SRWHelper
*
pHelper
,
int
blkIdx
,
SDataCols
*
pDataCols
);
static
int
tsdbInsertSuperBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
);
static
int
tsdbAddSubBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
,
int
rowsAdded
);
static
int
tsdbUpdateSuperBlock
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
int
blkIdx
);
int
tsdbInitHelper
(
SRWHelper
*
pHelper
,
SHelperCfg
*
pCfg
)
{
if
(
pHelper
==
NULL
||
pCfg
==
NULL
||
tsdbCheckHelperCfg
(
pCfg
)
<
0
)
return
-
1
;
...
...
@@ -236,7 +238,6 @@ int tsdbWriteDataBlock(SRWHelper *pHelper, SDataCols *pDataCols) {
rowsToWrite
=
tsdbMergeDataWithBlock
(
pHelper
,
blkIdx
,
pDataCols
);
if
(
rowsToWrite
<
0
)
goto
_err
;
ASSERT
(
rowsToWrite
==
MIN
(
rows1
,
rows2
));
}
else
{
// Either merge with the previous block or save as a super block in the middle
SCompBlock
*
prevBlock
=
(
blkIdx
==
0
)
?
NULL
:
(
pCompBlock
-
1
);
...
...
@@ -283,7 +284,7 @@ int tsdbWriteCompIdx(SRWHelper *pHelper) {
}
int
tsdbLoadCompIdx
(
SRWHelper
*
pHelper
,
void
*
target
)
{
ASSERT
(
pHelper
->
state
=
TSDB_HELPER_FILE_SET_AND_OPEN
);
ASSERT
(
pHelper
->
state
=
=
TSDB_HELPER_FILE_SET_AND_OPEN
);
if
(
!
helperHasState
(
pHelper
,
TSDB_HELPER_IDX_LOAD
))
{
// If not load from file, just load it in object
...
...
@@ -538,7 +539,6 @@ static int nRowsLEThan(SDataCols *pDataCols, int maxKey) {
static
int
tsdbMergeDataWithBlock
(
SRWHelper
*
pHelper
,
int
blkIdx
,
SDataCols
*
pDataCols
)
{
int
rowsWritten
=
0
;
TSKEY
keyFirst
=
dataColsKeyFirst
(
pDataCols
);
SCompBlock
compBlock
=
{
0
};
SCompIdx
*
pIdx
=
pHelper
->
pCompIdx
+
pHelper
->
tableInfo
.
tid
;
...
...
@@ -566,24 +566,7 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa
if
(
tsdbWriteBlockToFile
(
pHelper
,
pFile
,
pDataCols
,
rowsCanMerge
,
&
compBlock
,
pCompBlock
->
last
,
false
)
<
0
)
goto
_err
;
// TODO: Add the sub-block
if
(
pCompBlock
->
numOfSubBlocks
==
1
)
{
pCompBlock
->
numOfSubBlocks
+=
2
;
// pCompBlock->offset = ;
// pCompBlock->len = ;
}
else
{
pCompBlock
->
numOfSubBlocks
++
;
}
pCompBlock
->
numOfPoints
+=
rowsCanMerge
;
pCompBlock
->
keyFirst
=
MIN
(
pCompBlock
->
keyFirst
,
dataColsKeyFirst
(
pDataCols
));
pCompBlock
->
keyLast
=
MAX
(
pCompBlock
->
keyLast
,
dataColsKeyAt
(
pDataCols
,
rowsCanMerge
-
1
));
// Update the Idx
// pIdx->hasLast = ;
// pIdx->len =;
// pIdx->numOfSuperBlocks = ;
rowsWritten
=
rowsCanMerge
;
if
(
tsdbAddSubBlock
(
pHelper
,
&
compBlock
,
blkIdx
,
rowsCanMerge
)
<
0
)
goto
_err
;
}
else
{
// Read-Merge-Write as a super block
if
(
tsdbLoadBlockData
(
pHelper
,
blkIdx
,
NULL
)
<
0
)
goto
_err
;
...
...
@@ -603,12 +586,7 @@ static int tsdbMergeDataWithBlock(SRWHelper *pHelper, int blkIdx, SDataCols *pDa
}
if
(
tsdbWriteBlockToFile
(
pHelper
,
pFile
,
pHelper
->
pDataCols
[
0
],
pCompBlock
->
numOfPoints
+
rowsCanMerge
,
&
compBlock
,
isLast
,
true
)
<
0
)
goto
_err
;
*
pCompBlock
=
compBlock
;
pIdx
->
maxKey
=
MAX
(
pIdx
->
maxKey
,
compBlock
.
keyLast
);
// pIdx->hasLast = ;
// pIdx->
if
(
tsdbUpdateSuperBlock
(
pHelper
,
&
compBlock
,
blkIdx
)
<
0
)
goto
_err
;
}
return
rowsWritten
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录