Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
03fa4578
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看板
提交
03fa4578
编写于
2月 01, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feat/vnode_compact
上级
db9a6b11
fc829aec
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
83 addition
and
26 deletion
+83
-26
cmake/taosadapter_CMakeLists.txt.in
cmake/taosadapter_CMakeLists.txt.in
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+82
-25
未找到文件。
cmake/taosadapter_CMakeLists.txt.in
浏览文件 @
03fa4578
...
...
@@ -2,7 +2,7 @@
# taosadapter
ExternalProject_Add(taosadapter
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
GIT_TAG
213f8b3
GIT_TAG
3e08996
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
03fa4578
...
...
@@ -573,6 +573,68 @@ static SSDataBlock* createResBlock(SQueryTableDataCond* pCond, int32_t capacity)
return
pResBlock
;
}
static
int32_t
tsdbInitReaderLock
(
STsdbReader
*
pReader
)
{
int32_t
code
=
-
1
;
qTrace
(
"tsdb/read: %p, pre-init read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
code
=
taosThreadMutexInit
(
&
pReader
->
readerMutex
,
NULL
);
qTrace
(
"tsdb/read: %p, post-init read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
return
code
;
}
static
int32_t
tsdbUninitReaderLock
(
STsdbReader
*
pReader
)
{
int32_t
code
=
-
1
;
qTrace
(
"tsdb/read: %p, pre-uninit read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
code
=
taosThreadMutexDestroy
(
&
pReader
->
readerMutex
);
qTrace
(
"tsdb/read: %p, post-uninit read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
return
code
;
}
static
int32_t
tsdbAcquireReader
(
STsdbReader
*
pReader
)
{
int32_t
code
=
-
1
;
qTrace
(
"tsdb/read: %p, pre-take read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
code
=
taosThreadMutexLock
(
&
pReader
->
readerMutex
);
qTrace
(
"tsdb/read: %p, post-take read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
return
code
;
}
static
int32_t
tsdbTryAcquireReader
(
STsdbReader
*
pReader
)
{
int32_t
code
=
-
1
;
qTrace
(
"tsdb/read: %p, pre-trytake read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
code
=
taosThreadMutexTryLock
(
&
pReader
->
readerMutex
);
qTrace
(
"tsdb/read: %p, post-trytake read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
return
code
;
}
static
int32_t
tsdbReleaseReader
(
STsdbReader
*
pReader
)
{
int32_t
code
=
-
1
;
qTrace
(
"tsdb/read: %p, pre-untake read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
code
=
taosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
qTrace
(
"tsdb/read: %p, post-untake read mutex: %p, code: %d"
,
pReader
,
&
pReader
->
readerMutex
,
code
);
return
code
;
}
void
tsdbReleaseDataBlock
(
STsdbReader
*
pReader
)
{
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
if
(
!
pStatus
->
composedDataBlock
)
{
tsdbReleaseReader
(
pReader
);
}
}
static
int32_t
tsdbReaderCreate
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
STsdbReader
**
ppReader
,
int32_t
capacity
,
SSDataBlock
*
pResBlock
,
const
char
*
idstr
)
{
int32_t
code
=
0
;
...
...
@@ -636,7 +698,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd
setColumnIdSlotList
(
&
pReader
->
suppInfo
,
pCond
->
colList
,
pCond
->
pSlotList
,
pCond
->
numOfCols
);
t
aosThreadMutexInit
(
&
pReader
->
readerMutex
,
NULL
);
t
sdbInitReaderLock
(
pReader
);
*
ppReader
=
pReader
;
return
code
;
...
...
@@ -4016,8 +4078,9 @@ void tsdbReaderClose(STsdbReader* pReader) {
qTrace
(
"tsdb/reader: %p, untake snapshot"
,
pReader
);
tsdbUntakeReadSnap
(
pReader
,
pReader
->
pReadSnap
,
true
);
pReader
->
pReadSnap
=
NULL
;
t
aosThreadMutexDestroy
(
&
pReader
->
readerMutex
);
t
sdbUninitReaderLock
(
pReader
);
taosMemoryFree
(
pReader
->
status
.
uidCheckInfo
.
tableUidList
);
SIOCostSummary
*
pCost
=
&
pReader
->
cost
;
...
...
@@ -4164,16 +4227,16 @@ static int32_t tsdbSetQueryReseek(void* pQHandle) {
int32_t
code
=
0
;
STsdbReader
*
pReader
=
pQHandle
;
code
=
t
aosThreadMutexTryLock
(
&
pReader
->
readerMutex
);
code
=
t
sdbTryAcquireReader
(
pReader
);
if
(
code
==
0
)
{
if
(
pReader
->
suspended
)
{
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
return
code
;
}
tsdbReaderSuspend
(
pReader
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
return
code
;
}
else
if
(
code
==
EBUSY
)
{
...
...
@@ -4274,8 +4337,9 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
qTrace
(
"tsdb/read: %p, take read mutex"
,
pReader
);
taosThreadMutexLock
(
&
pReader
->
readerMutex
);
int32_t
code
=
tsdbAcquireReader
(
pReader
);
qTrace
(
"tsdb/read: %p, take read mutex, code: %d"
,
pReader
,
code
);
if
(
pReader
->
suspended
)
{
tsdbReaderResume
(
pReader
);
}
...
...
@@ -4287,7 +4351,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
pStatus
=
&
pReader
->
innerReader
[
0
]
->
status
;
if
(
pStatus
->
composedDataBlock
)
{
qTrace
(
"tsdb/read: %p, unlock read mutex"
,
pReader
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
}
return
ret
;
...
...
@@ -4310,7 +4374,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
if
(
ret
)
{
if
(
pStatus
->
composedDataBlock
)
{
qTrace
(
"tsdb/read: %p, unlock read mutex"
,
pReader
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
}
return
ret
;
...
...
@@ -4330,7 +4394,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
pStatus
=
&
pReader
->
innerReader
[
1
]
->
status
;
if
(
pStatus
->
composedDataBlock
)
{
qTrace
(
"tsdb/read: %p, unlock read mutex"
,
pReader
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
}
return
ret1
;
...
...
@@ -4338,7 +4402,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
}
qTrace
(
"tsdb/read: %p, unlock read mutex"
,
pReader
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
return
false
;
}
...
...
@@ -4497,13 +4561,6 @@ static SSDataBlock* doRetrieveDataBlock(STsdbReader* pReader) {
return
pReader
->
pResBlock
;
}
void
tsdbReleaseDataBlock
(
STsdbReader
*
pReader
)
{
// SReaderStatus* pStatus = &pReader->status;
// if (!pStatus->composedDataBlock) {
taosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
//}
}
SSDataBlock
*
tsdbRetrieveDataBlock
(
STsdbReader
*
pReader
,
SArray
*
pIdList
)
{
STsdbReader
*
pTReader
=
pReader
;
if
(
pReader
->
type
==
TIMEWINDOW_RANGE_EXTERNAL
)
{
...
...
@@ -4522,7 +4579,7 @@ SSDataBlock* tsdbRetrieveDataBlock(STsdbReader* pReader, SArray* pIdList) {
SSDataBlock
*
ret
=
doRetrieveDataBlock
(
pTReader
);
qTrace
(
"tsdb/read-retrieve: %p, unlock read mutex"
,
pReader
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
return
ret
;
}
...
...
@@ -4531,7 +4588,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
qTrace
(
"tsdb/reader-reset: %p, take read mutex"
,
pReader
);
t
aosThreadMutexLock
(
&
pReader
->
readerMutex
);
t
sdbAcquireReader
(
pReader
);
if
(
pReader
->
suspended
)
{
tsdbReaderResume
(
pReader
);
...
...
@@ -4540,7 +4597,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
if
(
isEmptyQueryTimeWindow
(
&
pReader
->
window
)
||
pReader
->
pReadSnap
==
NULL
)
{
tsdbDebug
(
"tsdb reader reset return %p"
,
pReader
->
pReadSnap
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -4578,7 +4635,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
tsdbError
(
"%p reset reader failed, numOfTables:%d, query range:%"
PRId64
" - %"
PRId64
" in query %s"
,
pReader
,
numOfTables
,
pReader
->
window
.
skey
,
pReader
->
window
.
ekey
,
pReader
->
idStr
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
return
code
;
}
...
...
@@ -4589,7 +4646,7 @@ int32_t tsdbReaderReset(STsdbReader* pReader, SQueryTableDataCond* pCond) {
pReader
,
pReader
->
suid
,
numOfTables
,
pCond
->
twindows
.
skey
,
pReader
->
window
.
skey
,
pReader
->
window
.
ekey
,
pReader
->
idStr
);
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
return
code
;
}
...
...
@@ -4674,7 +4731,7 @@ int64_t tsdbGetNumOfRowsInMemTable(STsdbReader* pReader) {
int64_t
rows
=
0
;
SReaderStatus
*
pStatus
=
&
pReader
->
status
;
t
aosThreadMutexLock
(
&
pReader
->
readerMutex
);
t
sdbAcquireReader
(
pReader
);
if
(
pReader
->
suspended
)
{
tsdbReaderResume
(
pReader
);
}
...
...
@@ -4704,7 +4761,7 @@ int64_t tsdbGetNumOfRowsInMemTable(STsdbReader* pReader) {
pStatus
->
pTableIter
=
taosHashIterate
(
pStatus
->
pTableMap
,
pStatus
->
pTableIter
);
}
t
aosThreadMutexUnlock
(
&
pReader
->
readerMutex
);
t
sdbReleaseReader
(
pReader
);
return
rows
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录