Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
006a832c
T
TDengine
项目概览
Rattenking
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
006a832c
编写于
10月 19, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/develop' into feature/os
上级
0b3fb779
49413180
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
33 addition
and
3 deletion
+33
-3
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+1
-1
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+7
-0
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+25
-2
未找到文件。
src/common/src/tdataformat.c
浏览文件 @
006a832c
...
@@ -566,7 +566,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
...
@@ -566,7 +566,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) {
SKVRow
nrow
=
NULL
;
SKVRow
nrow
=
NULL
;
void
*
ptr
=
taosbsearch
(
&
colId
,
kvRowColIdx
(
row
),
kvRowNCols
(
row
),
sizeof
(
SColIdx
),
comparTagId
,
TD_GE
);
void
*
ptr
=
taosbsearch
(
&
colId
,
kvRowColIdx
(
row
),
kvRowNCols
(
row
),
sizeof
(
SColIdx
),
comparTagId
,
TD_GE
);
if
(
ptr
==
NULL
||
((
SColIdx
*
)
ptr
)
->
colId
<
colId
)
{
// need to add a column value to the row
if
(
ptr
==
NULL
||
((
SColIdx
*
)
ptr
)
->
colId
>
colId
)
{
// need to add a column value to the row
int
diff
=
IS_VAR_DATA_TYPE
(
type
)
?
varDataTLen
(
value
)
:
TYPE_BYTES
[
type
];
int
diff
=
IS_VAR_DATA_TYPE
(
type
)
?
varDataTLen
(
value
)
:
TYPE_BYTES
[
type
];
nrow
=
malloc
(
kvRowLen
(
row
)
+
sizeof
(
SColIdx
)
+
diff
);
nrow
=
malloc
(
kvRowLen
(
row
)
+
sizeof
(
SColIdx
)
+
diff
);
if
(
nrow
==
NULL
)
return
-
1
;
if
(
nrow
==
NULL
)
return
-
1
;
...
...
src/query/inc/qExecutor.h
浏览文件 @
006a832c
...
@@ -185,11 +185,18 @@ enum {
...
@@ -185,11 +185,18 @@ enum {
QUERY_RESULT_READY
=
2
,
QUERY_RESULT_READY
=
2
,
};
};
typedef
struct
SMemRef
{
int32_t
ref
;
void
*
mem
;
void
*
imem
;
}
SMemRef
;
typedef
struct
SQInfo
{
typedef
struct
SQInfo
{
void
*
signature
;
void
*
signature
;
int32_t
code
;
// error code to returned to client
int32_t
code
;
// error code to returned to client
int64_t
owner
;
// if it is in execution
int64_t
owner
;
// if it is in execution
void
*
tsdb
;
void
*
tsdb
;
SMemRef
memRef
;
int32_t
vgId
;
int32_t
vgId
;
STableGroupInfo
tableGroupInfo
;
// table <tid, last_key> list SArray<STableKeyInfo>
STableGroupInfo
tableGroupInfo
;
// table <tid, last_key> list SArray<STableKeyInfo>
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
006a832c
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "exception.h"
#include "exception.h"
#include "../../query/inc/qAst.h" // todo move to common module
#include "../../query/inc/qAst.h" // todo move to common module
#include "../../query/inc/qExecutor.h" // todo move to common module
#include "tlosertree.h"
#include "tlosertree.h"
#include "tsdb.h"
#include "tsdb.h"
#include "tsdbMain.h"
#include "tsdbMain.h"
...
@@ -143,6 +144,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey,
...
@@ -143,6 +144,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey,
STsdbQueryHandle
*
pQueryHandle
);
STsdbQueryHandle
*
pQueryHandle
);
static
int
tsdbCheckInfoCompar
(
const
void
*
key1
,
const
void
*
key2
);
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
;
pBlockLoadInfo
->
tid
=
-
1
;
pBlockLoadInfo
->
tid
=
-
1
;
...
@@ -182,6 +184,27 @@ static SArray* getDefaultLoadColumns(STsdbQueryHandle* pQueryHandle, bool loadTS
...
@@ -182,6 +184,27 @@ static SArray* getDefaultLoadColumns(STsdbQueryHandle* pQueryHandle, bool loadTS
return
pLocalIdList
;
return
pLocalIdList
;
}
}
static
void
tsdbMayTakeMemSnapshot
(
TsdbQueryHandleT
pHandle
)
{
STsdbQueryHandle
*
pSecQueryHandle
=
(
STsdbQueryHandle
*
)
pHandle
;
SQInfo
*
pQInfo
=
(
SQInfo
*
)(
pSecQueryHandle
->
qinfo
);
if
(
pQInfo
->
memRef
.
ref
++
==
0
)
{
tsdbTakeMemSnapshot
(
pSecQueryHandle
->
pTsdb
,
&
pSecQueryHandle
->
mem
,
&
pSecQueryHandle
->
imem
);
pQInfo
->
memRef
.
mem
=
pSecQueryHandle
->
mem
;
pQInfo
->
memRef
.
imem
=
pSecQueryHandle
->
imem
;
}
else
{
pSecQueryHandle
->
mem
=
(
SMemTable
*
)(
pQInfo
->
memRef
.
mem
);
pSecQueryHandle
->
imem
=
(
SMemTable
*
)(
pQInfo
->
memRef
.
imem
);
}
}
static
void
tsdbMayUnTakeMemSnapshot
(
TsdbQueryHandleT
pHandle
)
{
STsdbQueryHandle
*
pSecQueryHandle
=
(
STsdbQueryHandle
*
)
pHandle
;
SQInfo
*
pQInfo
=
(
SQInfo
*
)(
pSecQueryHandle
->
qinfo
);
if
(
--
pQInfo
->
memRef
.
ref
==
0
)
{
tsdbUnTakeMemSnapShot
(
pSecQueryHandle
->
pTsdb
,
pSecQueryHandle
->
mem
,
pSecQueryHandle
->
imem
);
}
}
static
SArray
*
createCheckInfoFromTableGroup
(
STsdbQueryHandle
*
pQueryHandle
,
STableGroupInfo
*
pGroupList
,
STsdbMeta
*
pMeta
)
{
static
SArray
*
createCheckInfoFromTableGroup
(
STsdbQueryHandle
*
pQueryHandle
,
STableGroupInfo
*
pGroupList
,
STsdbMeta
*
pMeta
)
{
size_t
sizeOfGroup
=
taosArrayGetSize
(
pGroupList
->
pGroupList
);
size_t
sizeOfGroup
=
taosArrayGetSize
(
pGroupList
->
pGroupList
);
assert
(
sizeOfGroup
>=
1
&&
pMeta
!=
NULL
);
assert
(
sizeOfGroup
>=
1
&&
pMeta
!=
NULL
);
...
@@ -270,7 +293,7 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(TSDB_REPO_T* tsdb, STsdbQueryCond*
...
@@ -270,7 +293,7 @@ static STsdbQueryHandle* tsdbQueryTablesImpl(TSDB_REPO_T* tsdb, STsdbQueryCond*
goto
out_of_memory
;
goto
out_of_memory
;
}
}
tsdb
TakeMemSnapshot
(
pQueryHandle
->
pTsdb
,
&
pQueryHandle
->
mem
,
&
pQueryHandle
->
imem
);
tsdb
MayTakeMemSnapshot
(
pQueryHandle
);
assert
(
pCond
!=
NULL
&&
pCond
->
numOfCols
>
0
);
assert
(
pCond
!=
NULL
&&
pCond
->
numOfCols
>
0
);
if
(
ASCENDING_TRAVERSE
(
pCond
->
order
))
{
if
(
ASCENDING_TRAVERSE
(
pCond
->
order
))
{
...
@@ -2701,7 +2724,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
...
@@ -2701,7 +2724,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
taosTFree
(
pQueryHandle
->
statis
);
taosTFree
(
pQueryHandle
->
statis
);
// todo check error
// todo check error
tsdb
UnTakeMemSnapShot
(
pQueryHandle
->
pTsdb
,
pQueryHandle
->
mem
,
pQueryHandle
->
imem
);
tsdb
MayUnTakeMemSnapshot
(
pQueryHandle
);
tsdbDestroyHelper
(
&
pQueryHandle
->
rhelper
);
tsdbDestroyHelper
(
&
pQueryHandle
->
rhelper
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录