Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d2141ea5
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看板
提交
d2141ea5
编写于
9月 15, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
87b59d21
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
25 deletion
+44
-25
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+4
-4
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+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
+18
-2
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+18
-15
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
d2141ea5
...
...
@@ -206,8 +206,8 @@ 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
);
void
tsdbRefMemTable
(
SMemTable
*
pMemTable
);
void
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
);
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
STsdbReader
*
pReader
);
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
STsdbReader
*
pReader
);
SArray
*
tsdbMemTableGetTbDataArray
(
SMemTable
*
pMemTable
);
// STbDataIter
int32_t
tsdbTbDataIterCreate
(
STbData
*
pTbData
,
TSDBKEY
*
pFrom
,
int8_t
backward
,
STbDataIter
**
ppIter
);
...
...
@@ -285,8 +285,8 @@ 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
(
STsdb
*
pTsdb
,
STsdbReadSnap
**
ppSnap
);
void
tsdbUntakeReadSnap
(
STsdb
*
pTsdb
,
STsdbReadSnap
*
pSnap
);
int32_t
tsdbTakeReadSnap
(
STsdb
Reader
*
pReader
,
STsdbReadSnap
**
ppSnap
);
void
tsdbUntakeReadSnap
(
STsdb
Reader
*
pReader
,
STsdbReadSnap
*
pSnap
);
// tsdbMerge.c ==============================================================================================
int32_t
tsdbMerge
(
STsdb
*
pTsdb
);
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
d2141ea5
...
...
@@ -847,7 +847,7 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs
tb_uid_t
suid
=
getTableSuidByUid
(
uid
,
pTsdb
);
tsdbTakeReadSnap
(
pTsdb
,
&
pIter
->
pReadSnap
);
tsdbTakeReadSnap
(
NULL
/*pTsdb (todo)*/
,
&
pIter
->
pReadSnap
);
STbData
*
pMem
=
NULL
;
if
(
pIter
->
pReadSnap
->
pMem
)
{
...
...
@@ -941,7 +941,7 @@ static int32_t nextRowIterClose(CacheNextRowIter *pIter) {
taosArrayDestroy
(
pIter
->
pSkyline
);
}
tsdbUntakeReadSnap
(
pIter
->
pTsdb
,
pIter
->
pReadSnap
);
tsdbUntakeReadSnap
(
NULL
/*pIter->pTsdb (todo)*/
,
pIter
->
pReadSnap
);
_err:
return
code
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
d2141ea5
...
...
@@ -158,7 +158,7 @@ int32_t tsdbCommit(STsdb *pTsdb) {
pTsdb
->
mem
=
NULL
;
taosThreadRwlockUnlock
(
&
pTsdb
->
rwLock
);
tsdbUnrefMemTable
(
pMemTable
);
tsdbUnrefMemTable
(
pMemTable
,
NULL
);
goto
_exit
;
}
...
...
@@ -983,7 +983,7 @@ static int32_t tsdbEndCommit(SCommitter *pCommitter, int32_t eno) {
// unlock
taosThreadRwlockUnlock
(
&
pTsdb
->
rwLock
);
tsdbUnrefMemTable
(
pMemTable
);
tsdbUnrefMemTable
(
pMemTable
,
NULL
);
tsdbFSDestroy
(
&
pCommitter
->
fs
);
taosArrayDestroy
(
pCommitter
->
aTbDataP
);
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
d2141ea5
...
...
@@ -629,16 +629,32 @@ _err:
int32_t
tsdbGetNRowsInTbData
(
STbData
*
pTbData
)
{
return
pTbData
->
sl
.
size
;
}
void
tsdbRefMemTable
(
SMemTable
*
pMemTable
)
{
int32_t
tsdbRefMemTable
(
SMemTable
*
pMemTable
,
STsdbReader
*
pReader
)
{
int32_t
code
=
0
;
int32_t
nRef
=
atomic_fetch_add_32
(
&
pMemTable
->
nRef
,
1
);
ASSERT
(
nRef
>
0
);
// register handle (todo)
if
(
pReader
)
{
}
return
code
;
}
void
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
)
{
int32_t
tsdbUnrefMemTable
(
SMemTable
*
pMemTable
,
STsdbReader
*
pReader
)
{
int32_t
code
=
0
;
// unregister handle (todo)
if
(
pReader
)
{
}
int32_t
nRef
=
atomic_sub_fetch_32
(
&
pMemTable
->
nRef
,
1
);
if
(
nRef
==
0
)
{
tsdbMemTableDestroy
(
pMemTable
);
}
return
code
;
}
static
FORCE_INLINE
int32_t
tbDataPCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
d2141ea5
...
...
@@ -3354,7 +3354,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
goto
_err
;
}
code
=
tsdbTakeReadSnap
(
pReader
->
pTsdb
,
&
pReader
->
pReadSnap
);
code
=
tsdbTakeReadSnap
(
pReader
,
&
pReader
->
pReadSnap
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
...
...
@@ -3378,7 +3378,7 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, SArray* pTabl
STsdbReader
*
pPrevReader
=
pReader
->
innerReader
[
0
];
SDataBlockIter
*
pBlockIter
=
&
pPrevReader
->
status
.
blockIter
;
code
=
tsdbTakeReadSnap
(
pPrevReader
->
pTsdb
,
&
pPrevReader
->
pReadSnap
);
code
=
tsdbTakeReadSnap
(
pPrevReader
,
&
pPrevReader
->
pReadSnap
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_err
;
}
...
...
@@ -3435,7 +3435,7 @@ void tsdbReaderClose(STsdbReader* pReader) {
tsdbDataFReaderClose
(
&
pReader
->
pFileReader
);
}
tsdbUntakeReadSnap
(
pReader
->
pTsdb
,
pReader
->
pReadSnap
);
tsdbUntakeReadSnap
(
pReader
,
pReader
->
pReadSnap
);
taosMemoryFree
(
pReader
->
status
.
uidCheckInfo
.
tableUidList
);
SIOCostSummary
*
pCost
=
&
pReader
->
cost
;
...
...
@@ -3858,8 +3858,10 @@ int32_t tsdbGetTableSchema(SVnode* pVnode, int64_t uid, STSchema** pSchema, int6
return
TSDB_CODE_SUCCESS
;
}
int32_t
tsdbTakeReadSnap
(
STsdb
*
pTsdb
,
STsdbReadSnap
**
ppSnap
)
{
int32_t
code
=
0
;
int32_t
tsdbTakeReadSnap
(
STsdbReader
*
pReader
,
STsdbReadSnap
**
ppSnap
)
{
int32_t
code
=
0
;
STsdb
*
pTsdb
=
pReader
->
pTsdb
;
SVersionRange
*
pRange
=
&
pReader
->
verRange
;
// alloc
*
ppSnap
=
(
STsdbReadSnap
*
)
taosMemoryCalloc
(
1
,
sizeof
(
STsdbReadSnap
));
...
...
@@ -3876,15 +3878,14 @@ int32_t tsdbTakeReadSnap(STsdb* pTsdb, STsdbReadSnap** ppSnap) {
}
// take snapshot
(
*
ppSnap
)
->
pMem
=
pTsdb
->
mem
;
(
*
ppSnap
)
->
pIMem
=
pTsdb
->
imem
;
if
((
*
ppSnap
)
->
pMem
)
{
tsdbRefMemTable
((
*
ppSnap
)
->
pMem
);
if
(
pTsdb
->
mem
&&
(
pRange
->
minVer
<=
pTsdb
->
mem
->
maxVer
&&
pRange
->
maxVer
>=
pTsdb
->
mem
->
minVer
))
{
tsdbRefMemTable
(
pTsdb
->
mem
,
pReader
);
(
*
ppSnap
)
->
pMem
=
pTsdb
->
mem
;
}
if
((
*
ppSnap
)
->
pIMem
)
{
tsdbRefMemTable
((
*
ppSnap
)
->
pIMem
);
if
(
pTsdb
->
imem
&&
(
pRange
->
minVer
<=
pTsdb
->
imem
->
maxVer
&&
pRange
->
maxVer
>=
pTsdb
->
imem
->
minVer
))
{
tsdbRefMemTable
(
pTsdb
->
imem
,
pReader
);
(
*
ppSnap
)
->
pIMem
=
pTsdb
->
imem
;
}
// fs
...
...
@@ -3906,14 +3907,16 @@ _exit:
return
code
;
}
void
tsdbUntakeReadSnap
(
STsdb
*
pTsdb
,
STsdbReadSnap
*
pSnap
)
{
void
tsdbUntakeReadSnap
(
STsdbReader
*
pReader
,
STsdbReadSnap
*
pSnap
)
{
STsdb
*
pTsdb
=
pReader
->
pTsdb
;
if
(
pSnap
)
{
if
(
pSnap
->
pMem
)
{
tsdbUnrefMemTable
(
pSnap
->
pMem
);
tsdbUnrefMemTable
(
pSnap
->
pMem
,
pReader
);
}
if
(
pSnap
->
pIMem
)
{
tsdbUnrefMemTable
(
pSnap
->
pIMem
);
tsdbUnrefMemTable
(
pSnap
->
pIMem
,
pReader
);
}
tsdbFSUnref
(
pTsdb
,
&
pSnap
->
fs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录