Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fb035bb3
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fb035bb3
编写于
12月 14, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add query lib
上级
3bca1680
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
125 addition
and
38 deletion
+125
-38
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+1
-1
include/libs/query/query.h
include/libs/query/query.h
+5
-5
source/common/inc/commonInt.h
source/common/inc/commonInt.h
+0
-10
source/libs/CMakeLists.txt
source/libs/CMakeLists.txt
+2
-1
source/libs/catalog/CMakeLists.txt
source/libs/catalog/CMakeLists.txt
+2
-2
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+51
-6
source/libs/query/CMakeLists.txt
source/libs/query/CMakeLists.txt
+12
-0
source/libs/query/inc/queryInt.h
source/libs/query/inc/queryInt.h
+40
-0
source/libs/query/src/querymsg.c
source/libs/query/src/querymsg.c
+12
-13
未找到文件。
include/libs/catalog/catalog.h
浏览文件 @
fb035bb3
...
...
@@ -108,7 +108,7 @@ int32_t catalogUpdateVgroup(struct SCatalog* pCatalog, SVgroupListInfo* pVgroup)
int32_t
catalogGetDBVgroupVersion
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
int32_t
*
version
);
int32_t
catalogGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbName
,
int32_t
forceUpdate
,
SDBVgroupInfo
*
dbInfo
);
int32_t
catalogGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbName
,
int32_t
forceUpdate
,
SDBVgroupInfo
*
*
dbInfo
);
int32_t
catalogUpdateDBVgroup
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
SDBVgroupInfo
*
dbInfo
);
...
...
include/
common/tmessage
.h
→
include/
libs/query/query
.h
浏览文件 @
fb035bb3
...
...
@@ -13,20 +13,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_
COMMON_TMESSAGE
_H_
#define _TD_
COMMON_TMESSAGE
_H_
#ifndef _TD_
QUERY
_H_
#define _TD_
QUERY
_H_
#ifdef __cplusplus
extern
"C"
{
#endif
extern
int32_t
(
*
tscBuildMsg
[
TSDB_MSG_TYPE_MAX
])(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
);
extern
int32_t
(
*
tscProcessMsgRsp
[
TSDB_MSG_TYPE_MAX
])(
void
*
output
,
char
*
msg
,
int32_t
msgSize
);
extern
int32_t
(
*
queryBuildMsg
[
TSDB_MSG_TYPE_MAX
])(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
);
extern
int32_t
(
*
queryProcessMsgRsp
[
TSDB_MSG_TYPE_MAX
])(
void
*
output
,
char
*
msg
,
int32_t
msgSize
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_
COMMON_TMESSAGE
_H_*/
#endif
/*_TD_
QUERY
_H_*/
source/common/inc/commonInt.h
浏览文件 @
fb035bb3
...
...
@@ -21,17 +21,7 @@ extern "C" {
#endif
#include "tlog.h"
extern
int32_t
cDebugFlag
;
#define tscFatal(...) do { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", cDebugFlag, __VA_ARGS__); }} while(0)
#define tscError(...) do { if (cDebugFlag & DEBUG_ERROR) { taosPrintLog("TSC ERROR ", cDebugFlag, __VA_ARGS__); }} while(0)
#define tscWarn(...) do { if (cDebugFlag & DEBUG_WARN) { taosPrintLog("TSC WARN ", cDebugFlag, __VA_ARGS__); }} while(0)
#define tscInfo(...) do { if (cDebugFlag & DEBUG_INFO) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }} while(0)
#define tscDebug(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }} while(0)
#define tscTrace(...) do { if (cDebugFlag & DEBUG_TRACE) { taosPrintLog("TSC ", cDebugFlag, __VA_ARGS__); }} while(0)
#define tscDebugL(...) do { if (cDebugFlag & DEBUG_DEBUG) { taosPrintLongString("TSC ", cDebugFlag, __VA_ARGS__); }} while(0)
#ifdef __cplusplus
}
...
...
source/libs/CMakeLists.txt
浏览文件 @
fb035bb3
...
...
@@ -10,3 +10,4 @@ add_subdirectory(catalog)
add_subdirectory
(
executor
)
add_subdirectory
(
planner
)
add_subdirectory
(
function
)
add_subdirectory
(
query
)
source/libs/catalog/CMakeLists.txt
浏览文件 @
fb035bb3
...
...
@@ -8,5 +8,5 @@ target_include_directories(
target_link_libraries
(
catalog
PRIVATE os util common transport
PRIVATE os util common transport
query
)
source/libs/catalog/src/catalog.c
浏览文件 @
fb035bb3
...
...
@@ -15,7 +15,7 @@
#include "catalogInt.h"
#include "trpc.h"
#include "
tmessage
.h"
#include "
query
.h"
SCatalogMgmt
ctgMgmt
=
{
0
};
...
...
@@ -24,7 +24,7 @@ int32_t ctgGetVgroupFromMnode(struct SCatalog* pCatalog, void *pRpc, const SEpSe
SEpSet
*
pVnodeEpSet
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
code
=
tsc
BuildMsg
[
TSDB_MSG_TYPE_VGROUP_LIST
](
NULL
,
&
msg
,
0
,
&
msgLen
);
int32_t
code
=
query
BuildMsg
[
TSDB_MSG_TYPE_VGROUP_LIST
](
NULL
,
&
msg
,
0
,
&
msgLen
);
if
(
code
)
{
return
code
;
}
...
...
@@ -39,7 +39,7 @@ int32_t ctgGetVgroupFromMnode(struct SCatalog* pCatalog, void *pRpc, const SEpSe
rpcSendRecv
(
pRpc
,
(
SEpSet
*
)
pMgmtEps
,
&
rpcMsg
,
&
rpcRsp
);
code
=
tsc
ProcessMsgRsp
[
TSDB_MSG_TYPE_VGROUP_LIST
](
pVgroup
,
rpcRsp
.
pCont
,
rpcRsp
.
contLen
);
code
=
query
ProcessMsgRsp
[
TSDB_MSG_TYPE_VGROUP_LIST
](
pVgroup
,
rpcRsp
.
pCont
,
rpcRsp
.
contLen
);
if
(
code
)
{
return
code
;
}
...
...
@@ -63,7 +63,23 @@ int32_t ctgGetVgroupFromCache(SCatalog* pCatalog, SArray** pVgroupList, int32_t*
}
int32_t
ctgGetDBVgroupFromCache
(
SCatalog
*
pCatalog
,
char
*
dbName
,
SDBVgroupInfo
**
dbInfo
,
int32_t
*
exist
)
{
/*
if (NULL == pCatalog->dbCache.cache) {
*exist = 0;
return TSDB_CODE_SUCCESS;
}
taosHashGet(SHashObj * pHashObj, const void * key, size_t keyLen)
if (dbInfo) {
*pVgroupList = taosArrayDup(pCatalog->vgroupCache.arrayCache);
}
*exist = 1;
*/
return
TSDB_CODE_SUCCESS
;
}
int32_t
catalogInit
(
SCatalogCfg
*
cfg
)
{
...
...
@@ -245,12 +261,41 @@ int32_t catalogGetDBVgroupVersion(struct SCatalog* pCatalog, const char* dbName,
return
TSDB_CODE_SUCCESS
;
}
int32_t
catalog
GetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbName
,
int32_t
forceUpdat
e
,
SDBVgroupInfo
*
dbInfo
)
{
int32_t
catalog
UpdateDBVgroup
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbNam
e
,
SDBVgroupInfo
*
dbInfo
)
{
}
int32_t
catalogUpdateDBVgroup
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
SDBVgroupInfo
*
dbInfo
)
{
int32_t
catalogGetDBVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbName
,
int32_t
forceUpdate
,
SDBVgroupInfo
**
dbInfo
)
{
if
(
NULL
==
pCatalog
||
NULL
==
dbName
||
NULL
==
pRpc
||
NULL
==
pMgmtEps
)
{
return
TSDB_CODE_CTG_INVALID_INPUT
;
}
/*
int32_t exist = 0;
if (0 == forceUpdate) {
CTG_ERR_RET(ctgGetDBVgroupFromCache(pCatalog, dbName, dbInfo, &exist));
if (exist) {
return TSDB_CODE_SUCCESS;
}
}
SDBVgroupInfo* newDbInfo = NULL;
CTG_ERR_RET(ctgGetDBVgroupFromMnode(pCatalog, pRpc, pMgmtEps, dbName, &newDbInfo));
CTG_ERR_RET(catalogUpdateDBVgroup(pCatalog, dbName, newDbInfo));
if (dbInfo) {
*dbInfo = newDbInfo;
}
*/
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -265,7 +310,7 @@ int32_t catalogGetTableMetaFromMnode(struct SCatalog* pCatalog, void *pRpc, cons
SEpSet
*
pVnodeEpSet
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
code
=
tsc
BuildMsg
[
TSDB_MSG_TYPE_TABLE_META
](
&
bInput
,
&
msg
,
0
,
&
msgLen
);
int32_t
code
=
query
BuildMsg
[
TSDB_MSG_TYPE_TABLE_META
](
&
bInput
,
&
msg
,
0
,
&
msgLen
);
if
(
code
)
{
return
code
;
}
...
...
source/libs/query/CMakeLists.txt
0 → 100644
浏览文件 @
fb035bb3
aux_source_directory
(
src QUERY_SRC
)
add_library
(
query
${
QUERY_SRC
}
)
target_include_directories
(
query
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/query"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
query
PRIVATE os util common transport
)
source/libs/query/inc/queryInt.h
0 → 100644
浏览文件 @
fb035bb3
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_QUERY_INT_H_
#define _TD_QUERY_INT_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include "tlog.h"
extern
int32_t
qDebugFlag
;
#define qFatal(...) do { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", qDebugFlag, __VA_ARGS__); }} while(0)
#define qError(...) do { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", qDebugFlag, __VA_ARGS__); }} while(0)
#define qWarn(...) do { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN ", qDebugFlag, __VA_ARGS__); }} while(0)
#define qInfo(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
#define qDebug(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
#define qTrace(...) do { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
#define qDebugL(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLongString("QRY ", qDebugFlag, __VA_ARGS__); }} while(0)
#ifdef __cplusplus
}
#endif
#endif
/*_TD_QUERY_INT_H_*/
source/
common/src/tmessage
.c
→
source/
libs/query/src/querymsg
.c
浏览文件 @
fb035bb3
...
...
@@ -14,15 +14,15 @@
*/
#include "taosmsg.h"
#include "
commoni
nt.h"
#include "
queryI
nt.h"
int32_t
(
*
tsc
BuildMsg
[
TSDB_MSG_TYPE_MAX
])(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
=
{
0
};
int32_t
(
*
query
BuildMsg
[
TSDB_MSG_TYPE_MAX
])(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
=
{
0
};
int32_t
(
*
tsc
ProcessMsgRsp
[
TSDB_MSG_TYPE_MAX
])(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
=
{
0
};
int32_t
(
*
query
ProcessMsgRsp
[
TSDB_MSG_TYPE_MAX
])(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
=
{
0
};
int32_t
tsc
BuildVgroupListReqMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
{
int32_t
query
BuildVgroupListReqMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
{
if
(
NULL
==
msg
||
NULL
==
msgLen
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
...
...
@@ -32,7 +32,7 @@ int32_t tscBuildVgroupListReqMsg(void* input, char **msg, int32_t msgSize, int32
return
TSDB_CODE_SUCCESS
;
}
int32_t
tsc
BuildTableMetaReqMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
{
int32_t
query
BuildTableMetaReqMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
{
if
(
NULL
==
input
||
NULL
==
msg
||
NULL
==
msgLen
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
...
...
@@ -61,7 +61,7 @@ int32_t tscBuildTableMetaReqMsg(void* input, char **msg, int32_t msgSize, int32_
}
int32_t
tsc
ProcessVgroupListRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
int32_t
query
ProcessVgroupListRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
if
(
NULL
==
output
||
NULL
==
msg
||
msgSize
<=
0
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
...
...
@@ -72,17 +72,17 @@ int32_t tscProcessVgroupListRsp(void* output, char *msg, int32_t msgSize) {
pRsp
->
vgroupVersion
=
htonl
(
pRsp
->
vgroupVersion
);
if
(
pRsp
->
vgroupNum
<
0
)
{
tsc
Error
(
"vgroup number[%d] in rsp is invalid"
,
pRsp
->
vgroupNum
);
q
Error
(
"vgroup number[%d] in rsp is invalid"
,
pRsp
->
vgroupNum
);
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
if
(
pRsp
->
vgroupVersion
<
0
)
{
tsc
Error
(
"vgroup vgroupVersion[%d] in rsp is invalid"
,
pRsp
->
vgroupVersion
);
q
Error
(
"vgroup vgroupVersion[%d] in rsp is invalid"
,
pRsp
->
vgroupVersion
);
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
if
(
msgSize
!=
(
pRsp
->
vgroupNum
*
sizeof
(
pRsp
->
vgroupInfo
[
0
])
+
sizeof
(
*
pRsp
)))
{
tsc
Error
(
"vgroup list msg size mis-match, msgSize:%d, vgroup number:%d"
,
msgSize
,
pRsp
->
vgroupNum
);
q
Error
(
"vgroup list msg size mis-match, msgSize:%d, vgroup number:%d"
,
msgSize
,
pRsp
->
vgroupNum
);
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
...
...
@@ -104,12 +104,11 @@ int32_t tscProcessVgroupListRsp(void* output, char *msg, int32_t msgSize) {
}
void
msgInit
()
{
tscBuildMsg
[
TSDB_MSG_TYPE_TABLE_META
]
=
tscBuildTableMetaReqMsg
;
tscBuildMsg
[
TSDB_MSG_TYPE_VGROUP_LIST
]
=
tscBuildVgroupListReqMsg
;
queryBuildMsg
[
TSDB_MSG_TYPE_TABLE_META
]
=
queryBuildTableMetaReqMsg
;
queryBuildMsg
[
TSDB_MSG_TYPE_VGROUP_LIST
]
=
queryBuildVgroupListReqMsg
;
//tscProcessMsgRsp[TSDB_MSG_TYPE_TABLE_META] = tscProcessTableMetaRsp;
tscProcessMsgRsp
[
TSDB_MSG_TYPE_VGROUP_LIST
]
=
tsc
ProcessVgroupListRsp
;
queryProcessMsgRsp
[
TSDB_MSG_TYPE_VGROUP_LIST
]
=
query
ProcessVgroupListRsp
;
/*
tscBuildMsg[TSDB_SQL_SELECT] = tscBuildQueryMsg;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录