Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
71fc95cc
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
71fc95cc
编写于
2月 15, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
[td-11818] merge 3.0
上级
63f3da03
643843f1
变更
102
展开全部
隐藏空白更改
内联
并排
Showing
102 changed file
with
7758 addition
and
4275 deletion
+7758
-4275
example/src/tmq.c
example/src/tmq.c
+19
-19
include/common/common.h
include/common/common.h
+43
-31
include/common/taosdef.h
include/common/taosdef.h
+7
-7
include/common/tmsg.h
include/common/tmsg.h
+170
-140
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+22
-21
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+1
-1
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+133
-0
include/libs/nodes/nodesShowStmts.h
include/libs/nodes/nodesShowStmts.h
+0
-0
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+5
-101
include/libs/qcom/query.h
include/libs/qcom/query.h
+3
-3
include/libs/sync/sync.h
include/libs/sync/sync.h
+69
-65
include/util/taoserror.h
include/util/taoserror.h
+7
-2
include/util/tcoding.h
include/util/tcoding.h
+25
-27
include/util/tdef.h
include/util/tdef.h
+1
-0
source/CMakeLists.txt
source/CMakeLists.txt
+1
-2
source/client/src/clientHb.c
source/client/src/clientHb.c
+19
-29
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+18
-15
source/client/src/tmq.c
source/client/src/tmq.c
+64
-63
source/common/src/tmsg.c
source/common/src/tmsg.c
+949
-147
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+2
-1
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+16
-10
source/dnode/mnode/impl/inc/mndAuth.h
source/dnode/mnode/impl/inc/mndAuth.h
+7
-0
source/dnode/mnode/impl/inc/mndDb.h
source/dnode/mnode/impl/inc/mndDb.h
+1
-1
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+32
-1
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+74
-37
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+2
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+298
-183
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+84
-41
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+135
-95
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+74
-36
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+20
-17
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+73
-36
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+33
-25
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+73
-35
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+1
-1
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+77
-61
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+16
-7
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+7
-1
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+6
-7
source/dnode/mnode/impl/test/acct/acct.cpp
source/dnode/mnode/impl/test/acct/acct.cpp
+6
-3
source/dnode/mnode/impl/test/bnode/bnode.cpp
source/dnode/mnode/impl/test/bnode/bnode.cpp
+76
-46
source/dnode/mnode/impl/test/db/db.cpp
source/dnode/mnode/impl/test/db/db.cpp
+104
-95
source/dnode/mnode/impl/test/dnode/dnode.cpp
source/dnode/mnode/impl/test/dnode/dnode.cpp
+75
-48
source/dnode/mnode/impl/test/func/func.cpp
source/dnode/mnode/impl/test/func/func.cpp
+222
-195
source/dnode/mnode/impl/test/mnode/mnode.cpp
source/dnode/mnode/impl/test/mnode/mnode.cpp
+71
-43
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+13
-13
source/dnode/mnode/impl/test/qnode/qnode.cpp
source/dnode/mnode/impl/test/qnode/qnode.cpp
+76
-48
source/dnode/mnode/impl/test/show/show.cpp
source/dnode/mnode/impl/test/show/show.cpp
+12
-8
source/dnode/mnode/impl/test/snode/snode.cpp
source/dnode/mnode/impl/test/snode/snode.cpp
+76
-46
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+30
-26
source/dnode/mnode/impl/test/trans/trans.cpp
source/dnode/mnode/impl/test/trans/trans.cpp
+28
-19
source/dnode/mnode/impl/test/user/user.cpp
source/dnode/mnode/impl/test/user/user.cpp
+84
-111
source/dnode/vnode/inc/tq.h
source/dnode/vnode/inc/tq.h
+4
-145
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+9
-8
source/dnode/vnode/src/inc/tqInt.h
source/dnode/vnode/src/inc/tqInt.h
+143
-2
source/dnode/vnode/src/inc/tqMetaStore.h
source/dnode/vnode/src/inc/tqMetaStore.h
+2
-2
source/dnode/vnode/src/inc/tqOffset.h
source/dnode/vnode/src/inc/tqOffset.h
+40
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+137
-210
source/dnode/vnode/src/tq/tqMetaStore.c
source/dnode/vnode/src/tq/tqMetaStore.c
+15
-18
source/dnode/vnode/src/tq/tqOffset.c
source/dnode/vnode/src/tq/tqOffset.c
+42
-0
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+157
-0
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+35
-34
source/dnode/vnode/src/vnd/vnodeMain.c
source/dnode/vnode/src/vnd/vnodeMain.c
+1
-0
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+3
-0
source/dnode/vnode/src/vnd/vnodeWrite.c
source/dnode/vnode/src/vnd/vnodeWrite.c
+6
-19
source/libs/CMakeLists.txt
source/libs/CMakeLists.txt
+1
-0
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+83
-12
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+1137
-679
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+386
-164
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+3
-2
source/libs/nodes/CMakeLists.txt
source/libs/nodes/CMakeLists.txt
+1
-1
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+0
-0
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+0
-0
source/libs/nodes/src/nodesEqualFuncs.c
source/libs/nodes/src/nodesEqualFuncs.c
+1
-1
source/libs/nodes/src/nodesTraverseFuncs.c
source/libs/nodes/src/nodesTraverseFuncs.c
+272
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+22
-2
source/libs/nodes/test/CMakeLists.txt
source/libs/nodes/test/CMakeLists.txt
+0
-0
source/libs/nodes/test/nodesTest.cpp
source/libs/nodes/test/nodesTest.cpp
+61
-0
source/libs/parser/inc/astCreateFuncs.h
source/libs/parser/inc/astCreateFuncs.h
+2
-1
source/libs/parser/inc/astToMsg.h
source/libs/parser/inc/astToMsg.h
+21
-7
source/libs/parser/inc/new_sql.y
source/libs/parser/inc/new_sql.y
+7
-1
source/libs/parser/inc/parserImpl.h
source/libs/parser/inc/parserImpl.h
+2
-1
source/libs/parser/src/astCreateFuncs.c
source/libs/parser/src/astCreateFuncs.c
+12
-0
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+232
-98
source/libs/parser/src/astValidate.c
source/libs/parser/src/astValidate.c
+1
-1
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+23
-114
source/libs/parser/src/new_sql.c
source/libs/parser/src/new_sql.c
+593
-566
source/libs/parser/src/parserImpl.c
source/libs/parser/src/parserImpl.c
+187
-59
source/libs/parser/src/ttokenizer.c
source/libs/parser/src/ttokenizer.c
+3
-1
source/libs/parser/test/newParserTest.cpp
source/libs/parser/test/newParserTest.cpp
+202
-37
source/libs/planner/inc/plannerImpl.h
source/libs/planner/inc/plannerImpl.h
+9
-7
source/libs/planner/src/plannerImpl.c
source/libs/planner/src/plannerImpl.c
+19
-0
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+34
-55
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+12
-2
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+11
-2
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+48
-20
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+6
-4
source/libs/transport/src/transSrv.c
source/libs/transport/src/transSrv.c
+68
-22
source/libs/transport/test/CMakeLists.txt
source/libs/transport/test/CMakeLists.txt
+36
-1
source/libs/transport/test/pushClient.c
source/libs/transport/test/pushClient.c
+9
-6
source/libs/transport/test/pushServer.c
source/libs/transport/test/pushServer.c
+199
-0
source/util/src/terror.c
source/util/src/terror.c
+1
-1
未找到文件。
example/src/tmq.c
浏览文件 @
71fc95cc
...
...
@@ -44,35 +44,35 @@ int32_t init_env() {
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create stable st1 (ts timestamp, k int) tags(a int)"
);
/*pRes = taos_query(pConn, "create stable if not exists st1 (ts timestamp, k int) tags(a int)");*/
/*if (taos_errno(pRes) != 0) {*/
/*printf("failed to create super table 123_$^), reason:%s\n", taos_errstr(pRes));*/
/*return -1;*/
/*}*/
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create table tu using st1 tags(1)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create child table tu, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create table tu2 using st1 tags(2)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create child table tu2, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
}
taos_free_result
(
pRes
);
/*taos_free_result(pRes);*/
/*pRes = taos_query(pConn, "create table if not exists tu using st1 tags(1)");*/
/*if (taos_errno(pRes) != 0) {*/
/*printf("failed to create child table tu, reason:%s\n", taos_errstr(pRes));*/
/*return -1;*/
/*}*/
/*taos_free_result(pRes);*/
const
char
*
sql
=
"select * from st1"
;
pRes
=
tmq_create_topic
(
pConn
,
"test_stb_topic_1"
,
sql
,
strlen
(
sql
));
/*pRes = taos_query(pConn, "create table if not exists tu2 using st1 tags(2)");*/
/*if (taos_errno(pRes) != 0) {*/
/*printf("failed to create
topic test_stb_topic_1
, reason:%s\n", taos_errstr(pRes));*/
/*printf("failed to create
child table tu2
, reason:%s\n", taos_errstr(pRes));*/
/*return -1;*/
/*}*/
/*taos_free_result(pRes);*/
const
char
*
sql
=
"select * from st1"
;
pRes
=
tmq_create_topic
(
pConn
,
"test_stb_topic_1"
,
sql
,
strlen
(
sql
));
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create topic test_stb_topic_1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
}
taos_free_result
(
pRes
);
taos_close
(
pConn
);
return
0
;
}
...
...
include/common/common.h
浏览文件 @
71fc95cc
...
...
@@ -22,21 +22,34 @@ extern "C" {
#endif
#include "taosdef.h"
#include "tmsg.h"
#include "tarray.h"
#include "tmsg.h"
#include "tvariant.h"
#define TMQ_REQ_TYPE_COMMIT_ONLY 0
#define TMQ_REQ_TYPE_CONSUME_ONLY 1
#define TMQ_REQ_TYPE_CONSUME_AND_COMMIT 2
#define TMQ_REQ_TYPE_COMMIT_ONLY 0
#define TMQ_REQ_TYPE_CONSUME_ONLY 1
// typedef struct STimeWindow {
// TSKEY skey;
// TSKEY ekey;
// } STimeWindow;
// typedef struct {
// int32_t dataLen;
// char name[TSDB_TABLE_FNAME_LEN];
// char *data;
// } STagData;
// typedef struct SSchema {
// uint8_t type;
// char name[TSDB_COL_NAME_LEN];
// int16_t colId;
// int16_t bytes;
// } SSchema;
#define TMQ_REQ_TYPE_COMMIT_ONLY 0
#define TMQ_REQ_TYPE_CONSUME_ONLY 1
#define TMQ_REQ_TYPE_CONSUME_AND_COMMIT 2
typedef
struct
{
uint32_t
numOfTables
;
SArray
*
pGroupList
;
SArray
*
pGroupList
;
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
}
STableGroupInfo
;
...
...
@@ -67,9 +80,9 @@ typedef struct SConstantItem {
// info.numOfCols = taosArrayGetSize(pDataBlock) + taosArrayGetSize(pConstantList);
typedef
struct
SSDataBlock
{
SColumnDataAgg
*
pBlockAgg
;
SArray
*
pDataBlock
;
// SArray<SColumnInfoData>
SArray
*
pConstantList
;
// SArray<SConstantItem>, it is a constant/tags value of the corresponding result value.
SDataBlockInfo
info
;
SArray
*
pDataBlock
;
// SArray<SColumnInfoData>
SArray
*
pConstantList
;
// SArray<SConstantItem>, it is a constant/tags value of the corresponding result value.
SDataBlockInfo
info
;
}
SSDataBlock
;
typedef
struct
SVarColAttr
{
...
...
@@ -112,7 +125,7 @@ static FORCE_INLINE int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlo
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeDataBlock
(
void
*
buf
,
SSDataBlock
*
pBlock
)
{
static
FORCE_INLINE
void
*
tDecodeDataBlock
(
const
void
*
buf
,
SSDataBlock
*
pBlock
)
{
int32_t
sz
;
buf
=
taosDecodeFixedI64
(
buf
,
&
pBlock
->
info
.
uid
);
...
...
@@ -129,7 +142,7 @@ static FORCE_INLINE void* tDecodeDataBlock(void* buf, SSDataBlock* pBlock) {
buf
=
taosDecodeBinary
(
buf
,
(
void
**
)
&
data
.
pData
,
colSz
);
taosArrayPush
(
pBlock
->
pDataBlock
,
&
data
);
}
return
buf
;
return
(
void
*
)
buf
;
}
static
FORCE_INLINE
int32_t
tEncodeSMqConsumeRsp
(
void
**
buf
,
const
SMqConsumeRsp
*
pRsp
)
{
...
...
@@ -148,7 +161,7 @@ static FORCE_INLINE int32_t tEncodeSMqConsumeRsp(void** buf, const SMqConsumeRsp
}
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SSDataBlock
*
pBlock
=
(
SSDataBlock
*
)
taosArrayGet
(
pRsp
->
pBlockData
,
i
);
SSDataBlock
*
pBlock
=
(
SSDataBlock
*
)
taosArrayGet
(
pRsp
->
pBlockData
,
i
);
tlen
+=
tEncodeDataBlock
(
buf
,
pBlock
);
}
return
tlen
;
...
...
@@ -181,19 +194,18 @@ static FORCE_INLINE void tDeleteSSDataBlock(SSDataBlock* pBlock) {
return
;
}
//int32_t numOfOutput = pBlock->info.numOfCols;
//
int32_t numOfOutput = pBlock->info.numOfCols;
int32_t
sz
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
sz
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
sz
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
tfree
(
pColInfoData
->
pData
);
}
taosArrayDestroy
(
pBlock
->
pDataBlock
);
tfree
(
pBlock
->
pBlockAgg
);
//tfree(pBlock);
//
tfree(pBlock);
}
static
FORCE_INLINE
void
tDeleteSMqConsumeRsp
(
SMqConsumeRsp
*
pRsp
)
{
if
(
pRsp
->
schemas
)
{
if
(
pRsp
->
schemas
->
nCols
)
{
...
...
@@ -201,11 +213,11 @@ static FORCE_INLINE void tDeleteSMqConsumeRsp(SMqConsumeRsp* pRsp) {
}
free
(
pRsp
->
schemas
);
}
taosArrayDestroyEx
(
pRsp
->
pBlockData
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
pRsp
->
pBlockData
=
NULL
;
//for (int i = 0; i < taosArrayGetSize(pRsp->pBlockData); i++) {
//
SSDataBlock* pDataBlock = (SSDataBlock*)taosArrayGet(pRsp->pBlockData, i);
//
tDeleteSSDataBlock(pDataBlock);
taosArrayDestroyEx
(
pRsp
->
pBlockData
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
pRsp
->
pBlockData
=
NULL
;
//
for (int i = 0; i < taosArrayGetSize(pRsp->pBlockData); i++) {
//
SSDataBlock* pDataBlock = (SSDataBlock*)taosArrayGet(pRsp->pBlockData, i);
//
tDeleteSSDataBlock(pDataBlock);
//}
}
...
...
@@ -229,7 +241,7 @@ typedef struct SOrder {
}
SOrder
;
typedef
struct
SGroupbyExpr
{
SArray
*
columnInfo
;
// SArray<SColIndex>, group by columns information
SArray
*
columnInfo
;
// SArray<SColIndex>, group by columns information
bool
groupbyTag
;
// group by tag or column
}
SGroupbyExpr
;
...
...
@@ -238,16 +250,16 @@ typedef struct SSqlExpr {
char
token
[
TSDB_COL_NAME_LEN
];
// original token
SSchema
resSchema
;
int32_t
numOfCols
;
SColumn
*
pColumns
;
// data columns that are required by query
int32_t
interBytes
;
// inter result buffer size
int16_t
numOfParams
;
// argument value of each function
SVariant
param
[
3
];
// parameters are not more than 3
int32_t
numOfCols
;
SColumn
*
pColumns
;
// data columns that are required by query
int32_t
interBytes
;
// inter result buffer size
int16_t
numOfParams
;
// argument value of each function
SVariant
param
[
3
];
// parameters are not more than 3
}
SSqlExpr
;
typedef
struct
SExprInfo
{
struct
SSqlExpr
base
;
struct
tExprNode
*
pExpr
;
struct
tExprNode
*
pExpr
;
}
SExprInfo
;
typedef
struct
SStateWindow
{
...
...
include/common/taosdef.h
浏览文件 @
71fc95cc
...
...
@@ -23,7 +23,7 @@ extern "C" {
#include "taos.h"
#include "tdef.h"
typedef
u
int64_t
tb_uid_t
;
typedef
int64_t
tb_uid_t
;
#define TSWINDOW_INITIALIZER ((STimeWindow){INT64_MIN, INT64_MAX})
#define TSWINDOW_DESC_INITIALIZER ((STimeWindow){INT64_MAX, INT64_MIN})
...
...
@@ -38,12 +38,12 @@ typedef enum {
}
EQType
;
typedef
enum
{
TSDB_SUPER_TABLE
=
1
,
// super table
TSDB_CHILD_TABLE
=
2
,
// table created from super table
TSDB_NORMAL_TABLE
=
3
,
// ordinary table
TSDB_STREAM_TABLE
=
4
,
// table created from stream computing
TSDB_TEMP_TABLE
=
5
,
// temp table created by nest query
TSDB_TABLE_MAX
=
6
TSDB_SUPER_TABLE
=
1
,
// super table
TSDB_CHILD_TABLE
=
2
,
// table created from super table
TSDB_NORMAL_TABLE
=
3
,
// ordinary table
TSDB_STREAM_TABLE
=
4
,
// table created from stream computing
TSDB_TEMP_TABLE
=
5
,
// temp table created by nest query
TSDB_TABLE_MAX
=
6
}
ETableType
;
typedef
enum
{
...
...
include/common/tmsg.h
浏览文件 @
71fc95cc
...
...
@@ -275,6 +275,7 @@ typedef struct {
int32_t
tSerializeSMCreateStbReq
(
void
**
buf
,
SMCreateStbReq
*
pReq
);
void
*
tDeserializeSMCreateStbReq
(
void
*
buf
,
SMCreateStbReq
*
pReq
);
void
tFreeSMCreateStbReq
(
SMCreateStbReq
*
pReq
);
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
...
...
@@ -328,6 +329,26 @@ static FORCE_INLINE void* taosDecodeSEpSet(void* buf, SEpSet* pEp) {
return
buf
;
}
static
FORCE_INLINE
int32_t
tEncodeSEpSet
(
SCoder
*
pEncoder
,
const
SEpSet
*
pEp
)
{
if
(
tEncodeI8
(
pEncoder
,
pEp
->
inUse
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pEp
->
numOfEps
)
<
0
)
return
-
1
;
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
if
(
tEncodeU16
(
pEncoder
,
pEp
->
eps
[
i
].
port
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pEp
->
eps
[
i
].
fqdn
)
<
0
)
return
-
1
;
}
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeSEpSet
(
SCoder
*
pDecoder
,
SEpSet
*
pEp
)
{
if
(
tDecodeI8
(
pDecoder
,
&
pEp
->
inUse
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pEp
->
numOfEps
)
<
0
)
return
-
1
;
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
if
(
tDecodeU16
(
pDecoder
,
&
pEp
->
eps
[
i
].
port
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pEp
->
eps
[
i
].
fqdn
)
<
0
)
return
-
1
;
}
return
0
;
}
typedef
struct
{
int32_t
acctId
;
int64_t
clusterId
;
...
...
@@ -349,15 +370,15 @@ typedef struct {
int64_t
maxStorage
;
// In unit of GB
}
SCreateAcctReq
,
SAlterAcctReq
;
int32_t
tSerializeSCreateAcctReq
(
void
*
*
buf
,
SCreateAcctReq
*
pReq
);
void
*
tDeserializeSCreateAcctReq
(
void
*
buf
,
SCreateAcctReq
*
pReq
);
int32_t
tSerializeSCreateAcctReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateAcctReq
*
pReq
);
int32_t
tDeserializeSCreateAcctReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateAcctReq
*
pReq
);
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
}
SDropUserReq
,
SDropAcctReq
;
int32_t
tSerializeSDropUserReq
(
void
*
*
buf
,
SDropUserReq
*
pReq
);
void
*
tDeserializeSDropUserReq
(
void
*
buf
,
SDropUserReq
*
pReq
);
int32_t
tSerializeSDropUserReq
(
void
*
buf
,
int32_t
bufLen
,
SDropUserReq
*
pReq
);
int32_t
tDeserializeSDropUserReq
(
void
*
buf
,
int32_t
bufLen
,
SDropUserReq
*
pReq
);
typedef
struct
{
int8_t
createType
;
...
...
@@ -366,8 +387,8 @@ typedef struct {
char
pass
[
TSDB_PASSWORD_LEN
];
}
SCreateUserReq
;
int32_t
tSerializeSCreateUserReq
(
void
*
*
buf
,
SCreateUserReq
*
pReq
);
void
*
tDeserializeSCreateUserReq
(
void
*
buf
,
SCreateUserReq
*
pReq
);
int32_t
tSerializeSCreateUserReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateUserReq
*
pReq
);
int32_t
tDeserializeSCreateUserReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateUserReq
*
pReq
);
typedef
struct
{
int8_t
alterType
;
...
...
@@ -377,15 +398,15 @@ typedef struct {
char
dbname
[
TSDB_DB_FNAME_LEN
];
}
SAlterUserReq
;
int32_t
tSerializeSAlterUserReq
(
void
*
*
buf
,
SAlterUserReq
*
pReq
);
void
*
tDeserializeSAlterUserReq
(
void
*
buf
,
SAlterUserReq
*
pReq
);
int32_t
tSerializeSAlterUserReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterUserReq
*
pReq
);
int32_t
tDeserializeSAlterUserReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterUserReq
*
pReq
);
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
}
SGetUserAuthReq
;
int32_t
tSerializeSGetUserAuthReq
(
void
*
*
buf
,
SGetUserAuthReq
*
pReq
);
void
*
tDeserializeSGetUserAuthReq
(
void
*
buf
,
SGetUserAuthReq
*
pReq
);
int32_t
tSerializeSGetUserAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthReq
*
pReq
);
int32_t
tDeserializeSGetUserAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthReq
*
pReq
);
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
...
...
@@ -394,8 +415,8 @@ typedef struct {
SHashObj
*
writeDbs
;
}
SGetUserAuthRsp
;
int32_t
tSerializeSGetUserAuthRsp
(
void
*
*
buf
,
SGetUserAuthRsp
*
pReq
);
void
*
tDeserializeSGetUserAuthRsp
(
void
*
buf
,
SGetUserAuthRsp
*
pReq
);
int32_t
tSerializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
);
int32_t
tDeserializeSGetUserAuthRsp
(
void
*
buf
,
int32_t
bufLen
,
SGetUserAuthRsp
*
pRsp
);
typedef
struct
{
int16_t
colId
;
// column id
...
...
@@ -525,28 +546,6 @@ typedef struct {
int32_t
code
;
}
SQueryTableRsp
;
// todo: the show handle should be replaced with id
typedef
struct
{
SMsgHead
header
;
union
{
int64_t
showId
;
int64_t
qhandle
;
int64_t
qId
;
};
// query handle
int8_t
free
;
}
SRetrieveTableReq
;
typedef
struct
{
int64_t
useconds
;
int8_t
completed
;
// all results are returned to client
int8_t
precision
;
int8_t
compressed
;
int32_t
compLen
;
int32_t
numOfRows
;
char
data
[];
}
SRetrieveTableRsp
;
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
int32_t
numOfVgroups
;
...
...
@@ -570,6 +569,9 @@ typedef struct {
int8_t
ignoreExist
;
}
SCreateDbReq
;
int32_t
tSerializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
);
int32_t
tDeserializeSCreateDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDbReq
*
pReq
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
int32_t
totalBlocks
;
...
...
@@ -582,28 +584,60 @@ typedef struct {
int8_t
cacheLastRow
;
}
SAlterDbReq
;
int32_t
tSerializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
);
int32_t
tDeserializeSAlterDbReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterDbReq
*
pReq
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
int8_t
ignoreNotExists
;
}
SDropDbReq
;
int32_t
tSerializeSDropDbReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDbReq
*
pReq
);
int32_t
tDeserializeSDropDbReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDbReq
*
pReq
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
uint64_t
uid
;
}
SDropDbRsp
;
int32_t
tSerializeSDropDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SDropDbRsp
*
pRsp
);
int32_t
tDeserializeSDropDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SDropDbRsp
*
pRsp
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
int32_t
vgVersion
;
}
SUseDbReq
;
int32_t
tSerializeSUseDbReq
(
void
*
buf
,
int32_t
bufLen
,
SUseDbReq
*
pReq
);
int32_t
tDeserializeSUseDbReq
(
void
*
buf
,
int32_t
bufLen
,
SUseDbReq
*
pReq
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
}
SSyncDbReq
;
char
db
[
TSDB_DB_FNAME_LEN
];
uint64_t
uid
;
int32_t
vgVersion
;
int32_t
vgNum
;
int8_t
hashMethod
;
SArray
*
pVgroupInfos
;
// Array of SVgroupInfo
}
SUseDbRsp
;
int32_t
tSerializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbRsp
*
pRsp
);
int32_t
tDeserializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbRsp
*
pRsp
);
void
tFreeSUsedbRsp
(
SUseDbRsp
*
pRsp
);
typedef
struct
{
SArray
*
pArray
;
// Array of SUseDbRsp
}
SUseDbBatchRsp
;
int32_t
tSerializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
);
int32_t
tDeserializeSUseDbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SUseDbBatchRsp
*
pRsp
);
void
tFreeSUseDbBatchRsp
(
SUseDbBatchRsp
*
pRsp
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
}
SCompactDbReq
;
}
SSyncDbReq
,
SCompactDbReq
;
int32_t
tSerializeSSyncDbReq
(
void
*
buf
,
int32_t
bufLen
,
SSyncDbReq
*
pReq
);
int32_t
tDeserializeSSyncDbReq
(
void
*
buf
,
int32_t
bufLen
,
SSyncDbReq
*
pReq
);
typedef
struct
{
char
name
[
TSDB_FUNC_NAME_LEN
];
...
...
@@ -616,22 +650,31 @@ typedef struct {
int64_t
signature
;
int32_t
commentSize
;
int32_t
codeSize
;
char
pCont
[];
char
pComment
[
TSDB_FUNC_COMMENT_LEN
];
char
pCode
[
TSDB_FUNC_CODE_LEN
];
}
SCreateFuncReq
;
int32_t
tSerializeSCreateFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateFuncReq
*
pReq
);
int32_t
tDeserializeSCreateFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateFuncReq
*
pReq
);
typedef
struct
{
char
name
[
TSDB_FUNC_NAME_LEN
];
int8_t
igNotExists
;
}
SDropFuncReq
;
int32_t
tSerializeSDropFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SDropFuncReq
*
pReq
);
int32_t
tDeserializeSDropFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SDropFuncReq
*
pReq
);
typedef
struct
{
int32_t
numOfFuncs
;
char
pFuncNames
[]
;
SArray
*
pFuncNames
;
}
SRetrieveFuncReq
;
int32_t
tSerializeSRetrieveFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncReq
*
pReq
);
int32_t
tDeserializeSRetrieveFuncReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncReq
*
pReq
);
typedef
struct
{
char
name
[
TSDB_FUNC_NAME_LEN
];
int8_t
align
;
int8_t
funcType
;
int8_t
scriptType
;
int8_t
outputType
;
...
...
@@ -640,14 +683,18 @@ typedef struct {
int64_t
signature
;
int32_t
commentSize
;
int32_t
codeSize
;
char
pCont
[];
char
pComment
[
TSDB_FUNC_COMMENT_LEN
];
char
pCode
[
TSDB_FUNC_CODE_LEN
];
}
SFuncInfo
;
typedef
struct
{
int32_t
numOfFuncs
;
char
pFuncInfos
[]
;
SArray
*
pFuncInfos
;
}
SRetrieveFuncRsp
;
int32_t
tSerializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
int32_t
tDeserializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
typedef
struct
{
int32_t
statusInterval
;
int64_t
checkTime
;
// 1970-01-01 00:00:00.000
...
...
@@ -814,27 +861,22 @@ typedef struct {
char
*
data
;
}
STagData
;
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
uint64_t
uid
;
int32_t
vgVersion
;
int32_t
vgNum
;
int8_t
hashMethod
;
SVgroupInfo
vgroupInfo
[];
}
SUseDbRsp
;
/*
* sql: show tables like '%a_%'
* payload is the query condition, e.g., '%a_%'
* payloadLen is the length of payload
*/
typedef
struct
{
int
8
_t
type
;
int
32
_t
type
;
char
db
[
TSDB_DB_FNAME_LEN
];
int
16
_t
payloadLen
;
char
payload
[]
;
int
32
_t
payloadLen
;
char
*
payload
;
}
SShowReq
;
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
);
int32_t
tDeserializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
);
void
tFreeSShowReq
(
SShowReq
*
pReq
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
int32_t
numOfVgroup
;
...
...
@@ -846,24 +888,57 @@ typedef struct {
STableMetaRsp
tableMeta
;
}
SShowRsp
;
// todo: the show handle should be replaced with id
typedef
struct
{
int64_t
showId
;
int8_t
free
;
}
SRetrieveTableReq
;
int32_t
tSerializeSRetrieveTableReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveTableReq
*
pReq
);
int32_t
tDeserializeSRetrieveTableReq
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveTableReq
*
pReq
);
typedef
struct
{
int64_t
useconds
;
int8_t
completed
;
// all results are returned to client
int8_t
precision
;
int8_t
compressed
;
int32_t
compLen
;
int32_t
numOfRows
;
char
data
[];
}
SRetrieveTableRsp
;
typedef
struct
{
char
fqdn
[
TSDB_FQDN_LEN
];
// end point, hostname:port
int32_t
port
;
}
SCreateDnodeReq
;
int32_t
tSerializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
);
int32_t
tDeserializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
}
SDropDnodeReq
;
int32_t
tSerializeSDropDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDnodeReq
*
pReq
);
int32_t
tDeserializeSDropDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropDnodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
char
config
[
TSDB_DNODE_CONFIG_LEN
];
char
value
[
TSDB_DNODE_VALUE_LEN
];
}
SMCfgDnodeReq
,
SDCfgDnodeReq
;
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
int32_t
tDeserializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
;
int32_t
tSerializeSMCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateMnodeReq
*
pReq
);
int32_t
tDeserializeSMCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateMnodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
int8_t
replica
;
...
...
@@ -872,15 +947,11 @@ typedef struct {
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
;
}
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
SMCreateSnodeReq
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
,
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateSnodeReq
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
;
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
int32_t
tSerializeSMCreateDropQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
int32_t
tDeserializeSMCreateDropQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
typedef
struct
{
char
sql
[
TSDB_SHOW_SQL_LEN
];
...
...
@@ -1499,43 +1570,30 @@ typedef struct {
SArray
*
rsps
;
// SArray<SClientHbRsp>
}
SClientHbBatchRsp
;
static
FORCE_INLINE
uint32_t
hbKeyHashFunc
(
const
char
*
key
,
uint32_t
keyLen
)
{
return
taosIntHash_64
(
key
,
keyLen
);
}
static
FORCE_INLINE
uint32_t
hbKeyHashFunc
(
const
char
*
key
,
uint32_t
keyLen
)
{
return
taosIntHash_64
(
key
,
keyLen
);
}
int
tSerializeSClientHbReq
(
void
**
buf
,
const
SClientHbReq
*
pReq
);
void
*
tDeserializeSClientHbReq
(
void
*
buf
,
SClientHbReq
*
pReq
);
int
tSerializeSClientHbRsp
(
void
**
buf
,
const
SClientHbRsp
*
pRsp
);
void
*
tDeserializeSClientHbRsp
(
void
*
buf
,
SClientHbRsp
*
pRsp
);
static
FORCE_INLINE
void
tFreeReqKvHash
(
SHashObj
*
info
)
{
void
*
pIter
=
taosHashIterate
(
info
,
NULL
);
static
FORCE_INLINE
void
tFreeReqKvHash
(
SHashObj
*
info
)
{
void
*
pIter
=
taosHashIterate
(
info
,
NULL
);
while
(
pIter
!=
NULL
)
{
SKv
*
kv
=
(
SKv
*
)
pIter
;
tfree
(
kv
->
value
);
pIter
=
taosHashIterate
(
info
,
pIter
);
}
}
static
FORCE_INLINE
void
tFreeClientHbReq
(
void
*
pReq
)
{
static
FORCE_INLINE
void
tFreeClientHbReq
(
void
*
pReq
)
{
SClientHbReq
*
req
=
(
SClientHbReq
*
)
pReq
;
if
(
req
->
info
)
{
tFreeReqKvHash
(
req
->
info
);
taosHashCleanup
(
req
->
info
);
}
}
int
tSerializeSClientHbBatchReq
(
void
**
buf
,
const
SClientHbBatchReq
*
pReq
);
void
*
tDeserializeSClientHbBatchReq
(
void
*
buf
,
SClientHbBatchReq
*
pReq
);
int
32_t
tSerializeSClientHbBatchReq
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchReq
*
pReq
);
int32_t
tDeserializeSClientHbBatchReq
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchReq
*
pReq
);
static
FORCE_INLINE
void
tFreeClientHbBatchReq
(
void
*
pReq
,
bool
deep
)
{
SClientHbBatchReq
*
req
=
(
SClientHbBatchReq
*
)
pReq
;
SClientHbBatchReq
*
req
=
(
SClientHbBatchReq
*
)
pReq
;
if
(
deep
)
{
taosArrayDestroyEx
(
req
->
reqs
,
tFreeClientHbReq
);
}
else
{
...
...
@@ -1544,54 +1602,52 @@ static FORCE_INLINE void tFreeClientHbBatchReq(void* pReq, bool deep) {
free
(
pReq
);
}
static
FORCE_INLINE
void
tFreeClientKv
(
void
*
pKv
)
{
SKv
*
kv
=
(
SKv
*
)
pKv
;
static
FORCE_INLINE
void
tFreeClientKv
(
void
*
pKv
)
{
SKv
*
kv
=
(
SKv
*
)
pKv
;
if
(
kv
)
{
tfree
(
kv
->
value
);
}
}
static
FORCE_INLINE
void
tFreeClientHbRsp
(
void
*
pRsp
)
{
static
FORCE_INLINE
void
tFreeClientHbRsp
(
void
*
pRsp
)
{
SClientHbRsp
*
rsp
=
(
SClientHbRsp
*
)
pRsp
;
if
(
rsp
->
info
)
taosArrayDestroyEx
(
rsp
->
info
,
tFreeClientKv
);
}
static
FORCE_INLINE
void
tFreeClientHbBatchRsp
(
void
*
pRsp
)
{
SClientHbBatchRsp
*
rsp
=
(
SClientHbBatchRsp
*
)
pRsp
;
SClientHbBatchRsp
*
rsp
=
(
SClientHbBatchRsp
*
)
pRsp
;
taosArrayDestroyEx
(
rsp
->
rsps
,
tFreeClientHbRsp
);
}
int32_t
tSerializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SClientHbBatchRsp
*
pBatchRsp
);
int32_t
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
SClientHbBatchRsp
*
pBatchRsp
);
int
tSerializeSClientHbBatchRsp
(
void
**
buf
,
const
SClientHbBatchRsp
*
pBatchRsp
);
void
*
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
SClientHbBatchRsp
*
pBatchRsp
);
static
FORCE_INLINE
int
taosEncodeSKv
(
void
**
buf
,
const
SKv
*
pKv
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pKv
->
key
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pKv
->
valueLen
);
tlen
+=
taosEncodeBinary
(
buf
,
pKv
->
value
,
pKv
->
valueLen
);
return
tlen
;
static
FORCE_INLINE
int32_t
tEncodeSKv
(
SCoder
*
pEncoder
,
const
SKv
*
pKv
)
{
if
(
tEncodeI32
(
pEncoder
,
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
if
(
tEncodeCStrWithLen
(
pEncoder
,
(
const
char
*
)
pKv
->
value
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
return
0
;
}
static
FORCE_INLINE
void
*
taosDecodeSKv
(
void
*
buf
,
SKv
*
pKv
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pKv
->
key
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pKv
->
valueLen
);
buf
=
taosDecodeBinary
(
buf
,
&
pKv
->
value
,
pKv
->
valueLen
);
return
buf
;
static
FORCE_INLINE
int32_t
tDecodeSKv
(
SCoder
*
pDecoder
,
SKv
*
pKv
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pKv
->
valueLen
)
<
0
)
return
-
1
;
pKv
->
value
=
malloc
(
pKv
->
valueLen
+
1
);
if
(
pKv
->
value
==
NULL
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
(
char
*
)
pKv
->
value
)
<
0
)
return
-
1
;
return
0
;
}
static
FORCE_INLINE
int
taosEncodeSClientHbKey
(
void
**
buf
,
const
SClientHbKey
*
pKey
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pKey
->
connId
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pKey
->
hbType
);
return
tlen
;
static
FORCE_INLINE
int32_t
tEncodeSClientHbKey
(
SCoder
*
pEncoder
,
const
SClientHbKey
*
pKey
)
{
if
(
tEncodeI32
(
pEncoder
,
pKey
->
connId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pKey
->
hbType
)
<
0
)
return
-
1
;
return
0
;
}
static
FORCE_INLINE
void
*
taosDecodeSClientHbKey
(
void
*
buf
,
SClientHbKey
*
pKey
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pKey
->
connId
)
;
buf
=
taosDecodeFixedI32
(
buf
,
&
pKey
->
hbType
)
;
return
buf
;
static
FORCE_INLINE
int32_t
tDecodeSClientHbKey
(
SCoder
*
pDecoder
,
SClientHbKey
*
pKey
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pKey
->
connId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pKey
->
hbType
)
<
0
)
return
-
1
;
return
0
;
}
typedef
struct
SMqHbVgInfo
{
...
...
@@ -1684,8 +1740,7 @@ static FORCE_INLINE void* taosDecodeSMqMsg(void* buf, SMqHbMsg* pMsg) {
typedef
struct
{
int64_t
leftForVer
;
int32_t
vgId
;
int64_t
oldConsumerId
;
int64_t
newConsumerId
;
int64_t
consumerId
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
cgroup
[
TSDB_CONSUMER_GROUP_LEN
];
char
*
sql
;
...
...
@@ -1694,55 +1749,30 @@ typedef struct {
char
*
qmsg
;
}
SMqSetCVgReq
;
static
FORCE_INLINE
int32_t
tEncodeSSubQueryMsg
(
void
**
buf
,
const
SSubQueryMsg
*
pMsg
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedU64
(
buf
,
pMsg
->
sId
);
tlen
+=
taosEncodeFixedU64
(
buf
,
pMsg
->
queryId
);
tlen
+=
taosEncodeFixedU64
(
buf
,
pMsg
->
taskId
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pMsg
->
sqlLen
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pMsg
->
phyLen
);
//tlen += taosEncodeBinary(buf, pMsg->msg, pMsg->contentLen);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeSSubQueryMsg
(
void
*
buf
,
SSubQueryMsg
*
pMsg
)
{
buf
=
taosDecodeFixedU64
(
buf
,
&
pMsg
->
sId
);
buf
=
taosDecodeFixedU64
(
buf
,
&
pMsg
->
queryId
);
buf
=
taosDecodeFixedU64
(
buf
,
&
pMsg
->
taskId
);
buf
=
taosDecodeFixedU32
(
buf
,
&
pMsg
->
sqlLen
);
buf
=
taosDecodeFixedU32
(
buf
,
&
pMsg
->
phyLen
);
//buf = taosDecodeBinaryTo(buf, pMsg->msg, pMsg->contentLen);
return
buf
;
}
static
FORCE_INLINE
int32_t
tEncodeSMqSetCVgReq
(
void
**
buf
,
const
SMqSetCVgReq
*
pReq
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
leftForVer
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
vgId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
oldConsumerId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
newConsumerId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
topicName
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
cgroup
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
sql
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
logicalPlan
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
physicalPlan
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
qmsg
);
//tlen += tEncodeSSubQueryMsg(buf, &pReq->msg);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeSMqSetCVgReq
(
void
*
buf
,
SMqSetCVgReq
*
pReq
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
leftForVer
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
vgId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
oldConsumerId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
newConsumerId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
consumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
topicName
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
cgroup
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
sql
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
logicalPlan
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
physicalPlan
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
qmsg
);
//buf = tDecodeSSubQueryMsg(buf, &pReq->msg);
return
buf
;
}
...
...
@@ -1996,4 +2026,4 @@ static FORCE_INLINE void* tDecodeSMqCMGetSubEpRsp(void* buf, SMqCMGetSubEpRsp* p
}
#endif
#endif
/*_TD_COMMON_TAOS_MSG_H_*/
#endif
/*_TD_COMMON_TAOS_MSG_H_*/
\ No newline at end of file
include/libs/catalog/catalog.h
浏览文件 @
71fc95cc
...
...
@@ -30,7 +30,7 @@ extern "C" {
#include "tmsg.h"
#include "transport.h"
struct
SCatalog
;
typedef
struct
SCatalog
SCatalog
;
enum
{
CTG_DBG_DB_NUM
=
1
,
...
...
@@ -64,6 +64,7 @@ typedef struct SCatalogCfg {
typedef
struct
SSTableMetaVersion
{
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
stbName
[
TSDB_TABLE_NAME_LEN
];
uint64_t
dbId
;
uint64_t
suid
;
int16_t
sversion
;
int16_t
tversion
;
...
...
@@ -84,7 +85,7 @@ int32_t catalogInit(SCatalogCfg *cfg);
* @param catalogHandle (output, NO need to free it)
* @return error code
*/
int32_t
catalogGetHandle
(
uint64_t
clusterId
,
struct
SCatalog
**
catalogHandle
);
int32_t
catalogGetHandle
(
uint64_t
clusterId
,
SCatalog
**
catalogHandle
);
/**
* Free a cluster's all catalog info, usually it's not necessary, until the application is closing.
...
...
@@ -92,9 +93,9 @@ int32_t catalogGetHandle(uint64_t clusterId, struct SCatalog** catalogHandle);
* @param pCatalog (input, NO more usage)
* @return error code
*/
void
catalogFreeHandle
(
struct
SCatalog
*
pCatalog
);
void
catalogFreeHandle
(
SCatalog
*
pCatalog
);
int32_t
catalogGetDBVg
roupVersion
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
int32_t
*
version
);
int32_t
catalogGetDBVg
Version
(
SCatalog
*
pCatalog
,
const
char
*
dbName
,
int32_t
*
version
);
/**
* Get a DB's all vgroup info.
...
...
@@ -106,13 +107,13 @@ int32_t catalogGetDBVgroupVersion(struct SCatalog* pCatalog, const char* dbName,
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
* @return error code
*/
int32_t
catalogGetDBVg
roup
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
char
*
pDBName
,
bool
forceUpdate
,
SArray
**
pVgroupList
);
int32_t
catalogGetDBVg
Info
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
char
*
pDBName
,
bool
forceUpdate
,
SArray
**
pVgroupList
);
int32_t
catalogUpdateDBVg
roup
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
uint64_t
dbId
,
SDBVgroup
Info
*
dbInfo
);
int32_t
catalogUpdateDBVg
Info
(
SCatalog
*
pCatalog
,
const
char
*
dbName
,
uint64_t
dbId
,
SDBVg
Info
*
dbInfo
);
int32_t
catalogRemoveDB
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
uint64_t
dbId
);
int32_t
catalogRemoveDB
(
SCatalog
*
pCatalog
,
const
char
*
dbName
,
uint64_t
dbId
);
int32_t
catalogRemoveS
TableMeta
(
struct
SCatalog
*
pCatalog
,
const
char
*
dbName
,
const
char
*
stbName
,
uint64_t
suid
);
int32_t
catalogRemoveS
tbMeta
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
uint64_t
dbId
,
const
char
*
stbName
,
uint64_t
suid
);
/**
* Get a table's meta data.
...
...
@@ -123,7 +124,7 @@ int32_t catalogRemoveSTableMeta(struct SCatalog* pCatalog, const char* dbName, c
* @param pTableMeta(output, table meta data, NEED to free it by calller)
* @return error code
*/
int32_t
catalogGetTableMeta
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogGetTableMeta
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
/**
* Get a super table's meta data.
...
...
@@ -134,13 +135,13 @@ int32_t catalogGetTableMeta(struct SCatalog* pCatalog, void * pTransporter, cons
* @param pTableMeta(output, table meta data, NEED to free it by calller)
* @return error code
*/
int32_t
catalogGetSTableMeta
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogGetSTableMeta
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogUpdateSTableMeta
(
struct
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
int32_t
catalogUpdateSTableMeta
(
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
/**
* Force re
new
a table's local cached meta data.
* Force re
fresh
a table's local cached meta data.
* @param pCatalog (input, got with catalogGetHandle)
* @param pTransporter (input, rpc object)
* @param pMgmtEps (input, mnode EPs)
...
...
@@ -148,10 +149,10 @@ int32_t catalogUpdateSTableMeta(struct SCatalog* pCatalog, STableMetaRsp *rspMsg
* @param isSTable (input, is super table or not, 1:supposed to be stable, 0: supposed not to be stable, -1:not sure)
* @return error code
*/
int32_t
catalogRe
newTableMeta
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
int32_t
isSTable
);
int32_t
catalogRe
freshTableMeta
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
int32_t
isSTable
);
/**
* Force re
new
a table's local cached meta data and get the new one.
* Force re
fresh
a table's local cached meta data and get the new one.
* @param pCatalog (input, got with catalogGetHandle)
* @param pTransporter (input, rpc object)
* @param pMgmtEps (input, mnode EPs)
...
...
@@ -160,7 +161,7 @@ int32_t catalogUpdateSTableMeta(struct SCatalog* pCatalog, STableMetaRsp *rspMsg
* @param isSTable (input, is super table or not, 1:supposed to be stable, 0: supposed not to be stable, -1:not sure)
* @return error code
*/
int32_t
catalogRe
newAndGetTableMeta
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
isSTable
);
int32_t
catalogRe
freshGetTableMeta
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
,
int32_t
isSTable
);
...
...
@@ -173,7 +174,7 @@ int32_t catalogUpdateSTableMeta(struct SCatalog* pCatalog, STableMetaRsp *rspMsg
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
* @return error code
*/
int32_t
catalogGetTableDistVg
roup
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
SArray
**
pVgroupList
);
int32_t
catalogGetTableDistVg
Info
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pTableName
,
SArray
**
pVgroupList
);
/**
* Get a table's vgroup from its name's hash value.
...
...
@@ -184,7 +185,7 @@ int32_t catalogGetTableDistVgroup(struct SCatalog* pCatalog, void *pTransporter,
* @param vgInfo (output, vgroup info)
* @return error code
*/
int32_t
catalogGetTableHashVgroup
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pName
,
SVgroupInfo
*
vgInfo
);
int32_t
catalogGetTableHashVgroup
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SName
*
pName
,
SVgroupInfo
*
vgInfo
);
/**
...
...
@@ -196,14 +197,14 @@ int32_t catalogGetTableHashVgroup(struct SCatalog* pCatalog, void * pTransporter
* @param pRsp (output, response data)
* @return error code
*/
int32_t
catalogGetAllMeta
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
);
int32_t
catalogGetAllMeta
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
);
int32_t
catalogGetQnodeList
(
struct
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
SArray
*
pQnodeList
);
int32_t
catalogGetQnodeList
(
SCatalog
*
pCatalog
,
void
*
pTransporter
,
const
SEpSet
*
pMgmtEps
,
SArray
*
pQnodeList
);
int32_t
catalogGetExpiredSTables
(
struct
SCatalog
*
pCatalog
,
SSTableMetaVersion
**
stables
,
uint32_t
*
num
);
int32_t
catalogGetExpiredSTables
(
SCatalog
*
pCatalog
,
SSTableMetaVersion
**
stables
,
uint32_t
*
num
);
int32_t
catalogGetExpiredDBs
(
struct
SCatalog
*
pCatalog
,
SDbVgVersion
**
dbs
,
uint32_t
*
num
);
int32_t
catalogGetExpiredDBs
(
SCatalog
*
pCatalog
,
SDbVgVersion
**
dbs
,
uint32_t
*
num
);
/**
...
...
include/libs/function/functionMgt.h
浏览文件 @
71fc95cc
...
...
@@ -20,7 +20,7 @@
extern
"C"
{
#endif
#include "nodes.h"
#include "
query
nodes.h"
typedef
enum
EFunctionType
{
// aggregate function
...
...
include/libs/nodes/nodes.h
0 → 100644
浏览文件 @
71fc95cc
/*
* 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_NODES_H_
#define _TD_NODES_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include "tdef.h"
#define nodeType(nodeptr) (((const SNode*)(nodeptr))->type)
#define setNodeType(nodeptr, type) (((SNode*)(nodeptr))->type = (type))
#define LIST_LENGTH(l) (NULL != (l) ? (l)->length : 0)
#define FOREACH(node, list) \
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); cell = cell->pNext)
// only be use in FOREACH
#define ERASE_NODE(list) cell = nodesListErase(list, cell);
#define REPLACE_NODE(newNode) cell->pNode = (SNode*)(newNode)
#define FORBOTH(node1, list1, node2, list2) \
for (SListCell* cell1 = (NULL != (list1) ? (list1)->pHead : NULL), *cell2 = (NULL != (list2) ? (list2)->pHead : NULL); \
(NULL == cell1 ? (node1 = NULL, false) : (node1 = cell1->pNode, true)), (NULL == cell2 ? (node2 = NULL, false) : (node2 = cell2->pNode, true)), (node1 != NULL && node2 != NULL); \
cell1 = cell1->pNext, cell2 = cell2->pNext)
#define FOREACH_FOR_REWRITE(node, list) \
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); (NULL != cell ? (node = &(cell->pNode), true) : (node = NULL, false)); cell = cell->pNext)
typedef
enum
ENodeType
{
// Syntax nodes are used in parser and planner module, and some are also used in executor module, such as COLUMN, VALUE, OPERATOR, FUNCTION and so on.
QUERY_NODE_COLUMN
=
1
,
QUERY_NODE_VALUE
,
QUERY_NODE_OPERATOR
,
QUERY_NODE_LOGIC_CONDITION
,
QUERY_NODE_IS_NULL_CONDITION
,
QUERY_NODE_FUNCTION
,
QUERY_NODE_REAL_TABLE
,
QUERY_NODE_TEMP_TABLE
,
QUERY_NODE_JOIN_TABLE
,
QUERY_NODE_GROUPING_SET
,
QUERY_NODE_ORDER_BY_EXPR
,
QUERY_NODE_LIMIT
,
QUERY_NODE_STATE_WINDOW
,
QUERY_NODE_SESSION_WINDOW
,
QUERY_NODE_INTERVAL_WINDOW
,
QUERY_NODE_NODE_LIST
,
QUERY_NODE_FILL
,
// Only be used in parser module.
QUERY_NODE_RAW_EXPR
,
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR
,
QUERY_NODE_SELECT_STMT
,
QUERY_NODE_SHOW_STMT
}
ENodeType
;
/**
* The first field of a node of any type is guaranteed to be the ENodeType.
* Hence the type of any node can be gotten by casting it to SNode.
*/
typedef
struct
SNode
{
ENodeType
type
;
}
SNode
;
typedef
struct
SListCell
{
struct
SListCell
*
pPrev
;
struct
SListCell
*
pNext
;
SNode
*
pNode
;
}
SListCell
;
typedef
struct
SNodeList
{
int16_t
length
;
SListCell
*
pHead
;
SListCell
*
pTail
;
}
SNodeList
;
SNode
*
nodesMakeNode
(
ENodeType
type
);
void
nodesDestroyNode
(
SNode
*
pNode
);
SNodeList
*
nodesMakeList
();
SNodeList
*
nodesListAppend
(
SNodeList
*
pList
,
SNode
*
pNode
);
SListCell
*
nodesListErase
(
SNodeList
*
pList
,
SListCell
*
pCell
);
SNode
*
nodesListGetNode
(
SNodeList
*
pList
,
int32_t
index
);
void
nodesDestroyList
(
SNodeList
*
pList
);
typedef
enum
EDealRes
{
DEAL_RES_CONTINUE
=
1
,
DEAL_RES_IGNORE_CHILD
,
DEAL_RES_ERROR
,
}
EDealRes
;
typedef
EDealRes
(
*
FNodeWalker
)(
SNode
*
pNode
,
void
*
pContext
);
void
nodesWalkNode
(
SNode
*
pNode
,
FNodeWalker
walker
,
void
*
pContext
);
void
nodesWalkList
(
SNodeList
*
pList
,
FNodeWalker
walker
,
void
*
pContext
);
void
nodesWalkNodePostOrder
(
SNode
*
pNode
,
FNodeWalker
walker
,
void
*
pContext
);
void
nodesWalkListPostOrder
(
SNodeList
*
pList
,
FNodeWalker
walker
,
void
*
pContext
);
typedef
EDealRes
(
*
FNodeRewriter
)(
SNode
**
pNode
,
void
*
pContext
);
void
nodesRewriteNode
(
SNode
**
pNode
,
FNodeRewriter
rewriter
,
void
*
pContext
);
void
nodesRewriteList
(
SNodeList
*
pList
,
FNodeRewriter
rewriter
,
void
*
pContext
);
void
nodesRewriteNodePostOrder
(
SNode
**
pNode
,
FNodeRewriter
rewriter
,
void
*
pContext
);
void
nodesRewriteListPostOrder
(
SNodeList
*
pList
,
FNodeRewriter
rewriter
,
void
*
pContext
);
bool
nodesEqualNode
(
const
SNode
*
a
,
const
SNode
*
b
);
void
nodesCloneNode
(
const
SNode
*
pNode
);
int32_t
nodesNodeToString
(
const
SNode
*
pNode
,
char
**
pStr
,
int32_t
*
pLen
);
int32_t
nodesStringToNode
(
const
char
*
pStr
,
SNode
**
pNode
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_NODES_H_*/
include/nodes/nodesShowStmts.h
→
include/
libs/
nodes/nodesShowStmts.h
浏览文件 @
71fc95cc
文件已移动
include/
nodes/
nodes.h
→
include/
libs/nodes/query
nodes.h
浏览文件 @
71fc95cc
...
...
@@ -13,88 +13,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_NODES_H_
#define _TD_NODES_H_
#ifndef _TD_
QUERY_
NODES_H_
#define _TD_
QUERY_
NODES_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include "tdef.h"
#define nodeType(nodeptr) (((const SNode*)(nodeptr))->type)
#define setNodeType(nodeptr, type) (((SNode*)(nodeptr))->type = (type))
#define LIST_LENGTH(l) (NULL != (l) ? (l)->length : 0)
#define FOREACH(node, list) \
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); cell = cell->pNext)
// only be use in FOREACH
#define ERASE_NODE(list) \
if (NULL == cell->pPrev) { \
(list)->pHead = cell->pNext; \
} else { \
cell->pPrev->pNext = cell->pNext; \
cell->pNext->pPrev = cell->pPrev; \
} \
SListCell* tmp = cell; \
cell = cell->pNext; \
tfree(tmp);
#define REPLACE_NODE(newNode) cell->pNode = (SNode*)(newNode)
#define FORBOTH(node1, list1, node2, list2) \
for (SListCell* cell1 = (NULL != (list1) ? (list1)->pHead : NULL), *cell2 = (NULL != (list2) ? (list2)->pHead : NULL); \
(NULL == cell1 ? (node1 = NULL, false) : (node1 = cell1->pNode, true)), (NULL == cell2 ? (node2 = NULL, false) : (node2 = cell2->pNode, true)), (node1 != NULL && node2 != NULL); \
cell1 = cell1->pNext, cell2 = cell2->pNext)
typedef
enum
ENodeType
{
QUERY_NODE_COLUMN
=
1
,
QUERY_NODE_VALUE
,
QUERY_NODE_OPERATOR
,
QUERY_NODE_LOGIC_CONDITION
,
QUERY_NODE_IS_NULL_CONDITION
,
QUERY_NODE_FUNCTION
,
QUERY_NODE_REAL_TABLE
,
QUERY_NODE_TEMP_TABLE
,
QUERY_NODE_JOIN_TABLE
,
QUERY_NODE_GROUPING_SET
,
QUERY_NODE_ORDER_BY_EXPR
,
QUERY_NODE_LIMIT
,
QUERY_NODE_STATE_WINDOW
,
QUERY_NODE_SESSION_WINDOW
,
QUERY_NODE_INTERVAL_WINDOW
,
QUERY_NODE_NODE_LIST
,
QUERY_NODE_FILL
,
// only for parser
QUERY_NODE_RAW_EXPR
,
QUERY_NODE_SET_OPERATOR
,
QUERY_NODE_SELECT_STMT
,
QUERY_NODE_SHOW_STMT
}
ENodeType
;
/**
* The first field of a node of any type is guaranteed to be the ENodeType.
* Hence the type of any node can be gotten by casting it to SNode.
*/
typedef
struct
SNode
{
ENodeType
type
;
}
SNode
;
typedef
struct
SListCell
{
struct
SListCell
*
pPrev
;
struct
SListCell
*
pNext
;
SNode
*
pNode
;
}
SListCell
;
typedef
struct
SNodeList
{
int16_t
length
;
SListCell
*
pHead
;
SListCell
*
pTail
;
}
SNodeList
;
#include "nodes.h"
typedef
struct
SRawExprNode
{
ENodeType
nodeType
;
...
...
@@ -338,29 +264,7 @@ typedef struct SSetOperator {
SNode
*
pLimit
;
}
SSetOperator
;
SNode
*
nodesMakeNode
(
ENodeType
type
);
void
nodesDestroyNode
(
SNode
*
pNode
);
SNodeList
*
nodesMakeList
();
SNodeList
*
nodesListAppend
(
SNodeList
*
pList
,
SNode
*
pNode
);
SNode
*
nodesListGetNode
(
SNodeList
*
pList
,
int32_t
index
);
void
nodesDestroyList
(
SNodeList
*
pList
);
typedef
bool
(
*
FQueryNodeWalker
)(
SNode
*
pNode
,
void
*
pContext
);
void
nodesWalkNode
(
SNode
*
pNode
,
FQueryNodeWalker
walker
,
void
*
pContext
);
void
nodesWalkList
(
SNodeList
*
pList
,
FQueryNodeWalker
walker
,
void
*
pContext
);
void
nodesWalkNodePostOrder
(
SNode
*
pNode
,
FQueryNodeWalker
walker
,
void
*
pContext
);
void
nodesWalkListPostOrder
(
SNodeList
*
pList
,
FQueryNodeWalker
walker
,
void
*
pContext
);
bool
nodesWalkStmt
(
SNode
*
pNode
,
FQueryNodeWalker
walker
,
void
*
pContext
);
bool
nodesEqualNode
(
const
SNode
*
a
,
const
SNode
*
b
);
void
nodesCloneNode
(
const
SNode
*
pNode
);
int32_t
nodesNodeToString
(
const
SNode
*
pNode
,
char
**
pStr
,
int32_t
*
pLen
);
int32_t
nodesStringToNode
(
const
char
*
pStr
,
SNode
**
pNode
);
bool
nodesIsExprNode
(
const
SNode
*
pNode
);
bool
nodesIsArithmeticOp
(
const
SOperatorNode
*
pOp
);
bool
nodesIsComparisonOp
(
const
SOperatorNode
*
pOp
);
...
...
@@ -373,4 +277,4 @@ bool nodesIsTimelineQuery(const SNode* pQuery);
}
#endif
#endif
/*_TD_NODES_H_*/
#endif
/*_TD_
QUERY_
NODES_H_*/
\ No newline at end of file
include/libs/qcom/query.h
浏览文件 @
71fc95cc
...
...
@@ -80,16 +80,16 @@ typedef struct STableMeta {
SSchema
schema
[];
}
STableMeta
;
typedef
struct
SDBVg
roup
Info
{
typedef
struct
SDBVgInfo
{
int32_t
vgVersion
;
int8_t
hashMethod
;
SHashObj
*
vgHash
;
//key:vgId, value:SVgroupInfo
}
SDBVg
roup
Info
;
}
SDBVgInfo
;
typedef
struct
SUseDbOutput
{
char
db
[
TSDB_DB_FNAME_LEN
];
uint64_t
dbId
;
SDBVg
roupInfo
*
dbVgroup
;
SDBVg
Info
*
dbVgroup
;
}
SUseDbOutput
;
enum
{
...
...
include/libs/sync/sync.h
浏览文件 @
71fc95cc
/*
* Copyright (c) 2019 TAOS Data, Inc. <
cli
@taosdata.com>
* 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
...
...
@@ -23,7 +23,7 @@ extern "C" {
#include <stdint.h>
#include "taosdef.h"
typedef
int32_t
SyncNodeId
;
typedef
uint64_t
SyncNodeId
;
typedef
int32_t
SyncGroupId
;
typedef
int64_t
SyncIndex
;
typedef
uint64_t
SyncTerm
;
...
...
@@ -46,109 +46,113 @@ typedef struct {
}
SNodeInfo
;
typedef
struct
{
int32_t
selfIndex
;
int32_t
replica
;
int32_t
replicaNum
;
SNodeInfo
nodeInfo
[
TSDB_MAX_REPLICA
];
}
SSyncC
luster
;
}
SSyncC
fg
;
typedef
struct
{
int32_t
selfIndex
;
int32_t
replica
;
SNodeInfo
node
[
TSDB_MAX_REPLICA
];
int32_t
replicaNum
;
SNodeInfo
nodeInfo
[
TSDB_MAX_REPLICA
];
ESyncState
role
[
TSDB_MAX_REPLICA
];
}
SNodesRole
;
typedef
struct
SSyncFSM
{
void
*
pData
;
// apply committed log, bufs will be free by sync module
int32_t
(
*
applyLog
)(
struct
SSyncFSM
*
fsm
,
SyncIndex
index
,
const
SSyncBuffer
*
buf
,
void
*
pData
)
;
// abstract definition of snapshot
typedef
struct
SSnapshot
{
void
*
data
;
SyncIndex
lastApplyIndex
;
}
SSnapshot
;
// cluster commit callback
int32_t
(
*
onClusterChanged
)(
struct
SSyncFSM
*
fsm
,
const
SSyncCluster
*
cluster
,
void
*
pData
)
;
typedef
struct
SSyncFSM
{
void
*
data
;
//
fsm return snapshot in ppBuf, bufs will be free by sync module
//
TODO: getSnapshot SHOULD be async?
int32_t
(
*
getSnapshot
)(
struct
SSyncFSM
*
fsm
,
SSyncBuffer
**
ppBuf
,
int32_t
*
objId
,
bool
*
isLast
);
//
when value in pBuf finish a raft flow, FpCommitCb is called, code indicates the result
//
user can do something according to the code and isWeak. for example, write data into tsdb
void
(
*
FpCommitCb
)(
struct
SSyncFSM
*
pFsm
,
const
SSyncBuffer
*
pBuf
,
SyncIndex
index
,
bool
isWeak
,
int32_t
code
);
// fsm apply snapshot with pBuf data
int32_t
(
*
applySnapshot
)(
struct
SSyncFSM
*
fsm
,
SSyncBuffer
*
pBuf
,
int32_t
objId
,
bool
isLast
);
// when value in pBuf has been written into local log store, FpPreCommitCb is called, code indicates the result
// user can do something according to the code and isWeak. for example, write data into tsdb
void
(
*
FpPreCommitCb
)(
struct
SSyncFSM
*
pFsm
,
const
SSyncBuffer
*
pBuf
,
SyncIndex
index
,
bool
isWeak
,
int32_t
code
);
// call when restore snapshot and log done
int32_t
(
*
onRestoreDone
)(
struct
SSyncFSM
*
fsm
);
// when log entry is updated by a new one, FpRollBackCb is called
// user can do something to roll back. for example, delete data from tsdb, or just ignore it
void
(
*
FpRollBackCb
)(
struct
SSyncFSM
*
pFsm
,
const
SSyncBuffer
*
pBuf
,
SyncIndex
index
,
bool
isWeak
,
int32_t
code
);
void
(
*
onRollback
)(
struct
SSyncFSM
*
fsm
,
SyncIndex
index
,
const
SSyncBuffer
*
buf
);
// user should implement this function, use "data" to take snapshot into "snapshot"
int32_t
(
*
FpTakeSnapshot
)(
SSnapshot
*
snapshot
);
void
(
*
onRoleChanged
)(
struct
SSyncFSM
*
fsm
,
const
SNodesRole
*
pRole
);
// user should implement this function, restore "data" from "snapshot"
int32_t
(
*
FpRestoreSnapshot
)(
const
SSnapshot
*
snapshot
);
}
SSyncFSM
;
// abstract definition of log store in raft
// SWal implements it
typedef
struct
SSyncLogStore
{
void
*
pData
;
void
*
data
;
// append one log entry
int32_t
(
*
appendEntry
)(
struct
SSyncLogStore
*
pLogStore
,
SSyncBuffer
*
pBuf
);
//
write log with given index
int32_t
(
*
logWrite
)(
struct
SSyncLogStore
*
l
ogStore
,
SyncIndex
index
,
SSyncBuffer
*
pBuf
);
//
get one log entry, user need to free pBuf->data
int32_t
(
*
getEntry
)(
struct
SSyncLogStore
*
pL
ogStore
,
SyncIndex
index
,
SSyncBuffer
*
pBuf
);
/**
* read log from given index(included) with limit, return the actual num in nBuf,
* pBuf will be free in sync module
**/
int32_t
(
*
logRead
)(
struct
SSyncLogStore
*
logStore
,
SyncIndex
index
,
int
limit
,
SSyncBuffer
*
pBuf
,
int
*
nBuf
);
// update log store commit index with "index"
int32_t
(
*
updateCommitIndex
)(
struct
SSyncLogStore
*
pLogStore
,
SyncIndex
index
);
//
mark log with given index has been commt
ted
int32_t
(
*
logCommit
)(
struct
SSyncLogStore
*
l
ogStore
,
SyncIndex
index
);
//
truncate log with index, entries after the given index (>index) will be dele
ted
int32_t
(
*
truncate
)(
struct
SSyncLogStore
*
pL
ogStore
,
SyncIndex
index
);
//
prune log before given index(not included)
int32_t
(
*
logPrune
)(
struct
SSyncLogStore
*
logStore
,
SyncIndex
index
);
//
return commit index of log
SyncIndex
(
*
getCommitIndex
)(
struct
SSyncLogStore
*
pLogStore
);
// rollback log after given index(included)
int32_t
(
*
logRollback
)(
struct
SSyncLogStore
*
logStore
,
SyncIndex
index
);
// return index of last entry
SyncIndex
(
*
getLastIndex
)(
struct
SSyncLogStore
*
pLogStore
);
// return term of last entry
SyncTerm
(
*
getLastTerm
)(
struct
SSyncLogStore
*
pLogStore
);
// return last index of log
SyncIndex
(
*
logLastIndex
)(
struct
SSyncLogStore
*
logStore
);
}
SSyncLogStore
;
typedef
struct
SStateManager
{
void
*
pData
;
// raft need to persist two variables in storage: currentTerm, voteFor
typedef
struct
SStateMgr
{
void
*
data
;
// save serialized server state data, buffer will be free by Sync
int32_t
(
*
saveServerState
)(
struct
SStateManager
*
stateMng
,
const
char
*
buffer
,
int
n
);
int32_t
(
*
getCurrentTerm
)(
struct
SStateMgr
*
pMgr
,
SyncTerm
*
pCurrentTerm
);
int32_t
(
*
persistCurrentTerm
)(
struct
SStateMgr
*
pMgr
,
SyncTerm
pCurrentTerm
);
// read serialized server state data, buffer will be free by Sync
int32_t
(
*
readServerState
)(
struct
SStateManager
*
stateMng
,
char
**
ppBuffer
,
int
*
n
);
int32_t
(
*
getVoteFor
)(
struct
SStateMgr
*
pMgr
,
SyncNodeId
*
pVoteFor
);
int32_t
(
*
persistVoteFor
)(
struct
SStateMgr
*
pMgr
,
SyncNodeId
voteFor
);
// save serialized cluster state data, buffer will be free by Sync
void
(
*
saveClusterState
)(
struct
SStateManager
*
stateMng
,
const
char
*
buffer
,
int
n
);
int32_t
(
*
getSyncCfg
)(
struct
SStateMgr
*
pMgr
,
SSyncCfg
*
pSyncCfg
);
int32_t
(
*
persistSyncCfg
)(
struct
SStateMgr
*
pMgr
,
SSyncCfg
*
pSyncCfg
);
// read serialized cluster state data, buffer will be free by Sync
int32_t
(
*
readClusterState
)(
struct
SStateManager
*
stateMng
,
char
**
ppBuffer
,
int
*
n
);
}
SStateManager
;
}
SStateMgr
;
typedef
struct
{
SyncGroupId
vgId
;
SyncIndex
appliedIndex
;
SSyncCluster
syncCfg
;
SSyncFSM
fsm
;
SSyncCfg
syncCfg
;
SSyncLogStore
logStore
;
SStateManager
stateManager
;
SStateMgr
stateManager
;
SSyncFSM
syncFsm
;
}
SSyncInfo
;
struct
SSyncNode
;
typedef
struct
SSyncNode
SSyncNode
;
// will be defined in syncInt.h, here just for complie
typedef
struct
SSyncNode
{
}
SSyncNode
;
int32_t
syncInit
();
void
syncCleanUp
();
SSyncNode
*
syncStart
(
const
SSyncInfo
*
);
void
syncReconfig
(
const
SSyncNode
*
,
const
SSyncCluster
*
);
void
syncStop
(
const
SSyncNode
*
);
int32_t
syncPropose
(
SSyncNode
*
syncNode
,
const
SSyncBuffer
*
pBuf
,
void
*
pData
,
bool
isWeak
);
int64_t
syncStart
(
const
SSyncInfo
*
);
void
syncStop
(
int64_t
rid
);
int32_t
syncReconfig
(
int64_t
rid
,
const
SSyncCfg
*
);
int32_t
syncAddNode
(
SSyncNode
syncNode
,
const
SNodeInfo
*
pNode
);
// int32_t syncForwardToPeer(int64_t rid, const SRpcMsg* pBuf, bool isWeak);
int32_t
syncForwardToPeer
(
int64_t
rid
,
const
SSyncBuffer
*
pBuf
,
bool
isWeak
);
int32_t
syncRemoveNode
(
SSyncNode
syncNode
,
const
SNodeInfo
*
pNode
);
ESyncState
syncGetMyRole
(
int64_t
rid
);
void
syncGetNodesRole
(
int64_t
rid
,
SNodesRole
*
);
extern
int32_t
sDebugFlag
;
...
...
include/util/taoserror.h
浏览文件 @
71fc95cc
...
...
@@ -247,7 +247,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0)
#define TSDB_CODE_MND_TRANS_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D1)
// mnode-
topic
// mnode-
mq
#define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E0)
#define TSDB_CODE_MND_TOPIC_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E1)
#define TSDB_CODE_MND_TOO_MANY_TOPICS TAOS_DEF_ERROR_CODE(0, 0x03E2)
...
...
@@ -256,7 +256,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_TOPIC_OPTION_UNCHNAGED TAOS_DEF_ERROR_CODE(0, 0x03E5)
#define TSDB_CODE_MND_NAME_CONFLICT_WITH_STB TAOS_DEF_ERROR_CODE(0, 0x03E6)
#define TSDB_CODE_MND_CONSUMER_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E7)
#define TSDB_CODE_MND_UNSUPPORTED_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03E7)
#define TSDB_CODE_MND_UNSUPPORTED_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03E8)
#define TSDB_CODE_MND_SUBSCRIBE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E9)
#define TSDB_CODE_MND_MQ_PLACEHOLDER TAOS_DEF_ERROR_CODE(0, 0x03F0)
// dnode
#define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0400)
...
...
@@ -454,6 +456,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_FUNTION_PARA_TYPE TAOS_DEF_ERROR_CODE(0, 0x2607) //Inconsistent datatypes
#define TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION TAOS_DEF_ERROR_CODE(0, 0x2608) //There mustn't be aggregation
#define TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT TAOS_DEF_ERROR_CODE(0, 0x2609) //ORDER BY item must be the number of a SELECT-list expression
#define TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260A) //Not a GROUP BY expression
#define TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260B) //Not SELECTed expression
#define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C) //Not a single-group group function
#ifdef __cplusplus
}
...
...
include/util/tcoding.h
浏览文件 @
71fc95cc
...
...
@@ -37,7 +37,7 @@ static FORCE_INLINE int taosEncodeFixedU8(void **buf, uint8_t value) {
return
(
int
)
sizeof
(
value
);
}
static
FORCE_INLINE
void
*
taosDecodeFixedU8
(
void
*
buf
,
uint8_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedU8
(
const
void
*
buf
,
uint8_t
*
value
)
{
*
value
=
((
uint8_t
*
)
buf
)[
0
];
return
POINTER_SHIFT
(
buf
,
sizeof
(
*
value
));
}
...
...
@@ -51,7 +51,7 @@ static FORCE_INLINE int taosEncodeFixedI8(void **buf, int8_t value) {
return
(
int
)
sizeof
(
value
);
}
static
FORCE_INLINE
void
*
taosDecodeFixedI8
(
void
*
buf
,
int8_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedI8
(
const
void
*
buf
,
int8_t
*
value
)
{
*
value
=
((
int8_t
*
)
buf
)[
0
];
return
POINTER_SHIFT
(
buf
,
sizeof
(
*
value
));
}
...
...
@@ -71,7 +71,7 @@ static FORCE_INLINE int taosEncodeFixedU16(void **buf, uint16_t value) {
return
(
int
)
sizeof
(
value
);
}
static
FORCE_INLINE
void
*
taosDecodeFixedU16
(
void
*
buf
,
uint16_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedU16
(
const
void
*
buf
,
uint16_t
*
value
)
{
if
(
IS_LITTLE_ENDIAN
())
{
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
}
else
{
...
...
@@ -87,9 +87,9 @@ static FORCE_INLINE int taosEncodeFixedI16(void **buf, int16_t value) {
return
taosEncodeFixedU16
(
buf
,
ZIGZAGE
(
int16_t
,
value
));
}
static
FORCE_INLINE
void
*
taosDecodeFixedI16
(
void
*
buf
,
int16_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedI16
(
const
void
*
buf
,
int16_t
*
value
)
{
uint16_t
tvalue
=
0
;
void
*
ret
=
taosDecodeFixedU16
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeFixedU16
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int16_t
,
tvalue
);
return
ret
;
}
...
...
@@ -111,7 +111,7 @@ static FORCE_INLINE int taosEncodeFixedU32(void **buf, uint32_t value) {
return
(
int
)
sizeof
(
value
);
}
static
FORCE_INLINE
void
*
taosDecodeFixedU32
(
void
*
buf
,
uint32_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedU32
(
const
void
*
buf
,
uint32_t
*
value
)
{
if
(
IS_LITTLE_ENDIAN
())
{
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
}
else
{
...
...
@@ -129,9 +129,9 @@ static FORCE_INLINE int taosEncodeFixedI32(void **buf, int32_t value) {
return
taosEncodeFixedU32
(
buf
,
ZIGZAGE
(
int32_t
,
value
));
}
static
FORCE_INLINE
void
*
taosDecodeFixedI32
(
void
*
buf
,
int32_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedI32
(
const
void
*
buf
,
int32_t
*
value
)
{
uint32_t
tvalue
=
0
;
void
*
ret
=
taosDecodeFixedU32
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeFixedU32
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int32_t
,
tvalue
);
return
ret
;
}
...
...
@@ -158,7 +158,7 @@ static FORCE_INLINE int taosEncodeFixedU64(void **buf, uint64_t value) {
return
(
int
)
sizeof
(
value
);
}
static
FORCE_INLINE
void
*
taosDecodeFixedU64
(
void
*
buf
,
uint64_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedU64
(
const
void
*
buf
,
uint64_t
*
value
)
{
if
(
IS_LITTLE_ENDIAN
())
{
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
}
else
{
...
...
@@ -180,9 +180,9 @@ static FORCE_INLINE int taosEncodeFixedI64(void **buf, int64_t value) {
return
taosEncodeFixedU64
(
buf
,
ZIGZAGE
(
int64_t
,
value
));
}
static
FORCE_INLINE
void
*
taosDecodeFixedI64
(
void
*
buf
,
int64_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedI64
(
const
void
*
buf
,
int64_t
*
value
)
{
uint64_t
tvalue
=
0
;
void
*
ret
=
taosDecodeFixedU64
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeFixedU64
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int64_t
,
tvalue
);
return
ret
;
}
...
...
@@ -205,7 +205,7 @@ static FORCE_INLINE int taosEncodeVariantU16(void **buf, uint16_t value) {
return
i
+
1
;
}
static
FORCE_INLINE
void
*
taosDecodeVariantU16
(
void
*
buf
,
uint16_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantU16
(
const
void
*
buf
,
uint16_t
*
value
)
{
int
i
=
0
;
uint16_t
tval
=
0
;
*
value
=
0
;
...
...
@@ -228,9 +228,9 @@ static FORCE_INLINE int taosEncodeVariantI16(void **buf, int16_t value) {
return
taosEncodeVariantU16
(
buf
,
ZIGZAGE
(
int16_t
,
value
));
}
static
FORCE_INLINE
void
*
taosDecodeVariantI16
(
void
*
buf
,
int16_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantI16
(
const
void
*
buf
,
int16_t
*
value
)
{
uint16_t
tvalue
=
0
;
void
*
ret
=
taosDecodeVariantU16
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeVariantU16
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int16_t
,
tvalue
);
return
ret
;
}
...
...
@@ -253,7 +253,7 @@ static FORCE_INLINE int taosEncodeVariantU32(void **buf, uint32_t value) {
return
i
+
1
;
}
static
FORCE_INLINE
void
*
taosDecodeVariantU32
(
void
*
buf
,
uint32_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantU32
(
const
void
*
buf
,
uint32_t
*
value
)
{
int
i
=
0
;
uint32_t
tval
=
0
;
*
value
=
0
;
...
...
@@ -276,9 +276,9 @@ static FORCE_INLINE int taosEncodeVariantI32(void **buf, int32_t value) {
return
taosEncodeVariantU32
(
buf
,
ZIGZAGE
(
int32_t
,
value
));
}
static
FORCE_INLINE
void
*
taosDecodeVariantI32
(
void
*
buf
,
int32_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantI32
(
const
void
*
buf
,
int32_t
*
value
)
{
uint32_t
tvalue
=
0
;
void
*
ret
=
taosDecodeVariantU32
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeVariantU32
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int32_t
,
tvalue
);
return
ret
;
}
...
...
@@ -301,7 +301,7 @@ static FORCE_INLINE int taosEncodeVariantU64(void **buf, uint64_t value) {
return
i
+
1
;
}
static
FORCE_INLINE
void
*
taosDecodeVariantU64
(
void
*
buf
,
uint64_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantU64
(
const
void
*
buf
,
uint64_t
*
value
)
{
int
i
=
0
;
uint64_t
tval
=
0
;
*
value
=
0
;
...
...
@@ -324,9 +324,9 @@ static FORCE_INLINE int taosEncodeVariantI64(void **buf, int64_t value) {
return
taosEncodeVariantU64
(
buf
,
ZIGZAGE
(
int64_t
,
value
));
}
static
FORCE_INLINE
void
*
taosDecodeVariantI64
(
void
*
buf
,
int64_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantI64
(
const
void
*
buf
,
int64_t
*
value
)
{
uint64_t
tvalue
=
0
;
void
*
ret
=
taosDecodeVariantU64
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeVariantU64
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int64_t
,
tvalue
);
return
ret
;
}
...
...
@@ -346,7 +346,7 @@ static FORCE_INLINE int taosEncodeString(void **buf, const char *value) {
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeString
(
void
*
buf
,
char
**
value
)
{
static
FORCE_INLINE
void
*
taosDecodeString
(
const
void
*
buf
,
char
**
value
)
{
uint64_t
size
=
0
;
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
...
...
@@ -360,7 +360,7 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
return
POINTER_SHIFT
(
buf
,
size
);
}
static
FORCE_INLINE
void
*
taosDecodeStringTo
(
void
*
buf
,
char
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeStringTo
(
const
void
*
buf
,
char
*
value
)
{
uint64_t
size
=
0
;
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
...
...
@@ -373,7 +373,7 @@ static FORCE_INLINE void *taosDecodeStringTo(void *buf, char *value) {
// ---- binary
static
FORCE_INLINE
int
taosEncodeBinary
(
void
**
buf
,
const
void
*
value
,
int32_t
valueLen
)
{
int
tlen
=
0
;
int
tlen
=
0
;
if
(
buf
!=
NULL
)
{
memcpy
(
*
buf
,
value
,
valueLen
);
...
...
@@ -384,8 +384,7 @@ static FORCE_INLINE int taosEncodeBinary(void **buf, const void *value, int32_t
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeBinary
(
void
*
buf
,
void
**
value
,
int32_t
valueLen
)
{
static
FORCE_INLINE
void
*
taosDecodeBinary
(
const
void
*
buf
,
void
**
value
,
int32_t
valueLen
)
{
*
value
=
malloc
((
size_t
)
valueLen
);
if
(
*
value
==
NULL
)
return
NULL
;
memcpy
(
*
value
,
buf
,
(
size_t
)
valueLen
);
...
...
@@ -393,8 +392,7 @@ static FORCE_INLINE void *taosDecodeBinary(void *buf, void **value, int32_t valu
return
POINTER_SHIFT
(
buf
,
valueLen
);
}
static
FORCE_INLINE
void
*
taosDecodeBinaryTo
(
void
*
buf
,
void
*
value
,
int32_t
valueLen
)
{
static
FORCE_INLINE
void
*
taosDecodeBinaryTo
(
const
void
*
buf
,
void
*
value
,
int32_t
valueLen
)
{
memcpy
(
value
,
buf
,
(
size_t
)
valueLen
);
return
POINTER_SHIFT
(
buf
,
valueLen
);
}
...
...
include/util/tdef.h
浏览文件 @
71fc95cc
...
...
@@ -219,6 +219,7 @@ do { \
#define TSDB_ERROR_MSG_LEN 1024
#define TSDB_DNODE_CONFIG_LEN 128
#define TSDB_DNODE_VALUE_LEN 256
#define TSDB_MQTT_HOSTNAME_LEN 64
#define TSDB_MQTT_PORT_LEN 8
...
...
source/CMakeLists.txt
浏览文件 @
71fc95cc
...
...
@@ -3,5 +3,4 @@ add_subdirectory(util)
add_subdirectory
(
common
)
add_subdirectory
(
libs
)
add_subdirectory
(
client
)
add_subdirectory
(
dnode
)
add_subdirectory
(
nodes
)
\ No newline at end of file
add_subdirectory
(
dnode
)
\ No newline at end of file
source/client/src/clientHb.c
浏览文件 @
71fc95cc
...
...
@@ -28,22 +28,23 @@ static int32_t hbMqHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp* pRsp)
}
static
int32_t
hbProcessDBInfoRsp
(
void
*
value
,
int32_t
valueLen
,
struct
SCatalog
*
pCatalog
)
{
int32_t
msgLen
=
0
;
int32_t
code
=
0
;
while
(
msgLen
<
valueLen
)
{
SUseDbRsp
*
rsp
=
(
SUseDbRsp
*
)((
char
*
)
value
+
msgLen
);
rsp
->
vgVersion
=
ntohl
(
rsp
->
vgVersion
);
rsp
->
vgNum
=
ntohl
(
rsp
->
vgNum
);
rsp
->
uid
=
be64toh
(
rsp
->
uid
);
SUseDbBatchRsp
batchUseRsp
=
{
0
};
if
(
tDeserializeSUseDbBatchRsp
(
value
,
valueLen
,
&
batchUseRsp
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
int32_t
numOfBatchs
=
taosArrayGetSize
(
batchUseRsp
.
pArray
);
for
(
int32_t
i
=
0
;
i
<
numOfBatchs
;
++
i
)
{
SUseDbRsp
*
rsp
=
taosArrayGet
(
batchUseRsp
.
pArray
,
i
);
tscDebug
(
"hb db rsp, db:%s, vgVersion:%d, uid:%"
PRIx64
,
rsp
->
db
,
rsp
->
vgVersion
,
rsp
->
uid
);
if
(
rsp
->
vgVersion
<
0
)
{
code
=
catalogRemoveDB
(
pCatalog
,
rsp
->
db
,
rsp
->
uid
);
}
else
{
SDBVg
roup
Info
vgInfo
=
{
0
};
SDBVgInfo
vgInfo
=
{
0
};
vgInfo
.
vgVersion
=
rsp
->
vgVersion
;
vgInfo
.
hashMethod
=
rsp
->
hashMethod
;
vgInfo
.
vgHash
=
taosHashInit
(
rsp
->
vgNum
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_ENTRY_LOCK
);
...
...
@@ -52,33 +53,21 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
for
(
int32_t
i
=
0
;
i
<
rsp
->
vgNum
;
++
i
)
{
rsp
->
vgroupInfo
[
i
].
vgId
=
ntohl
(
rsp
->
vgroupInfo
[
i
].
vgId
);
rsp
->
vgroupInfo
[
i
].
hashBegin
=
ntohl
(
rsp
->
vgroupInfo
[
i
].
hashBegin
);
rsp
->
vgroupInfo
[
i
].
hashEnd
=
ntohl
(
rsp
->
vgroupInfo
[
i
].
hashEnd
);
for
(
int32_t
n
=
0
;
n
<
rsp
->
vgroupInfo
[
i
].
epset
.
numOfEps
;
++
n
)
{
rsp
->
vgroupInfo
[
i
].
epset
.
eps
[
n
].
port
=
ntohs
(
rsp
->
vgroupInfo
[
i
].
epset
.
eps
[
n
].
port
);
}
if
(
0
!=
taosHashPut
(
vgInfo
.
vgHash
,
&
rsp
->
vgroupInfo
[
i
].
vgId
,
sizeof
(
rsp
->
vgroupInfo
[
i
].
vgId
),
&
rsp
->
vgroupInfo
[
i
],
sizeof
(
rsp
->
vgroupInfo
[
i
])))
{
for
(
int32_t
j
=
0
;
j
<
rsp
->
vgNum
;
++
j
)
{
SVgroupInfo
*
pInfo
=
taosArrayGet
(
rsp
->
pVgroupInfos
,
j
);
if
(
taosHashPut
(
vgInfo
.
vgHash
,
&
pInfo
->
vgId
,
sizeof
(
int32_t
),
pInfo
,
sizeof
(
SVgroupInfo
))
!=
0
)
{
tscError
(
"hash push failed, errno:%d"
,
errno
);
taosHashCleanup
(
vgInfo
.
vgHash
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
code
=
catalogUpdateDBVgroup
(
pCatalog
,
rsp
->
db
,
rsp
->
uid
,
&
vgInfo
);
if
(
code
)
{
taosHashCleanup
(
vgInfo
.
vgHash
);
}
catalogUpdateDBVgInfo
(
pCatalog
,
rsp
->
db
,
rsp
->
uid
,
&
vgInfo
);
}
if
(
code
)
{
return
code
;
}
msgLen
+=
sizeof
(
SUseDbRsp
)
+
rsp
->
vgNum
*
sizeof
(
SVgroupInfo
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -94,13 +83,14 @@ static int32_t hbProcessStbInfoRsp(void *value, int32_t valueLen, struct SCatalo
rsp
->
numOfColumns
=
ntohl
(
rsp
->
numOfColumns
);
rsp
->
suid
=
be64toh
(
rsp
->
suid
);
rsp
->
dbId
=
be64toh
(
rsp
->
dbId
);
if
(
rsp
->
numOfColumns
<
0
)
{
schemaNum
=
0
;
tscDebug
(
"hb remove stb, db:%s, stb:%s"
,
rsp
->
dbFName
,
rsp
->
stbName
);
catalogRemoveS
TableMeta
(
pCatalog
,
rsp
->
dbFName
,
rsp
->
stbName
,
rsp
->
suid
);
catalogRemoveS
tbMeta
(
pCatalog
,
rsp
->
dbFName
,
rsp
->
dbId
,
rsp
->
stbName
,
rsp
->
suid
);
}
else
{
tscDebug
(
"hb update stb, db:%s, stb:%s"
,
rsp
->
dbFName
,
rsp
->
stbName
);
...
...
@@ -201,9 +191,10 @@ static int32_t hbMqAsyncCallBack(void* param, const SDataBuf* pMsg, int32_t code
tfree
(
param
);
return
-
1
;
}
char
*
key
=
(
char
*
)
param
;
SClientHbBatchRsp
pRsp
=
{
0
};
tDeserializeSClientHbBatchRsp
(
pMsg
->
pData
,
&
pRsp
);
tDeserializeSClientHbBatchRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
pRsp
);
int32_t
rspNum
=
taosArrayGetSize
(
pRsp
.
rsps
);
...
...
@@ -416,7 +407,7 @@ static void* hbThreadFunc(void* param) {
if
(
pReq
==
NULL
)
{
continue
;
}
int
tlen
=
tSerializeSClientHbBatchReq
(
NULL
,
pReq
);
int
tlen
=
tSerializeSClientHbBatchReq
(
NULL
,
0
,
pReq
);
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
@@ -424,8 +415,7 @@ static void* hbThreadFunc(void* param) {
hbClearReqInfo
(
pAppHbMgr
);
break
;
}
void
*
abuf
=
buf
;
tSerializeSClientHbBatchReq
(
&
abuf
,
pReq
);
tSerializeSClientHbBatchReq
(
buf
,
tlen
,
pReq
);
SMsgSendInfo
*
pInfo
=
malloc
(
sizeof
(
SMsgSendInfo
));
if
(
pInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
71fc95cc
...
...
@@ -97,14 +97,15 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) {
if
(
pRequest
->
type
==
TDMT_MND_SHOW_RETRIEVE
||
pRequest
->
type
==
TDMT_VND_SHOW_TABLES_FETCH
)
{
if
(
pRequest
->
type
==
TDMT_MND_SHOW_RETRIEVE
)
{
SRetrieveTableReq
*
pRetrieveMsg
=
calloc
(
1
,
sizeof
(
SRetrieveTableReq
));
if
(
pRetrieveMsg
==
NULL
)
{
return
NULL
;
}
SRetrieveTableReq
retrieveReq
=
{
0
};
retrieveReq
.
showId
=
pRequest
->
body
.
showInfo
.
execId
;
int32_t
contLen
=
tSerializeSRetrieveTableReq
(
NULL
,
0
,
&
retrieveReq
);
void
*
pReq
=
malloc
(
contLen
);
tSerializeSRetrieveTableReq
(
pReq
,
contLen
,
&
retrieveReq
);
pRetrieveMsg
->
showId
=
htobe64
(
pRequest
->
body
.
showInfo
.
execId
);
pMsgSendInfo
->
msgInfo
.
pData
=
pRetrieveMsg
;
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SRetrieveTableReq
);
pMsgSendInfo
->
msgInfo
.
pData
=
pReq
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
}
else
{
SVShowTablesFetchReq
*
pFetchMsg
=
calloc
(
1
,
sizeof
(
SVShowTablesFetchReq
));
if
(
pFetchMsg
==
NULL
)
{
...
...
@@ -264,9 +265,13 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
}
SUseDbRsp
*
pUseDbRsp
=
(
SUseDbRsp
*
)
pMsg
->
pData
;
SUseDbRsp
usedbRsp
=
{
0
};
tDeserializeSUseDbRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
usedbRsp
);
SName
name
=
{
0
};
tNameFromString
(
&
name
,
pUseDbRsp
->
db
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameFromString
(
&
name
,
usedbRsp
.
db
,
T_NAME_ACCT
|
T_NAME_DB
);
tFreeSUsedbRsp
(
&
usedbRsp
);
char
db
[
TSDB_DB_NAME_LEN
]
=
{
0
};
tNameGetDbName
(
&
name
,
db
);
...
...
@@ -300,14 +305,12 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
}
SDropDbRsp
*
rsp
=
(
SDropDbRsp
*
)
pMsg
->
pData
;
struct
SCatalog
*
pCatalog
=
NULL
;
rsp
->
uid
=
be64toh
(
rsp
->
uid
);
SDropDbRsp
dropdbRsp
=
{
0
};
tDeserializeSDropDbRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
dropdbRsp
);
struct
SCatalog
*
pCatalog
=
NULL
;
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
catalogRemoveDB
(
pCatalog
,
rsp
->
db
,
rsp
->
uid
);
catalogRemoveDB
(
pCatalog
,
dropdbRsp
.
db
,
dropdbRsp
.
uid
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
code
;
...
...
source/client/src/tmq.c
浏览文件 @
71fc95cc
...
...
@@ -113,10 +113,10 @@ typedef struct SMqConsumeCbParam {
}
SMqConsumeCbParam
;
typedef
struct
SMqCommitCbParam
{
tmq_t
*
tmq
;
SMqClientVg
*
pVg
;
int32_t
async
;
tsem_t
rspSem
;
tmq_t
*
tmq
;
SMqClientVg
*
pVg
;
int32_t
async
;
tsem_t
rspSem
;
}
SMqCommitCbParam
;
tmq_conf_t
*
tmq_conf_new
()
{
...
...
@@ -163,8 +163,8 @@ int32_t tmqSubscribeCb(void* param, const SDataBuf* pMsg, int32_t code) {
}
int32_t
tmqCommitCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SMqCommitCbParam
*
pParam
=
(
SMqCommitCbParam
*
)
param
;
tmq_resp_err_t
rspErr
=
code
==
0
?
TMQ_RESP_ERR__SUCCESS
:
TMQ_RESP_ERR__FAIL
;
SMqCommitCbParam
*
pParam
=
(
SMqCommitCbParam
*
)
param
;
tmq_resp_err_t
rspErr
=
code
==
0
?
TMQ_RESP_ERR__SUCCESS
:
TMQ_RESP_ERR__FAIL
;
if
(
pParam
->
tmq
->
commit_cb
)
{
pParam
->
tmq
->
commit_cb
(
pParam
->
tmq
,
rspErr
,
NULL
,
NULL
);
}
...
...
@@ -221,13 +221,7 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) {
tNameExtractFullName
(
&
name
,
topicFname
);
tscDebug
(
"subscribe topic: %s"
,
topicFname
);
SMqClientTopic
topic
=
{
.
nextVgIdx
=
0
,
.
sql
=
NULL
,
.
sqlLen
=
0
,
.
topicId
=
0
,
.
topicName
=
topicFname
,
.
vgs
=
NULL
};
.
nextVgIdx
=
0
,
.
sql
=
NULL
,
.
sqlLen
=
0
,
.
topicId
=
0
,
.
topicName
=
topicFname
,
.
vgs
=
NULL
};
topic
.
vgs
=
taosArrayInit
(
0
,
sizeof
(
SMqClientVg
));
taosArrayPush
(
tmq
->
clientTopics
,
&
topic
);
/*SMqClientTopic topic = {*/
...
...
@@ -461,10 +455,10 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
void
tmqShowMsg
(
tmq_message_t
*
tmq_message
)
{
if
(
tmq_message
==
NULL
)
return
;
static
bool
noPrintSchema
;
char
pBuf
[
128
];
static
bool
noPrintSchema
;
char
pBuf
[
128
];
SMqConsumeRsp
*
pRsp
=
(
SMqConsumeRsp
*
)
tmq_message
;
int32_t
colNum
=
pRsp
->
schemas
->
nCols
;
int32_t
colNum
=
pRsp
->
schemas
->
nCols
;
if
(
!
noPrintSchema
)
{
printf
(
"|"
);
for
(
int32_t
i
=
0
;
i
<
colNum
;
i
++
)
{
...
...
@@ -506,7 +500,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
SMqConsumeCbParam
*
pParam
=
(
SMqConsumeCbParam
*
)
param
;
SMqClientVg
*
pVg
=
pParam
->
pVg
;
if
(
code
!=
0
)
{
/*printf("msg discard\n");*/
printf
(
"msg discard
\n
"
);
tsem_post
(
&
pParam
->
rspSem
);
return
0
;
}
...
...
@@ -517,7 +511,7 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
return
-
1
;
}
tDecodeSMqConsumeRsp
(
pMsg
->
pData
,
pRsp
);
/*printf("rsp
%ld %ld
%d\n", pRsp->committedOffset, pRsp->rspOffset, pRsp->numOfTopics);*/
/*printf("rsp
commit off:%ld rsp off:%ld has data:
%d\n", pRsp->committedOffset, pRsp->rspOffset, pRsp->numOfTopics);*/
if
(
pRsp
->
numOfTopics
==
0
)
{
/*printf("no data\n");*/
free
(
pRsp
);
...
...
@@ -584,7 +578,7 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) {
return
0
;
}
int32_t
tmqAs
yncAs
kEp
(
tmq_t
*
tmq
,
bool
wait
)
{
int32_t
tmqAskEp
(
tmq_t
*
tmq
,
bool
wait
)
{
int32_t
tlen
=
sizeof
(
SMqCMGetSubEpReq
);
SMqCMGetSubEpReq
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
...
...
@@ -603,7 +597,7 @@ int32_t tmqAsyncAskEp(tmq_t* tmq, bool wait) {
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
buf
,
.
len
=
tlen
};
SMqAskEpCbParam
*
pParam
=
malloc
(
sizeof
(
SMqAskEpCbParam
));
SMqAskEpCbParam
*
pParam
=
malloc
(
sizeof
(
SMqAskEpCbParam
));
if
(
pParam
==
NULL
)
{
tscError
(
"failed to malloc subscribe param"
);
goto
END
;
...
...
@@ -653,7 +647,7 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
tmq_message_t
*
tmq_message
=
NULL
;
int64_t
status
=
atomic_load_64
(
&
tmq
->
status
);
tmqAs
yncAs
kEp
(
tmq
,
status
==
0
);
tmqAskEp
(
tmq
,
status
==
0
);
if
(
blocking_time
<
0
)
blocking_time
=
1
;
if
(
blocking_time
>
1000
)
blocking_time
=
1000
;
...
...
@@ -671,47 +665,57 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
}
tmq
->
nextTopicIdx
=
(
tmq
->
nextTopicIdx
+
1
)
%
taosArrayGetSize
(
tmq
->
clientTopics
);
pTopic
->
nextVgIdx
=
(
pTopic
->
nextVgIdx
+
1
%
taosArrayGetSize
(
pTopic
->
vgs
));
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
pTopic
->
nextVgIdx
);
SMqConsumeReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blocking_time
,
TMQ_REQ_TYPE_CONSUME_ONLY
,
pTopic
,
pVg
);
if
(
pReq
==
NULL
)
{
usleep
(
blocking_time
*
1000
);
return
NULL
;
}
int32_t
beginVgIdx
=
pTopic
->
nextVgIdx
;
while
(
1
)
{
pTopic
->
nextVgIdx
=
(
pTopic
->
nextVgIdx
+
1
)
%
taosArrayGetSize
(
pTopic
->
vgs
);
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
pTopic
->
nextVgIdx
);
/*printf("consume vg %d, offset %ld\n", pVg->vgId, pVg->currentOffset);*/
SMqConsumeReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blocking_time
,
TMQ_REQ_TYPE_CONSUME_ONLY
,
pTopic
,
pVg
);
if
(
pReq
==
NULL
)
{
ASSERT
(
false
);
usleep
(
blocking_time
*
1000
);
return
NULL
;
}
SMqConsumeCbParam
*
param
=
malloc
(
sizeof
(
SMqConsumeCbParam
));
if
(
param
==
NULL
)
{
usleep
(
blocking_time
*
1000
);
return
NULL
;
}
param
->
tmq
=
tmq
;
param
->
retMsg
=
&
tmq_message
;
param
->
pVg
=
pVg
;
tsem_init
(
&
param
->
rspSem
,
0
,
0
);
SMqConsumeCbParam
*
param
=
malloc
(
sizeof
(
SMqConsumeCbParam
));
if
(
param
==
NULL
)
{
ASSERT
(
false
);
usleep
(
blocking_time
*
1000
);
return
NULL
;
}
param
->
tmq
=
tmq
;
param
->
retMsg
=
&
tmq_message
;
param
->
pVg
=
pVg
;
tsem_init
(
&
param
->
rspSem
,
0
,
0
);
SRequestObj
*
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_VND_CONSUME
);
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
pReq
,
.
len
=
sizeof
(
SMqConsumeReq
)};
SRequestObj
*
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_VND_CONSUME
);
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
pReq
,
.
len
=
sizeof
(
SMqConsumeReq
)};
SMsgSendInfo
*
sendInfo
=
buildMsgInfoImpl
(
pRequest
);
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
param
=
param
;
sendInfo
->
fp
=
tmqPollCb
;
SMsgSendInfo
*
sendInfo
=
buildMsgInfoImpl
(
pRequest
);
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
param
=
param
;
sendInfo
->
fp
=
tmqPollCb
;
/*printf("req offset: %ld\n", pReq->offset);*/
/*printf("req offset: %ld\n", pReq->offset);*/
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
pVg
->
epSet
,
&
transporterId
,
sendInfo
);
tmq
->
pollCnt
++
;
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
pVg
->
epSet
,
&
transporterId
,
sendInfo
);
tmq
->
pollCnt
++
;
tsem_wait
(
&
param
->
rspSem
);
tsem_destroy
(
&
param
->
rspSem
);
free
(
param
);
tsem_wait
(
&
param
->
rspSem
);
tsem_destroy
(
&
param
->
rspSem
);
free
(
param
);
if
(
tmq_message
==
NULL
)
{
usleep
(
blocking_time
*
1000
);
}
if
(
tmq_message
==
NULL
)
{
if
(
beginVgIdx
==
pTopic
->
nextVgIdx
)
{
usleep
(
blocking_time
*
1000
);
}
else
{
continue
;
}
}
return
tmq_message
;
return
tmq_message
;
}
/*tsem_wait(&pRequest->body.rspSem);*/
...
...
@@ -727,21 +731,20 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
}
tmq_resp_err_t
tmq_commit
(
tmq_t
*
tmq
,
const
tmq_topic_vgroup_list_t
*
tmq_topic_vgroup_list
,
int32_t
async
)
{
if
(
tmq_topic_vgroup_list
!=
NULL
)
{
//TODO
//
TODO
}
//TODO: change semaphore to gate
//
TODO: change semaphore to gate
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tmq
->
clientTopics
);
i
++
)
{
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
i
);
for
(
int
j
=
0
;
j
<
taosArrayGetSize
(
pTopic
->
vgs
);
j
++
)
{
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
SMqConsumeReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
0
,
TMQ_REQ_TYPE_COMMIT_ONLY
,
pTopic
,
pVg
);
SRequestObj
*
pRequest
=
createRequest
(
tmq
->
pTscObj
,
NULL
,
NULL
,
TDMT_VND_CONSUME
);
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
pReq
,
.
len
=
sizeof
(
SMqConsumeReq
)};
SMqCommitCbParam
*
pParam
=
malloc
(
sizeof
(
SMqCommitCbParam
));
SMqCommitCbParam
*
pParam
=
malloc
(
sizeof
(
SMqCommitCbParam
));
if
(
pParam
==
NULL
)
{
continue
;
}
...
...
@@ -772,9 +775,7 @@ void tmq_message_destroy(tmq_message_t* tmq_message) {
free
(
tmq_message
);
}
tmq_resp_err_t
tmq_consumer_close
(
tmq_t
*
tmq
)
{
return
TMQ_RESP_ERR__SUCCESS
;
}
tmq_resp_err_t
tmq_consumer_close
(
tmq_t
*
tmq
)
{
return
TMQ_RESP_ERR__SUCCESS
;
}
const
char
*
tmq_err2str
(
tmq_resp_err_t
err
)
{
if
(
err
==
TMQ_RESP_ERR__SUCCESS
)
{
...
...
source/common/src/tmsg.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
71fc95cc
...
...
@@ -382,7 +382,7 @@ static void *dnodeOpenVnodeFunc(void *param) {
pMgmt
->
openVnodes
,
pMgmt
->
totalVnodes
);
dndReportStartup
(
pDnode
,
"open-vnodes"
,
stepDesc
);
SVnodeCfg
cfg
=
{.
pDnode
=
pDnode
,
.
pTfs
=
pDnode
->
pTfs
,
.
vgId
=
pCfg
->
vgId
};
SVnodeCfg
cfg
=
{.
pDnode
=
pDnode
,
.
pTfs
=
pDnode
->
pTfs
,
.
vgId
=
pCfg
->
vgId
,
.
dbId
=
pCfg
->
dbUid
};
SVnode
*
pImpl
=
vnodeOpen
(
pCfg
->
path
,
&
cfg
);
if
(
pImpl
==
NULL
)
{
dError
(
"vgId:%d, failed to open vnode by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
...
...
@@ -594,6 +594,7 @@ int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
vnodeCfg
.
pDnode
=
pDnode
;
vnodeCfg
.
pTfs
=
pDnode
->
pTfs
;
vnodeCfg
.
dbId
=
wrapperCfg
.
dbUid
;
SVnode
*
pImpl
=
vnodeOpen
(
wrapperCfg
.
path
,
&
vnodeCfg
);
if
(
pImpl
==
NULL
)
{
dError
(
"vgId:%d, failed to create vnode since %s"
,
pCreate
->
vgId
,
terrstr
());
...
...
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
71fc95cc
...
...
@@ -80,12 +80,16 @@ SRpcMsg* Testbase::SendReq(tmsg_t msgType, void* pCont, int32_t contLen) {
}
void
Testbase
::
SendShowMetaReq
(
int8_t
showType
,
const
char
*
db
)
{
int32_t
contLen
=
sizeof
(
SShowReq
);
SShowReq
*
pShow
=
(
SShowReq
*
)
rpcMallocCont
(
contLen
);
pShow
->
type
=
showType
;
strcpy
(
pShow
->
db
,
db
);
SShowReq
showReq
=
{
0
};
showReq
.
type
=
showType
;
strcpy
(
showReq
.
db
,
db
);
SRpcMsg
*
pRsp
=
SendReq
(
TDMT_MND_SHOW
,
pShow
,
contLen
);
int32_t
contLen
=
tSerializeSShowReq
(
NULL
,
0
,
&
showReq
);
char
*
pReq
=
(
char
*
)
rpcMallocCont
(
contLen
);
tSerializeSShowReq
(
pReq
,
contLen
,
&
showReq
);
tFreeSShowReq
(
&
showReq
);
SRpcMsg
*
pRsp
=
SendReq
(
TDMT_MND_SHOW
,
pReq
,
contLen
);
SShowRsp
*
pShowRsp
=
(
SShowRsp
*
)
pRsp
->
pCont
;
ASSERT
(
pShowRsp
!=
nullptr
);
...
...
@@ -128,13 +132,15 @@ int32_t Testbase::GetMetaNum() { return pMeta->numOfColumns; }
const
char
*
Testbase
::
GetMetaTbName
()
{
return
pMeta
->
tbName
;
}
void
Testbase
::
SendShowRetrieveReq
()
{
int32_t
contLen
=
sizeof
(
SRetrieveTableReq
);
SRetrieveTableReq
retrieveReq
=
{
0
};
retrieveReq
.
showId
=
showId
;
retrieveReq
.
free
=
0
;
SRetrieveTableReq
*
pRetrieve
=
(
SRetrieveTableReq
*
)
rpcMallocCont
(
contLen
);
pRetrieve
->
showId
=
htobe64
(
showId
);
pRetrieve
->
free
=
0
;
int32_t
contLen
=
tSerializeSRetrieveTableReq
(
NULL
,
0
,
&
retrieveReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSRetrieveTableReq
(
pReq
,
contLen
,
&
retrieveReq
)
;
SRpcMsg
*
pRsp
=
SendReq
(
TDMT_MND_SHOW_RETRIEVE
,
pRe
trieve
,
contLen
);
SRpcMsg
*
pRsp
=
SendReq
(
TDMT_MND_SHOW_RETRIEVE
,
pRe
q
,
contLen
);
pRetrieveRsp
=
(
SRetrieveTableRsp
*
)
pRsp
->
pCont
;
pRetrieveRsp
->
numOfRows
=
htonl
(
pRetrieveRsp
->
numOfRows
);
pRetrieveRsp
->
useconds
=
htobe64
(
pRetrieveRsp
->
useconds
);
...
...
source/dnode/mnode/impl/inc/mndAuth.h
浏览文件 @
71fc95cc
...
...
@@ -29,6 +29,13 @@ int32_t mndCheckCreateUserAuth(SUserObj *pOperUser);
int32_t
mndCheckAlterUserAuth
(
SUserObj
*
pOperUser
,
SUserObj
*
pUser
,
SDbObj
*
pDb
,
SAlterUserReq
*
pAlter
);
int32_t
mndCheckDropUserAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckNodeAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckFuncAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckCreateDbAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckAlterDropCompactSyncDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mnode/impl/inc/mndDb.h
浏览文件 @
71fc95cc
...
...
@@ -26,7 +26,7 @@ int32_t mndInitDb(SMnode *pMnode);
void
mndCleanupDb
(
SMnode
*
pMnode
);
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
char
*
db
);
void
mndReleaseDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
);
int32_t
mndValidateD
BInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
dbs
,
int32_t
num
,
void
**
rsp
,
int32_t
*
r
spLen
);
int32_t
mndValidateD
bInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
pDbs
,
int32_t
numOfDbs
,
void
**
ppRsp
,
int32_t
*
pR
spLen
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
71fc95cc
...
...
@@ -109,4 +109,35 @@ int32_t mndCheckDropUserAuth(SUserObj *pOperUser) {
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
\ No newline at end of file
}
int32_t
mndCheckNodeAuth
(
SUserObj
*
pOperUser
)
{
if
(
pOperUser
->
superUser
)
{
return
0
;
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
int32_t
mndCheckFuncAuth
(
SUserObj
*
pOperUser
)
{
if
(
pOperUser
->
superUser
)
{
return
0
;
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
int32_t
mndCheckCreateDbAuth
(
SUserObj
*
pOperUser
)
{
return
0
;
}
int32_t
mndCheckAlterDropCompactSyncDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
if
(
pOperUser
->
superUser
||
strcmp
(
pOperUser
->
user
,
pDb
->
createUser
)
==
0
)
{
return
0
;
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
return
0
;
}
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
71fc95cc
...
...
@@ -15,9 +15,11 @@
#define _DEFAULT_SOURCE
#include "mndBnode.h"
#include "mndAuth.h"
#include "mndDnode.h"
#include "mndShow.h"
#include "mndTrans.h"
#include "mndUser.h"
#define TSDB_BNODE_VER_NUMBER 1
#define TSDB_BNODE_RESERVE_SIZE 64
...
...
@@ -257,40 +259,57 @@ CREATE_BNODE_OVER:
}
static
int32_t
mndProcessCreateBnodeReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMCreateBnodeReq
*
pCreate
=
pReq
->
rpcMsg
.
pCont
;
pCreate
->
dnodeId
=
htonl
(
pCreate
->
dnodeId
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SBnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_BNODE_OVER
;
}
mDebug
(
"bnode:%d, start to create"
,
pCreate
->
dnodeId
);
mDebug
(
"bnode:%d, start to create"
,
createReq
.
dnodeId
);
SBnodeObj
*
pObj
=
mndAcquireBnode
(
pMnode
,
pCreate
->
dnodeId
);
pObj
=
mndAcquireBnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pObj
!=
NULL
)
{
mError
(
"bnode:%d, bnode already exist"
,
pObj
->
id
);
terrno
=
TSDB_CODE_MND_BNODE_ALREADY_EXIST
;
mndReleaseBnode
(
pMnode
,
pObj
);
return
-
1
;
goto
CREATE_BNODE_OVER
;
}
else
if
(
terrno
!=
TSDB_CODE_MND_BNODE_NOT_EXIST
)
{
mError
(
"bnode:%d, failed to create bnode since %s"
,
pCreate
->
dnodeId
,
terrstr
());
return
-
1
;
goto
CREATE_BNODE_OVER
;
}
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pCreate
->
dnodeId
);
pDnode
=
mndAcquireDnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
mError
(
"bnode:%d, dnode not exist"
,
pCreate
->
dnodeId
);
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
return
-
1
;
goto
CREATE_BNODE_OVER
;
}
int32_t
code
=
mndCreateBnode
(
pMnode
,
pReq
,
pDnode
,
pCreate
);
mndReleaseDnode
(
pMnode
,
pDnode
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_BNODE_OVER
;
}
if
(
code
!=
0
)
{
mError
(
"bnode:%d, failed to create since %s"
,
pCreate
->
dnodeId
,
terrstr
());
return
-
1
;
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
CREATE_BNODE_OVER
;
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
code
=
mndCreateBnode
(
pMnode
,
pReq
,
pDnode
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_BNODE_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"bnode:%d, failed to create since %s"
,
createReq
.
dnodeId
,
terrstr
());
}
mndReleaseBnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndSetDropBnodeRedoLogs
(
STrans
*
pTrans
,
SBnodeObj
*
pObj
)
{
...
...
@@ -352,33 +371,51 @@ DROP_BNODE_OVER:
}
static
int32_t
mndProcessDropBnodeReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMDropBnodeReq
*
pDrop
=
pReq
->
rpcMsg
.
pCont
;
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SBnodeObj
*
pObj
=
NULL
;
SMDropBnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_BNODE_OVER
;
}
mDebug
(
"bnode:%d, start to drop"
,
pDrop
->
dnodeId
);
mDebug
(
"bnode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
pDrop
->
dnodeId
<=
0
)
{
if
(
dropReq
.
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_SDB_APP_ERROR
;
mError
(
"bnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
goto
DROP_BNODE_OVER
;
}
SBnodeObj
*
pObj
=
mndAcquireBnode
(
pMnode
,
pDrop
->
dnodeId
);
pObj
=
mndAcquireBnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pObj
==
NULL
)
{
mError
(
"bnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
goto
DROP_BNODE_OVER
;
}
int32_t
code
=
mndDropBnode
(
pMnode
,
pReq
,
pObj
);
if
(
code
!=
0
)
{
sdbRelease
(
pMnode
->
pSdb
,
pObj
);
mError
(
"bnode:%d, failed to drop since %s"
,
pMnode
->
dnodeId
,
terrstr
());
return
-
1
;
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_BNODE_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
DROP_BNODE_OVER
;
}
sdbRelease
(
pMnode
->
pSdb
,
pObj
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
code
=
mndDropBnode
(
pMnode
,
pReq
,
pObj
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_BNODE_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"bnode:%d, failed to drop since %s"
,
dropReq
.
dnodeId
,
terrstr
());
}
mndReleaseBnode
(
pMnode
,
pObj
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndProcessCreateBnodeRsp
(
SMnodeMsg
*
pRsp
)
{
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
71fc95cc
...
...
@@ -59,6 +59,7 @@ SMqConsumerObj* mndCreateConsumer(int64_t consumerId, const char* cgroup) {
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
pConsumer
->
recentRemovedTopics
=
taosArrayInit
(
0
,
sizeof
(
char
*
));
pConsumer
->
epoch
=
1
;
pConsumer
->
consumerId
=
consumerId
;
atomic_store_32
(
&
pConsumer
->
status
,
MQ_CONSUMER_STATUS__INIT
);
...
...
@@ -169,7 +170,7 @@ SMqConsumerObj *mndAcquireConsumer(SMnode *pMnode, int64_t consumerId) {
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SMqConsumerObj
*
pConsumer
=
sdbAcquire
(
pSdb
,
SDB_CONSUMER
,
&
consumerId
);
if
(
pConsumer
==
NULL
)
{
/*terrno = TSDB_CODE_MND_CONSUMER_NOT_EXIST;*/
terrno
=
TSDB_CODE_MND_CONSUMER_NOT_EXIST
;
}
return
pConsumer
;
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
71fc95cc
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "mndDb.h"
#include "mndAuth.h"
#include "mndDnode.h"
#include "mndShow.h"
#include "mndTrans.h"
...
...
@@ -369,7 +370,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SDropVnodeReq
);
action
.
msgType
=
TDMT_DND_DROP_VNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
;
action
.
acceptableCode
=
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
pReq
);
return
-
1
;
...
...
@@ -451,54 +452,54 @@ CREATE_DB_OVER:
}
static
int32_t
mndProcessCreateDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SCreateDbReq
*
pCreate
=
pReq
->
rpcMsg
.
pCont
;
pCreate
->
numOfVgroups
=
htonl
(
pCreate
->
numOfVgroups
);
pCreate
->
cacheBlockSize
=
htonl
(
pCreate
->
cacheBlockSize
);
pCreate
->
totalBlocks
=
htonl
(
pCreate
->
totalBlocks
);
pCreate
->
daysPerFile
=
htonl
(
pCreate
->
daysPerFile
);
pCreate
->
daysToKeep0
=
htonl
(
pCreate
->
daysToKeep0
);
pCreate
->
daysToKeep1
=
htonl
(
pCreate
->
daysToKeep1
);
pCreate
->
daysToKeep2
=
htonl
(
pCreate
->
daysToKeep2
);
pCreate
->
minRows
=
htonl
(
pCreate
->
minRows
);
pCreate
->
maxRows
=
htonl
(
pCreate
->
maxRows
);
pCreate
->
commitTime
=
htonl
(
pCreate
->
commitTime
);
pCreate
->
fsyncPeriod
=
htonl
(
pCreate
->
fsyncPeriod
);
mDebug
(
"db:%s, start to create, vgroups:%d"
,
pCreate
->
db
,
pCreate
->
numOfVgroups
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pCreate
->
db
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCreateDbReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_DB_OVER
;
}
mDebug
(
"db:%s, start to create, vgroups:%d"
,
createReq
.
db
,
createReq
.
numOfVgroups
);
pDb
=
mndAcquireDb
(
pMnode
,
createReq
.
db
);
if
(
pDb
!=
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
if
(
pCreate
->
ignoreExist
)
{
mDebug
(
"db:%s, already exist, ignore exist is set"
,
pCreate
->
db
)
;
return
0
;
if
(
createReq
.
ignoreExist
)
{
mDebug
(
"db:%s, already exist, ignore exist is set"
,
createReq
.
db
);
code
=
0
;
goto
CREATE_DB_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_DB_ALREADY_EXIST
;
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
goto
CREATE_DB_OVER
;
}
}
else
if
(
terrno
!=
TSDB_CODE_MND_DB_NOT_EXIST
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
goto
CREATE_DB_OVER
;
}
SUserObj
*
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pOperUser
==
NULL
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
CREATE_DB_OVER
;
}
int32_t
code
=
mndCreateDb
(
pMnode
,
pReq
,
pCreate
,
pOperUser
);
mndReleaseUser
(
pMnode
,
pOperUser
);
if
(
mndCheckCreateDbAuth
(
pUser
)
!=
0
)
{
goto
CREATE_DB_OVER
;
}
if
(
code
!=
0
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
code
=
mndCreateDb
(
pMnode
,
pReq
,
&
createReq
,
pUser
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_DB_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"db:%s, failed to create since %s"
,
createReq
.
db
,
terrstr
());
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndSetDbCfgFromAlterDbReq
(
SDbObj
*
pDb
,
SAlterDbReq
*
pAlter
)
{
...
...
@@ -633,43 +634,56 @@ UPDATE_DB_OVER:
}
static
int32_t
mndProcessAlterDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SAlterDbReq
*
pAlter
=
pReq
->
rpcMsg
.
pCont
;
pAlter
->
totalBlocks
=
htonl
(
pAlter
->
totalBlocks
);
pAlter
->
daysToKeep0
=
htonl
(
pAlter
->
daysToKeep0
);
pAlter
->
daysToKeep1
=
htonl
(
pAlter
->
daysToKeep1
);
pAlter
->
daysToKeep2
=
htonl
(
pAlter
->
daysToKeep2
);
pAlter
->
fsyncPeriod
=
htonl
(
pAlter
->
fsyncPeriod
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SAlterDbReq
alterReq
=
{
0
};
if
(
tDeserializeSAlterDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
ALTER_DB_OVER
;
}
mDebug
(
"db:%s, start to alter"
,
pAlter
->
db
);
mDebug
(
"db:%s, start to alter"
,
alterReq
.
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pAlter
->
db
);
pDb
=
mndAcquireDb
(
pMnode
,
alterReq
.
db
);
if
(
pDb
==
NULL
)
{
mError
(
"db:%s, failed to alter since %s"
,
pAlter
->
db
,
terrstr
());
return
TSDB_CODE_MND_DB_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
goto
ALTER_DB_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
ALTER_DB_OVER
;
}
if
(
mndCheckAlterDropCompactSyncDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
ALTER_DB_OVER
;
}
SDbObj
dbObj
=
{
0
};
memcpy
(
&
dbObj
,
pDb
,
sizeof
(
SDbObj
));
int32_t
code
=
mndSetDbCfgFromAlterDbReq
(
&
dbObj
,
pAlter
);
code
=
mndSetDbCfgFromAlterDbReq
(
&
dbObj
,
&
alterReq
);
if
(
code
!=
0
)
{
mndReleaseDb
(
pMnode
,
pDb
);
mError
(
"db:%s, failed to alter since %s"
,
pAlter
->
db
,
tstrerror
(
code
));
return
code
;
goto
ALTER_DB_OVER
;
}
dbObj
.
cfgVersion
++
;
dbObj
.
updateTime
=
taosGetTimestampMs
();
code
=
mndUpdateDb
(
pMnode
,
pReq
,
pDb
,
&
dbObj
);
mndReleaseDb
(
pMnode
,
pDb
)
;
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
code
!=
0
)
{
mError
(
"db:%s, failed to alter since %s"
,
pAlter
->
db
,
tstrerror
(
code
));
return
code
;
ALTER_DB_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"db:%s, failed to alter since %s"
,
alterReq
.
db
,
terrstr
())
;
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndSetDropDbRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
...
...
@@ -771,11 +785,18 @@ static int32_t mndDropDb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pDb) {
if
(
mndSetDropDbCommitLogs
(
pMnode
,
pTrans
,
pDb
)
!=
0
)
goto
DROP_DB_OVER
;
if
(
mndSetDropDbRedoActions
(
pMnode
,
pTrans
,
pDb
)
!=
0
)
goto
DROP_DB_OVER
;
int32_t
rspLen
=
sizeof
(
SDropDbRsp
);
SDropDbRsp
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
goto
DROP_DB_OVER
;
memcpy
(
pRsp
->
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
pRsp
->
uid
=
htobe64
(
pDb
->
uid
);
SDropDbRsp
dropRsp
=
{
0
};
memcpy
(
dropRsp
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
dropRsp
.
uid
=
pDb
->
uid
;
int32_t
rspLen
=
tSerializeSDropDbRsp
(
NULL
,
0
,
&
dropRsp
);
void
*
pRsp
=
malloc
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
DROP_DB_OVER
;
}
tSerializeSDropDbRsp
(
pRsp
,
rspLen
,
&
dropRsp
);
mndTransSetRpcRsp
(
pTrans
,
pRsp
,
rspLen
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
DROP_DB_OVER
;
...
...
@@ -788,37 +809,56 @@ DROP_DB_OVER:
}
static
int32_t
mndProcessDropDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SDropDbReq
*
pDrop
=
pReq
->
rpcMsg
.
pCont
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SDropDbReq
dropReq
=
{
0
};
if
(
tDeserializeSDropDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_DB_OVER
;
}
mDebug
(
"db:%s, start to drop"
,
pDrop
->
db
);
mDebug
(
"db:%s, start to drop"
,
dropReq
.
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pDrop
->
db
);
pDb
=
mndAcquireDb
(
pMnode
,
dropReq
.
db
);
if
(
pDb
==
NULL
)
{
if
(
pDrop
->
ignoreNotExists
)
{
mDebug
(
"db:%s, not exist, ignore not exist is set"
,
pDrop
->
db
)
;
return
TSDB_CODE_SUCCESS
;
if
(
dropReq
.
ignoreNotExists
)
{
code
=
0
;
goto
DROP_DB_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
mError
(
"db:%s, failed to drop since %s"
,
pDrop
->
db
,
terrstr
());
return
-
1
;
goto
DROP_DB_OVER
;
}
}
int32_t
code
=
mndDropDb
(
pMnode
,
pReq
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
DROP_DB_OVER
;
}
if
(
code
!=
0
)
{
mError
(
"db:%s, failed to drop since %s"
,
pDrop
->
db
,
terrstr
());
return
code
;
if
(
mndCheckAlterDropCompactSyncDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
DROP_DB_OVER
;
}
code
=
mndDropDb
(
pMnode
,
pReq
,
pDb
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_DB_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"db:%s, failed to drop since %s"
,
dropReq
.
db
,
terrstr
());
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
void
mndBuildDBVgroupInfo
(
SDbObj
*
pDb
,
SMnode
*
pMnode
,
S
VgroupInfo
*
vgList
,
int32_t
*
vgNum
)
{
static
void
mndBuildDBVgroupInfo
(
SDbObj
*
pDb
,
SMnode
*
pMnode
,
S
Array
*
pVgList
)
{
int32_t
vindex
=
0
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
while
(
vindex
<
pDb
->
cfg
.
numOfVgroups
)
{
...
...
@@ -827,168 +867,243 @@ static void mndBuildDBVgroupInfo(SDbObj *pDb, SMnode *pMnode, SVgroupInfo *vgLis
if
(
pIter
==
NULL
)
break
;
if
(
pVgroup
->
dbUid
==
pDb
->
uid
)
{
SVgroupInfo
*
pInfo
=
&
vgList
[
vindex
]
;
pInfo
->
vgId
=
htonl
(
pVgroup
->
vgId
)
;
pInfo
->
hashBegin
=
htonl
(
pVgroup
->
hashBegin
)
;
pInfo
->
hashEnd
=
htonl
(
pVgroup
->
hashEnd
)
;
pInfo
->
epset
.
numOfEps
=
pVgroup
->
replica
;
SVgroupInfo
vgInfo
=
{
0
}
;
vgInfo
.
vgId
=
pVgroup
->
vgId
;
vgInfo
.
hashBegin
=
pVgroup
->
hashBegin
;
vgInfo
.
hashEnd
=
pVgroup
->
hashEnd
;
vgInfo
.
epset
.
numOfEps
=
pVgroup
->
replica
;
for
(
int32_t
gid
=
0
;
gid
<
pVgroup
->
replica
;
++
gid
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
gid
];
SEp
*
pEp
=
&
pInfo
->
epset
.
eps
[
gid
];
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
gid
];
SEp
*
pEp
=
&
vgInfo
.
epset
.
eps
[
gid
];
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
if
(
pDnode
!=
NULL
)
{
memcpy
(
pEp
->
fqdn
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
pEp
->
port
=
htons
(
pDnode
->
port
)
;
pEp
->
port
=
pDnode
->
port
;
}
mndReleaseDnode
(
pMnode
,
pDnode
);
if
(
pVgid
->
role
==
TAOS_SYNC_STATE_LEADER
)
{
pInfo
->
epset
.
inUse
=
gid
;
vgInfo
.
epset
.
inUse
=
gid
;
}
}
vindex
++
;
taosArrayPush
(
pVgList
,
&
vgInfo
);
}
sdbRelease
(
pSdb
,
pVgroup
);
}
*
vgNum
=
vindex
;
}
static
int32_t
mndProcessUseDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SUseDbReq
*
pUse
=
pReq
->
rpcMsg
.
pCont
;
pUse
->
vgVersion
=
htonl
(
pUse
->
vgVersion
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SUseDbReq
usedbReq
=
{
0
};
SUseDbRsp
usedbRsp
=
{
0
};
if
(
tDeserializeSUseDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
usedbReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
USE_DB_OVER
;
}
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pUse
->
db
);
pDb
=
mndAcquireDb
(
pMnode
,
usedbReq
.
db
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
mError
(
"db:%s, failed to process use db req since %s"
,
pUse
->
db
,
terrstr
());
return
-
1
;
goto
USE_DB_OVER
;
}
int32_t
contLen
=
sizeof
(
SUseDbRsp
)
+
pDb
->
cfg
.
numOfVgroups
*
sizeof
(
SVgroupInfo
);
SUseDbRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
USE_DB_OVER
;
}
if
(
mndCheckUseDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
USE_DB_OVER
;
}
usedbRsp
.
pVgroupInfos
=
taosArrayInit
(
pDb
->
cfg
.
numOfVgroups
,
sizeof
(
SVgroupInfo
));
if
(
usedbRsp
.
pVgroupInfos
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
goto
USE_DB_OVER
;
}
int32_t
vgNum
=
0
;
if
(
usedbReq
.
vgVersion
<
pDb
->
vgVersion
)
{
mndBuildDBVgroupInfo
(
pDb
,
pMnode
,
usedbRsp
.
pVgroupInfos
);
}
if
(
pUse
->
vgVersion
<
pDb
->
vgVersion
)
{
mndBuildDBVgroupInfo
(
pDb
,
pMnode
,
pRsp
->
vgroupInfo
,
&
vgNum
);
memcpy
(
usedbRsp
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
usedbRsp
.
uid
=
pDb
->
uid
;
usedbRsp
.
vgVersion
=
pDb
->
vgVersion
;
usedbRsp
.
vgNum
=
taosArrayGetSize
(
usedbRsp
.
pVgroupInfos
);
usedbRsp
.
hashMethod
=
pDb
->
hashMethod
;
int32_t
contLen
=
tSerializeSUseDbRsp
(
NULL
,
0
,
&
usedbRsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
USE_DB_OVER
;
}
memcpy
(
pRsp
->
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
pRsp
->
uid
=
htobe64
(
pDb
->
uid
);
pRsp
->
vgVersion
=
htonl
(
pDb
->
vgVersion
);
pRsp
->
vgNum
=
htonl
(
vgNum
);
pRsp
->
hashMethod
=
pDb
->
hashMethod
;
tSerializeSUseDbRsp
(
pRsp
,
contLen
,
&
usedbRsp
);
pReq
->
pCont
=
pRsp
;
pReq
->
contLen
=
contLen
;
code
=
0
;
USE_DB_OVER:
if
(
code
!=
0
)
{
mError
(
"db:%s, failed to process use db req since %s"
,
usedbReq
.
db
,
terrstr
());
}
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
tFreeSUsedbRsp
(
&
usedbRsp
);
return
0
;
return
code
;
}
int32_t
mndValidateDBInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
dbs
,
int32_t
num
,
void
**
rsp
,
int32_t
*
rspLen
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
bufSize
=
num
*
(
sizeof
(
SUseDbRsp
)
+
TSDB_DEFAULT_VN_PER_DB
*
sizeof
(
SVgroupInfo
));
void
*
buf
=
malloc
(
bufSize
);
int32_t
len
=
0
;
int32_t
contLen
=
0
;
int32_t
bufOffset
=
0
;
SUseDbRsp
*
pRsp
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SDbVgVersion
*
db
=
&
dbs
[
i
];
db
->
dbId
=
be64toh
(
db
->
dbId
);
db
->
vgVersion
=
ntohl
(
db
->
vgVersion
);
len
=
0
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
db
->
dbFName
);
if
(
pDb
==
NULL
)
{
mInfo
(
"db %s not exist"
,
db
->
dbFName
);
len
=
sizeof
(
SUseDbRsp
);
}
else
if
(
pDb
->
uid
!=
db
->
dbId
||
db
->
vgVersion
<
pDb
->
vgVersion
)
{
len
=
sizeof
(
SUseDbRsp
)
+
pDb
->
cfg
.
numOfVgroups
*
sizeof
(
SVgroupInfo
);
}
int32_t
mndValidateDbInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
pDbs
,
int32_t
numOfDbs
,
void
**
ppRsp
,
int32_t
*
pRspLen
)
{
SUseDbBatchRsp
batchUseRsp
=
{
0
};
batchUseRsp
.
pArray
=
taosArrayInit
(
numOfDbs
,
sizeof
(
SUseDbRsp
));
if
(
batchUseRsp
.
pArray
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
if
(
0
==
len
)
{
for
(
int32_t
i
=
0
;
i
<
numOfDbs
;
++
i
)
{
SDbVgVersion
*
pDbVgVersion
=
&
pDbs
[
i
];
pDbVgVersion
->
dbId
=
htobe64
(
pDbVgVersion
->
dbId
);
pDbVgVersion
->
vgVersion
=
htonl
(
pDbVgVersion
->
vgVersion
);
SUseDbRsp
usedbRsp
=
{
0
};
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pDbVgVersion
->
dbFName
);
if
(
pDb
==
NULL
)
{
mDebug
(
"db:%s, no exist"
,
pDbVgVersion
->
dbFName
);
memcpy
(
usedbRsp
.
db
,
pDbVgVersion
->
dbFName
,
TSDB_DB_FNAME_LEN
);
usedbRsp
.
uid
=
pDbVgVersion
->
dbId
;
usedbRsp
.
vgVersion
=
-
1
;
taosArrayPush
(
batchUseRsp
.
pArray
,
&
usedbRsp
);
}
else
if
(
pDbVgVersion
->
vgVersion
>=
pDb
->
vgVersion
)
{
mDebug
(
"db:%s, version not changed"
,
pDbVgVersion
->
dbFName
);
mndReleaseDb
(
pMnode
,
pDb
);
continue
;
}
contLen
+=
len
;
if
(
contLen
>
bufSize
)
{
buf
=
realloc
(
buf
,
contLen
);
}
pRsp
=
(
SUseDbRsp
*
)((
char
*
)
buf
+
bufOffset
);
memcpy
(
pRsp
->
db
,
db
->
dbFName
,
TSDB_DB_FNAME_LEN
);
if
(
pDb
)
{
int32_t
vgNum
=
0
;
mndBuildDBVgroupInfo
(
pDb
,
pMnode
,
pRsp
->
vgroupInfo
,
&
vgNum
);
pRsp
->
uid
=
htobe64
(
pDb
->
uid
);
pRsp
->
vgVersion
=
htonl
(
pDb
->
vgVersion
);
pRsp
->
vgNum
=
htonl
(
vgNum
);
pRsp
->
hashMethod
=
pDb
->
hashMethod
;
}
else
{
pRsp
->
uid
=
htobe64
(
db
->
dbId
);
pRsp
->
vgNum
=
htonl
(
0
);
pRsp
->
hashMethod
=
0
;
pRsp
->
vgVersion
=
htonl
(
-
1
);
}
usedbRsp
.
pVgroupInfos
=
taosArrayInit
(
pDb
->
cfg
.
numOfVgroups
,
sizeof
(
SVgroupInfo
));
if
(
usedbRsp
.
pVgroupInfos
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
mError
(
"db:%s, failed to malloc usedb response"
,
pDb
->
name
);
continue
;
}
mndBuildDBVgroupInfo
(
pDb
,
pMnode
,
usedbRsp
.
pVgroupInfos
);
memcpy
(
usedbRsp
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
usedbRsp
.
uid
=
pDb
->
uid
;
usedbRsp
.
vgVersion
=
pDb
->
vgVersion
;
usedbRsp
.
vgNum
=
(
int32_t
)
taosArrayGetSize
(
usedbRsp
.
pVgroupInfos
);
usedbRsp
.
hashMethod
=
pDb
->
hashMethod
;
bufOffset
+=
len
;
mndReleaseDb
(
pMnode
,
pDb
);
taosArrayPush
(
batchUseRsp
.
pArray
,
&
usedbRsp
)
;
mndReleaseDb
(
pMnode
,
pDb
);
}
}
if
(
contLen
>
0
)
{
*
rsp
=
buf
;
*
rspLen
=
contLen
;
}
else
{
*
rsp
=
NULL
;
tfree
(
buf
);
*
rspLen
=
0
;
int32_t
rspLen
=
tSerializeSUseDbBatchRsp
(
NULL
,
0
,
&
batchUseRsp
);
void
*
pRsp
=
malloc
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
tFreeSUseDbBatchRsp
(
&
batchUseRsp
);
return
-
1
;
}
tSerializeSUseDbBatchRsp
(
pRsp
,
rspLen
,
&
batchUseRsp
);
*
ppRsp
=
pRsp
;
*
pRspLen
=
rspLen
;
tFreeSUseDbBatchRsp
(
&
batchUseRsp
);
return
0
;
}
static
int32_t
mndProcessSyncDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSyncDbReq
*
pSync
=
pReq
->
rpcMsg
.
pCont
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pSync
->
db
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SSyncDbReq
syncReq
=
{
0
};
if
(
tDeserializeSSyncDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
syncReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
SYNC_DB_OVER
;
}
mDebug
(
"db:%s, start to sync"
,
syncReq
.
db
);
pDb
=
mndAcquireDb
(
pMnode
,
syncReq
.
db
);
if
(
pDb
==
NULL
)
{
mError
(
"db:%s, failed to process sync db req since %s"
,
pSync
->
db
,
terrstr
());
return
-
1
;
goto
SYNC_DB_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
SYNC_DB_OVER
;
}
if
(
mndCheckAlterDropCompactSyncDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
SYNC_DB_OVER
;
}
// code = mndSyncDb();
SYNC_DB_OVER:
if
(
code
!=
0
)
{
mError
(
"db:%s, failed to process sync db req since %s"
,
syncReq
.
db
,
terrstr
());
}
mndReleaseDb
(
pMnode
,
pDb
);
return
0
;
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndProcessCompactDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SCompactDbReq
*
pCompact
=
pReq
->
rpcMsg
.
pCont
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pCompact
->
db
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCompactDbReq
compactReq
=
{
0
};
if
(
tDeserializeSSyncDbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
compactReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
SYNC_DB_OVER
;
}
mDebug
(
"db:%s, start to sync"
,
compactReq
.
db
);
pDb
=
mndAcquireDb
(
pMnode
,
compactReq
.
db
);
if
(
pDb
==
NULL
)
{
mError
(
"db:%s, failed to process compact db req since %s"
,
pCompact
->
db
,
terrstr
());
return
-
1
;
goto
SYNC_DB_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
SYNC_DB_OVER
;
}
if
(
mndCheckAlterDropCompactSyncDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
SYNC_DB_OVER
;
}
// code = mndSyncDb();
SYNC_DB_OVER:
if
(
code
!=
0
)
{
mError
(
"db:%s, failed to process compact db req since %s"
,
compactReq
.
db
,
terrstr
());
}
mndReleaseDb
(
pMnode
,
pDb
);
return
0
;
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndGetDbMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
71fc95cc
...
...
@@ -15,9 +15,11 @@
#define _DEFAULT_SOURCE
#include "mndDnode.h"
#include "mndAuth.h"
#include "mndMnode.h"
#include "mndShow.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndVgroup.h"
#define TSDB_DNODE_VER_NUMBER 1
...
...
@@ -354,7 +356,8 @@ static int32_t mndProcessStatusReq(SMnodeMsg *pReq) {
if
(
pDnode
!=
NULL
)
{
pDnode
->
offlineReason
=
DND_REASON_VERSION_NOT_MATCH
;
}
mError
(
"dnode:%d, status msg version:%d not match cluster:%d"
,
statusReq
.
dnodeId
,
statusReq
.
sver
,
pMnode
->
cfg
.
sver
);
mError
(
"dnode:%d, status msg version:%d not match cluster:%d"
,
statusReq
.
dnodeId
,
statusReq
.
sver
,
pMnode
->
cfg
.
sver
);
terrno
=
TSDB_CODE_MND_INVALID_MSG_VERSION
;
goto
PROCESS_STATUS_MSG_OVER
;
}
...
...
@@ -461,35 +464,53 @@ static int32_t mndCreateDnode(SMnode *pMnode, SMnodeMsg *pReq, SCreateDnodeReq *
}
static
int32_t
mndProcessCreateDnodeReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SCreateDnodeReq
*
pCreate
=
pReq
->
rpcMsg
.
pCont
;
pCreate
->
port
=
htonl
(
pCreate
->
port
);
mDebug
(
"dnode:%s:%d, start to create"
,
pCreate
->
fqdn
,
pCreate
->
port
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SCreateDnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDnodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_DNODE_OVER
;
}
mDebug
(
"dnode:%s:%d, start to create"
,
createReq
.
fqdn
,
createReq
.
port
);
if
(
pCreate
->
fqdn
[
0
]
==
0
||
pCreate
->
port
<=
0
||
pCreate
->
port
>
UINT16_MAX
)
{
if
(
createReq
.
fqdn
[
0
]
==
0
||
createReq
.
port
<=
0
||
createReq
.
port
>
UINT16_MAX
)
{
terrno
=
TSDB_CODE_MND_INVALID_DNODE_EP
;
mError
(
"dnode:%s:%d, failed to create since %s"
,
pCreate
->
fqdn
,
pCreate
->
port
,
terrstr
());
return
-
1
;
goto
CREATE_DNODE_OVER
;
}
char
ep
[
TSDB_EP_LEN
];
snprintf
(
ep
,
TSDB_EP_LEN
,
"%s:%d"
,
pCreate
->
fqdn
,
pCreate
->
port
);
SDnodeObj
*
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
ep
);
snprintf
(
ep
,
TSDB_EP_LEN
,
"%s:%d"
,
createReq
.
fqdn
,
createReq
.
port
);
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
ep
);
if
(
pDnode
!=
NULL
)
{
mError
(
"dnode:%d, already exist, %s:%u"
,
pDnode
->
id
,
pCreate
->
fqdn
,
pCreate
->
port
);
mndReleaseDnode
(
pMnode
,
pDnode
);
terrno
=
TSDB_CODE_MND_DNODE_ALREADY_EXIST
;
return
-
1
;
goto
CREATE_DNODE_OVER
;
}
int32_t
code
=
mndCreateDnode
(
pMnode
,
pReq
,
pCreate
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_DNODE_OVER
;
}
if
(
code
!=
0
)
{
mError
(
"dnode:%s:%d, failed to create since %s"
,
pCreate
->
fqdn
,
pCreate
->
port
,
terrstr
());
return
-
1
;
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
CREATE_DNODE_OVER
;
}
code
=
mndCreateDnode
(
pMnode
,
pReq
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_DNODE_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"dnode:%s:%d, failed to create since %s"
,
createReq
.
fqdn
,
createReq
.
port
,
terrstr
());
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndDropDnode
(
SMnode
*
pMnode
,
SMnodeMsg
*
pReq
,
SDnodeObj
*
pDnode
)
{
...
...
@@ -520,44 +541,66 @@ static int32_t mndDropDnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode)
static
int32_t
mndProcessDropDnodeReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SDropDnodeReq
*
pDrop
=
pReq
->
rpcMsg
.
pCont
;
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSMCreateDropMnodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_DNODE_OVER
;
}
mDebug
(
"dnode:%d, start to drop"
,
pDrop
->
dnodeId
);
mDebug
(
"dnode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
pDrop
->
dnodeId
<=
0
)
{
if
(
dropReq
.
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_DNODE_ID
;
mError
(
"dnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
goto
DROP_DNODE_OVER
;
}
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pDrop
->
dnodeId
);
pDnode
=
mndAcquireDnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
mError
(
"dnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
goto
DROP_DNODE_OVER
;
}
int32_t
code
=
mndDropDnode
(
pMnode
,
pReq
,
pDnode
);
if
(
code
!=
0
)
{
mndReleaseDnode
(
pMnode
,
pDnode
);
mError
(
"dnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_DNODE_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
DROP_DNODE_OVER
;
}
code
=
mndDropDnode
(
pMnode
,
pReq
,
pDnode
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_DNODE_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"dnode:%d, failed to drop since %s"
,
dropReq
.
dnodeId
,
terrstr
());
}
mndReleaseDnode
(
pMnode
,
pDnode
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndProcessConfigDnodeReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMCfgDnodeReq
*
pCfg
=
pReq
->
rpcMsg
.
pCont
;
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMCfgDnodeReq
cfgReq
=
{
0
};
if
(
tDeserializeSMCfgDnodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
cfgReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pCfg
->
dnodeId
);
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
cfgReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
mError
(
"dnode:%d, failed to config since %s "
,
pCfg
->
dnodeId
,
terrstr
());
mError
(
"dnode:%d, failed to config since %s "
,
cfgReq
.
dnodeId
,
terrstr
());
return
-
1
;
}
...
...
@@ -565,15 +608,15 @@ static int32_t mndProcessConfigDnodeReq(SMnodeMsg *pReq) {
mndReleaseDnode
(
pMnode
,
pDnode
);
SDCfgDnodeReq
*
pCfgDnode
=
rpcMallocCont
(
sizeof
(
SDCfgDnodeReq
));
pCfgDnode
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
memcpy
(
pCfgDnode
->
config
,
pCfg
->
config
,
TSDB_DNODE_CONFIG_LEN
);
pCfgDnode
->
dnodeId
=
htonl
(
cfgReq
.
dnodeId
);
memcpy
(
pCfgDnode
->
config
,
cfgReq
.
config
,
TSDB_DNODE_CONFIG_LEN
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pCfgDnode
,
.
contLen
=
sizeof
(
SDCfgDnodeReq
),
.
ahandle
=
pReq
->
rpcMsg
.
ahandle
};
mInfo
(
"dnode:%d, app:%p config:%s req send to dnode"
,
pCfg
->
dnodeId
,
rpcMsg
.
ahandle
,
pCfg
->
config
);
mInfo
(
"dnode:%d, app:%p config:%s req send to dnode"
,
cfgReq
.
dnodeId
,
rpcMsg
.
ahandle
,
cfgReq
.
config
);
mndSendReqToDnode
(
pMnode
,
&
epSet
,
&
rpcMsg
);
return
0
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
71fc95cc
...
...
@@ -15,9 +15,11 @@
#define _DEFAULT_SOURCE
#include "mndFunc.h"
#include "mndAuth.h"
#include "mndShow.h"
#include "mndSync.h"
#include "mndTrans.h"
#include "mndUser.h"
#define SDB_FUNC_VER 1
#define SDB_FUNC_RESERVE_SIZE 64
...
...
@@ -201,8 +203,8 @@ static int32_t mndCreateFunc(SMnode *pMnode, SMnodeMsg *pReq, SCreateFuncReq *pC
goto
CREATE_FUNC_OVER
;
}
memcpy
(
func
.
pComment
,
pCreate
->
pCont
,
pCreate
->
commentSize
);
memcpy
(
func
.
pCode
,
pCreate
->
pCo
nt
+
pCreate
->
commentSiz
e
,
func
.
codeSize
);
memcpy
(
func
.
pComment
,
pCreate
->
pCo
mme
nt
,
pCreate
->
commentSize
);
memcpy
(
func
.
pCode
,
pCreate
->
pCo
d
e
,
func
.
codeSize
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
CREATE_FUNC_OVER
;
...
...
@@ -261,164 +263,202 @@ DROP_FUNC_OVER:
}
static
int32_t
mndProcessCreateFuncReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SCreateFuncReq
*
pCreate
=
pReq
->
rpcMsg
.
pCont
;
pCreate
->
outputLen
=
htonl
(
pCreate
->
outputLen
);
pCreate
->
bufSize
=
htonl
(
pCreate
->
bufSize
);
pCreate
->
signature
=
htobe64
(
pCreate
->
signature
);
pCreate
->
commentSize
=
htonl
(
pCreate
->
commentSize
);
pCreate
->
codeSize
=
htonl
(
pCreate
->
codeSize
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SFuncObj
*
pFunc
=
NULL
;
SCreateFuncReq
createReq
=
{
0
};
if
(
tDeserializeSCreateFuncReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_FUNC_OVER
;
}
mDebug
(
"func:%s, start to create"
,
pCreate
->
name
);
mDebug
(
"func:%s, start to create"
,
createReq
.
name
);
SFuncObj
*
pFunc
=
mndAcquireFunc
(
pMnode
,
pCreate
->
name
);
pFunc
=
mndAcquireFunc
(
pMnode
,
createReq
.
name
);
if
(
pFunc
!=
NULL
)
{
mndReleaseFunc
(
pMnode
,
pFunc
);
if
(
pCreate
->
igExists
)
{
mDebug
(
"stb:%s, already exist, ignore exist is set"
,
pCreate
->
name
)
;
return
0
;
if
(
createReq
.
igExists
)
{
mDebug
(
"func:%s, already exist, ignore exist is set"
,
createReq
.
name
);
code
=
0
;
goto
CREATE_FUNC_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_FUNC_ALREADY_EXIST
;
mError
(
"func:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
goto
CREATE_FUNC_OVER
;
}
}
else
if
(
terrno
==
TSDB_CODE_MND_FUNC_ALREADY_EXIST
)
{
mError
(
"stb:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
goto
CREATE_FUNC_OVER
;
}
if
(
pCreate
->
name
[
0
]
==
0
)
{
if
(
createReq
.
name
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_NAME
;
mError
(
"func:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
goto
CREATE_FUNC_OVER
;
}
if
(
pCreate
->
commentSize
<=
0
||
pCreate
->
commentSize
>
TSDB_FUNC_COMMENT_LEN
)
{
if
(
createReq
.
commentSize
<=
0
||
createReq
.
commentSize
>
TSDB_FUNC_COMMENT_LEN
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_COMMENT
;
mError
(
"func:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
goto
CREATE_FUNC_OVER
;
}
if
(
pCreate
->
codeSize
<=
0
||
pCreate
->
codeSize
>
TSDB_FUNC_CODE_LEN
)
{
if
(
createReq
.
codeSize
<=
0
||
createReq
.
codeSize
>
TSDB_FUNC_CODE_LEN
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_CODE
;
mError
(
"func:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
goto
CREATE_FUNC_OVER
;
}
if
(
pCreate
->
pCont
[
0
]
==
0
)
{
if
(
createReq
.
pCode
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_CODE
;
mError
(
"func:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
goto
CREATE_FUNC_OVER
;
}
if
(
pCreate
->
bufSize
<=
0
||
pCreate
->
bufSize
>
TSDB_FUNC_BUF_SIZE
)
{
if
(
createReq
.
bufSize
<=
0
||
createReq
.
bufSize
>
TSDB_FUNC_BUF_SIZE
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_BUFSIZE
;
mError
(
"func:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
goto
CREATE_FUNC_OVER
;
}
int32_t
code
=
mndCreateFunc
(
pMnode
,
pReq
,
pCreate
);
if
(
code
!=
0
)
{
mError
(
"func:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_FUNC_OVER
;
}
if
(
mndCheckFuncAuth
(
pUser
))
{
goto
CREATE_FUNC_OVER
;
}
code
=
mndCreateFunc
(
pMnode
,
pReq
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_FUNC_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"func:%s, failed to create since %s"
,
createReq
.
name
,
terrstr
());
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseFunc
(
pMnode
,
pFunc
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndProcessDropFuncReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SDropFuncReq
*
pDrop
=
pReq
->
rpcMsg
.
pCont
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SFuncObj
*
pFunc
=
NULL
;
SDropFuncReq
dropReq
=
{
0
};
if
(
tDeserializeSDropFuncReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_FUNC_OVER
;
}
mDebug
(
"func:%s, start to drop"
,
pDrop
->
name
);
mDebug
(
"func:%s, start to drop"
,
dropReq
.
name
);
if
(
pDrop
->
name
[
0
]
==
0
)
{
if
(
dropReq
.
name
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_NAME
;
mError
(
"func:%s, failed to drop since %s"
,
pDrop
->
name
,
terrstr
());
return
-
1
;
goto
DROP_FUNC_OVER
;
}
SFuncObj
*
pFunc
=
mndAcquireFunc
(
pMnode
,
pDrop
->
name
);
pFunc
=
mndAcquireFunc
(
pMnode
,
dropReq
.
name
);
if
(
pFunc
==
NULL
)
{
if
(
pDrop
->
igNotExists
)
{
mDebug
(
"func:%s, not exist, ignore not exist is set"
,
pDrop
->
name
);
return
0
;
if
(
dropReq
.
igNotExists
)
{
mDebug
(
"func:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
code
=
0
;
goto
DROP_FUNC_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_FUNC_NOT_EXIST
;
mError
(
"func:%s, failed to drop since %s"
,
pDrop
->
name
,
terrstr
());
return
-
1
;
goto
DROP_FUNC_OVER
;
}
}
int32_t
code
=
mndDropFunc
(
pMnode
,
pReq
,
pFunc
);
mndReleaseFunc
(
pMnode
,
pFunc
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_FUNC_OVER
;
}
if
(
mndCheckFuncAuth
(
pUser
))
{
goto
DROP_FUNC_OVER
;
}
code
=
mndDropFunc
(
pMnode
,
pReq
,
pFunc
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
code
!=
0
)
{
mError
(
"func:%s, failed to drop since %s"
,
pDrop
->
name
,
terrstr
());
return
-
1
;
DROP_FUNC_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"func:%s, failed to drop since %s"
,
dropReq
.
name
,
terrstr
())
;
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseFunc
(
pMnode
,
pFunc
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndProcessRetrieveFuncReq
(
SMnodeMsg
*
pReq
)
{
int32_t
code
=
-
1
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SRetrieveFuncReq
retrieveReq
=
{
0
};
SRetrieveFuncRsp
retrieveRsp
=
{
0
};
if
(
tDeserializeSRetrieveFuncReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
retrieveReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
RETRIEVE_FUNC_OVER
;
}
SRetrieveFuncReq
*
pRetrieve
=
pReq
->
rpcMsg
.
pCont
;
pRetrieve
->
numOfFuncs
=
htonl
(
pRetrieve
->
numOfFuncs
);
if
(
pRetrieve
->
numOfFuncs
<=
0
||
pRetrieve
->
numOfFuncs
>
TSDB_FUNC_MAX_RETRIEVE
)
{
if
(
retrieveReq
.
numOfFuncs
<=
0
||
retrieveReq
.
numOfFuncs
>
TSDB_FUNC_MAX_RETRIEVE
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_RETRIEVE
;
return
-
1
;
goto
RETRIEVE_FUNC_OVER
;
}
int32_t
fsize
=
sizeof
(
SFuncInfo
)
+
TSDB_FUNC_CODE_LEN
+
TSDB_FUNC_COMMENT_LEN
;
int32_t
size
=
sizeof
(
SRetrieveFuncRsp
)
+
fsize
*
pRetrieve
->
numOfFuncs
;
SRetrieveFuncRsp
*
pRetrieveRsp
=
rpcMallocCont
(
size
);
if
(
pRetrieveRsp
==
NULL
)
{
retrieveRsp
.
numOfFuncs
=
retrieveReq
.
numOfFuncs
;
retrieveRsp
.
pFuncInfos
=
taosArrayInit
(
retrieveReq
.
numOfFuncs
,
sizeof
(
SFuncInfo
));
if
(
retrieveRsp
.
pFuncInfos
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
FUNC_RETRIEVE
_OVER
;
goto
RETRIEVE_FUNC
_OVER
;
}
pRetrieveRsp
->
numOfFuncs
=
htonl
(
pRetrieve
->
numOfFuncs
);
char
*
pOutput
=
pRetrieveRsp
->
pFuncInfos
;
for
(
int32_t
i
=
0
;
i
<
pRetrieve
->
numOfFuncs
;
++
i
)
{
char
funcName
[
TSDB_FUNC_NAME_LEN
]
=
{
0
};
memcpy
(
funcName
,
pRetrieve
->
pFuncNames
+
i
*
TSDB_FUNC_NAME_LEN
,
TSDB_FUNC_NAME_LEN
);
for
(
int32_t
i
=
0
;
i
<
retrieveReq
.
numOfFuncs
;
++
i
)
{
char
*
funcName
=
taosArrayGet
(
retrieveReq
.
pFuncNames
,
i
);
SFuncObj
*
pFunc
=
mndAcquireFunc
(
pMnode
,
funcName
);
if
(
pFunc
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC
;
mError
(
"func:%s, failed to retrieve since %s"
,
funcName
,
terrstr
());
goto
FUNC_RETRIEVE_OVER
;
goto
RETRIEVE_FUNC_OVER
;
}
SFuncInfo
*
pFuncInfo
=
(
SFuncInfo
*
)
pOutput
;
memcpy
(
pFuncInfo
->
name
,
pFunc
->
name
,
TSDB_FUNC_NAME_LEN
);
pFuncInfo
->
funcType
=
pFunc
->
funcType
;
pFuncInfo
->
scriptType
=
pFunc
->
scriptType
;
pFuncInfo
->
outputType
=
pFunc
->
outputType
;
pFuncInfo
->
outputLen
=
htonl
(
pFunc
->
outputLen
)
;
pFuncInfo
->
bufSize
=
htonl
(
pFunc
->
bufSize
)
;
pFuncInfo
->
signature
=
htobe64
(
pFunc
->
signature
)
;
pFuncInfo
->
commentSize
=
htonl
(
pFunc
->
commentSize
)
;
pFuncInfo
->
codeSize
=
htonl
(
pFunc
->
codeSize
)
;
memcpy
(
pFuncInfo
->
pCo
nt
,
pFunc
->
pComment
,
pFunc
->
commentSize
);
memcpy
(
pFuncInfo
->
pCont
+
pFunc
->
commentSiz
e
,
pFunc
->
pCode
,
pFunc
->
codeSize
);
pOutput
+=
(
sizeof
(
SFuncInfo
)
+
pFunc
->
commentSize
+
pFunc
->
codeSize
);
SFuncInfo
funcInfo
=
{
0
}
;
memcpy
(
funcInfo
.
name
,
pFunc
->
name
,
TSDB_FUNC_NAME_LEN
);
funcInfo
.
funcType
=
pFunc
->
funcType
;
funcInfo
.
scriptType
=
pFunc
->
scriptType
;
funcInfo
.
outputType
=
pFunc
->
outputType
;
funcInfo
.
outputLen
=
pFunc
->
outputLen
;
funcInfo
.
bufSize
=
pFunc
->
bufSize
;
funcInfo
.
signature
=
pFunc
->
signature
;
funcInfo
.
commentSize
=
pFunc
->
commentSize
;
funcInfo
.
codeSize
=
pFunc
->
codeSize
;
memcpy
(
funcInfo
.
pComme
nt
,
pFunc
->
pComment
,
pFunc
->
commentSize
);
memcpy
(
funcInfo
.
pCod
e
,
pFunc
->
pCode
,
pFunc
->
codeSize
);
taosArrayPush
(
retrieveRsp
.
pFuncInfos
,
&
funcInfo
);
mndReleaseFunc
(
pMnode
,
pFunc
);
}
pReq
->
pCont
=
pRetrieveRsp
;
pReq
->
contLen
=
(
int32_t
)(
pOutput
-
(
char
*
)
pRetrieveRsp
);
int32_t
contLen
=
tSerializeSRetrieveFuncRsp
(
NULL
,
0
,
&
retrieveRsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
RETRIEVE_FUNC_OVER
;
}
tSerializeSRetrieveFuncRsp
(
pRsp
,
contLen
,
&
retrieveRsp
);
pReq
->
pCont
=
pRsp
;
pReq
->
contLen
=
contLen
;
code
=
0
;
FUNC_RETRIEVE_OVER:
if
(
code
!=
0
)
rpcFreeCont
(
pRetrieveRsp
);
RETRIEVE_FUNC_OVER:
taosArrayDestroy
(
retrieveReq
.
pFuncNames
);
taosArrayDestroy
(
retrieveRsp
.
pFuncInfos
);
return
code
;
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
71fc95cc
...
...
@@ -15,9 +15,11 @@
#define _DEFAULT_SOURCE
#include "mndMnode.h"
#include "mndAuth.h"
#include "mndDnode.h"
#include "mndShow.h"
#include "mndTrans.h"
#include "mndUser.h"
#define TSDB_MNODE_VER_NUMBER 1
#define TSDB_MNODE_RESERVE_SIZE 64
...
...
@@ -379,40 +381,57 @@ CREATE_MNODE_OVER:
}
static
int32_t
mndProcessCreateMnodeReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMCreateMnodeReq
*
pCreate
=
pReq
->
rpcMsg
.
pCont
;
pCreate
->
dnodeId
=
htonl
(
pCreate
->
dnodeId
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SMnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateMnodeReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateDropMnodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_MNODE_OVER
;
}
mDebug
(
"mnode:%d, start to create"
,
pCreate
->
dnodeId
);
mDebug
(
"mnode:%d, start to create"
,
createReq
.
dnodeId
);
SMnodeObj
*
pObj
=
mndAcquireMnode
(
pMnode
,
pCreate
->
dnodeId
);
pObj
=
mndAcquireMnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pObj
!=
NULL
)
{
mndReleaseMnode
(
pMnode
,
pObj
);
mError
(
"mnode:%d, mnode already exist"
,
pObj
->
id
);
terrno
=
TSDB_CODE_MND_MNODE_ALREADY_EXIST
;
return
-
1
;
goto
CREATE_MNODE_OVER
;
}
else
if
(
terrno
!=
TSDB_CODE_MND_MNODE_NOT_EXIST
)
{
mError
(
"qnode:%d, failed to create mnode since %s"
,
pCreate
->
dnodeId
,
terrstr
());
return
-
1
;
goto
CREATE_MNODE_OVER
;
}
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pCreate
->
dnodeId
);
pDnode
=
mndAcquireDnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
mError
(
"mnode:%d, dnode not exist"
,
pCreate
->
dnodeId
);
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
return
-
1
;
goto
CREATE_MNODE_OVER
;
}
int32_t
code
=
mndCreateMnode
(
pMnode
,
pReq
,
pDnode
,
pCreate
);
mndReleaseDnode
(
pMnode
,
pDnode
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
CREATE_MNODE_OVER
;
}
if
(
code
!=
0
)
{
mError
(
"mnode:%d, failed to create since %s"
,
pCreate
->
dnodeId
,
terrstr
());
return
-
1
;
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
CREATE_MNODE_OVER
;
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
code
=
mndCreateMnode
(
pMnode
,
pReq
,
pDnode
,
&
createReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_MNODE_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"mnode:%d, failed to create since %s"
,
createReq
.
dnodeId
,
terrstr
());
}
mndReleaseMnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndSetDropMnodeRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMnodeObj
*
pObj
)
{
...
...
@@ -534,32 +553,51 @@ DROP_MNODE_OVER:
}
static
int32_t
mndProcessDropMnodeReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMDropMnodeReq
*
pDrop
=
pReq
->
rpcMsg
.
pCont
;
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SMnodeObj
*
pObj
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeSMCreateDropMnodeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_MNODE_OVER
;
}
mDebug
(
"mnode:%d, start to drop"
,
pDrop
->
dnodeId
);
mDebug
(
"mnode:%d, start to drop"
,
dropReq
.
dnodeId
);
if
(
pDrop
->
dnodeId
<=
0
)
{
if
(
dropReq
.
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_SDB_APP_ERROR
;
mError
(
"mnode:%d, failed to drop since %s"
,
pDrop
->
dnodeId
,
terrstr
());
return
-
1
;
goto
DROP_MNODE_OVER
;
}
SMnodeObj
*
pObj
=
mndAcquireMnode
(
pMnode
,
pDrop
->
dnodeId
);
pObj
=
mndAcquireMnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pObj
==
NULL
)
{
mError
(
"mnode:%d, not exist"
,
pDrop
->
dnodeId
);
return
-
1
;
goto
DROP_MNODE_OVER
;
}
int32_t
code
=
mndDropMnode
(
pMnode
,
pReq
,
pObj
);
if
(
code
!=
0
)
{
mError
(
"mnode:%d, failed to drop since %s"
,
pMnode
->
dnodeId
,
terrstr
());
return
-
1
;
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
DROP_MNODE_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
))
{
goto
DROP_MNODE_OVER
;
}
sdbRelease
(
pMnode
->
pSdb
,
pObj
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
code
=
mndDropMnode
(
pMnode
,
pReq
,
pObj
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_MNODE_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"mnode:%d, failed to drop since %s"
,
dropReq
.
dnodeId
,
terrstr
());
}
mndReleaseMnode
(
pMnode
,
pObj
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
static
int32_t
mndProcessCreateMnodeRsp
(
SMnodeMsg
*
pRsp
)
{
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
71fc95cc
...
...
@@ -343,17 +343,21 @@ static SClientHbRsp* mndMqHbBuildRsp(SMnode* pMnode, SClientHbReq* pReq) {
static
int32_t
mndProcessHeartBeatReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
char
*
batchReqStr
=
pReq
->
rpcMsg
.
pCont
;
SClientHbBatchReq
batchReq
=
{
0
};
tDeserializeSClientHbBatchReq
(
batchReqStr
,
&
batchReq
);
if
(
tDeserializeSClientHbBatchReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
batchReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
SArray
*
pArray
=
batchReq
.
reqs
;
int
sz
=
taosArrayGetSize
(
pArray
);
int
32_t
sz
=
taosArrayGetSize
(
pArray
);
SClientHbBatchRsp
batchRsp
=
{
0
};
batchRsp
.
rsps
=
taosArrayInit
(
0
,
sizeof
(
SClientHbRsp
));
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SClientHbReq
*
pHbReq
=
taosArrayGet
(
pArray
,
i
);
SClientHbReq
*
pHbReq
=
taosArrayGet
(
pArray
,
i
);
if
(
pHbReq
->
connKey
.
hbType
==
HEARTBEAT_TYPE_QUERY
)
{
int32_t
kvNum
=
taosHashGetSize
(
pHbReq
->
info
);
if
(
NULL
==
pHbReq
->
info
||
kvNum
<=
0
)
{
...
...
@@ -364,13 +368,13 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq) {
void
*
pIter
=
taosHashIterate
(
pHbReq
->
info
,
NULL
);
while
(
pIter
!=
NULL
)
{
SKv
*
kv
=
pIter
;
SKv
*
kv
=
pIter
;
switch
(
kv
->
key
)
{
case
HEARTBEAT_KEY_DBINFO
:
{
void
*
rspMsg
=
NULL
;
void
*
rspMsg
=
NULL
;
int32_t
rspLen
=
0
;
mndValidateD
BInfo
(
pMnode
,
(
SDbVgVersion
*
)
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SDbVgVersion
),
&
rspMsg
,
&
rspLen
);
mndValidateD
bInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SDbVgVersion
),
&
rspMsg
,
&
rspLen
);
if
(
rspMsg
&&
rspLen
>
0
)
{
SKv
kv
=
{.
key
=
HEARTBEAT_KEY_DBINFO
,
.
valueLen
=
rspLen
,
.
value
=
rspMsg
};
taosArrayPush
(
hbRsp
.
info
,
&
kv
);
...
...
@@ -378,9 +382,9 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq) {
break
;
}
case
HEARTBEAT_KEY_STBINFO
:
{
void
*
rspMsg
=
NULL
;
void
*
rspMsg
=
NULL
;
int32_t
rspLen
=
0
;
mndValidateStbInfo
(
pMnode
,
(
SSTableMetaVersion
*
)
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SSTableMetaVersion
),
&
rspMsg
,
&
rspLen
);
mndValidateStbInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SSTableMetaVersion
),
&
rspMsg
,
&
rspLen
);
if
(
rspMsg
&&
rspLen
>
0
)
{
SKv
kv
=
{.
key
=
HEARTBEAT_KEY_STBINFO
,
.
valueLen
=
rspLen
,
.
value
=
rspMsg
};
taosArrayPush
(
hbRsp
.
info
,
&
kv
);
...
...
@@ -392,7 +396,7 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq) {
hbRsp
.
status
=
TSDB_CODE_MND_APP_ERROR
;
break
;
}
pIter
=
taosHashIterate
(
pHbReq
->
info
,
pIter
);
}
...
...
@@ -407,15 +411,14 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq) {
}
taosArrayDestroyEx
(
pArray
,
tFreeClientHbReq
);
int32_t
tlen
=
tSerializeSClientHbBatchRsp
(
NULL
,
&
batchRsp
);
void
*
buf
=
rpcMallocCont
(
tlen
);
void
*
abuf
=
buf
;
tSerializeSClientHbBatchRsp
(
&
abuf
,
&
batchRsp
);
int32_t
tlen
=
tSerializeSClientHbBatchRsp
(
NULL
,
0
,
&
batchRsp
);
void
*
buf
=
rpcMallocCont
(
tlen
);
tSerializeSClientHbBatchRsp
(
buf
,
tlen
,
&
batchRsp
);
int32_t
rspNum
=
(
int32_t
)
taosArrayGetSize
(
batchRsp
.
rsps
);
for
(
int32_t
i
=
0
;
i
<
rspNum
;
++
i
)
{
SClientHbRsp
*
rsp
=
taosArrayGet
(
batchRsp
.
rsps
,
i
);
int32_t
kvNum
=
(
rsp
->
info
)
?
taosArrayGetSize
(
rsp
->
info
)
:
0
;
int32_t
kvNum
=
(
rsp
->
info
)
?
taosArrayGetSize
(
rsp
->
info
)
:
0
;
for
(
int32_t
n
=
0
;
n
<
kvNum
;
++
n
)
{
SKv
*
kv
=
taosArrayGet
(
rsp
->
info
,
n
);
tfree
(
kv
->
value
);
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
71fc95cc
...
...
@@ -118,27 +118,28 @@ static void mndReleaseShowObj(SShowObj *pShow, bool forceRemove) {
static
int32_t
mndProcessShowReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SShowMgmt
*
pMgmt
=
&
pMnode
->
showMgmt
;
SShowReq
*
pShowReq
=
pReq
->
rpcMsg
.
pCont
;
int8_t
type
=
pShowReq
->
type
;
int16_t
payloadLen
=
htonl
(
pShowReq
->
payloadLen
);
int32_t
code
=
-
1
;
SShowReq
showReq
=
{
0
};
if
(
type
<=
TSDB_MGMT_TABLE_START
||
type
>=
TSDB_MGMT_TABLE_MAX
)
{
if
(
tDeserializeSShowReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
showReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
SHOW_OVER
;
}
if
(
showReq
.
type
<=
TSDB_MGMT_TABLE_START
||
showReq
.
type
>=
TSDB_MGMT_TABLE_MAX
)
{
terrno
=
TSDB_CODE_MND_INVALID_MSG_TYPE
;
mError
(
"failed to process show-meta req since %s"
,
terrstr
());
return
-
1
;
goto
SHOW_OVER
;
}
ShowMetaFp
metaFp
=
pMgmt
->
metaFps
[
type
];
ShowMetaFp
metaFp
=
pMgmt
->
metaFps
[
showReq
.
type
];
if
(
metaFp
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_MSG_TYPE
;
mError
(
"failed to process show-meta req:%s since %s"
,
mndShowStr
(
type
),
terrstr
());
return
-
1
;
goto
SHOW_OVER
;
}
SShowObj
*
pShow
=
mndCreateShowObj
(
pMnode
,
pS
howReq
);
SShowObj
*
pShow
=
mndCreateShowObj
(
pMnode
,
&
s
howReq
);
if
(
pShow
==
NULL
)
{
mError
(
"failed to process show-meta req:%s since %s"
,
mndShowStr
(
type
),
terrstr
());
return
-
1
;
goto
SHOW_OVER
;
}
int32_t
size
=
sizeof
(
SShowRsp
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
+
TSDB_EXTRA_PAYLOAD_SIZE
;
...
...
@@ -146,26 +147,30 @@ static int32_t mndProcessShowReq(SMnodeMsg *pReq) {
if
(
pRsp
==
NULL
)
{
mndReleaseShowObj
(
pShow
,
true
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"show:0x%"
PRIx64
", failed to process show-meta req:%s since malloc rsp error"
,
pShow
->
id
,
mndShowStr
(
type
));
return
-
1
;
goto
SHOW_OVER
;
}
int32_t
code
=
(
*
metaFp
)(
pReq
,
pShow
,
&
pRsp
->
tableMeta
);
mDebug
(
"show:0x%"
PRIx64
", get meta finished, numOfRows:%d cols:%d
type:%s, result:%s"
,
pShow
->
id
,
pShow
->
numOfRows
,
pShow
->
numOf
Columns
,
mndShowStr
(
type
),
tstrerror
(
code
));
code
=
(
*
metaFp
)(
pReq
,
pShow
,
&
pRsp
->
tableMeta
);
mDebug
(
"show:0x%"
PRIx64
", get meta finished, numOfRows:%d cols:%d
showReq.type:%s, result:%s"
,
pShow
->
id
,
pShow
->
numOf
Rows
,
pShow
->
numOfColumns
,
mndShowStr
(
showReq
.
type
),
tstrerror
(
code
));
if
(
code
==
TSDB_CODE_SUCCESS
)
{
pReq
->
contLen
=
sizeof
(
SShowRsp
)
+
sizeof
(
SSchema
)
*
pShow
->
numOfColumns
;
pReq
->
pCont
=
pRsp
;
pRsp
->
showId
=
htobe64
(
pShow
->
id
);
mndReleaseShowObj
(
pShow
,
false
);
return
TSDB_CODE_SUCCESS
;
}
else
{
rpcFreeCont
(
pRsp
);
mndReleaseShowObj
(
pShow
,
true
);
return
code
;
}
SHOW_OVER:
if
(
code
!=
0
)
{
mError
(
"failed to process show-meta req since %s"
,
terrstr
());
}
tFreeSShowReq
(
&
showReq
);
return
code
;
}
static
int32_t
mndProcessRetrieveReq
(
SMnodeMsg
*
pReq
)
{
...
...
@@ -175,10 +180,13 @@ static int32_t mndProcessRetrieveReq(SMnodeMsg *pReq) {
int32_t
size
=
0
;
int32_t
rowsRead
=
0
;
SRetrieveTableReq
*
pRetrieve
=
pReq
->
rpcMsg
.
pCont
;
int64_t
showId
=
htobe64
(
pRetrieve
->
showId
);
SRetrieveTableReq
retrieveReq
=
{
0
};
if
(
tDeserializeSRetrieveTableReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
retrieveReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
SShowObj
*
pShow
=
mndAcquireShowObj
(
pMnode
,
showId
);
SShowObj
*
pShow
=
mndAcquireShowObj
(
pMnode
,
retrieveReq
.
showId
);
if
(
pShow
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_SHOWOBJ
;
mError
(
"failed to process show-retrieve req:%p since %s"
,
pShow
,
terrstr
());
...
...
@@ -202,7 +210,7 @@ static int32_t mndProcessRetrieveReq(SMnodeMsg *pReq) {
pShow
->
numOfReads
=
pShow
->
numOfRows
;
}
if
((
pRetrieve
->
free
&
TSDB_QUERY_TYPE_FREE_RESOURCE
)
!=
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
if
((
retrieveReq
.
free
&
TSDB_QUERY_TYPE_FREE_RESOURCE
)
!=
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
rowsToRead
=
pShow
->
numOfRows
-
pShow
->
numOfReads
;
}
...
...
@@ -226,7 +234,7 @@ static int32_t mndProcessRetrieveReq(SMnodeMsg *pReq) {
}
// if free flag is set, client wants to clean the resources
if
((
pRetrieve
->
free
&
TSDB_QUERY_TYPE_FREE_RESOURCE
)
!=
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
if
((
retrieveReq
.
free
&
TSDB_QUERY_TYPE_FREE_RESOURCE
)
!=
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
rowsRead
=
(
*
retrieveFp
)(
pReq
,
pShow
,
pRsp
->
data
,
rowsToRead
);
}
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
71fc95cc
...
...
@@ -1523,4 +1523,4 @@ static int32_t mndRetrieveStb(SMnodeMsg *pReq, SShowObj *pShow, char *data, int3
static
void
mndCancelGetNextStb
(
SMnode
*
pMnode
,
void
*
pIter
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
}
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
71fc95cc
...
...
@@ -542,12 +542,18 @@ static void mndTransSendRpcRsp(STrans *pTrans) {
}
if
(
sendRsp
&&
pTrans
->
rpcHandle
!=
NULL
)
{
void
*
rpcCont
=
rpcMallocCont
(
pTrans
->
rpcRspLen
);
if
(
rpcCont
!=
NULL
)
{
memcpy
(
rpcCont
,
pTrans
->
rpcRsp
,
pTrans
->
rpcRspLen
);
}
free
(
pTrans
->
rpcRsp
);
mDebug
(
"trans:%d, send rsp, code:0x%x stage:%d app:%p"
,
pTrans
->
id
,
pTrans
->
code
&
0xFFFF
,
pTrans
->
stage
,
pTrans
->
rpcAHandle
);
SRpcMsg
rspMsg
=
{.
handle
=
pTrans
->
rpcHandle
,
.
code
=
pTrans
->
code
,
.
ahandle
=
pTrans
->
rpcAHandle
,
.
pCont
=
pTrans
->
rpcRsp
,
.
pCont
=
rpcCont
,
.
contLen
=
pTrans
->
rpcRspLen
};
rpcSendResponse
(
&
rspMsg
);
pTrans
->
rpcHandle
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/acct/acct.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/bnode/bnode.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/db/db.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/dnode/dnode.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/func/func.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/mnode/mnode.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/qnode/qnode.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/show/show.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/snode/snode.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/trans/trans.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/user/user.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/inc/tq.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/inc/vnode.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/inc/tqInt.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/inc/tqMetaStore.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/inc/tqOffset.h
0 → 100644
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tq.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqMetaStore.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqOffset.c
0 → 100644
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqRead.c
0 → 100644
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeMain.c
浏览文件 @
71fc95cc
...
...
@@ -29,6 +29,7 @@ SVnode *vnodeOpen(const char *path, const SVnodeCfg *pVnodeCfg) {
cfg
.
vgId
=
pVnodeCfg
->
vgId
;
cfg
.
pDnode
=
pVnodeCfg
->
pDnode
;
cfg
.
pTfs
=
pVnodeCfg
->
pTfs
;
cfg
.
dbId
=
pVnodeCfg
->
dbId
;
}
// Validate options
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeWrite.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/CMakeLists.txt
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/catalog/inc/catalogInt.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/catalog/src/catalog.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/function/src/functionMgt.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/nodes/CMakeLists.txt
→
source/
libs/
nodes/CMakeLists.txt
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/nodes/src/nodesCloneFuncs.c
→
source/
libs/
nodes/src/nodesCloneFuncs.c
浏览文件 @
71fc95cc
文件已移动
source/nodes/src/nodesCodeFuncs.c
→
source/
libs/
nodes/src/nodesCodeFuncs.c
浏览文件 @
71fc95cc
文件已移动
source/nodes/src/nodesEqualFuncs.c
→
source/
libs/
nodes/src/nodesEqualFuncs.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/nodes/src/nodesTraverseFuncs.c
→
source/
libs/
nodes/src/nodesTraverseFuncs.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/nodes/src/nodesUtilFuncs.c
→
source/
libs/
nodes/src/nodesUtilFuncs.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/nodes/test/CMakeLists.txt
→
source/
libs/
nodes/test/CMakeLists.txt
浏览文件 @
71fc95cc
文件已移动
source/libs/nodes/test/nodesTest.cpp
0 → 100644
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/inc/astCreateFuncs.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/inc/astToMsg.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/inc/new_sql.y
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/inc/parserImpl.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/src/astCreateFuncs.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/src/astToMsg.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/src/astValidate.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/src/new_sql.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/src/parserImpl.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/src/ttokenizer.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/parser/test/newParserTest.cpp
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/
nodes/test/nodesTest.cpp
→
source/
libs/planner/inc/plannerImpl.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/planner/src/plannerImpl.c
0 → 100644
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/qcom/src/querymsg.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/transport/inc/transComm.h
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/transport/src/trans.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/transport/src/transComm.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/transport/src/transSrv.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/transport/test/CMakeLists.txt
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/transport/test/pushClient.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/libs/transport/test/pushServer.c
0 → 100644
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
71fc95cc
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录