Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
580fb8e9
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
580fb8e9
编写于
6月 17, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-353]
上级
a2260415
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
21 addition
and
17 deletion
+21
-17
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+21
-17
未找到文件。
src/tsdb/src/tsdbRead.c
浏览文件 @
580fb8e9
...
@@ -72,9 +72,11 @@ typedef struct STableCheckInfo {
...
@@ -72,9 +72,11 @@ typedef struct STableCheckInfo {
int32_t
compSize
;
int32_t
compSize
;
int32_t
numOfBlocks
;
// number of qualified data blocks not the original blocks
int32_t
numOfBlocks
;
// number of qualified data blocks not the original blocks
SDataCols
*
pDataCols
;
SDataCols
*
pDataCols
;
int32_t
chosen
;
// indicate which iterator should move forward
int32_t
chosen
;
// indicate which iterator should move forward
bool
initBuf
;
// whether to initialize the in-memory skip list iterator or not
bool
initBuf
;
// whether to initialize the in-memory skip list iterator or not
SMemTable
*
mem
;
// in-mem buffer, hold the ref count
SMemTable
*
imem
;
// imem buffer, hold the ref count to avoid release
SSkipListIterator
*
iter
;
// mem buffer skip list iterator
SSkipListIterator
*
iter
;
// mem buffer skip list iterator
SSkipListIterator
*
iiter
;
// imem buffer skip list iterator
SSkipListIterator
*
iiter
;
// imem buffer skip list iterator
}
STableCheckInfo
;
}
STableCheckInfo
;
...
@@ -248,21 +250,23 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
...
@@ -248,21 +250,23 @@ static bool initTableMemIterator(STsdbQueryHandle* pHandle, STableCheckInfo* pCh
pCheckInfo
->
initBuf
=
true
;
pCheckInfo
->
initBuf
=
true
;
int32_t
order
=
pHandle
->
order
;
int32_t
order
=
pHandle
->
order
;
tsdbTakeMemSnapshot
(
pHandle
->
pTsdb
,
&
pCheckInfo
->
mem
,
&
pCheckInfo
->
imem
);
// no data in buffer, abort
// no data in buffer, abort
if
(
p
Table
->
mem
==
NULL
&&
pTable
->
imem
==
NULL
)
{
if
(
p
CheckInfo
->
mem
==
NULL
&&
pCheckInfo
->
imem
==
NULL
)
{
return
false
;
return
false
;
}
}
assert
(
pCheckInfo
->
iter
==
NULL
&&
pCheckInfo
->
iiter
==
NULL
);
assert
(
pCheckInfo
->
iter
==
NULL
&&
pCheckInfo
->
iiter
==
NULL
);
if
(
p
Table
->
mem
)
{
if
(
p
CheckInfo
->
mem
)
{
pCheckInfo
->
iter
=
tSkipListCreateIterFromVal
(
p
Table
->
mem
->
pData
,
(
const
char
*
)
&
pCheckInfo
->
lastKey
,
pCheckInfo
->
iter
=
tSkipListCreateIterFromVal
(
p
CheckInfo
->
mem
->
tData
[
pCheckInfo
->
tableId
.
tid
]
->
pData
,
TSDB_DATA_TYPE_TIMESTAMP
,
order
);
(
const
char
*
)
&
pCheckInfo
->
lastKey
,
TSDB_DATA_TYPE_TIMESTAMP
,
order
);
}
}
if
(
p
Table
->
imem
)
{
if
(
p
CheckInfo
->
imem
)
{
pCheckInfo
->
iiter
=
tSkipListCreateIterFromVal
(
p
Table
->
imem
->
pData
,
(
const
char
*
)
&
pCheckInfo
->
lastKey
,
pCheckInfo
->
iiter
=
tSkipListCreateIterFromVal
(
p
CheckInfo
->
imem
->
tData
[
pCheckInfo
->
tableId
.
tid
]
->
pData
,
TSDB_DATA_TYPE_TIMESTAMP
,
order
);
(
const
char
*
)
&
pCheckInfo
->
lastKey
,
TSDB_DATA_TYPE_TIMESTAMP
,
order
);
}
}
// both iterators are NULL, no data in buffer right now
// both iterators are NULL, no data in buffer right now
...
@@ -1822,8 +1826,8 @@ static int32_t getAllTableIdList(STable* pSuperTable, SArray* list) {
...
@@ -1822,8 +1826,8 @@ static int32_t getAllTableIdList(STable* pSuperTable, SArray* list) {
while
(
tSkipListIterNext
(
iter
))
{
while
(
tSkipListIterNext
(
iter
))
{
SSkipListNode
*
pNode
=
tSkipListIterGet
(
iter
);
SSkipListNode
*
pNode
=
tSkipListIterGet
(
iter
);
STable
IndexElem
*
elem
=
(
STableIndexElem
*
)(
SL_GET_NODE_DATA
((
SSkipListNode
*
)
pNode
)
);
STable
**
pTable
=
(
STable
**
)
SL_GET_NODE_DATA
((
SSkipListNode
*
)
pNode
);
taosArrayPush
(
list
,
&
elem
->
pTable
->
tableId
);
taosArrayPush
(
list
,
&
(
*
pTable
)
->
tableId
);
}
}
tSkipListDestroyIter
(
iter
);
tSkipListDestroyIter
(
iter
);
...
@@ -1842,8 +1846,8 @@ static void convertQueryResult(SArray* pRes, SArray* pTableList) {
...
@@ -1842,8 +1846,8 @@ static void convertQueryResult(SArray* pRes, SArray* pTableList) {
size_t
size
=
taosArrayGetSize
(
pTableList
);
size_t
size
=
taosArrayGetSize
(
pTableList
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
// todo speedup by using reserve space.
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
// todo speedup by using reserve space.
STable
IndexElem
*
elem
=
taosArrayGet
(
pTableList
,
i
);
STable
*
pTable
=
taosArrayGetP
(
pTableList
,
i
);
taosArrayPush
(
pRes
,
&
elem
->
pTable
->
tableId
);
taosArrayPush
(
pRes
,
&
pTable
->
tableId
);
}
}
}
}
...
@@ -2027,16 +2031,16 @@ SArray* createTableGroup(SArray* pTableList, STSchema* pTagSchema, SColIndex* pC
...
@@ -2027,16 +2031,16 @@ SArray* createTableGroup(SArray* pTableList, STSchema* pTagSchema, SColIndex* pC
bool
indexedNodeFilterFp
(
const
void
*
pNode
,
void
*
param
)
{
bool
indexedNodeFilterFp
(
const
void
*
pNode
,
void
*
param
)
{
tQueryInfo
*
pInfo
=
(
tQueryInfo
*
)
param
;
tQueryInfo
*
pInfo
=
(
tQueryInfo
*
)
param
;
STable
IndexElem
*
elem
=
(
STableIndexElem
*
)(
SL_GET_NODE_DATA
((
SSkipListNode
*
)
pNode
));
STable
*
pTable
=
*
(
STable
*
*
)(
SL_GET_NODE_DATA
((
SSkipListNode
*
)
pNode
));
char
*
val
=
NULL
;
char
*
val
=
NULL
;
int8_t
type
=
pInfo
->
sch
.
type
;
int8_t
type
=
pInfo
->
sch
.
type
;
if
(
pInfo
->
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
if
(
pInfo
->
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
val
=
(
char
*
)
elem
->
pTable
->
name
;
val
=
(
char
*
)
pTable
->
name
;
type
=
TSDB_DATA_TYPE_BINARY
;
type
=
TSDB_DATA_TYPE_BINARY
;
}
else
{
}
else
{
val
=
tdGetKVRowValOfCol
(
elem
->
pTable
->
tagVal
,
pInfo
->
sch
.
colId
);
val
=
tdGetKVRowValOfCol
(
pTable
->
tagVal
,
pInfo
->
sch
.
colId
);
}
}
//todo :the val is possible to be null, so check it out carefully
//todo :the val is possible to be null, so check it out carefully
...
@@ -2092,7 +2096,7 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr)
...
@@ -2092,7 +2096,7 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr)
.
pExtInfo
=
pSTable
->
tagSchema
,
.
pExtInfo
=
pSTable
->
tagSchema
,
};
};
SArray
*
pTableList
=
taosArrayInit
(
8
,
sizeof
(
STableIndexElem
)
);
SArray
*
pTableList
=
taosArrayInit
(
8
,
POINTER_BYTES
);
tExprTreeTraverse
(
pExpr
,
pSTable
->
pIndex
,
pTableList
,
&
supp
);
tExprTreeTraverse
(
pExpr
,
pSTable
->
pIndex
,
pTableList
,
&
supp
);
tExprTreeDestroy
(
&
pExpr
,
destroyHelper
);
tExprTreeDestroy
(
&
pExpr
,
destroyHelper
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录