Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f845a014
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,发现更多精彩内容 >>
提交
f845a014
编写于
9月 15, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
9b29931f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
6 deletion
+51
-6
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+2
-2
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+32
-4
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+17
-0
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
f845a014
...
...
@@ -207,7 +207,7 @@ int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, in
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
*
pQ
uery
Handle
,
SQueryNode
**
ppNode
);
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
void
*
pQHandle
,
SQueryNode
**
ppNode
);
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
SQueryNode
*
pNode
);
SArray
*
tsdbMemTableGetTbDataArray
(
SMemTable
*
pMemTable
);
// STbDataIter
...
...
@@ -369,7 +369,7 @@ struct STbData {
struct
SQueryNode
{
SQueryNode
*
pNext
;
SQueryNode
**
ppNext
;
void
*
pQ
uery
Handle
;
void
*
pQHandle
;
};
struct
SMemTable
{
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
f845a014
...
...
@@ -631,19 +631,19 @@ _err:
int32_t
tsdbGetNRowsInTbData
(
STbData
*
pTbData
)
{
return
pTbData
->
sl
.
size
;
}
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
void
*
pQ
uery
Handle
,
SQueryNode
**
ppNode
)
{
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
void
*
pQHandle
,
SQueryNode
**
ppNode
)
{
int32_t
code
=
0
;
int32_t
nRef
=
atomic_fetch_add_32
(
&
pMemTable
->
nRef
,
1
);
ASSERT
(
nRef
>
0
);
// register handle
// register handle
(todo: take concurrency in consideration)
*
ppNode
=
taosMemoryMalloc
(
sizeof
(
SQueryNode
));
if
(
*
ppNode
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
(
*
ppNode
)
->
pQ
ueryHandle
=
pQuery
Handle
;
(
*
ppNode
)
->
pQ
Handle
=
pQ
Handle
;
(
*
ppNode
)
->
pNext
=
pMemTable
->
qList
.
pNext
;
(
*
ppNode
)
->
ppNext
=
&
pMemTable
->
qList
.
pNext
;
pMemTable
->
qList
.
pNext
->
ppNext
=
&
(
*
ppNode
)
->
pNext
;
...
...
@@ -656,7 +656,7 @@ _exit:
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
SQueryNode
*
pNode
)
{
int32_t
code
=
0
;
// unregister handle
// unregister handle
(todo: take concurrency in consideration)
if
(
pNode
)
{
pNode
->
pNext
->
ppNext
=
pNode
->
ppNext
;
*
pNode
->
ppNext
=
pNode
->
pNext
;
...
...
@@ -708,3 +708,31 @@ SArray *tsdbMemTableGetTbDataArray(SMemTable *pMemTable) {
_exit:
return
aTbDataP
;
}
extern
int32_t
tsdbSetQueryReseek
(
void
*
pQHandle
);
int32_t
tsdbRecycleMemTable
(
SMemTable
*
pMemTable
)
{
int32_t
code
=
0
;
SQueryNode
*
pNode
=
pMemTable
->
qList
.
pNext
;
while
(
1
)
{
ASSERT
(
pNode
!=
&
pMemTable
->
qList
);
SQueryNode
*
pNextNode
=
pNode
->
pNext
;
if
(
pNextNode
==
&
pMemTable
->
qList
)
{
code
=
tsdbSetQueryReseek
(
pNode
->
pQHandle
);
if
(
code
)
goto
_exit
;
break
;
}
else
{
code
=
tsdbSetQueryReseek
(
pNode
->
pQHandle
);
if
(
code
)
goto
_exit
;
pNode
=
pMemTable
->
qList
.
pNext
;
ASSERT
(
pNode
==
pNextNode
);
}
}
// NOTE: Take care here, pMemTable is destroyed
_exit:
return
code
;
}
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
f845a014
...
...
@@ -3925,3 +3925,20 @@ void tsdbUntakeReadSnap(STsdbReader* pReader, STsdbReadSnap* pSnap) {
tsdbTrace
(
"vgId:%d, untake read snapshot"
,
TD_VID
(
pTsdb
->
pVnode
));
}
int32_t
tsdbSetQueryReseek
(
void
*
pQHandle
)
{
int32_t
code
=
0
;
// lock handle
// check state (is already in reseek state, skip below)
// save all state for further restore
// unref read snapshot
// tsdbUntakeReadSnap();
// unlock handle
return
code
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录