Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bff8c216
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看板
提交
bff8c216
编写于
1月 10, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
bb2ed08a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
41 deletion
+26
-41
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+2
-2
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-2
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+6
-7
source/dnode/vnode/src/tsdb/tsdbOpen.c
source/dnode/vnode/src/tsdb/tsdbOpen.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+2
-2
source/dnode/vnode/src/vnd/vnodeBufPool.c
source/dnode/vnode/src/vnd/vnodeBufPool.c
+11
-25
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
bff8c216
...
...
@@ -209,10 +209,10 @@ int32_t tsdbDecmprColData(uint8_t *pIn, SBlockCol *pBlockCol, int8_t cmprAlg, in
// tsdbMemTable ==============================================================================================
// SMemTable
int32_t
tsdbMemTableCreate
(
STsdb
*
pTsdb
,
SMemTable
**
ppMemTable
);
void
tsdbMemTableDestroy
(
SMemTable
*
pMemTable
);
void
tsdbMemTableDestroy
(
SMemTable
*
pMemTable
,
bool
proactive
);
STbData
*
tsdbGetTbDataFromMemTable
(
SMemTable
*
pMemTable
,
tb_uid_t
suid
,
tb_uid_t
uid
);
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
SQueryNode
*
pQNode
);
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
SQueryNode
*
pNode
);
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
SQueryNode
*
pNode
,
bool
proactive
);
SArray
*
tsdbMemTableGetTbDataArray
(
SMemTable
*
pMemTable
);
// STbDataIter
int32_t
tsdbTbDataIterCreate
(
STbData
*
pTbData
,
TSDBKEY
*
pFrom
,
int8_t
backward
,
STbDataIter
**
ppIter
);
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
bff8c216
...
...
@@ -105,11 +105,11 @@ void* vnodeBufPoolMalloc(SVBufPool* pPool, int size);
void
*
vnodeBufPoolMallocAligned
(
SVBufPool
*
pPool
,
int
size
);
void
vnodeBufPoolFree
(
SVBufPool
*
pPool
,
void
*
p
);
void
vnodeBufPoolRef
(
SVBufPool
*
pPool
);
void
vnodeBufPoolUnRef
(
SVBufPool
*
pPool
);
void
vnodeBufPoolUnRef
(
SVBufPool
*
pPool
,
bool
proactive
);
int
vnodeDecodeInfo
(
uint8_t
*
pData
,
SVnodeInfo
*
pInfo
);
int32_t
vnodeBufPoolRegisterQuery
(
SVBufPool
*
pPool
,
SQueryNode
*
pQNode
);
int32_t
vnodeBufPoolDeregisterQuery
(
SVBufPool
*
pPool
,
SQueryNode
*
pQNod
e
);
void
vnodeBufPoolDeregisterQuery
(
SVBufPool
*
pPool
,
SQueryNode
*
pQNode
,
bool
proactiv
e
);
// meta
typedef
struct
SMCtbCursor
SMCtbCursor
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
bff8c216
...
...
@@ -175,7 +175,7 @@ int32_t tsdbCommit(STsdb *pTsdb, SCommitInfo *pInfo) {
pTsdb
->
imem
=
NULL
;
taosThreadRwlockUnlock
(
&
pTsdb
->
rwLock
);
tsdbUnrefMemTable
(
pMemTable
,
NULL
);
tsdbUnrefMemTable
(
pMemTable
,
NULL
,
true
);
goto
_exit
;
}
...
...
@@ -1664,7 +1664,7 @@ int32_t tsdbFinishCommit(STsdb *pTsdb) {
// unlock
taosThreadRwlockUnlock
(
&
pTsdb
->
rwLock
);
if
(
pMemTable
)
{
tsdbUnrefMemTable
(
pMemTable
,
NULL
);
tsdbUnrefMemTable
(
pMemTable
,
NULL
,
true
);
}
_exit:
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
bff8c216
...
...
@@ -76,9 +76,9 @@ _err:
return
code
;
}
void
tsdbMemTableDestroy
(
SMemTable
*
pMemTable
)
{
void
tsdbMemTableDestroy
(
SMemTable
*
pMemTable
,
bool
proactive
)
{
if
(
pMemTable
)
{
vnodeBufPoolUnRef
(
pMemTable
->
pPool
);
vnodeBufPoolUnRef
(
pMemTable
->
pPool
,
proactive
);
taosMemoryFree
(
pMemTable
->
aBucket
);
taosMemoryFree
(
pMemTable
);
}
...
...
@@ -761,16 +761,15 @@ _exit:
return
code
;
}
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
SQueryNode
*
pNode
)
{
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
SQueryNode
*
pNode
,
bool
proactive
)
{
int32_t
code
=
0
;
if
(
pNode
)
{
vnodeBufPoolDeregisterQuery
(
pMemTable
->
pPool
,
pNode
);
vnodeBufPoolDeregisterQuery
(
pMemTable
->
pPool
,
pNode
,
proactive
);
}
int32_t
nRef
=
atomic_sub_fetch_32
(
&
pMemTable
->
nRef
,
1
);
if
(
nRef
==
0
)
{
tsdbMemTableDestroy
(
pMemTable
);
if
(
atomic_sub_fetch_32
(
&
pMemTable
->
nRef
,
1
)
==
0
)
{
tsdbMemTableDestroy
(
pMemTable
,
proactive
);
}
return
code
;
...
...
source/dnode/vnode/src/tsdb/tsdbOpen.c
浏览文件 @
bff8c216
...
...
@@ -88,7 +88,7 @@ _err:
int
tsdbClose
(
STsdb
**
pTsdb
)
{
if
(
*
pTsdb
)
{
taosThreadRwlockWrlock
(
&
(
*
pTsdb
)
->
rwLock
);
tsdbMemTableDestroy
((
*
pTsdb
)
->
mem
);
tsdbMemTableDestroy
((
*
pTsdb
)
->
mem
,
true
);
(
*
pTsdb
)
->
mem
=
NULL
;
taosThreadRwlockUnlock
(
&
(
*
pTsdb
)
->
rwLock
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
bff8c216
...
...
@@ -4719,11 +4719,11 @@ void tsdbUntakeReadSnap(STsdbReader* pReader, STsdbReadSnap* pSnap) {
if
(
pSnap
)
{
if
(
pSnap
->
pMem
)
{
tsdbUnrefMemTable
(
pSnap
->
pMem
,
pSnap
->
pNode
);
tsdbUnrefMemTable
(
pSnap
->
pMem
,
pSnap
->
pNode
,
true
);
}
if
(
pSnap
->
pIMem
)
{
tsdbUnrefMemTable
(
pSnap
->
pIMem
,
pSnap
->
pINode
);
tsdbUnrefMemTable
(
pSnap
->
pIMem
,
pSnap
->
pINode
,
true
);
}
tsdbFSUnref
(
pTsdb
,
&
pSnap
->
fs
);
...
...
source/dnode/vnode/src/vnd/vnodeBufPool.c
浏览文件 @
bff8c216
...
...
@@ -239,12 +239,12 @@ void vnodeBufPoolAddToFreeList(SVBufPool *pPool) {
taosThreadCondSignal
(
&
pVnode
->
poolNotEmpty
);
}
void
vnodeBufPoolUnRef
(
SVBufPool
*
pPool
)
{
void
vnodeBufPoolUnRef
(
SVBufPool
*
pPool
,
bool
proactive
)
{
if
(
pPool
==
NULL
)
return
;
SVnode
*
pVnode
=
pPool
->
pVnode
;
taosThreadMutexLock
(
&
pVnode
->
mutex
);
if
(
proactive
)
taosThreadMutexLock
(
&
pVnode
->
mutex
);
if
(
atomic_sub_fetch_32
(
&
pPool
->
nRef
,
1
)
>
0
)
goto
_exit
;
...
...
@@ -252,6 +252,8 @@ void vnodeBufPoolUnRef(SVBufPool *pPool) {
if
(
pVnode
->
onRecycle
==
pPool
)
{
pVnode
->
onRecycle
=
NULL
;
}
else
{
ASSERT
(
proactive
);
if
(
pPool
->
recyclePrev
)
{
pPool
->
recyclePrev
->
recycleNext
=
pPool
->
recycleNext
;
}
else
{
...
...
@@ -269,7 +271,7 @@ void vnodeBufPoolUnRef(SVBufPool *pPool) {
vnodeBufPoolAddToFreeList
(
pPool
);
_exit:
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
if
(
proactive
)
taosThreadMutexUnlock
(
&
pVnode
->
mutex
);
return
;
}
...
...
@@ -290,25 +292,21 @@ _exit:
return
code
;
}
int32_t
vnodeBufPoolDeregisterQuery
(
SVBufPool
*
pPool
,
SQueryNode
*
pQNod
e
)
{
void
vnodeBufPoolDeregisterQuery
(
SVBufPool
*
pPool
,
SQueryNode
*
pQNode
,
bool
proactiv
e
)
{
int32_t
code
=
0
;
taosThreadMutexLock
(
&
pPool
->
mutex
);
if
(
proactive
)
taosThreadMutexLock
(
&
pPool
->
mutex
);
pQNode
->
pNext
->
ppNext
=
pQNode
->
ppNext
;
*
pQNode
->
ppNext
=
pQNode
->
pNext
;
pPool
->
nQuery
--
;
taosThreadMutexUnlock
(
&
pPool
->
mutex
);
_exit:
return
code
;
if
(
proactive
)
taosThreadMutexUnlock
(
&
pPool
->
mutex
);
}
int32_t
vnodeBufPoolRecycle
(
SVBufPool
*
pPool
)
{
int32_t
code
=
0
;
bool
canRecycle
;
SVnode
*
pVnode
=
pPool
->
pVnode
;
vDebug
(
"vgId:%d recycle buffer pool %p of id %d"
,
TD_VID
(
pVnode
),
pPool
,
pPool
->
id
);
...
...
@@ -317,15 +315,11 @@ int32_t vnodeBufPoolRecycle(SVBufPool *pPool) {
SQueryNode
*
pNode
=
pPool
->
qList
.
pNext
;
while
(
pNode
!=
&
pPool
->
qList
)
{
SQueryNode
*
pTNode
=
pNode
->
pNext
;
int32_t
rc
=
pNode
->
reseek
(
pNode
->
pQHandle
);
if
(
rc
==
0
)
{
SQueryNode
*
pTNode
=
pNode
->
pNext
;
pNode
->
pNext
->
ppNext
=
pNode
->
ppNext
;
*
pNode
->
ppNext
=
pNode
->
pNext
;
pPool
->
nQuery
--
;
if
(
rc
==
0
||
rc
==
TSDB_CODE_VND_QUERY_BUSY
)
{
pNode
=
pTNode
;
}
else
if
(
rc
==
TSDB_CODE_VND_QUERY_BUSY
)
{
pNode
=
pNode
->
pNext
;
}
else
{
taosThreadMutexUnlock
(
&
pPool
->
mutex
);
code
=
rc
;
...
...
@@ -333,16 +327,8 @@ int32_t vnodeBufPoolRecycle(SVBufPool *pPool) {
}
}
canRecycle
=
(
pPool
->
nQuery
==
0
);
taosThreadMutexUnlock
(
&
pPool
->
mutex
);
if
(
canRecycle
)
{
ASSERT
(
atomic_load_32
(
&
pPool
->
nRef
)
==
0
);
pVnode
->
onRecycle
=
NULL
;
vnodeBufPoolAddToFreeList
(
pPool
);
}
_exit:
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录