Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
c07c7ca7
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看板
提交
c07c7ca7
编写于
7月 05, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-805] opt query/launch perf
上级
c067db1f
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
155 addition
and
92 deletion
+155
-92
src/inc/tsdb.h
src/inc/tsdb.h
+3
-1
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+7
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+118
-60
src/query/src/qUtil.c
src/query/src/qUtil.c
+2
-2
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+25
-3
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+0
-24
未找到文件。
src/inc/tsdb.h
浏览文件 @
c07c7ca7
...
@@ -108,7 +108,9 @@ void tsdbClearTableCfg(STableCfg *config);
...
@@ -108,7 +108,9 @@ void tsdbClearTableCfg(STableCfg *config);
void
*
tsdbGetTableTagVal
(
const
void
*
pTable
,
int32_t
colId
,
int16_t
type
,
int16_t
bytes
);
void
*
tsdbGetTableTagVal
(
const
void
*
pTable
,
int32_t
colId
,
int16_t
type
,
int16_t
bytes
);
char
*
tsdbGetTableName
(
void
*
pTable
);
char
*
tsdbGetTableName
(
void
*
pTable
);
STableId
tsdbGetTableId
(
void
*
pTable
);
#define TSDB_TABLEID(_table) ((STableId*) (_table))
STableCfg
*
tsdbCreateTableCfgFromMsg
(
SMDCreateTableMsg
*
pMsg
);
STableCfg
*
tsdbCreateTableCfgFromMsg
(
SMDCreateTableMsg
*
pMsg
);
int
tsdbCreateTable
(
TSDB_REPO_T
*
repo
,
STableCfg
*
pCfg
);
int
tsdbCreateTable
(
TSDB_REPO_T
*
repo
,
STableCfg
*
pCfg
);
...
...
src/query/inc/qExecutor.h
浏览文件 @
c07c7ca7
...
@@ -154,6 +154,7 @@ typedef struct SQuery {
...
@@ -154,6 +154,7 @@ typedef struct SQuery {
}
SQuery
;
}
SQuery
;
typedef
struct
SQueryRuntimeEnv
{
typedef
struct
SQueryRuntimeEnv
{
jmp_buf
env
;
SResultInfo
*
resultInfo
;
// todo refactor to merge with SWindowResInfo
SResultInfo
*
resultInfo
;
// todo refactor to merge with SWindowResInfo
SQuery
*
pQuery
;
SQuery
*
pQuery
;
SQLFunctionCtx
*
pCtx
;
SQLFunctionCtx
*
pCtx
;
...
@@ -169,6 +170,8 @@ typedef struct SQueryRuntimeEnv {
...
@@ -169,6 +170,8 @@ typedef struct SQueryRuntimeEnv {
void
*
pSecQueryHandle
;
// another thread for
void
*
pSecQueryHandle
;
// another thread for
bool
stableQuery
;
// super table query or not
bool
stableQuery
;
// super table query or not
bool
topBotQuery
;
// false
bool
topBotQuery
;
// false
bool
groupbyNormalCol
;
// denote if this is a groupby normal column query
bool
hasTagResults
;
// if there are tag values in final result or not
int32_t
prevGroupId
;
// previous executed group id
int32_t
prevGroupId
;
// previous executed group id
SDiskbasedResultBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
SDiskbasedResultBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
}
SQueryRuntimeEnv
;
}
SQueryRuntimeEnv
;
...
@@ -197,8 +200,10 @@ typedef struct SQInfo {
...
@@ -197,8 +200,10 @@ typedef struct SQInfo {
*/
*/
int32_t
tableIndex
;
int32_t
tableIndex
;
int32_t
numOfGroupResultPages
;
int32_t
numOfGroupResultPages
;
_qinfo_free_fn_t
freeFn
;
_qinfo_free_fn_t
freeFn
;
//todo remove it
jmp_buf
env
;
void
*
pBuf
;
// allocated buffer for STableQueryInfo, sizeof(STableQueryInfo)*numOfTables;
}
SQInfo
;
}
SQInfo
;
#endif // TDENGINE_QUERYEXECUTOR_H
#endif // TDENGINE_QUERYEXECUTOR_H
src/query/src/qExecutor.c
浏览文件 @
c07c7ca7
此差异已折叠。
点击以展开。
src/query/src/qUtil.c
浏览文件 @
c07c7ca7
...
@@ -32,7 +32,6 @@ int32_t initWindowResInfo(SWindowResInfo *pWindowResInfo, SQueryRuntimeEnv *pRun
...
@@ -32,7 +32,6 @@ int32_t initWindowResInfo(SWindowResInfo *pWindowResInfo, SQueryRuntimeEnv *pRun
pWindowResInfo
->
threshold
=
threshold
;
pWindowResInfo
->
threshold
=
threshold
;
pWindowResInfo
->
type
=
type
;
pWindowResInfo
->
type
=
type
;
_hash_fn_t
fn
=
taosGetDefaultHashFunction
(
type
);
_hash_fn_t
fn
=
taosGetDefaultHashFunction
(
type
);
pWindowResInfo
->
hashList
=
taosHashInit
(
threshold
,
fn
,
false
);
pWindowResInfo
->
hashList
=
taosHashInit
(
threshold
,
fn
,
false
);
...
@@ -54,7 +53,8 @@ void destroyTimeWindowRes(SWindowResult *pWindowRes, int32_t nOutputCols) {
...
@@ -54,7 +53,8 @@ void destroyTimeWindowRes(SWindowResult *pWindowRes, int32_t nOutputCols) {
if
(
pWindowRes
==
NULL
)
{
if
(
pWindowRes
==
NULL
)
{
return
;
return
;
}
}
// TODO opt malloc strategy
for
(
int32_t
i
=
0
;
i
<
nOutputCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
nOutputCols
;
++
i
)
{
free
(
pWindowRes
->
resultInfo
[
i
].
interResultBuf
);
free
(
pWindowRes
->
resultInfo
[
i
].
interResultBuf
);
}
}
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
c07c7ca7
...
@@ -47,9 +47,9 @@ extern int tsdbDebugFlag;
...
@@ -47,9 +47,9 @@ extern int tsdbDebugFlag;
// Definitions
// Definitions
// ------------------ tsdbMeta.c
// ------------------ tsdbMeta.c
typedef
struct
STable
{
typedef
struct
STable
{
STableId
tableId
;
ETableType
type
;
ETableType
type
;
tstr
*
name
;
// NOTE: there a flexible string here
tstr
*
name
;
// NOTE: there a flexible string here
STableId
tableId
;
uint64_t
suid
;
uint64_t
suid
;
struct
STable
*
pSuper
;
// super table pointer
struct
STable
*
pSuper
;
// super table pointer
uint8_t
numOfSchemas
;
uint8_t
numOfSchemas
;
...
@@ -294,14 +294,36 @@ typedef struct {
...
@@ -294,14 +294,36 @@ typedef struct {
#define TABLE_SUID(t) (t)->suid
#define TABLE_SUID(t) (t)->suid
#define TABLE_LASTKEY(t) (t)->lastKey
#define TABLE_LASTKEY(t) (t)->lastKey
static
FORCE_INLINE
STSchema
*
tsdbGetTableSchema
(
STable
*
pTable
)
{
if
(
pTable
->
type
==
TSDB_CHILD_TABLE
)
{
// check child table first
STable
*
pSuper
=
pTable
->
pSuper
;
if
(
pSuper
==
NULL
)
return
NULL
;
return
pSuper
->
schema
[
pSuper
->
numOfSchemas
-
1
];
}
else
if
(
pTable
->
type
==
TSDB_NORMAL_TABLE
||
pTable
->
type
==
TSDB_SUPER_TABLE
||
pTable
->
type
==
TSDB_STREAM_TABLE
)
{
return
pTable
->
schema
[
pTable
->
numOfSchemas
-
1
];
}
else
{
return
NULL
;
}
}
static
FORCE_INLINE
STSchema
*
tsdbGetTableTagSchema
(
STable
*
pTable
)
{
if
(
pTable
->
type
==
TSDB_CHILD_TABLE
)
{
// check child table first
STable
*
pSuper
=
pTable
->
pSuper
;
if
(
pSuper
==
NULL
)
return
NULL
;
return
pSuper
->
tagSchema
;
}
else
if
(
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
return
pTable
->
tagSchema
;
}
else
{
return
NULL
;
}
}
STsdbMeta
*
tsdbNewMeta
(
STsdbCfg
*
pCfg
);
STsdbMeta
*
tsdbNewMeta
(
STsdbCfg
*
pCfg
);
void
tsdbFreeMeta
(
STsdbMeta
*
pMeta
);
void
tsdbFreeMeta
(
STsdbMeta
*
pMeta
);
int
tsdbOpenMeta
(
STsdbRepo
*
pRepo
);
int
tsdbOpenMeta
(
STsdbRepo
*
pRepo
);
int
tsdbCloseMeta
(
STsdbRepo
*
pRepo
);
int
tsdbCloseMeta
(
STsdbRepo
*
pRepo
);
STSchema
*
tsdbGetTableSchema
(
STable
*
pTable
);
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
uint64_t
uid
);
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
uint64_t
uid
);
STSchema
*
tsdbGetTableSchemaByVersion
(
STable
*
pTable
,
int16_t
version
);
STSchema
*
tsdbGetTableSchemaByVersion
(
STable
*
pTable
,
int16_t
version
);
STSchema
*
tsdbGetTableTagSchema
(
STable
*
pTable
);
int
tsdbUpdateTable
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
STableCfg
*
pCfg
);
int
tsdbUpdateTable
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
STableCfg
*
pCfg
);
int
tsdbWLockRepoMeta
(
STsdbRepo
*
pRepo
);
int
tsdbWLockRepoMeta
(
STsdbRepo
*
pRepo
);
int
tsdbRLockRepoMeta
(
STsdbRepo
*
pRepo
);
int
tsdbRLockRepoMeta
(
STsdbRepo
*
pRepo
);
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
c07c7ca7
...
@@ -449,18 +449,6 @@ int tsdbCloseMeta(STsdbRepo *pRepo) {
...
@@ -449,18 +449,6 @@ int tsdbCloseMeta(STsdbRepo *pRepo) {
return
0
;
return
0
;
}
}
STSchema
*
tsdbGetTableSchema
(
STable
*
pTable
)
{
if
(
pTable
->
type
==
TSDB_NORMAL_TABLE
||
pTable
->
type
==
TSDB_SUPER_TABLE
||
pTable
->
type
==
TSDB_STREAM_TABLE
)
{
return
pTable
->
schema
[
pTable
->
numOfSchemas
-
1
];
}
else
if
(
pTable
->
type
==
TSDB_CHILD_TABLE
)
{
STable
*
pSuper
=
pTable
->
pSuper
;
if
(
pSuper
==
NULL
)
return
NULL
;
return
pSuper
->
schema
[
pSuper
->
numOfSchemas
-
1
];
}
else
{
return
NULL
;
}
}
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
uint64_t
uid
)
{
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
uint64_t
uid
)
{
void
*
ptr
=
taosHashGet
(
pMeta
->
uidMap
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
void
*
ptr
=
taosHashGet
(
pMeta
->
uidMap
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
...
@@ -480,18 +468,6 @@ STSchema *tsdbGetTableSchemaByVersion(STable *pTable, int16_t version) {
...
@@ -480,18 +468,6 @@ STSchema *tsdbGetTableSchemaByVersion(STable *pTable, int16_t version) {
return
*
(
STSchema
**
)
ptr
;
return
*
(
STSchema
**
)
ptr
;
}
}
STSchema
*
tsdbGetTableTagSchema
(
STable
*
pTable
)
{
if
(
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
return
pTable
->
tagSchema
;
}
else
if
(
pTable
->
type
==
TSDB_CHILD_TABLE
)
{
STable
*
pSuper
=
pTable
->
pSuper
;
if
(
pSuper
==
NULL
)
return
NULL
;
return
pSuper
->
tagSchema
;
}
else
{
return
NULL
;
}
}
int
tsdbUpdateTable
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
STableCfg
*
pCfg
)
{
int
tsdbUpdateTable
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
STableCfg
*
pCfg
)
{
// TODO: this function can only be called when there is no query and commit on this table
// TODO: this function can only be called when there is no query and commit on this table
ASSERT
(
TABLE_TYPE
(
pTable
)
!=
TSDB_CHILD_TABLE
);
ASSERT
(
TABLE_TYPE
(
pTable
)
!=
TSDB_CHILD_TABLE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录