Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cbd24bb2
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看板
提交
cbd24bb2
编写于
8月 16, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: do some internal refactor
上级
4ea58e56
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
48 addition
and
59 deletion
+48
-59
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+0
-7
source/dnode/vnode/src/tsdb/tsdbCommit2.c
source/dnode/vnode/src/tsdb/tsdbCommit2.c
+1
-0
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+27
-32
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+4
-4
source/dnode/vnode/src/tsdb/tsdbRead2.c
source/dnode/vnode/src/tsdb/tsdbRead2.c
+7
-7
source/dnode/vnode/src/tsdb/tsdbReadUtil.c
source/dnode/vnode/src/tsdb/tsdbReadUtil.c
+7
-7
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
+2
-2
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
cbd24bb2
...
...
@@ -731,13 +731,6 @@ typedef struct SSttBlockLoadInfo {
bool
sttBlockLoaded
;
SSttBlockLoadCostInfo
cost
;
// keep the last access position, this position may be used to reduce the binary times for
// starting last block data for a new table
struct
{
int32_t
blockIndex
;
int32_t
rowIndex
;
}
prevEndPos
;
}
SSttBlockLoadInfo
;
typedef
struct
SMergeTree
{
...
...
source/dnode/vnode/src/tsdb/tsdbCommit2.c
浏览文件 @
cbd24bb2
...
...
@@ -530,6 +530,7 @@ static int32_t tsdbCloseCommitter(SCommitter2 *committer, int32_t eno) {
ASSERT
(
committer
->
tombIterMerger
==
NULL
);
TARRAY2_DESTROY
(
committer
->
dataIterArray
,
NULL
);
TARRAY2_DESTROY
(
committer
->
tombIterArray
,
NULL
);
TARRAY2_DESTROY
(
committer
->
sttReaderArray
,
NULL
);
TARRAY2_DESTROY
(
committer
->
fopArray
,
NULL
);
tsdbFSDestroyCopySnapshot
(
&
committer
->
fsetArr
);
...
...
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
cbd24bb2
...
...
@@ -120,14 +120,10 @@ void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
pLoadInfo
->
blockIndex
[
0
]
=
-
1
;
pLoadInfo
->
blockIndex
[
1
]
=
-
1
;
tStatisBlockDestroy
(
pLoadInfo
->
statisBlock
);
TARRAY2_DESTROY
((
TStatisBlkArray
*
)
pLoadInfo
->
pSttStatisBlkArray
,
NULL
);
tBlockDataDestroy
(
&
pLoadInfo
->
blockData
[
0
]);
tBlockDataDestroy
(
&
pLoadInfo
->
blockData
[
1
]);
taosArrayDestroy
(
pLoadInfo
->
aSttBlk
);
taosMemoryFree
(
pLoadInfo
);
return
NULL
;
}
...
...
@@ -395,28 +391,27 @@ static bool existsFromSttBlkStatis(SSttBlockLoadInfo *pBlockLoadInfo, uint64_t s
return
false
;
}
if
(
pBlockLoadInfo
->
statisBlock
==
NULL
)
{
pBlockLoadInfo
->
statisBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
STbStatisBlock
));
int64_t
st
=
taosGetTimestampMs
();
tsdbSttFileReadStatisBlock
(
pReader
,
p
,
pBlockLoadInfo
->
statisBlock
);
pBlockLoadInfo
->
statisBlockIndex
=
i
;
double
el
=
(
taosGetTimestampMs
()
-
st
)
/
1000
.
0
;
pBlockLoadInfo
->
cost
.
loadStatisBlocks
+=
1
;
pBlockLoadInfo
->
cost
.
statisElapsedTime
+=
el
;
}
else
if
(
pBlockLoadInfo
->
statisBlockIndex
!=
i
)
{
tStatisBlockDestroy
(
pBlockLoadInfo
->
statisBlock
);
int64_t
st
=
taosGetTimestampMs
();
tsdbSttFileReadStatisBlock
(
pReader
,
p
,
pBlockLoadInfo
->
statisBlock
);
pBlockLoadInfo
->
statisBlockIndex
=
i
;
double
el
=
(
taosGetTimestampMs
()
-
st
)
/
1000
.
0
;
pBlockLoadInfo
->
cost
.
loadStatisBlocks
+=
1
;
pBlockLoadInfo
->
cost
.
statisElapsedTime
+=
el
;
}
// if (pBlockLoadInfo->statisBlock == NULL) {
// pBlockLoadInfo->statisBlock = taosMemoryCalloc(1, sizeof(STbStatisBlock));
//
// int64_t st = taosGetTimestampMs();
// tsdbSttFileReadStatisBlock(pReader, p, pBlockLoadInfo->statisBlock);
// pBlockLoadInfo->statisBlockIndex = i;
//
// double el = (taosGetTimestampMs() - st) / 1000.0;
// pBlockLoadInfo->cost.loadStatisBlocks += 1;
// pBlockLoadInfo->cost.statisElapsedTime += el;
// } else if (pBlockLoadInfo->statisBlockIndex != i) {
// tStatisBlockDestroy(pBlockLoadInfo->statisBlock);
//
// int64_t st = taosGetTimestampMs();
// tsdbSttFileReadStatisBlock(pReader, p, pBlockLoadInfo->statisBlock);
// pBlockLoadInfo->statisBlockIndex = i;
//
// double el = (taosGetTimestampMs() - st) / 1000.0;
// pBlockLoadInfo->cost.loadStatisBlocks += 1;
// pBlockLoadInfo->cost.statisElapsedTime += el;
// }
STbStatisBlock
*
pBlock
=
pBlockLoadInfo
->
statisBlock
;
int32_t
index
=
tarray2SearchIdx
(
pBlock
->
suid
,
&
suid
,
sizeof
(
int64_t
),
suidComparFn
,
TD_EQ
);
...
...
@@ -517,12 +512,12 @@ int32_t tLDataIterOpen2(SLDataIter *pIter, SSttFileReader *pSttFileReader, int32
}
}
bool
exists
=
existsFromSttBlkStatis
(
pBlockLoadInfo
,
suid
,
uid
,
pIter
->
pReader
);
if
(
!
exists
)
{
pIter
->
iSttBlk
=
-
1
;
pIter
->
pSttBlk
=
NULL
;
return
TSDB_CODE_SUCCESS
;
}
//
bool exists = existsFromSttBlkStatis(pBlockLoadInfo, suid, uid, pIter->pReader);
//
if (!exists) {
//
pIter->iSttBlk = -1;
//
pIter->pSttBlk = NULL;
//
return TSDB_CODE_SUCCESS;
//
}
// find the start block, actually we could load the position to avoid repeatly searching for the start position when
// the skey is updated.
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
cbd24bb2
...
...
@@ -63,7 +63,7 @@ typedef struct STableBlockScanInfo {
SIterInfo
iiter
;
// imem buffer skip list iterator
SArray
*
delSkyline
;
// delete info for this table
int32_t
fileDelIndex
;
// file block delete index
int32_t
las
tBlockDelIndex
;
// delete index for last block
int32_t
st
tBlockDelIndex
;
// delete index for last block
bool
iterInit
;
// whether to initialize the in-memory skip list iterator or not
}
STableBlockScanInfo
;
...
...
@@ -1976,7 +1976,7 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc
pLastBlockReader
->
currentKey
=
key
;
pScanInfo
->
lastKeyInStt
=
key
;
if
(
!
hasBeenDropped
(
pScanInfo
->
delSkyline
,
&
pScanInfo
->
las
tBlockDelIndex
,
key
,
ver
,
pLastBlockReader
->
order
,
if
(
!
hasBeenDropped
(
pScanInfo
->
delSkyline
,
&
pScanInfo
->
st
tBlockDelIndex
,
key
,
ver
,
pLastBlockReader
->
order
,
pVerRange
))
{
return
true
;
}
...
...
@@ -3018,7 +3018,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, STsdbReader*
pBlockScanInfo
->
iter
.
index
=
index
;
pBlockScanInfo
->
iiter
.
index
=
index
;
pBlockScanInfo
->
fileDelIndex
=
index
;
pBlockScanInfo
->
las
tBlockDelIndex
=
index
;
pBlockScanInfo
->
st
tBlockDelIndex
=
index
;
return
code
;
...
...
@@ -4029,7 +4029,7 @@ int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockSc
tsdbRowMergerAdd
(
pMerger
,
pRow1
,
NULL
);
}
else
{
tsdbTrace
(
"uid:%"
PRIu64
" last del index:%d, del range:%d, lastKeyInStt:%"
PRId64
", %s"
,
pScanInfo
->
uid
,
pScanInfo
->
las
tBlockDelIndex
,
(
int32_t
)
taosArrayGetSize
(
pScanInfo
->
delSkyline
),
pScanInfo
->
lastKeyInStt
,
pScanInfo
->
st
tBlockDelIndex
,
(
int32_t
)
taosArrayGetSize
(
pScanInfo
->
delSkyline
),
pScanInfo
->
lastKeyInStt
,
idStr
);
break
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead2.c
浏览文件 @
cbd24bb2
...
...
@@ -1387,7 +1387,7 @@ static bool nextRowFromLastBlocks(SLastBlockReader* pLastBlockReader, STableBloc
pLastBlockReader
->
currentKey
=
key
;
pScanInfo
->
lastKeyInStt
=
key
;
if
(
!
hasBeenDropped
(
pScanInfo
->
delSkyline
,
&
pScanInfo
->
las
tBlockDelIndex
,
key
,
ver
,
pLastBlockReader
->
order
,
if
(
!
hasBeenDropped
(
pScanInfo
->
delSkyline
,
&
pScanInfo
->
st
tBlockDelIndex
,
key
,
ver
,
pLastBlockReader
->
order
,
pVerRange
))
{
return
true
;
}
...
...
@@ -2406,7 +2406,7 @@ int32_t getInitialDelIndex(const SArray* pDelSkyline, int32_t order) {
int32_t
initDelSkylineIterator
(
STableBlockScanInfo
*
pBlockScanInfo
,
int32_t
order
,
SCostSummary
*
pCost
)
{
int32_t
code
=
0
;
int32_t
newDelDataInFile
=
taosArrayGetSize
(
pBlockScanInfo
->
p
f
ileDelData
);
int32_t
newDelDataInFile
=
taosArrayGetSize
(
pBlockScanInfo
->
p
F
ileDelData
);
if
(
newDelDataInFile
==
0
&&
((
pBlockScanInfo
->
delSkyline
!=
NULL
)
||
(
TARRAY_SIZE
(
pBlockScanInfo
->
pMemDelData
)
==
0
)))
{
return
code
;
...
...
@@ -2420,7 +2420,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, int32_t orde
pBlockScanInfo
->
delSkyline
=
taosArrayInit
(
4
,
sizeof
(
TSDBKEY
));
}
SArray
*
pSource
=
pBlockScanInfo
->
p
f
ileDelData
;
SArray
*
pSource
=
pBlockScanInfo
->
p
F
ileDelData
;
if
(
pSource
==
NULL
)
{
pSource
=
pBlockScanInfo
->
pMemDelData
;
}
else
{
...
...
@@ -2429,13 +2429,13 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, int32_t orde
code
=
tsdbBuildDeleteSkyline
(
pSource
,
0
,
taosArrayGetSize
(
pSource
)
-
1
,
pBlockScanInfo
->
delSkyline
);
taosArrayClear
(
pBlockScanInfo
->
p
f
ileDelData
);
taosArrayClear
(
pBlockScanInfo
->
p
F
ileDelData
);
int32_t
index
=
getInitialDelIndex
(
pBlockScanInfo
->
delSkyline
,
order
);
pBlockScanInfo
->
iter
.
index
=
index
;
pBlockScanInfo
->
iiter
.
index
=
index
;
pBlockScanInfo
->
fileDelIndex
=
index
;
pBlockScanInfo
->
las
tBlockDelIndex
=
index
;
pBlockScanInfo
->
st
tBlockDelIndex
=
index
;
double
el
=
taosGetTimestampUs
()
-
st
;
pCost
->
createSkylineIterTime
=
el
/
1000
.
0
;
...
...
@@ -3409,7 +3409,7 @@ int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockSc
tsdbRowMergerAdd
(
pMerger
,
pRow1
,
NULL
);
}
else
{
tsdbTrace
(
"uid:%"
PRIu64
" last del index:%d, del range:%d, lastKeyInStt:%"
PRId64
", %s"
,
pScanInfo
->
uid
,
pScanInfo
->
las
tBlockDelIndex
,
(
int32_t
)
taosArrayGetSize
(
pScanInfo
->
delSkyline
),
pScanInfo
->
lastKeyInStt
,
pScanInfo
->
st
tBlockDelIndex
,
(
int32_t
)
taosArrayGetSize
(
pScanInfo
->
delSkyline
),
pScanInfo
->
lastKeyInStt
,
idStr
);
break
;
}
...
...
@@ -4133,7 +4133,7 @@ int32_t tsdbReaderSuspend2(STsdbReader* pReader) {
}
pInfo
->
delSkyline
=
taosArrayDestroy
(
pInfo
->
delSkyline
);
pInfo
->
p
fileDelData
=
taosArrayDestroy
(
pInfo
->
pf
ileDelData
);
pInfo
->
p
FileDelData
=
taosArrayDestroy
(
pInfo
->
pF
ileDelData
);
}
}
else
{
// resetDataBlockScanInfo excluding lastKey
...
...
source/dnode/vnode/src/tsdb/tsdbReadUtil.c
浏览文件 @
cbd24bb2
...
...
@@ -221,7 +221,7 @@ void clearBlockScanInfo(STableBlockScanInfo* p) {
p
->
delSkyline
=
taosArrayDestroy
(
p
->
delSkyline
);
p
->
pBlockList
=
taosArrayDestroy
(
p
->
pBlockList
);
p
->
pMemDelData
=
taosArrayDestroy
(
p
->
pMemDelData
);
p
->
p
fileDelData
=
taosArrayDestroy
(
p
->
pf
ileDelData
);
p
->
p
FileDelData
=
taosArrayDestroy
(
p
->
pF
ileDelData
);
}
void
destroyAllBlockScanInfo
(
SSHashObj
*
pTableMap
)
{
...
...
@@ -238,7 +238,7 @@ void destroyAllBlockScanInfo(SSHashObj* pTableMap) {
static
void
doCleanupInfoForNextFileset
(
STableBlockScanInfo
*
pScanInfo
)
{
// reset the index in last block when handing a new file
taosArrayClear
(
pScanInfo
->
pBlockList
);
taosArrayClear
(
pScanInfo
->
p
f
ileDelData
);
// del data from each file set
taosArrayClear
(
pScanInfo
->
p
F
ileDelData
);
// del data from each file set
}
void
cleanupInfoFoxNextFileset
(
SSHashObj
*
pTableMap
)
{
...
...
@@ -502,14 +502,14 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_
if
(
newTable
)
{
(
*
pScanInfo
)
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
uid
,
pReader
->
idStr
);
if
((
*
pScanInfo
)
->
p
f
ileDelData
==
NULL
)
{
(
*
pScanInfo
)
->
p
f
ileDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
if
((
*
pScanInfo
)
->
p
F
ileDelData
==
NULL
)
{
(
*
pScanInfo
)
->
p
F
ileDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
}
}
if
(
record
.
version
<=
pReader
->
info
.
verRange
.
maxVer
)
{
SDelData
delData
=
{.
version
=
record
.
version
,
.
sKey
=
record
.
skey
,
.
eKey
=
record
.
ekey
};
taosArrayPush
((
*
pScanInfo
)
->
p
f
ileDelData
,
&
delData
);
taosArrayPush
((
*
pScanInfo
)
->
p
F
ileDelData
,
&
delData
);
}
}
...
...
@@ -556,8 +556,8 @@ static int32_t doLoadTombDataFromTombBlk(const TTombBlkArray* pTombBlkArray, STs
uint64_t
uid
=
pReader
->
status
.
uidList
.
tableUidList
[
j
];
STableBlockScanInfo
*
pScanInfo
=
getTableBlockScanInfo
(
pReader
->
status
.
pTableMap
,
uid
,
pReader
->
idStr
);
if
(
pScanInfo
->
p
f
ileDelData
==
NULL
)
{
pScanInfo
->
p
f
ileDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
if
(
pScanInfo
->
p
F
ileDelData
==
NULL
)
{
pScanInfo
->
p
F
ileDelData
=
taosArrayInit
(
4
,
sizeof
(
SDelData
));
}
ETombBlkCheckEnum
ret
=
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbReadUtil.h
浏览文件 @
cbd24bb2
...
...
@@ -65,12 +65,12 @@ typedef struct STableBlockScanInfo {
TSKEY
lastKeyInStt
;
// last accessed key in stt
SArray
*
pBlockList
;
// block data index list, SArray<SBrinRecord>
SArray
*
pMemDelData
;
// SArray<SDelData>
SArray
*
p
f
ileDelData
;
// SArray<SDelData> from each file set
SArray
*
p
F
ileDelData
;
// SArray<SDelData> from each file set
SIterInfo
iter
;
// mem buffer skip list iterator
SIterInfo
iiter
;
// imem buffer skip list iterator
SArray
*
delSkyline
;
// delete info for this table
int32_t
fileDelIndex
;
// file block delete index
int32_t
lastBlockDelIndex
;
// delete index for last block
int32_t
sttBlockDelIndex
;
// delete index for last block
bool
iterInit
;
// whether to initialize the in-memory skip list iterator or not
}
STableBlockScanInfo
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录