Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
fac8cf10
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fac8cf10
编写于
7月 21, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor and debug
上级
88ba2f49
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
34 deletion
+34
-34
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+16
-28
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+18
-6
未找到文件。
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
fac8cf10
...
...
@@ -60,7 +60,6 @@ static int tsdbProcessMergeCommit(SRWHelper *pHelper, SCommitIter *pCommitIter
int
*
blkIdx
);
static
int
tsdbLoadAndMergeFromCache
(
SDataCols
*
pDataCols
,
int
*
iter
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pTarget
,
TSKEY
maxKey
,
int
maxRows
);
static
int
tsdbCompareTidIdx
(
const
void
*
key1
,
const
void
*
key2
);
// ---------------------- INTERNAL FUNCTIONS ----------------------
int
tsdbInitReadHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
)
{
...
...
@@ -276,32 +275,31 @@ void tsdbSetHelperTable(SRWHelper *pHelper, STable *pTable, STsdbRepo *pRepo) {
tdInitDataCols
(
pHelper
->
pDataCols
[
0
],
pSchema
);
tdInitDataCols
(
pHelper
->
pDataCols
[
1
],
pSchema
);
if
(
helperType
(
pHelper
)
==
TSDB_WRITE_HELPER
)
{
if
(
pHelper
->
idxH
.
numOfIdx
>
0
)
{
if
(
pHelper
->
idxH
.
numOfIdx
>
0
)
{
while
(
true
)
{
if
(
pHelper
->
idxH
.
curIdx
>=
pHelper
->
idxH
.
numOfIdx
)
{
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
}
else
{
SCompIdx
*
pIdx
=
&
(
pHelper
->
idxH
.
pIdxArray
[
pHelper
->
idxH
.
curIdx
]);
if
(
pIdx
->
tid
==
TABLE_TID
(
pTable
))
{
break
;
}
SCompIdx
*
pIdx
=
&
(
pHelper
->
idxH
.
pIdxArray
[
pHelper
->
idxH
.
curIdx
]);
if
(
pIdx
->
tid
==
TABLE_TID
(
pTable
))
{
if
(
pIdx
->
uid
==
TABLE_UID
(
pTable
))
{
pHelper
->
curCompIdx
=
*
pIdx
;
pHelper
->
idxH
.
curIdx
++
;
}
else
{
ASSERT
(
pIdx
->
tid
>
TABLE_TID
(
pTable
));
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
}
pHelper
->
idxH
.
curIdx
++
;
break
;
}
else
if
(
pIdx
->
tid
>
TABLE_TID
(
pTable
))
{
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
break
;
}
else
{
pHelper
->
idxH
.
curIdx
++
;
}
}
else
{
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
}
}
else
{
// TODO: make it more efficient
void
*
ptr
=
bsearch
(
&
TABLE_TID
(
pTable
),
(
void
*
)
pHelper
->
idxH
.
pIdxArray
,
pHelper
->
idxH
.
numOfIdx
,
sizeof
(
SCompIdx
),
tsdbCompareTidIdx
);
if
(
ptr
==
NULL
)
{
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
}
else
{
pHelper
->
curCompIdx
=
*
(
SCompIdx
*
)
ptr
;
}
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
}
helperSetState
(
pHelper
,
TSDB_HELPER_TABLE_SET
);
...
...
@@ -1681,14 +1679,4 @@ static int tsdbWriteBlockToProperFile(SRWHelper *pHelper, SDataCols *pDataCols,
if
(
tsdbWriteBlockToFile
(
pHelper
,
pFile
,
pDataCols
,
pCompBlock
,
isLast
,
true
)
<
0
)
return
-
1
;
return
0
;
}
static
int
tsdbCompareTidIdx
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(
*
(
int32_t
*
)
key1
>
((
SCompIdx
*
)
key2
)
->
tid
)
{
return
1
;
}
else
if
(
*
(
int32_t
*
)
key1
<
((
SCompIdx
*
)
key2
)
->
tid
)
{
return
-
1
;
}
else
{
return
0
;
}
}
\ No newline at end of file
src/tsdb/src/tsdbRead.c
浏览文件 @
fac8cf10
...
...
@@ -126,12 +126,13 @@ typedef struct STsdbQueryHandle {
SIOCostSummary
cost
;
}
STsdbQueryHandle
;
static
void
changeQueryHandleForLastrowQuery
(
TsdbQueryHandleT
pqHandle
);
static
void
changeQueryHandleForInterpQuery
(
TsdbQueryHandleT
pHandle
);
static
void
doMergeTwoLevelData
(
STsdbQueryHandle
*
pQueryHandle
,
STableCheckInfo
*
pCheckInfo
,
SCompBlock
*
pBlock
);
static
void
changeQueryHandleForLastrowQuery
(
TsdbQueryHandleT
pqHandle
);
static
void
changeQueryHandleForInterpQuery
(
TsdbQueryHandleT
pHandle
);
static
void
doMergeTwoLevelData
(
STsdbQueryHandle
*
pQueryHandle
,
STableCheckInfo
*
pCheckInfo
,
SCompBlock
*
pBlock
);
static
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
static
int
tsdbReadRowsFromCache
(
STableCheckInfo
*
pCheckInfo
,
TSKEY
maxKey
,
int
maxRowsToRead
,
STimeWindow
*
win
,
STsdbQueryHandle
*
pQueryHandle
);
static
int
tsdbReadRowsFromCache
(
STableCheckInfo
*
pCheckInfo
,
TSKEY
maxKey
,
int
maxRowsToRead
,
STimeWindow
*
win
,
STsdbQueryHandle
*
pQueryHandle
);
static
int
tsdbCheckInfoCompar
(
const
void
*
key1
,
const
void
*
key2
);
static
void
tsdbInitDataBlockLoadInfo
(
SDataBlockLoadInfo
*
pBlockLoadInfo
)
{
pBlockLoadInfo
->
slot
=
-
1
;
...
...
@@ -236,7 +237,8 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
taosArrayPush
(
pQueryHandle
->
pTableCheckInfo
,
&
info
);
}
}
taosArraySort
(
pQueryHandle
->
pTableCheckInfo
,
tsdbCheckInfoCompar
);
pQueryHandle
->
defaultLoadColumn
=
getDefaultLoadColumns
(
pQueryHandle
,
true
);
tsdbDebug
(
"%p total numOfTable:%zu in query, %p"
,
pQueryHandle
,
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
),
pQueryHandle
->
qinfo
);
...
...
@@ -2431,3 +2433,13 @@ void tsdbDestroyTableGroup(STableGroupInfo *pGroupList) {
taosArrayDestroy
(
pGroupList
->
pGroupList
);
}
static
int
tsdbCheckInfoCompar
(
const
void
*
key1
,
const
void
*
key2
)
{
if
(((
STableCheckInfo
*
)
key1
)
->
tableId
.
tid
<
((
STableCheckInfo
*
)
key2
)
->
tableId
.
tid
)
{
return
-
1
;
}
else
if
(((
STableCheckInfo
*
)
key1
)
->
tableId
.
tid
>
((
STableCheckInfo
*
)
key2
)
->
tableId
.
tid
)
{
return
1
;
}
else
{
ASSERT
(
false
);
return
0
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录