Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fac8cf10
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
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
...
@@ -60,7 +60,6 @@ static int tsdbProcessMergeCommit(SRWHelper *pHelper, SCommitIter *pCommitIter
int
*
blkIdx
);
int
*
blkIdx
);
static
int
tsdbLoadAndMergeFromCache
(
SDataCols
*
pDataCols
,
int
*
iter
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pTarget
,
static
int
tsdbLoadAndMergeFromCache
(
SDataCols
*
pDataCols
,
int
*
iter
,
SCommitIter
*
pCommitIter
,
SDataCols
*
pTarget
,
TSKEY
maxKey
,
int
maxRows
);
TSKEY
maxKey
,
int
maxRows
);
static
int
tsdbCompareTidIdx
(
const
void
*
key1
,
const
void
*
key2
);
// ---------------------- INTERNAL FUNCTIONS ----------------------
// ---------------------- INTERNAL FUNCTIONS ----------------------
int
tsdbInitReadHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
)
{
int
tsdbInitReadHelper
(
SRWHelper
*
pHelper
,
STsdbRepo
*
pRepo
)
{
...
@@ -276,32 +275,31 @@ void tsdbSetHelperTable(SRWHelper *pHelper, STable *pTable, STsdbRepo *pRepo) {
...
@@ -276,32 +275,31 @@ void tsdbSetHelperTable(SRWHelper *pHelper, STable *pTable, STsdbRepo *pRepo) {
tdInitDataCols
(
pHelper
->
pDataCols
[
0
],
pSchema
);
tdInitDataCols
(
pHelper
->
pDataCols
[
0
],
pSchema
);
tdInitDataCols
(
pHelper
->
pDataCols
[
1
],
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
)
{
if
(
pHelper
->
idxH
.
curIdx
>=
pHelper
->
idxH
.
numOfIdx
)
{
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
}
else
{
break
;
}
SCompIdx
*
pIdx
=
&
(
pHelper
->
idxH
.
pIdxArray
[
pHelper
->
idxH
.
curIdx
]);
SCompIdx
*
pIdx
=
&
(
pHelper
->
idxH
.
pIdxArray
[
pHelper
->
idxH
.
curIdx
]);
if
(
pIdx
->
tid
==
TABLE_TID
(
pTable
))
{
if
(
pIdx
->
tid
==
TABLE_TID
(
pTable
))
{
if
(
pIdx
->
uid
==
TABLE_UID
(
pTable
))
{
pHelper
->
curCompIdx
=
*
pIdx
;
pHelper
->
curCompIdx
=
*
pIdx
;
pHelper
->
idxH
.
curIdx
++
;
}
else
{
}
else
{
ASSERT
(
pIdx
->
tid
>
TABLE_TID
(
pTable
));
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
}
}
}
pHelper
->
idxH
.
curIdx
++
;
}
else
{
break
;
}
else
if
(
pIdx
->
tid
>
TABLE_TID
(
pTable
))
{
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
break
;
}
else
{
pHelper
->
idxH
.
curIdx
++
;
}
}
}
}
else
{
}
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
));
memset
(
&
(
pHelper
->
curCompIdx
),
0
,
sizeof
(
SCompIdx
));
}
else
{
pHelper
->
curCompIdx
=
*
(
SCompIdx
*
)
ptr
;
}
}
}
helperSetState
(
pHelper
,
TSDB_HELPER_TABLE_SET
);
helperSetState
(
pHelper
,
TSDB_HELPER_TABLE_SET
);
...
@@ -1682,13 +1680,3 @@ static int tsdbWriteBlockToProperFile(SRWHelper *pHelper, SDataCols *pDataCols,
...
@@ -1682,13 +1680,3 @@ static int tsdbWriteBlockToProperFile(SRWHelper *pHelper, SDataCols *pDataCols,
return
0
;
return
0
;
}
}
\ No newline at end of file
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
...
@@ -132,6 +132,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
...
@@ -132,6 +132,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
static
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
static
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
static
int
tsdbReadRowsFromCache
(
STableCheckInfo
*
pCheckInfo
,
TSKEY
maxKey
,
int
maxRowsToRead
,
STimeWindow
*
win
,
static
int
tsdbReadRowsFromCache
(
STableCheckInfo
*
pCheckInfo
,
TSKEY
maxKey
,
int
maxRowsToRead
,
STimeWindow
*
win
,
STsdbQueryHandle
*
pQueryHandle
);
STsdbQueryHandle
*
pQueryHandle
);
static
int
tsdbCheckInfoCompar
(
const
void
*
key1
,
const
void
*
key2
);
static
void
tsdbInitDataBlockLoadInfo
(
SDataBlockLoadInfo
*
pBlockLoadInfo
)
{
static
void
tsdbInitDataBlockLoadInfo
(
SDataBlockLoadInfo
*
pBlockLoadInfo
)
{
pBlockLoadInfo
->
slot
=
-
1
;
pBlockLoadInfo
->
slot
=
-
1
;
...
@@ -237,6 +238,7 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
...
@@ -237,6 +238,7 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
}
}
}
}
taosArraySort
(
pQueryHandle
->
pTableCheckInfo
,
tsdbCheckInfoCompar
);
pQueryHandle
->
defaultLoadColumn
=
getDefaultLoadColumns
(
pQueryHandle
,
true
);
pQueryHandle
->
defaultLoadColumn
=
getDefaultLoadColumns
(
pQueryHandle
,
true
);
tsdbDebug
(
"%p total numOfTable:%zu in query, %p"
,
pQueryHandle
,
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
),
pQueryHandle
->
qinfo
);
tsdbDebug
(
"%p total numOfTable:%zu in query, %p"
,
pQueryHandle
,
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
),
pQueryHandle
->
qinfo
);
...
@@ -2431,3 +2433,13 @@ void tsdbDestroyTableGroup(STableGroupInfo *pGroupList) {
...
@@ -2431,3 +2433,13 @@ void tsdbDestroyTableGroup(STableGroupInfo *pGroupList) {
taosArrayDestroy
(
pGroupList
->
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录