Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
7c5633cf
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看板
提交
7c5633cf
编写于
4月 16, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-100
上级
d5059564
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
6 deletion
+11
-6
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+2
-0
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+9
-6
未找到文件。
src/tsdb/src/tsdbMain.c
浏览文件 @
7c5633cf
...
...
@@ -924,10 +924,12 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
// Loop to write the data in the cache to files. If no data to write, just break the loop
int
maxRowsToRead
=
pCfg
->
maxRowsPerFileBlock
*
4
/
5
;
int
nLoop
=
0
;
while
(
true
)
{
int
rowsRead
=
tsdbReadRowsFromCache
(
pIter
,
maxKey
,
maxRowsToRead
,
pDataCols
);
ASSERT
(
rowsRead
>=
0
);
if
(
pDataCols
->
numOfPoints
==
0
)
break
;
nLoop
++
;
ASSERT
(
dataColsKeyFirst
(
pDataCols
)
>=
minKey
&&
dataColsKeyFirst
(
pDataCols
)
<=
maxKey
);
ASSERT
(
dataColsKeyLast
(
pDataCols
)
>=
minKey
&&
dataColsKeyLast
(
pDataCols
)
<=
maxKey
);
...
...
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
7c5633cf
...
...
@@ -281,9 +281,7 @@ int tsdbWriteDataBlock(SRWHelper *pHelper, SDataCols *pDataCols) {
// Load the SCompInfo part if neccessary
ASSERT
(
helperHasState
(
pHelper
,
TSDB_HELPER_TABLE_SET
));
if
(
!
helperHasState
(
pHelper
,
TSDB_HELPER_INFO_LOAD
)
&&
(
pIdx
->
offset
>
0
))
{
if
(
tsdbLoadCompInfo
(
pHelper
,
NULL
)
<
0
)
goto
_err
;
}
if
(
tsdbLoadCompInfo
(
pHelper
,
NULL
)
<
0
)
goto
_err
;
if
(
pIdx
->
offset
==
0
||
(
!
pIdx
->
hasLast
&&
keyFirst
>
pIdx
->
maxKey
))
{
// Just append as a super block
ASSERT
(
pHelper
->
hasOldLastBlock
==
false
);
...
...
@@ -370,6 +368,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) {
if
(
!
helperHasState
(
pHelper
,
TSDB_HELPER_INFO_LOAD
))
{
if
(
pIdx
->
offset
>
0
)
{
pIdx
->
offset
=
lseek
(
pHelper
->
files
.
nHeadF
.
fd
,
0
,
SEEK_END
);
ASSERT
(
pIdx
->
offset
>
TSDB_FILE_HEAD_SIZE
);
if
(
pIdx
->
offset
<
0
)
return
-
1
;
if
(
tsendfile
(
pHelper
->
files
.
nHeadF
.
fd
,
pHelper
->
files
.
headF
.
fd
,
NULL
,
pIdx
->
len
)
<
pIdx
->
len
)
return
-
1
;
...
...
@@ -377,6 +376,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) {
}
else
{
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHelper
->
pCompInfo
,
pIdx
->
len
);
pIdx
->
offset
=
lseek
(
pHelper
->
files
.
nHeadF
.
fd
,
0
,
SEEK_END
);
ASSERT
(
pIdx
->
offset
>
TSDB_FILE_HEAD_SIZE
);
if
(
pIdx
->
offset
<
0
)
return
-
1
;
if
(
twrite
(
pHelper
->
files
.
nHeadF
.
fd
,
(
void
*
)(
pHelper
->
pCompInfo
),
pIdx
->
len
)
<
pIdx
->
len
)
return
-
1
;
...
...
@@ -919,15 +919,18 @@ static int tsdbInsertSuperBlock(SRWHelper *pHelper, SCompBlock *pCompBlock, int
}
// Memmove if needed
int
tsize
=
pIdx
->
len
-
(
sizeof
(
SComp
Data
)
+
sizeof
(
SCompCol
)
*
blkIdx
);
int
tsize
=
pIdx
->
len
-
(
sizeof
(
SComp
Info
)
+
sizeof
(
SCompBlock
)
*
blkIdx
);
if
(
tsize
>
0
)
{
memmove
((
void
*
)((
char
*
)
pHelper
->
pCompInfo
+
sizeof
(
SCompData
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)),
(
void
*
)((
char
*
)
pHelper
->
pCompInfo
+
sizeof
(
SCompData
)
+
sizeof
(
SCompBlock
)
*
blkIdx
),
tsize
);
ASSERT
(
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)
<
tsizeof
(
pHelper
->
pCompInfo
));
ASSERT
(
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)
+
tsize
<=
tsizeof
(
pHelper
->
pCompInfo
));
memmove
((
void
*
)((
char
*
)
pHelper
->
pCompInfo
+
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
(
blkIdx
+
1
)),
(
void
*
)((
char
*
)
pHelper
->
pCompInfo
+
sizeof
(
SCompInfo
)
+
sizeof
(
SCompBlock
)
*
blkIdx
),
tsize
);
}
pHelper
->
pCompInfo
->
blocks
[
blkIdx
]
=
*
pCompBlock
;
pIdx
->
numOfSuperBlocks
++
;
pIdx
->
len
+=
sizeof
(
SCompBlock
);
ASSERT
(
pIdx
->
len
<=
tsizeof
(
pHelper
->
pCompInfo
));
pIdx
->
maxKey
=
pHelper
->
pCompInfo
->
blocks
[
pIdx
->
numOfSuperBlocks
-
1
].
keyLast
;
pIdx
->
hasLast
=
pHelper
->
pCompInfo
->
blocks
[
pIdx
->
numOfSuperBlocks
-
1
].
last
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录