Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
185081a9
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看板
提交
185081a9
编写于
7月 19, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tsdb/fsreader: clear last fileset's resources
上级
a127e915
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
66 deletion
+21
-66
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+20
-65
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+1
-1
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
185081a9
...
...
@@ -1932,6 +1932,10 @@ static void clearLastFileSet(SFSNextRowIter *state) {
tBlockDataDestroy
(
state
->
pBlockData
);
state
->
pBlockData
=
NULL
;
}
if
(
state
->
pFileReader
)
{
tsdbDataFileReaderClose
(
&
state
->
pFileReader
);
}
}
static
int32_t
getNextRowFromFS
(
void
*
iter
,
TSDBROW
**
ppRow
,
bool
*
pIgnoreEarlierTs
,
bool
isLast
,
int16_t
*
aCols
,
...
...
@@ -2008,7 +2012,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
goto
_err
;
}
for
(
int
i
=
TARRAY2_SIZE
(
pBlkArray
);
i
>=
0
;
--
i
)
{
for
(
int
i
=
TARRAY2_SIZE
(
pBlkArray
)
-
1
;
i
>=
0
;
--
i
)
{
SBrinBlk
*
pBrinBlk
=
&
pBlkArray
->
data
[
i
];
if
(
state
->
suid
>=
pBrinBlk
->
minTbid
.
suid
&&
state
->
suid
<=
pBrinBlk
->
maxTbid
.
suid
)
{
if
(
state
->
uid
>=
pBrinBlk
->
minTbid
.
uid
&&
state
->
uid
<=
pBrinBlk
->
maxTbid
.
uid
)
{
...
...
@@ -2023,11 +2027,15 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
int
indexSize
=
TARRAY_SIZE
(
state
->
pIndexList
);
if
(
indexSize
<=
0
)
{
// goto next fileset
clearLastFileSet
(
state
);
goto
_next_fileset
;
}
state
->
state
=
SFSNEXTROW_INDEXLIST
;
state
->
iBrinIndex
=
indexSize
;
}
else
{
// empty fileset, goto next fileset
// clearLastFileSet(state);
goto
_next_fileset
;
}
}
...
...
@@ -2035,6 +2043,8 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
SBrinBlk
*
pBrinBlk
=
NULL
;
_next_brinindex:
if
(
--
state
->
iBrinIndex
<
0
)
{
// no index left, goto next fileset
clearLastFileSet
(
state
);
goto
_next_fileset
;
}
else
{
pBrinBlk
=
taosArrayGet
(
state
->
pIndexList
,
state
->
iBrinIndex
);
}
...
...
@@ -2163,28 +2173,9 @@ int32_t clearNextRowFromFS(void *iter) {
if
(
!
state
)
{
return
code
;
}
/*
if (state->pDataFReader) {
tsdbDataFReaderClose(&state->pDataFReader);
state->pDataFReader = NULL;
}
if (state->aBlockIdx) {
// taosArrayDestroy(state->aBlockIdx);
tsdbBICacheRelease(state->pTsdb->biCache, state->aBlockIdxHandle);
state->aBlockIdxHandle = NULL;
state->aBlockIdx = NULL;
}
if (state->pBlockData) {
// tBlockDataDestroy(&state->blockData, 1);
tBlockDataDestroy(state->pBlockData);
state->pBlockData = NULL;
}
clearLastFileSet
(
state
);
if (state->blockMap.pData != NULL) {
tMapDataClear(&state->blockMap);
}
*/
return
code
;
}
...
...
@@ -2638,44 +2629,9 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs
pIter
->
pTsdb
=
pTsdb
;
pIter
->
pMemDelData
=
NULL
;
loadMemTombData
(
&
pIter
->
pMemDelData
,
pMem
,
pIMem
,
pr
->
info
.
verRange
.
maxVer
);
#if 0
pIter->pSkyline = taosArrayInit(32, sizeof(TSDBKEY));
SDelFile *pDelFile = pReadSnap->fs.pDelFile;
if (pDelFile) {
SDelFReader *pDelFReader;
code = tsdbDelFReaderOpen(&pDelFReader, pDelFile, pTsdb);
if (code) goto _err;
SArray *pDelIdxArray = taosArrayInit(32, sizeof(SDelIdx));
code = tsdbReadDelIdx(pDelFReader, pDelIdxArray);
if (code) {
taosArrayDestroy(pDelIdxArray);
tsdbDelFReaderClose(&pDelFReader);
goto _err;
}
SDelIdx *delIdx = taosArraySearch(pDelIdxArray, &(SDelIdx){.suid = suid, .uid = uid}, tCmprDelIdx, TD_EQ);
code = getTableDelSkyline(pMem, pIMem, pDelFReader, delIdx, pIter->pSkyline);
if (code) {
taosArrayDestroy(pDelIdxArray);
tsdbDelFReaderClose(&pDelFReader);
goto _err;
}
taosArrayDestroy(pDelIdxArray);
tsdbDelFReaderClose(&pDelFReader);
} else {
code = getTableDelSkyline(pMem, pIMem, NULL, NULL, pIter->pSkyline);
if (code) goto _err;
}
loadMemTombData
(
&
pIter
->
pMemDelData
,
pMem
,
pIMem
,
pr
->
info
.
verRange
.
maxVer
);
pIter->iSkyline = taosArrayGetSize(pIter->pSkyline) - 1;
#endif
pIter
->
idx
=
(
SBlockIdx
){.
suid
=
suid
,
.
uid
=
uid
};
pIter
->
fsState
.
pRowIter
=
pIter
;
...
...
@@ -2687,13 +2643,10 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs
pIter
->
fsState
.
suid
=
suid
;
pIter
->
fsState
.
uid
=
uid
;
pIter
->
fsState
.
lastTs
=
lastTs
;
pIter
->
fsState
.
pr
=
pr
;
pIter
->
input
[
0
]
=
(
TsdbNextRowState
){
&
pIter
->
memRow
,
true
,
false
,
false
,
&
pIter
->
memState
,
getNextRowFromMem
,
NULL
};
pIter
->
input
[
1
]
=
(
TsdbNextRowState
){
&
pIter
->
imemRow
,
true
,
false
,
false
,
&
pIter
->
imemState
,
getNextRowFromMem
,
NULL
};
/*
pIter->input[2] = (TsdbNextRowState){
&pIter->fsLastRow, false, true, false, &pIter->fsLastState, getNextRowFromFSLast, clearNextRowFromFSLast};
*/
pIter
->
input
[
2
]
=
(
TsdbNextRowState
){
&
pIter
->
fsRow
,
false
,
true
,
false
,
&
pIter
->
fsState
,
getNextRowFromFS
,
clearNextRowFromFS
};
...
...
@@ -2721,7 +2674,7 @@ _err:
static
int32_t
nextRowIterClose
(
CacheNextRowIter
*
pIter
)
{
int
code
=
0
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
if
(
pIter
->
input
[
i
].
nextRowClearFn
)
{
pIter
->
input
[
i
].
nextRowClearFn
(
pIter
->
input
[
i
].
iter
);
}
...
...
@@ -2770,7 +2723,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
int
nMax
=
0
;
TSKEY
maxKey
=
TSKEY_MIN
;
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
if
(
!
pIter
->
input
[
i
].
stop
&&
pIter
->
input
[
i
].
pRow
!=
NULL
)
{
TSDBKEY
key
=
TSDBROW_KEY
(
pIter
->
input
[
i
].
pRow
);
...
...
@@ -2802,9 +2755,11 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
uint64_t
uid
=
pIter
->
idx
.
uid
;
STableLoadInfo
*
pInfo
=
*
(
STableLoadInfo
**
)
tSimpleHashGet
(
pIter
->
pr
->
pTableMap
,
&
uid
,
sizeof
(
uid
));
SArray
*
pTombData
=
pInfo
->
pTombData
;
taosArrayAddAll
(
pTombData
,
pIter
->
pMemDelData
);
if
(
pTombData
)
{
taosArrayAddAll
(
pTombData
,
pIter
->
pMemDelData
);
code
=
tsdbBuildDeleteSkyline
(
pTombData
,
0
,
(
int32_t
)(
TARRAY_SIZE
(
pTombData
)
-
1
),
pIter
->
pSkyline
);
code
=
tsdbBuildDeleteSkyline
(
pTombData
,
0
,
(
int32_t
)(
TARRAY_SIZE
(
pTombData
)
-
1
),
pIter
->
pSkyline
);
}
pIter
->
iSkyline
=
taosArrayGetSize
(
pIter
->
pSkyline
)
-
1
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
185081a9
...
...
@@ -185,7 +185,7 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
uint64_t
uid
=
p
->
pTableList
[
i
].
uid
;
p
->
uidList
[
i
]
=
uid
;
STableLoadInfo
*
pInfo
=
taosMemory
Malloc
(
sizeof
(
STableLoadInfo
));
STableLoadInfo
*
pInfo
=
taosMemory
Calloc
(
1
,
sizeof
(
STableLoadInfo
));
tSimpleHashPut
(
p
->
pTableMap
,
&
uid
,
sizeof
(
uint64_t
),
&
pInfo
,
POINTER_BYTES
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录