Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
eac38475
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
eac38475
编写于
10月 27, 2022
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: new reseek callback to separate tsdb & cache readers
上级
545607cc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
16 deletion
+26
-16
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+8
-5
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+7
-1
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+4
-5
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+7
-5
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
eac38475
...
...
@@ -207,10 +207,12 @@ int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, in
uint8_t
**
ppBuf
);
// tsdbMemTable ==============================================================================================
// SMemTable
typedef
int32_t
(
*
_tsdb_reseek_func_t
)(
void
*
pQHandle
);
int32_t
tsdbMemTableCreate
(
STsdb
*
pTsdb
,
SMemTable
**
ppMemTable
);
void
tsdbMemTableDestroy
(
SMemTable
*
pMemTable
);
STbData
*
tsdbGetTbDataFromMemTable
(
SMemTable
*
pMemTable
,
tb_uid_t
suid
,
tb_uid_t
uid
);
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
void
*
pQHandle
,
SQueryNode
**
ppNode
);
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
void
*
pQHandle
,
_tsdb_reseek_func_t
reseek
,
SQueryNode
**
ppNode
);
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
SQueryNode
*
pNode
);
SArray
*
tsdbMemTableGetTbDataArray
(
SMemTable
*
pMemTable
);
// STbDataIter
...
...
@@ -290,7 +292,7 @@ int32_t tsdbDelFReaderClose(SDelFReader **ppReader);
int32_t
tsdbReadDelData
(
SDelFReader
*
pReader
,
SDelIdx
*
pDelIdx
,
SArray
*
aDelData
);
int32_t
tsdbReadDelIdx
(
SDelFReader
*
pReader
,
SArray
*
aDelIdx
);
// tsdbRead.c ==============================================================================================
int32_t
tsdbTakeReadSnap
(
STsdbReader
*
pReader
,
STsdbReadSnap
**
ppSnap
);
int32_t
tsdbTakeReadSnap
(
STsdbReader
*
pReader
,
_tsdb_reseek_func_t
reseek
,
STsdbReadSnap
**
ppSnap
);
void
tsdbUntakeReadSnap
(
STsdbReader
*
pReader
,
STsdbReadSnap
*
pSnap
);
// tsdbMerge.c ==============================================================================================
int32_t
tsdbMerge
(
STsdb
*
pTsdb
);
...
...
@@ -362,9 +364,10 @@ struct STbData {
};
struct
SQueryNode
{
SQueryNode
*
pNext
;
SQueryNode
**
ppNext
;
void
*
pQHandle
;
SQueryNode
*
pNext
;
SQueryNode
**
ppNext
;
void
*
pQHandle
;
_tsdb_reseek_func_t
reseek
;
};
struct
SMemTable
{
...
...
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
eac38475
...
...
@@ -194,6 +194,12 @@ static void freeItem(void* pItem) {
}
}
static
int32_t
tsdbCacheQueryReseek
(
void
*
pQHandle
)
{
int32_t
code
=
0
;
return
code
;
}
int32_t
tsdbRetrieveCacheRows
(
void
*
pReader
,
SSDataBlock
*
pResBlock
,
const
int32_t
*
slotIds
,
SArray
*
pTableUidList
)
{
if
(
pReader
==
NULL
||
pResBlock
==
NULL
)
{
return
TSDB_CODE_INVALID_PARA
;
...
...
@@ -237,7 +243,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
taosArrayPush
(
pLastCols
,
&
p
);
}
tsdbTakeReadSnap
(
NULL
,
&
pr
->
pReadSnap
);
tsdbTakeReadSnap
(
NULL
,
tsdbCacheQueryReseek
,
&
pr
->
pReadSnap
);
pr
->
pDataFReader
=
NULL
;
pr
->
pDataFReaderLast
=
NULL
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
eac38475
...
...
@@ -636,7 +636,7 @@ _err:
int32_t
tsdbGetNRowsInTbData
(
STbData
*
pTbData
)
{
return
pTbData
->
sl
.
size
;
}
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
void
*
pQHandle
,
SQueryNode
**
ppNode
)
{
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
void
*
pQHandle
,
_tsdb_reseek_func_t
reseek
,
SQueryNode
**
ppNode
)
{
int32_t
code
=
0
;
int32_t
nRef
=
atomic_fetch_add_32
(
&
pMemTable
->
nRef
,
1
);
...
...
@@ -649,6 +649,7 @@ int32_t tsdbRefMemTable(SMemTable *pMemTable, void *pQHandle, SQueryNode **ppNod
goto
_exit
;
}
(
*
ppNode
)
->
pQHandle
=
pQHandle
;
(
*
ppNode
)
->
reseek
=
reseek
;
(
*
ppNode
)
->
pNext
=
pMemTable
->
qList
.
pNext
;
(
*
ppNode
)
->
ppNext
=
&
pMemTable
->
qList
.
pNext
;
pMemTable
->
qList
.
pNext
->
ppNext
=
&
(
*
ppNode
)
->
pNext
;
...
...
@@ -714,8 +715,6 @@ _exit:
return
aTbDataP
;
}
extern
int32_t
tsdbSetQueryReseek
(
void
*
pQHandle
);
int32_t
tsdbRecycleMemTable
(
SMemTable
*
pMemTable
)
{
int32_t
code
=
0
;
...
...
@@ -725,11 +724,11 @@ int32_t tsdbRecycleMemTable(SMemTable *pMemTable) {
SQueryNode
*
pNextNode
=
pNode
->
pNext
;
if
(
pNextNode
==
&
pMemTable
->
qList
)
{
code
=
tsdbSetQueryReseek
(
pNode
->
pQHandle
);
code
=
(
*
pNode
->
reseek
)
(
pNode
->
pQHandle
);
if
(
code
)
goto
_exit
;
break
;
}
else
{
code
=
tsdbSetQueryReseek
(
pNode
->
pQHandle
);
code
=
(
*
pNode
->
reseek
)
(
pNode
->
pQHandle
);
if
(
code
)
goto
_exit
;
pNode
=
pMemTable
->
qList
.
pNext
;
ASSERT
(
pNode
==
pNextNode
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
eac38475
...
...
@@ -3489,6 +3489,8 @@ static int32_t doOpenReaderImpl(STsdbReader* pReader) {
}
// ====================================== EXPOSED APIs ======================================
static
int32_t
tsdbSetQueryReseek
(
void
*
pQHandle
);
int32_t
tsdbReaderOpen
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
SArray
*
pTableList
,
STsdbReader
**
ppReader
,
const
char
*
idstr
)
{
STimeWindow
window
=
pCond
->
twindows
;
...
...
@@ -3570,7 +3572,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
}
if
(
numOfTables
>
0
)
{
code
=
tsdbTakeReadSnap
(
pReader
,
&
pReader
->
pReadSnap
);
code
=
tsdbTakeReadSnap
(
pReader
,
tsdbSetQueryReseek
,
&
pReader
->
pReadSnap
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
...
...
@@ -4106,7 +4108,7 @@ int32_t tsdbGetTableSchema(SVnode* pVnode, int64_t uid, STSchema** pSchema, int6
return
TSDB_CODE_SUCCESS
;
}
int32_t
tsdbTakeReadSnap
(
STsdbReader
*
pReader
,
STsdbReadSnap
**
ppSnap
)
{
int32_t
tsdbTakeReadSnap
(
STsdbReader
*
pReader
,
_tsdb_reseek_func_t
reseek
,
STsdbReadSnap
**
ppSnap
)
{
int32_t
code
=
0
;
STsdb
*
pTsdb
=
pReader
->
pTsdb
;
SVersionRange
*
pRange
=
&
pReader
->
verRange
;
...
...
@@ -4127,12 +4129,12 @@ int32_t tsdbTakeReadSnap(STsdbReader* pReader, STsdbReadSnap** ppSnap) {
// take snapshot
if
(
pTsdb
->
mem
&&
(
pRange
->
minVer
<=
pTsdb
->
mem
->
maxVer
&&
pRange
->
maxVer
>=
pTsdb
->
mem
->
minVer
))
{
tsdbRefMemTable
(
pTsdb
->
mem
,
pReader
,
&
(
*
ppSnap
)
->
pNode
);
tsdbRefMemTable
(
pTsdb
->
mem
,
pReader
,
reseek
,
&
(
*
ppSnap
)
->
pNode
);
(
*
ppSnap
)
->
pMem
=
pTsdb
->
mem
;
}
if
(
pTsdb
->
imem
&&
(
pRange
->
minVer
<=
pTsdb
->
imem
->
maxVer
&&
pRange
->
maxVer
>=
pTsdb
->
imem
->
minVer
))
{
tsdbRefMemTable
(
pTsdb
->
imem
,
pReader
,
&
(
*
ppSnap
)
->
pINode
);
tsdbRefMemTable
(
pTsdb
->
imem
,
pReader
,
reseek
,
&
(
*
ppSnap
)
->
pINode
);
(
*
ppSnap
)
->
pIMem
=
pTsdb
->
imem
;
}
...
...
@@ -4173,7 +4175,7 @@ void tsdbUntakeReadSnap(STsdbReader* pReader, STsdbReadSnap* pSnap) {
tsdbTrace
(
"vgId:%d, untake read snapshot"
,
TD_VID
(
pTsdb
->
pVnode
));
}
int32_t
tsdbSetQueryReseek
(
void
*
pQHandle
)
{
static
int32_t
tsdbSetQueryReseek
(
void
*
pQHandle
)
{
int32_t
code
=
0
;
// lock handle
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录