Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
40dd9564
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看板
提交
40dd9564
编写于
6月 29, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more work
上级
0dbdc3d6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
57 addition
and
75 deletion
+57
-75
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+0
-1
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+35
-70
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+2
-1
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+19
-2
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+1
-1
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
40dd9564
...
...
@@ -138,7 +138,6 @@ void tColDataClear(void *ph);
int32_t
tColDataAppendValue
(
SColData
*
pColData
,
SColVal
*
pColVal
);
int32_t
tColDataCopy
(
SColData
*
pColDataSrc
,
SColData
*
pColDataDest
);
int32_t
tColDataGetValue
(
SColData
*
pColData
,
int32_t
iRow
,
SColVal
*
pColVal
);
int32_t
tColDataPCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
// SBlockData
#define tBlockDataFirstRow(PBLOCKDATA) tsdbRowFromBlockData(PBLOCKDATA, 0)
#define tBlockDataLastRow(PBLOCKDATA) tsdbRowFromBlockData(PBLOCKDATA, (PBLOCKDATA)->nRow - 1)
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
40dd9564
...
...
@@ -415,10 +415,6 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, STbDataIter *pIter, SB
TSDBROW
*
pRow1
;
TSDBROW
row2
;
TSDBROW
*
pRow2
=
&
row2
;
TSDBROW
row
;
TSDBROW
*
pRow
=
&
row
;
int32_t
c
=
0
;
TSKEY
lastKey
;
// read SBlockData
code
=
tsdbReadBlockData
(
pCommitter
->
pReader
,
pBlockIdx
,
pBlockMerge
,
pBlockDataMerge
,
NULL
,
NULL
);
...
...
@@ -432,7 +428,6 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, STbDataIter *pIter, SB
code
=
tsdbCommitterUpdateSchema
(
pCommitter
,
pBlockIdx
->
suid
,
pBlockIdx
->
uid
,
TSDBROW_SVERSION
(
pRow1
));
if
(
code
)
goto
_err
;
lastKey
=
TSKEY_MIN
;
tBlockReset
(
pBlock
);
tBlockDataReset
(
pBlockData
);
while
(
true
)
{
...
...
@@ -445,68 +440,56 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, STbDataIter *pIter, SB
}
if
(
pRow1
&&
pRow2
)
{
if
(
tsdbRowCmprFn
(
pRow1
,
pRow2
)
<
0
)
{
*
pRow
=
*
pRow1
;
tsdbTbDataIterNext
(
pIter
);
pRow1
=
tsdbTbDataIterGet
(
pIter
);
if
(
pRow1
)
{
if
(
tsdbKeyCmprFn
(
&
TSDBROW_KEY
(
pRow1
),
&
toKey
)
<
0
)
{
code
=
tsdbCommitterUpdateSchema
(
pCommitter
,
pBlockIdx
->
suid
,
pBlockIdx
->
uid
,
TSDBROW_VERSION
(
pRow1
));
if
(
code
)
goto
_err
;
}
else
{
pRow1
=
NULL
;
}
}
}
else
if
(
tsdbRowCmprFn
(
pRow1
,
pRow2
)
>
0
)
{
*
pRow
=
*
pRow2
;
if
(
pRow2
->
iRow
+
1
<
pBlockDataMerge
->
nRow
)
{
*
pRow2
=
tsdbRowFromBlockData
(
pBlockDataMerge
,
pRow2
->
iRow
+
1
);
}
else
{
pRow2
=
NULL
;
}
int32_t
c
=
tsdbRowCmprFn
(
pRow1
,
pRow2
);
if
(
c
<
0
)
{
goto
_append_mem_row
;
}
else
if
(
c
>
0
)
{
goto
_append_block_row
;
}
else
{
ASSERT
(
0
);
}
}
else
if
(
pRow1
)
{
*
pRow
=
*
pRow1
;
tsdbTbDataIterNext
(
pIter
);
pRow1
=
tsdbTbDataIterGet
(
pIter
);
if
(
pRow1
)
{
if
(
tsdbKeyCmprFn
(
&
TSDBROW_KEY
(
pRow1
),
&
toKey
)
<
0
)
{
code
=
tsdbCommitterUpdateSchema
(
pCommitter
,
pBlockIdx
->
suid
,
pBlockIdx
->
uid
,
TSDBROW_VERSION
(
pRow1
));
if
(
code
)
goto
_err
;
}
else
{
pRow1
=
NULL
;
}
}
goto
_append_mem_row
;
}
else
{
*
pRow
=
*
pRow2
;
goto
_append_block_row
;
}
_append_mem_row:
code
=
tBlockDataAppendRow
(
pBlockData
,
pRow1
,
pCommitter
->
pTSchema
);
if
(
code
)
goto
_err
;
if
(
pRow2
->
iRow
+
1
<
pBlockDataMerge
->
nRow
)
{
*
pRow2
=
tsdbRowFromBlockData
(
pBlockDataMerge
,
pRow2
->
iRow
+
1
);
tsdbTbDataIterNext
(
pIter
);
pRow1
=
tsdbTbDataIterGet
(
pIter
);
if
(
pRow1
)
{
if
(
tsdbKeyCmprFn
(
&
TSDBROW_KEY
(
pRow1
),
&
toKey
)
<
0
)
{
code
=
tsdbCommitterUpdateSchema
(
pCommitter
,
pBlockIdx
->
suid
,
pBlockIdx
->
uid
,
TSDBROW_SVERSION
(
pRow1
));
if
(
code
)
goto
_err
;
}
else
{
pRow
2
=
NULL
;
pRow
1
=
NULL
;
}
}
code
=
tBlockDataAppendRow
(
pBlockData
,
pRow
,
pCommitter
->
pTSchema
);
if
(
pBlockData
->
nRow
>=
pCommitter
->
maxRow
*
4
/
5
)
{
goto
_write_block
;
}
else
{
continue
;
}
_append_block_row:
code
=
tBlockDataAppendRow
(
pBlockData
,
pRow1
,
NULL
);
if
(
code
)
goto
_err
;
pBlock
->
minVersion
=
TMIN
(
pBlock
->
minVersion
,
TSDBROW_VERSION
(
pRow
));
pBlock
->
maxVersion
=
TMAX
(
pBlock
->
maxVersion
,
TSDBROW_VERSION
(
pRow
));
pBlock
->
nRow
++
;
if
(
lastKey
==
TSDBROW_TS
(
pRow
))
{
pBlock
->
hasDup
=
1
;
if
(
pRow2
->
iRow
+
1
<
pBlockDataMerge
->
nRow
)
{
*
pRow2
=
tsdbRowFromBlockData
(
pBlockDataMerge
,
pRow2
->
iRow
+
1
);
}
else
{
lastKey
=
TSDBROW_TS
(
pRow
)
;
pRow2
=
NULL
;
}
if
(
pBlockData
->
nRow
>=
pCommitter
->
maxRow
*
4
/
5
)
goto
_write_block
;
continue
;
if
(
pBlockData
->
nRow
>=
pCommitter
->
maxRow
*
4
/
5
)
{
goto
_write_block
;
}
else
{
continue
;
}
_write_block:
if
(
!
toDataOnly
&&
pBlockData
->
nRow
<
pCommitter
->
minRow
)
{
...
...
@@ -521,7 +504,6 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, STbDataIter *pIter, SB
code
=
tMapDataPutItem
(
&
pCommitter
->
nBlockMap
,
pBlock
,
tPutBlock
);
if
(
code
)
goto
_err
;
lastKey
=
TSKEY_MIN
;
tBlockReset
(
pBlock
);
tBlockDataReset
(
pBlockData
);
}
...
...
@@ -538,7 +520,6 @@ static int32_t tsdbCommitTableMemData(SCommitter *pCommitter, STbDataIter *pIter
TSDBROW
*
pRow
;
SBlock
*
pBlock
=
&
pCommitter
->
nBlock
;
SBlockData
*
pBlockData
=
&
pCommitter
->
nBlockData
;
TSKEY
lastKey
=
TSKEY_MIN
;
int64_t
suid
=
pIter
->
pTbData
->
suid
;
int64_t
uid
=
pIter
->
pTbData
->
uid
;
...
...
@@ -563,16 +544,6 @@ static int32_t tsdbCommitTableMemData(SCommitter *pCommitter, STbDataIter *pIter
code
=
tBlockDataAppendRow
(
pBlockData
,
pRow
,
pCommitter
->
pTSchema
);
if
(
code
)
goto
_err
;
// update
pBlock
->
minVersion
=
TMIN
(
pBlock
->
minVersion
,
TSDBROW_VERSION
(
pRow
));
pBlock
->
maxVersion
=
TMIN
(
pBlock
->
maxVersion
,
TSDBROW_VERSION
(
pRow
));
pBlock
->
nRow
++
;
if
(
TSDBROW_TS
(
pRow
)
==
lastKey
)
{
pBlock
->
hasDup
=
1
;
}
else
{
lastKey
=
TSDBROW_TS
(
pRow
);
}
tsdbTbDataIterNext
(
pIter
);
pRow
=
tsdbTbDataIterGet
(
pIter
);
if
(
pRow
&&
tsdbKeyCmprFn
(
&
TSDBROW_KEY
(
pRow
),
&
toKey
)
>=
0
)
pRow
=
NULL
;
...
...
@@ -596,7 +567,6 @@ static int32_t tsdbCommitTableMemData(SCommitter *pCommitter, STbDataIter *pIter
tBlockReset
(
pBlock
);
tBlockDataReset
(
pBlockData
);
lastKey
=
TSKEY_MIN
;
}
return
code
;
...
...
@@ -614,12 +584,7 @@ static int32_t tsdbCommitTableDiskData(SCommitter *pCommitter, SBlock *pBlock, S
if
(
code
)
goto
_err
;
tBlockReset
(
&
pCommitter
->
nBlock
);
pCommitter
->
nBlock
.
minKey
=
pBlock
->
minKey
;
pCommitter
->
nBlock
.
maxKey
=
pBlock
->
maxKey
;
pCommitter
->
nBlock
.
minVersion
=
pBlock
->
minVersion
;
pCommitter
->
nBlock
.
nRow
=
pBlock
->
nRow
;
pCommitter
->
nBlock
.
last
=
pBlock
->
last
;
pCommitter
->
nBlock
.
hasDup
=
pBlock
->
hasDup
;
code
=
tsdbWriteBlockData
(
pCommitter
->
pWriter
,
&
pCommitter
->
oBlockData
,
NULL
,
NULL
,
pBlockIdx
,
&
pCommitter
->
nBlock
,
pCommitter
->
cmprAlg
);
if
(
code
)
goto
_err
;
...
...
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
40dd9564
...
...
@@ -176,7 +176,8 @@ static int32_t tsdbApplyDFileSetChange(STsdbFS *pFS, SDFileSet *pFrom, SDFileSet
if
(
pFrom
&&
pTo
)
{
// head
if
(
tsdbFileIsSame
(
pFrom
,
pTo
,
TSDB_HEAD_FILE
))
{
ASSERT
(
0
);
ASSERT
(
pFrom
->
fHead
.
size
==
pTo
->
fHead
.
size
);
ASSERT
(
pFrom
->
fHead
.
offset
==
pTo
->
fHead
.
offset
);
}
else
{
tsdbDataFileName
(
pFS
->
pTsdb
,
pFrom
,
TSDB_HEAD_FILE
,
fname
);
taosRemoveFile
(
fname
);
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
40dd9564
...
...
@@ -1220,8 +1220,25 @@ int32_t tsdbWriteBlockData(SDataFWriter *pWriter, SBlockData *pBlockData, uint8_
if
(
!
ppBuf1
)
ppBuf1
=
&
pBuf1
;
if
(
!
ppBuf2
)
ppBuf2
=
&
pBuf2
;
pBlock
->
minKey
=
MIN_TSDBKEY
(
pBlock
->
minKey
,
tBlockDataFirstKey
(
pBlockData
));
pBlock
->
maxKey
=
MAX_TSDBKEY
(
pBlock
->
maxKey
,
tBlockDataLastKey
(
pBlockData
));
TSKEY
lastKey
=
TSKEY_MIN
;
for
(
int32_t
iRow
=
0
;
iRow
<
pBlockData
->
nRow
;
iRow
++
)
{
TSDBKEY
key
=
TSDBROW_KEY
(
&
tsdbRowFromBlockData
(
pBlockData
,
iRow
));
if
(
iRow
==
0
)
{
pBlock
->
minKey
=
MIN_TSDBKEY
(
pBlock
->
minKey
,
key
);
}
if
(
iRow
==
pBlockData
->
nRow
-
1
)
{
pBlock
->
maxKey
=
MAX_TSDBKEY
(
pBlock
->
maxKey
,
key
);
}
pBlock
->
minVersion
=
TMIN
(
pBlock
->
minVersion
,
key
.
version
);
pBlock
->
maxVersion
=
TMAX
(
pBlock
->
maxVersion
,
key
.
version
);
if
(
key
.
ts
==
lastKey
)
{
pBlock
->
hasDup
=
1
;
}
lastKey
=
key
.
ts
;
}
pBlock
->
nRow
+=
pBlockData
->
nRow
;
pSubBlock
->
nRow
=
pBlockData
->
nRow
;
pSubBlock
->
cmprAlg
=
cmprAlg
;
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
40dd9564
...
...
@@ -1085,7 +1085,7 @@ _exit:
return
code
;
}
int32_t
tColDataPCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
static
FORCE_INLINE
int32_t
tColDataPCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
SColData
*
pColData1
=
*
(
SColData
**
)
p1
;
SColData
*
pColData2
=
*
(
SColData
**
)
p2
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录