Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tonvia
TDengine
提交
582cacc5
T
TDengine
项目概览
Tonvia
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
582cacc5
编写于
10月 28, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1732
上级
e0c0b4f1
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
229 addition
and
230 deletion
+229
-230
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+3
-3
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscProfile.c
src/client/src/tscProfile.c
+2
-2
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+7
-7
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+2
-2
src/client/src/tscServer.c
src/client/src/tscServer.c
+57
-58
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+5
-5
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+5
-5
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+12
-12
src/dnode/src/dnodePeer.c
src/dnode/src/dnodePeer.c
+2
-2
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+5
-5
src/inc/taosmsg.h
src/inc/taosmsg.h
+42
-42
src/inc/vnode.h
src/inc/vnode.h
+3
-3
src/mnode/inc/mnodeProfile.h
src/mnode/inc/mnodeProfile.h
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+7
-7
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+11
-11
src/mnode/src/mnodeMnode.c
src/mnode/src/mnodeMnode.c
+2
-2
src/mnode/src/mnodeProfile.c
src/mnode/src/mnodeProfile.c
+4
-4
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+8
-8
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+18
-18
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+6
-6
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+13
-13
src/vnode/inc/vnodeCfg.h
src/vnode/inc/vnodeCfg.h
+1
-1
src/vnode/src/vnodeCfg.c
src/vnode/src/vnodeCfg.c
+6
-6
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+5
-5
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+1
-1
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
582cacc5
...
@@ -86,8 +86,8 @@ typedef struct SJoinSupporter {
...
@@ -86,8 +86,8 @@ typedef struct SJoinSupporter {
}
SJoinSupporter
;
}
SJoinSupporter
;
typedef
struct
SVgroupTableInfo
{
typedef
struct
SVgroupTableInfo
{
S
CM
VgroupInfo
vgInfo
;
SVgroupInfo
vgInfo
;
SArray
*
itemList
;
//SArray<STableIdInfo>
SArray
*
itemList
;
//SArray<STableIdInfo>
}
SVgroupTableInfo
;
}
SVgroupTableInfo
;
static
FORCE_INLINE
SQueryInfo
*
tscGetQueryInfoDetail
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
)
{
static
FORCE_INLINE
SQueryInfo
*
tscGetQueryInfoDetail
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
)
{
...
@@ -237,7 +237,7 @@ void tscDoQuery(SSqlObj* pSql);
...
@@ -237,7 +237,7 @@ void tscDoQuery(SSqlObj* pSql);
SVgroupsInfo
*
tscVgroupInfoClone
(
SVgroupsInfo
*
pInfo
);
SVgroupsInfo
*
tscVgroupInfoClone
(
SVgroupsInfo
*
pInfo
);
void
*
tscVgroupInfoClear
(
SVgroupsInfo
*
pInfo
);
void
*
tscVgroupInfoClear
(
SVgroupsInfo
*
pInfo
);
void
tscS
CMVgroupInfoCopy
(
SCMVgroupInfo
*
dst
,
const
SCM
VgroupInfo
*
src
);
void
tscS
VgroupInfoCopy
(
SVgroupInfo
*
dst
,
const
S
VgroupInfo
*
src
);
/**
/**
* The create object function must be successful expect for the out of memory issue.
* The create object function must be successful expect for the out of memory issue.
*
*
...
...
src/client/inc/tsclient.h
浏览文件 @
582cacc5
...
@@ -103,7 +103,7 @@ typedef struct STableMeta {
...
@@ -103,7 +103,7 @@ typedef struct STableMeta {
int16_t
sversion
;
int16_t
sversion
;
int16_t
tversion
;
int16_t
tversion
;
char
sTableId
[
TSDB_TABLE_FNAME_LEN
];
char
sTableId
[
TSDB_TABLE_FNAME_LEN
];
S
CMVgroupInfo
vgroupInfo
;
S
VgroupInfo
vgroupInfo
;
SCMCorVgroupInfo
corVgroupInfo
;
SCMCorVgroupInfo
corVgroupInfo
;
STableId
id
;
STableId
id
;
SSchema
schema
[];
// if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info
SSchema
schema
[];
// if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info
...
...
src/client/src/tscProfile.c
浏览文件 @
582cacc5
...
@@ -222,7 +222,7 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
...
@@ -222,7 +222,7 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
}
}
int
tscBuildQueryStreamDesc
(
void
*
pMsg
,
STscObj
*
pObj
)
{
int
tscBuildQueryStreamDesc
(
void
*
pMsg
,
STscObj
*
pObj
)
{
S
CM
HeartBeatMsg
*
pHeartbeat
=
pMsg
;
SHeartBeatMsg
*
pHeartbeat
=
pMsg
;
int
allocedQueriesNum
=
pHeartbeat
->
numOfQueries
;
int
allocedQueriesNum
=
pHeartbeat
->
numOfQueries
;
int
allocedStreamsNum
=
pHeartbeat
->
numOfStreams
;
int
allocedStreamsNum
=
pHeartbeat
->
numOfStreams
;
...
@@ -277,7 +277,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
...
@@ -277,7 +277,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
}
}
int32_t
msgLen
=
pHeartbeat
->
numOfQueries
*
sizeof
(
SQueryDesc
)
+
pHeartbeat
->
numOfStreams
*
sizeof
(
SStreamDesc
)
+
int32_t
msgLen
=
pHeartbeat
->
numOfQueries
*
sizeof
(
SQueryDesc
)
+
pHeartbeat
->
numOfStreams
*
sizeof
(
SStreamDesc
)
+
sizeof
(
S
CM
HeartBeatMsg
);
sizeof
(
SHeartBeatMsg
);
pHeartbeat
->
connId
=
htonl
(
pObj
->
connId
);
pHeartbeat
->
connId
=
htonl
(
pObj
->
connId
);
pHeartbeat
->
numOfQueries
=
htonl
(
pHeartbeat
->
numOfQueries
);
pHeartbeat
->
numOfQueries
=
htonl
(
pHeartbeat
->
numOfQueries
);
pHeartbeat
->
numOfStreams
=
htonl
(
pHeartbeat
->
numOfStreams
);
pHeartbeat
->
numOfStreams
=
htonl
(
pHeartbeat
->
numOfStreams
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
582cacc5
...
@@ -114,7 +114,7 @@ static int32_t optrToString(tSQLExpr* pExpr, char** exprString);
...
@@ -114,7 +114,7 @@ static int32_t optrToString(tSQLExpr* pExpr, char** exprString);
static
int32_t
getTableIndexImpl
(
SStrToken
*
pTableToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
);
static
int32_t
getTableIndexImpl
(
SStrToken
*
pTableToken
,
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
);
static
int32_t
doFunctionsCompatibleCheck
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
);
static
int32_t
doFunctionsCompatibleCheck
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
);
static
int32_t
doLocalQueryProcess
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SQuerySQL
*
pQuerySql
);
static
int32_t
doLocalQueryProcess
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
SQuerySQL
*
pQuerySql
);
static
int32_t
tscCheckCreateDbParams
(
SSqlCmd
*
pCmd
,
SC
MC
reateDbMsg
*
pCreate
);
static
int32_t
tscCheckCreateDbParams
(
SSqlCmd
*
pCmd
,
SCreateDbMsg
*
pCreate
);
static
SColumnList
getColumnList
(
int32_t
num
,
int16_t
tableIndex
,
int32_t
columnIndex
);
static
SColumnList
getColumnList
(
int32_t
num
,
int16_t
tableIndex
,
int32_t
columnIndex
);
...
@@ -417,7 +417,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -417,7 +417,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char
*
pMsg
=
pCmd
->
payload
;
char
*
pMsg
=
pCmd
->
payload
;
SC
MCfgDnodeMsg
*
pCfg
=
(
SCM
CfgDnodeMsg
*
)
pMsg
;
SC
fgDnodeMsg
*
pCfg
=
(
S
CfgDnodeMsg
*
)
pMsg
;
pDCL
->
a
[
0
].
n
=
strdequote
(
pDCL
->
a
[
0
].
z
);
pDCL
->
a
[
0
].
n
=
strdequote
(
pDCL
->
a
[
0
].
z
);
strncpy
(
pCfg
->
ep
,
pDCL
->
a
[
0
].
z
,
pDCL
->
a
[
0
].
n
);
strncpy
(
pCfg
->
ep
,
pDCL
->
a
[
0
].
z
,
pDCL
->
a
[
0
].
n
);
...
@@ -5186,7 +5186,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
...
@@ -5186,7 +5186,7 @@ int32_t parseLimitClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t clauseIn
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
setKeepOption
(
SSqlCmd
*
pCmd
,
SC
MC
reateDbMsg
*
pMsg
,
SCreateDBInfo
*
pCreateDb
)
{
static
int32_t
setKeepOption
(
SSqlCmd
*
pCmd
,
SCreateDbMsg
*
pMsg
,
SCreateDBInfo
*
pCreateDb
)
{
const
char
*
msg
=
"invalid number of options"
;
const
char
*
msg
=
"invalid number of options"
;
pMsg
->
daysToKeep
=
htonl
(
-
1
);
pMsg
->
daysToKeep
=
htonl
(
-
1
);
...
@@ -5217,7 +5217,7 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo*
...
@@ -5217,7 +5217,7 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo*
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
setTimePrecision
(
SSqlCmd
*
pCmd
,
SC
MC
reateDbMsg
*
pMsg
,
SCreateDBInfo
*
pCreateDbInfo
)
{
static
int32_t
setTimePrecision
(
SSqlCmd
*
pCmd
,
SCreateDbMsg
*
pMsg
,
SCreateDBInfo
*
pCreateDbInfo
)
{
const
char
*
msg
=
"invalid time precision"
;
const
char
*
msg
=
"invalid time precision"
;
pMsg
->
precision
=
TSDB_TIME_PRECISION_MILLI
;
// millisecond by default
pMsg
->
precision
=
TSDB_TIME_PRECISION_MILLI
;
// millisecond by default
...
@@ -5241,7 +5241,7 @@ static int32_t setTimePrecision(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBIn
...
@@ -5241,7 +5241,7 @@ static int32_t setTimePrecision(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBIn
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
void
setCreateDBOption
(
SC
MC
reateDbMsg
*
pMsg
,
SCreateDBInfo
*
pCreateDb
)
{
static
void
setCreateDBOption
(
SCreateDbMsg
*
pMsg
,
SCreateDBInfo
*
pCreateDb
)
{
pMsg
->
maxTables
=
htonl
(
-
1
);
// max tables can not be set anymore
pMsg
->
maxTables
=
htonl
(
-
1
);
// max tables can not be set anymore
pMsg
->
cacheBlockSize
=
htonl
(
pCreateDb
->
cacheBlockSize
);
pMsg
->
cacheBlockSize
=
htonl
(
pCreateDb
->
cacheBlockSize
);
pMsg
->
totalBlocks
=
htonl
(
pCreateDb
->
numOfBlocks
);
pMsg
->
totalBlocks
=
htonl
(
pCreateDb
->
numOfBlocks
);
...
@@ -5258,7 +5258,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
...
@@ -5258,7 +5258,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
}
}
int32_t
parseCreateDBOptions
(
SSqlCmd
*
pCmd
,
SCreateDBInfo
*
pCreateDbSql
)
{
int32_t
parseCreateDBOptions
(
SSqlCmd
*
pCmd
,
SCreateDBInfo
*
pCreateDbSql
)
{
SC
MCreateDbMsg
*
pMsg
=
(
SCMCreateDbMsg
*
)(
pCmd
->
payload
);
SC
reateDbMsg
*
pMsg
=
(
SCreateDbMsg
*
)(
pCmd
->
payload
);
setCreateDBOption
(
pMsg
,
pCreateDbSql
);
setCreateDBOption
(
pMsg
,
pCreateDbSql
);
if
(
setKeepOption
(
pCmd
,
pMsg
,
pCreateDbSql
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
setKeepOption
(
pCmd
,
pMsg
,
pCreateDbSql
)
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -5770,7 +5770,7 @@ int32_t doLocalQueryProcess(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQ
...
@@ -5770,7 +5770,7 @@ int32_t doLocalQueryProcess(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQ
}
}
// can only perform the parameters based on the macro definitation
// can only perform the parameters based on the macro definitation
int32_t
tscCheckCreateDbParams
(
SSqlCmd
*
pCmd
,
SC
MC
reateDbMsg
*
pCreate
)
{
int32_t
tscCheckCreateDbParams
(
SSqlCmd
*
pCmd
,
SCreateDbMsg
*
pCreate
)
{
char
msg
[
512
]
=
{
0
};
char
msg
[
512
]
=
{
0
};
if
(
pCreate
->
walLevel
!=
-
1
&&
(
pCreate
->
walLevel
<
TSDB_MIN_WAL_LEVEL
||
pCreate
->
walLevel
>
TSDB_MAX_WAL_LEVEL
))
{
if
(
pCreate
->
walLevel
!=
-
1
&&
(
pCreate
->
walLevel
<
TSDB_MIN_WAL_LEVEL
||
pCreate
->
walLevel
>
TSDB_MAX_WAL_LEVEL
))
{
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
582cacc5
...
@@ -140,7 +140,7 @@ struct SSchema tscGetTbnameColumnSchema() {
...
@@ -140,7 +140,7 @@ struct SSchema tscGetTbnameColumnSchema() {
strcpy
(
s
.
name
,
TSQL_TBNAME_L
);
strcpy
(
s
.
name
,
TSQL_TBNAME_L
);
return
s
;
return
s
;
}
}
static
void
tscInitCorVgroupInfo
(
SCMCorVgroupInfo
*
corVgroupInfo
,
S
CM
VgroupInfo
*
vgroupInfo
)
{
static
void
tscInitCorVgroupInfo
(
SCMCorVgroupInfo
*
corVgroupInfo
,
SVgroupInfo
*
vgroupInfo
)
{
corVgroupInfo
->
version
=
0
;
corVgroupInfo
->
version
=
0
;
corVgroupInfo
->
inUse
=
0
;
corVgroupInfo
->
inUse
=
0
;
corVgroupInfo
->
numOfEps
=
vgroupInfo
->
numOfEps
;
corVgroupInfo
->
numOfEps
=
vgroupInfo
->
numOfEps
;
...
@@ -166,7 +166,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
...
@@ -166,7 +166,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
pTableMeta
->
id
.
tid
=
pTableMetaMsg
->
tid
;
pTableMeta
->
id
.
tid
=
pTableMetaMsg
->
tid
;
pTableMeta
->
id
.
uid
=
pTableMetaMsg
->
uid
;
pTableMeta
->
id
.
uid
=
pTableMetaMsg
->
uid
;
S
CM
VgroupInfo
*
pVgroupInfo
=
&
pTableMeta
->
vgroupInfo
;
SVgroupInfo
*
pVgroupInfo
=
&
pTableMeta
->
vgroupInfo
;
pVgroupInfo
->
numOfEps
=
pTableMetaMsg
->
vgroup
.
numOfEps
;
pVgroupInfo
->
numOfEps
=
pTableMetaMsg
->
vgroup
.
numOfEps
;
pVgroupInfo
->
vgId
=
pTableMetaMsg
->
vgroup
.
vgId
;
pVgroupInfo
->
vgId
=
pTableMetaMsg
->
vgroup
.
vgId
;
...
...
src/client/src/tscServer.c
浏览文件 @
582cacc5
...
@@ -48,7 +48,7 @@ static int32_t getWaitingTimeInterval(int32_t count) {
...
@@ -48,7 +48,7 @@ static int32_t getWaitingTimeInterval(int32_t count) {
return
initial
*
(
2
<<
(
count
-
2
));
return
initial
*
(
2
<<
(
count
-
2
));
}
}
static
void
tscSetDnodeEpSet
(
SSqlObj
*
pSql
,
S
CM
VgroupInfo
*
pVgroupInfo
)
{
static
void
tscSetDnodeEpSet
(
SSqlObj
*
pSql
,
SVgroupInfo
*
pVgroupInfo
)
{
assert
(
pSql
!=
NULL
&&
pVgroupInfo
!=
NULL
&&
pVgroupInfo
->
numOfEps
>
0
);
assert
(
pSql
!=
NULL
&&
pVgroupInfo
!=
NULL
&&
pVgroupInfo
->
numOfEps
>
0
);
SRpcEpSet
*
pEpSet
=
&
pSql
->
epSet
;
SRpcEpSet
*
pEpSet
=
&
pSql
->
epSet
;
...
@@ -158,12 +158,12 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
...
@@ -158,12 +158,12 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
if
(
code
==
0
)
{
if
(
code
==
0
)
{
S
CMHeartBeatRsp
*
pRsp
=
(
SCM
HeartBeatRsp
*
)
pRes
->
pRsp
;
S
HeartBeatRsp
*
pRsp
=
(
S
HeartBeatRsp
*
)
pRes
->
pRsp
;
SRpcEpSet
*
epSet
=
&
pRsp
->
epSet
;
SRpcEpSet
*
epSet
=
&
pRsp
->
epSet
;
if
(
epSet
->
numOfEps
>
0
)
{
if
(
epSet
->
numOfEps
>
0
)
{
tscEpSetHtons
(
epSet
);
tscEpSetHtons
(
epSet
);
tscUpdateMgmtEpSet
(
epSet
);
tscUpdateMgmtEpSet
(
epSet
);
}
}
pSql
->
pTscObj
->
connId
=
htonl
(
pRsp
->
connId
);
pSql
->
pTscObj
->
connId
=
htonl
(
pRsp
->
connId
);
...
@@ -566,7 +566,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
...
@@ -566,7 +566,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
UTIL_TABLE_IS_NORMAL_TABLE
(
pTableMetaInfo
)
||
pTableMetaInfo
->
pVgroupTables
==
NULL
)
{
if
(
UTIL_TABLE_IS_NORMAL_TABLE
(
pTableMetaInfo
)
||
pTableMetaInfo
->
pVgroupTables
==
NULL
)
{
S
CM
VgroupInfo
*
pVgroupInfo
=
NULL
;
SVgroupInfo
*
pVgroupInfo
=
NULL
;
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
int32_t
index
=
pTableMetaInfo
->
vgroupIndex
;
int32_t
index
=
pTableMetaInfo
->
vgroupIndex
;
assert
(
index
>=
0
);
assert
(
index
>=
0
);
...
@@ -907,10 +907,10 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -907,10 +907,10 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildCreateDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildCreateDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SC
MC
reateDbMsg
);
pCmd
->
payloadLen
=
sizeof
(
SCreateDbMsg
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_CREATE_DB
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_CREATE_DB
;
SC
MCreateDbMsg
*
pCreateDbMsg
=
(
SCMCreateDbMsg
*
)
pCmd
->
payload
;
SC
reateDbMsg
*
pCreateDbMsg
=
(
SCreateDbMsg
*
)
pCmd
->
payload
;
assert
(
pCmd
->
numOfClause
==
1
);
assert
(
pCmd
->
numOfClause
==
1
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
...
@@ -921,13 +921,13 @@ int32_t tscBuildCreateDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -921,13 +921,13 @@ int32_t tscBuildCreateDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildCreateDnodeMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildCreateDnodeMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SC
MC
reateDnodeMsg
);
pCmd
->
payloadLen
=
sizeof
(
SCreateDnodeMsg
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
SC
MCreateDnodeMsg
*
pCreate
=
(
SCM
CreateDnodeMsg
*
)
pCmd
->
payload
;
SC
reateDnodeMsg
*
pCreate
=
(
S
CreateDnodeMsg
*
)
pCmd
->
payload
;
strncpy
(
pCreate
->
ep
,
pInfo
->
pDCLInfo
->
a
[
0
].
z
,
pInfo
->
pDCLInfo
->
a
[
0
].
n
);
strncpy
(
pCreate
->
ep
,
pInfo
->
pDCLInfo
->
a
[
0
].
z
,
pInfo
->
pDCLInfo
->
a
[
0
].
n
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_CREATE_DNODE
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_CREATE_DNODE
;
...
@@ -982,14 +982,14 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -982,14 +982,14 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildUserMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildUserMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SC
MC
reateUserMsg
);
pCmd
->
payloadLen
=
sizeof
(
SCreateUserMsg
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
SC
MCreateUserMsg
*
pAlterMsg
=
(
SCMCreateUserMsg
*
)
pCmd
->
payload
;
SC
reateUserMsg
*
pAlterMsg
=
(
SCreateUserMsg
*
)
pCmd
->
payload
;
SUserInfo
*
pUser
=
&
pInfo
->
pDCLInfo
->
user
;
SUserInfo
*
pUser
=
&
pInfo
->
pDCLInfo
->
user
;
strncpy
(
pAlterMsg
->
user
,
pUser
->
user
.
z
,
pUser
->
user
.
n
);
strncpy
(
pAlterMsg
->
user
,
pUser
->
user
.
z
,
pUser
->
user
.
n
);
...
@@ -1014,21 +1014,21 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1014,21 +1014,21 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildCfgDnodeMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildCfgDnodeMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
SC
MC
fgDnodeMsg
);
pCmd
->
payloadLen
=
sizeof
(
SCfgDnodeMsg
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_CONFIG_DNODE
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_CONFIG_DNODE
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
tscBuildDropDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildDropDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
S
CM
DropDbMsg
);
pCmd
->
payloadLen
=
sizeof
(
SDropDbMsg
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
S
CMDropDbMsg
*
pDropDbMsg
=
(
SCM
DropDbMsg
*
)
pCmd
->
payload
;
S
DropDbMsg
*
pDropDbMsg
=
(
S
DropDbMsg
*
)
pCmd
->
payload
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
tstrncpy
(
pDropDbMsg
->
db
,
pTableMetaInfo
->
name
,
sizeof
(
pDropDbMsg
->
db
));
tstrncpy
(
pDropDbMsg
->
db
,
pTableMetaInfo
->
name
,
sizeof
(
pDropDbMsg
->
db
));
...
@@ -1058,13 +1058,13 @@ int32_t tscBuildDropTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1058,13 +1058,13 @@ int32_t tscBuildDropTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildDropDnodeMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildDropDnodeMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
S
CM
DropDnodeMsg
);
pCmd
->
payloadLen
=
sizeof
(
SDropDnodeMsg
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
S
CMDropDnodeMsg
*
pDrop
=
(
SCM
DropDnodeMsg
*
)
pCmd
->
payload
;
S
DropDnodeMsg
*
pDrop
=
(
S
DropDnodeMsg
*
)
pCmd
->
payload
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
tstrncpy
(
pDrop
->
ep
,
pTableMetaInfo
->
name
,
sizeof
(
pDrop
->
ep
));
tstrncpy
(
pDrop
->
ep
,
pTableMetaInfo
->
name
,
sizeof
(
pDrop
->
ep
));
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_DROP_DNODE
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_DROP_DNODE
;
...
@@ -1074,7 +1074,7 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1074,7 +1074,7 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildDropUserMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildDropUserMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
S
CM
DropUserMsg
);
pCmd
->
payloadLen
=
sizeof
(
SDropUserMsg
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_DROP_USER
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_DROP_USER
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
...
@@ -1082,7 +1082,7 @@ int32_t tscBuildDropUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1082,7 +1082,7 @@ int32_t tscBuildDropUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
S
CMDropUserMsg
*
pDropMsg
=
(
SCMDropUserMsg
*
)
pCmd
->
payload
;
S
DropUserMsg
*
pDropMsg
=
(
SDropUserMsg
*
)
pCmd
->
payload
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
tstrncpy
(
pDropMsg
->
user
,
pTableMetaInfo
->
name
,
sizeof
(
pDropMsg
->
user
));
tstrncpy
(
pDropMsg
->
user
,
pTableMetaInfo
->
name
,
sizeof
(
pDropMsg
->
user
));
...
@@ -1091,7 +1091,7 @@ int32_t tscBuildDropUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1091,7 +1091,7 @@ int32_t tscBuildDropUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildDropAcctMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildDropAcctMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
S
CM
DropUserMsg
);
pCmd
->
payloadLen
=
sizeof
(
SDropUserMsg
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_DROP_ACCT
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_DROP_ACCT
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
...
@@ -1099,7 +1099,7 @@ int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1099,7 +1099,7 @@ int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
S
CMDropUserMsg
*
pDropMsg
=
(
SCMDropUserMsg
*
)
pCmd
->
payload
;
S
DropUserMsg
*
pDropMsg
=
(
SDropUserMsg
*
)
pCmd
->
payload
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
tstrncpy
(
pDropMsg
->
user
,
pTableMetaInfo
->
name
,
sizeof
(
pDropMsg
->
user
));
tstrncpy
(
pDropMsg
->
user
,
pTableMetaInfo
->
name
,
sizeof
(
pDropMsg
->
user
));
...
@@ -1108,14 +1108,14 @@ int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1108,14 +1108,14 @@ int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t
tscBuildUseDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildUseDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
S
CM
UseDbMsg
);
pCmd
->
payloadLen
=
sizeof
(
SUseDbMsg
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
S
CMUseDbMsg
*
pUseDbMsg
=
(
SCMUseDbMsg
*
)
pCmd
->
payload
;
S
UseDbMsg
*
pUseDbMsg
=
(
SUseDbMsg
*
)
pCmd
->
payload
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
strcpy
(
pUseDbMsg
->
db
,
pTableMetaInfo
->
name
);
strcpy
(
pUseDbMsg
->
db
,
pTableMetaInfo
->
name
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_USE_DB
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_USE_DB
;
...
@@ -1127,14 +1127,14 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1127,14 +1127,14 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
STscObj
*
pObj
=
pSql
->
pTscObj
;
STscObj
*
pObj
=
pSql
->
pTscObj
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_SHOW
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_SHOW
;
pCmd
->
payloadLen
=
sizeof
(
S
CM
ShowMsg
)
+
100
;
pCmd
->
payloadLen
=
sizeof
(
SShowMsg
)
+
100
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
S
CMShowMsg
*
pShowMsg
=
(
SCMShowMsg
*
)
pCmd
->
payload
;
S
ShowMsg
*
pShowMsg
=
(
SShowMsg
*
)
pCmd
->
payload
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
size_t
nameLen
=
strlen
(
pTableMetaInfo
->
name
);
size_t
nameLen
=
strlen
(
pTableMetaInfo
->
name
);
...
@@ -1161,13 +1161,13 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1161,13 +1161,13 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pShowMsg
->
payloadLen
=
htons
(
pEpAddr
->
n
);
pShowMsg
->
payloadLen
=
htons
(
pEpAddr
->
n
);
}
}
pCmd
->
payloadLen
=
sizeof
(
S
CM
ShowMsg
)
+
pShowMsg
->
payloadLen
;
pCmd
->
payloadLen
=
sizeof
(
SShowMsg
)
+
pShowMsg
->
payloadLen
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
tscBuildKillMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int32_t
tscBuildKillMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
S
CM
KillQueryMsg
);
pCmd
->
payloadLen
=
sizeof
(
SKillQueryMsg
);
switch
(
pCmd
->
command
)
{
switch
(
pCmd
->
command
)
{
case
TSDB_SQL_KILL_QUERY
:
case
TSDB_SQL_KILL_QUERY
:
...
@@ -1279,8 +1279,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1279,8 +1279,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int
tscEstimateAlterTableMsgLength
(
SSqlCmd
*
pCmd
)
{
int
tscEstimateAlterTableMsgLength
(
SSqlCmd
*
pCmd
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
return
minMsgSize
()
+
sizeof
(
SCMAlterTableMsg
)
+
sizeof
(
SSchema
)
*
tscNumOfFields
(
pQueryInfo
)
+
return
minMsgSize
()
+
sizeof
(
SAlterTableMsg
)
+
sizeof
(
SSchema
)
*
tscNumOfFields
(
pQueryInfo
)
+
TSDB_EXTRA_PAYLOAD_SIZE
;
TSDB_EXTRA_PAYLOAD_SIZE
;
}
}
int
tscBuildAlterTableMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int
tscBuildAlterTableMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
...
@@ -1299,7 +1298,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1299,7 +1298,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
S
CMAlterTableMsg
*
pAlterTableMsg
=
(
SCM
AlterTableMsg
*
)
pCmd
->
payload
;
S
AlterTableMsg
*
pAlterTableMsg
=
(
S
AlterTableMsg
*
)
pCmd
->
payload
;
tscGetDBInfoFromTableFullName
(
pTableMetaInfo
->
name
,
pAlterTableMsg
->
db
);
tscGetDBInfoFromTableFullName
(
pTableMetaInfo
->
name
,
pAlterTableMsg
->
db
);
strcpy
(
pAlterTableMsg
->
tableId
,
pTableMetaInfo
->
name
);
strcpy
(
pAlterTableMsg
->
tableId
,
pTableMetaInfo
->
name
);
...
@@ -1348,10 +1347,10 @@ int tscBuildUpdateTagMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
...
@@ -1348,10 +1347,10 @@ int tscBuildUpdateTagMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
int
tscAlterDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int
tscAlterDbMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
payloadLen
=
sizeof
(
S
CM
AlterDbMsg
);
pCmd
->
payloadLen
=
sizeof
(
SAlterDbMsg
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_ALTER_DB
;
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_ALTER_DB
;
S
CMAlterDbMsg
*
pAlterDbMsg
=
(
SCMAlterDbMsg
*
)
pCmd
->
payload
;
S
AlterDbMsg
*
pAlterDbMsg
=
(
SAlterDbMsg
*
)
pCmd
->
payload
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
tstrncpy
(
pAlterDbMsg
->
db
,
pTableMetaInfo
->
name
,
sizeof
(
pAlterDbMsg
->
db
));
tstrncpy
(
pAlterDbMsg
->
db
,
pTableMetaInfo
->
name
,
sizeof
(
pAlterDbMsg
->
db
));
...
@@ -1505,11 +1504,11 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1505,11 +1504,11 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
S
CMTableInfoMsg
*
pInfoMsg
=
(
SCM
TableInfoMsg
*
)
pCmd
->
payload
;
S
TableInfoMsg
*
pInfoMsg
=
(
S
TableInfoMsg
*
)
pCmd
->
payload
;
strcpy
(
pInfoMsg
->
tableId
,
pTableMetaInfo
->
name
);
strcpy
(
pInfoMsg
->
tableId
,
pTableMetaInfo
->
name
);
pInfoMsg
->
createFlag
=
htons
(
pSql
->
cmd
.
autoCreated
?
1
:
0
);
pInfoMsg
->
createFlag
=
htons
(
pSql
->
cmd
.
autoCreated
?
1
:
0
);
char
*
pMsg
=
(
char
*
)
pInfoMsg
+
sizeof
(
SCM
TableInfoMsg
);
char
*
pMsg
=
(
char
*
)
pInfoMsg
+
sizeof
(
S
TableInfoMsg
);
size_t
len
=
htonl
(
pCmd
->
tagData
.
dataLen
);
size_t
len
=
htonl
(
pCmd
->
tagData
.
dataLen
);
if
(
pSql
->
cmd
.
autoCreated
)
{
if
(
pSql
->
cmd
.
autoCreated
)
{
...
@@ -1528,7 +1527,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1528,7 +1527,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
/**
/**
* multi table meta req pkg format:
* multi table meta req pkg format:
* | SMgmtHead | S
CM
MultiTableInfoMsg | tableId0 | tableId1 | tableId2 | ......
* | SMgmtHead | SMultiTableInfoMsg | tableId0 | tableId1 | tableId2 | ......
* no used 4B
* no used 4B
**/
**/
int
tscBuildMultiMeterMetaMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int
tscBuildMultiMeterMetaMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
...
@@ -1546,7 +1545,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1546,7 +1545,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SMgmtHead *pMgmt = (SMgmtHead *)(pCmd->payload + tsRpcHeadSize);
SMgmtHead *pMgmt = (SMgmtHead *)(pCmd->payload + tsRpcHeadSize);
memset(pMgmt->db, 0, TSDB_TABLE_FNAME_LEN); // server don't need the db
memset(pMgmt->db, 0, TSDB_TABLE_FNAME_LEN); // server don't need the db
S
CMMultiTableInfoMsg *pInfoMsg = (SCM
MultiTableInfoMsg *)(pCmd->payload + tsRpcHeadSize + sizeof(SMgmtHead));
S
MultiTableInfoMsg *pInfoMsg = (S
MultiTableInfoMsg *)(pCmd->payload + tsRpcHeadSize + sizeof(SMgmtHead));
pInfoMsg->numOfTables = htonl((int32_t)pCmd->count);
pInfoMsg->numOfTables = htonl((int32_t)pCmd->count);
if (pCmd->payloadLen > 0) {
if (pCmd->payloadLen > 0) {
...
@@ -1555,7 +1554,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1555,7 +1554,7 @@ int tscBuildMultiMeterMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
taosTFree(tmpData);
taosTFree(tmpData);
pCmd->payloadLen += sizeof(SMgmtHead) + sizeof(S
CM
MultiTableInfoMsg);
pCmd->payloadLen += sizeof(SMgmtHead) + sizeof(SMultiTableInfoMsg);
pCmd->msgType = TSDB_MSG_TYPE_CM_TABLES_META;
pCmd->msgType = TSDB_MSG_TYPE_CM_TABLES_META;
assert(pCmd->payloadLen + minMsgSize() <= pCmd->allocSize);
assert(pCmd->payloadLen + minMsgSize() <= pCmd->allocSize);
...
@@ -1600,12 +1599,12 @@ int tscBuildSTableVgroupMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1600,12 +1599,12 @@ int tscBuildSTableVgroupMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
char
*
pMsg
=
pCmd
->
payload
;
char
*
pMsg
=
pCmd
->
payload
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
S
CMSTableVgroupMsg
*
pStableVgroupMsg
=
(
SCMSTableVgroupMsg
*
)
pMsg
;
S
STableVgroupMsg
*
pStableVgroupMsg
=
(
SSTableVgroupMsg
*
)
pMsg
;
pStableVgroupMsg
->
numOfTables
=
htonl
(
pQueryInfo
->
numOfTables
);
pStableVgroupMsg
->
numOfTables
=
htonl
(
pQueryInfo
->
numOfTables
);
pMsg
+=
sizeof
(
S
CM
STableVgroupMsg
);
pMsg
+=
sizeof
(
SSTableVgroupMsg
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
i
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
i
);
size_t
size
=
sizeof
(
pTableMetaInfo
->
name
);
size_t
size
=
sizeof
(
pTableMetaInfo
->
name
);
tstrncpy
(
pMsg
,
pTableMetaInfo
->
name
,
size
);
tstrncpy
(
pMsg
,
pTableMetaInfo
->
name
,
size
);
...
@@ -1638,14 +1637,14 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1638,14 +1637,14 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
numOfStreams
++
;
numOfStreams
++
;
}
}
int
size
=
numOfQueries
*
sizeof
(
SQueryDesc
)
+
numOfStreams
*
sizeof
(
SStreamDesc
)
+
sizeof
(
S
CM
HeartBeatMsg
)
+
100
;
int
size
=
numOfQueries
*
sizeof
(
SQueryDesc
)
+
numOfStreams
*
sizeof
(
SStreamDesc
)
+
sizeof
(
SHeartBeatMsg
)
+
100
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
pthread_mutex_unlock
(
&
pObj
->
mutex
);
pthread_mutex_unlock
(
&
pObj
->
mutex
);
tscError
(
"%p failed to malloc for heartbeat msg"
,
pSql
);
tscError
(
"%p failed to malloc for heartbeat msg"
,
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
S
CMHeartBeatMsg
*
pHeartbeat
=
(
SCM
HeartBeatMsg
*
)
pCmd
->
payload
;
S
HeartBeatMsg
*
pHeartbeat
=
(
S
HeartBeatMsg
*
)
pCmd
->
payload
;
pHeartbeat
->
numOfQueries
=
numOfQueries
;
pHeartbeat
->
numOfQueries
=
numOfQueries
;
pHeartbeat
->
numOfStreams
=
numOfStreams
;
pHeartbeat
->
numOfStreams
=
numOfStreams
;
...
@@ -1734,7 +1733,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
...
@@ -1734,7 +1733,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
/**
/**
* multi table meta rsp pkg format:
* multi table meta rsp pkg format:
* | STaosRsp | ieType | S
CM
MultiTableInfoMsg | SMeterMeta0 | SSchema0 | SMeterMeta1 | SSchema1 | SMeterMeta2 | SSchema2
* | STaosRsp | ieType | SMultiTableInfoMsg | SMeterMeta0 | SSchema0 | SMeterMeta1 | SSchema1 | SMeterMeta2 | SSchema2
* |...... 1B 1B 4B
* |...... 1B 1B 4B
**/
**/
int
tscProcessMultiMeterMetaRsp
(
SSqlObj
*
pSql
)
{
int
tscProcessMultiMeterMetaRsp
(
SSqlObj
*
pSql
)
{
...
@@ -1751,9 +1750,9 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
...
@@ -1751,9 +1750,9 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
rsp++;
rsp++;
S
CMMultiTableInfoMsg *pInfo = (SCM
MultiTableInfoMsg *)rsp;
S
MultiTableInfoMsg *pInfo = (S
MultiTableInfoMsg *)rsp;
totalNum = htonl(pInfo->numOfTables);
totalNum = htonl(pInfo->numOfTables);
rsp += sizeof(S
CM
MultiTableInfoMsg);
rsp += sizeof(SMultiTableInfoMsg);
for (i = 0; i < totalNum; i++) {
for (i = 0; i < totalNum; i++) {
SMultiTableMeta *pMultiMeta = (SMultiTableMeta *)rsp;
SMultiTableMeta *pMultiMeta = (SMultiTableMeta *)rsp;
...
@@ -1845,10 +1844,10 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
...
@@ -1845,10 +1844,10 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
// NOTE: the order of several table must be preserved.
// NOTE: the order of several table must be preserved.
S
CMSTableVgroupRspMsg
*
pStableVgroup
=
(
SCM
STableVgroupRspMsg
*
)
pRes
->
pRsp
;
S
STableVgroupRspMsg
*
pStableVgroup
=
(
S
STableVgroupRspMsg
*
)
pRes
->
pRsp
;
pStableVgroup
->
numOfTables
=
htonl
(
pStableVgroup
->
numOfTables
);
pStableVgroup
->
numOfTables
=
htonl
(
pStableVgroup
->
numOfTables
);
char
*
pMsg
=
pRes
->
pRsp
+
sizeof
(
SCM
STableVgroupRspMsg
);
char
*
pMsg
=
pRes
->
pRsp
+
sizeof
(
S
STableVgroupRspMsg
);
// master sqlObj locates in param
// master sqlObj locates in param
SSqlObj
*
parent
=
pSql
->
param
;
SSqlObj
*
parent
=
pSql
->
param
;
assert
(
parent
!=
NULL
);
assert
(
parent
!=
NULL
);
...
@@ -1860,18 +1859,18 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
...
@@ -1860,18 +1859,18 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
SVgroupsMsg
*
pVgroupMsg
=
(
SVgroupsMsg
*
)
pMsg
;
SVgroupsMsg
*
pVgroupMsg
=
(
SVgroupsMsg
*
)
pMsg
;
pVgroupMsg
->
numOfVgroups
=
htonl
(
pVgroupMsg
->
numOfVgroups
);
pVgroupMsg
->
numOfVgroups
=
htonl
(
pVgroupMsg
->
numOfVgroups
);
size_t
size
=
sizeof
(
S
CM
VgroupMsg
)
*
pVgroupMsg
->
numOfVgroups
+
sizeof
(
SVgroupsMsg
);
size_t
size
=
sizeof
(
SVgroupMsg
)
*
pVgroupMsg
->
numOfVgroups
+
sizeof
(
SVgroupsMsg
);
size_t
vgroupsz
=
sizeof
(
S
CM
VgroupInfo
)
*
pVgroupMsg
->
numOfVgroups
+
sizeof
(
SVgroupsInfo
);
size_t
vgroupsz
=
sizeof
(
SVgroupInfo
)
*
pVgroupMsg
->
numOfVgroups
+
sizeof
(
SVgroupsInfo
);
pInfo
->
vgroupList
=
calloc
(
1
,
vgroupsz
);
pInfo
->
vgroupList
=
calloc
(
1
,
vgroupsz
);
assert
(
pInfo
->
vgroupList
!=
NULL
);
assert
(
pInfo
->
vgroupList
!=
NULL
);
pInfo
->
vgroupList
->
numOfVgroups
=
pVgroupMsg
->
numOfVgroups
;
pInfo
->
vgroupList
->
numOfVgroups
=
pVgroupMsg
->
numOfVgroups
;
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgroupList
->
numOfVgroups
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgroupList
->
numOfVgroups
;
++
j
)
{
//just init, no need to lock
//just init, no need to lock
S
CM
VgroupInfo
*
pVgroups
=
&
pInfo
->
vgroupList
->
vgroups
[
j
];
SVgroupInfo
*
pVgroups
=
&
pInfo
->
vgroupList
->
vgroups
[
j
];
S
CM
VgroupMsg
*
vmsg
=
&
pVgroupMsg
->
vgroups
[
j
];
SVgroupMsg
*
vmsg
=
&
pVgroupMsg
->
vgroups
[
j
];
pVgroups
->
vgId
=
htonl
(
vmsg
->
vgId
);
pVgroups
->
vgId
=
htonl
(
vmsg
->
vgId
);
pVgroups
->
numOfEps
=
vmsg
->
numOfEps
;
pVgroups
->
numOfEps
=
vmsg
->
numOfEps
;
...
@@ -1893,10 +1892,10 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
...
@@ -1893,10 +1892,10 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
* current process do not use the cache at all
* current process do not use the cache at all
*/
*/
int
tscProcessShowRsp
(
SSqlObj
*
pSql
)
{
int
tscProcessShowRsp
(
SSqlObj
*
pSql
)
{
STableMetaMsg
*
pMetaMsg
;
STableMetaMsg
*
pMetaMsg
;
S
CMShowRsp
*
pShow
;
S
ShowRsp
*
pShow
;
SSchema
*
pSchema
;
SSchema
*
pSchema
;
char
key
[
20
];
char
key
[
20
];
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
@@ -1905,7 +1904,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
...
@@ -1905,7 +1904,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
pShow
=
(
S
CM
ShowRsp
*
)
pRes
->
pRsp
;
pShow
=
(
SShowRsp
*
)
pRes
->
pRsp
;
pShow
->
qhandle
=
htobe64
(
pShow
->
qhandle
);
pShow
->
qhandle
=
htobe64
(
pShow
->
qhandle
);
pRes
->
qhandle
=
pShow
->
qhandle
;
pRes
->
qhandle
=
pShow
->
qhandle
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
582cacc5
...
@@ -489,7 +489,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr
...
@@ -489,7 +489,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr
SVgroupTableInfo
info
=
{{
0
}};
SVgroupTableInfo
info
=
{{
0
}};
for
(
int32_t
m
=
0
;
m
<
pvg
->
numOfVgroups
;
++
m
)
{
for
(
int32_t
m
=
0
;
m
<
pvg
->
numOfVgroups
;
++
m
)
{
if
(
tt
->
vgId
==
pvg
->
vgroups
[
m
].
vgId
)
{
if
(
tt
->
vgId
==
pvg
->
vgroups
[
m
].
vgId
)
{
tscS
CM
VgroupInfoCopy
(
&
info
.
vgInfo
,
&
pvg
->
vgroups
[
m
]);
tscSVgroupInfoCopy
(
&
info
.
vgInfo
,
&
pvg
->
vgroups
[
m
]);
break
;
break
;
}
}
}
}
...
@@ -1645,8 +1645,8 @@ static int32_t tscReissueSubquery(SRetrieveSupport *trsupport, SSqlObj *pSql, in
...
@@ -1645,8 +1645,8 @@ static int32_t tscReissueSubquery(SRetrieveSupport *trsupport, SSqlObj *pSql, in
SSqlObj
*
pParentSql
=
trsupport
->
pParentSql
;
SSqlObj
*
pParentSql
=
trsupport
->
pParentSql
;
int32_t
subqueryIndex
=
trsupport
->
subqueryIndex
;
int32_t
subqueryIndex
=
trsupport
->
subqueryIndex
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
S
CM
VgroupInfo
*
pVgroup
=
&
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
];
SVgroupInfo
*
pVgroup
=
&
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
];
tExtMemBufferClear
(
trsupport
->
pExtMemBuffer
[
subqueryIndex
]);
tExtMemBufferClear
(
trsupport
->
pExtMemBuffer
[
subqueryIndex
]);
...
@@ -1848,7 +1848,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
...
@@ -1848,7 +1848,7 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
assert
(
pState
->
numOfRemain
<=
pState
->
numOfSub
&&
pState
->
numOfRemain
>=
0
);
assert
(
pState
->
numOfRemain
<=
pState
->
numOfSub
&&
pState
->
numOfRemain
>=
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
S
CM
VgroupInfo
*
pVgroup
=
&
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
];
SVgroupInfo
*
pVgroup
=
&
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
];
if
(
pParentSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
pParentSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
{
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
...
@@ -1959,7 +1959,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
...
@@ -1959,7 +1959,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
assert
(
pSql
->
cmd
.
numOfClause
==
1
&&
pQueryInfo
->
numOfTables
==
1
);
assert
(
pSql
->
cmd
.
numOfClause
==
1
&&
pQueryInfo
->
numOfTables
==
1
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
);
S
CM
VgroupInfo
*
pVgroup
=
&
pTableMetaInfo
->
vgroupList
->
vgroups
[
trsupport
->
subqueryIndex
];
SVgroupInfo
*
pVgroup
=
&
pTableMetaInfo
->
vgroupList
->
vgroups
[
trsupport
->
subqueryIndex
];
// stable query killed or other subquery failed, all query stopped
// stable query killed or other subquery failed, all query stopped
if
(
pParentSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
pParentSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
582cacc5
...
@@ -2424,7 +2424,7 @@ SVgroupsInfo* tscVgroupInfoClone(SVgroupsInfo *vgroupList) {
...
@@ -2424,7 +2424,7 @@ SVgroupsInfo* tscVgroupInfoClone(SVgroupsInfo *vgroupList) {
return
NULL
;
return
NULL
;
}
}
size_t
size
=
sizeof
(
SVgroupsInfo
)
+
sizeof
(
S
CM
VgroupInfo
)
*
vgroupList
->
numOfVgroups
;
size_t
size
=
sizeof
(
SVgroupsInfo
)
+
sizeof
(
SVgroupInfo
)
*
vgroupList
->
numOfVgroups
;
SVgroupsInfo
*
pNew
=
calloc
(
1
,
size
);
SVgroupsInfo
*
pNew
=
calloc
(
1
,
size
);
if
(
pNew
==
NULL
)
{
if
(
pNew
==
NULL
)
{
return
NULL
;
return
NULL
;
...
@@ -2433,9 +2433,9 @@ SVgroupsInfo* tscVgroupInfoClone(SVgroupsInfo *vgroupList) {
...
@@ -2433,9 +2433,9 @@ SVgroupsInfo* tscVgroupInfoClone(SVgroupsInfo *vgroupList) {
pNew
->
numOfVgroups
=
vgroupList
->
numOfVgroups
;
pNew
->
numOfVgroups
=
vgroupList
->
numOfVgroups
;
for
(
int32_t
i
=
0
;
i
<
vgroupList
->
numOfVgroups
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
vgroupList
->
numOfVgroups
;
++
i
)
{
S
CM
VgroupInfo
*
pNewVInfo
=
&
pNew
->
vgroups
[
i
];
SVgroupInfo
*
pNewVInfo
=
&
pNew
->
vgroups
[
i
];
S
CM
VgroupInfo
*
pvInfo
=
&
vgroupList
->
vgroups
[
i
];
SVgroupInfo
*
pvInfo
=
&
vgroupList
->
vgroups
[
i
];
pNewVInfo
->
vgId
=
pvInfo
->
vgId
;
pNewVInfo
->
vgId
=
pvInfo
->
vgId
;
pNewVInfo
->
numOfEps
=
pvInfo
->
numOfEps
;
pNewVInfo
->
numOfEps
=
pvInfo
->
numOfEps
;
...
@@ -2454,7 +2454,7 @@ void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) {
...
@@ -2454,7 +2454,7 @@ void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) {
}
}
for
(
int32_t
i
=
0
;
i
<
vgroupList
->
numOfVgroups
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
vgroupList
->
numOfVgroups
;
++
i
)
{
S
CM
VgroupInfo
*
pVgroupInfo
=
&
vgroupList
->
vgroups
[
i
];
SVgroupInfo
*
pVgroupInfo
=
&
vgroupList
->
vgroups
[
i
];
for
(
int32_t
j
=
0
;
j
<
pVgroupInfo
->
numOfEps
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pVgroupInfo
->
numOfEps
;
++
j
)
{
taosTFree
(
pVgroupInfo
->
epAddr
[
j
].
fqdn
);
taosTFree
(
pVgroupInfo
->
epAddr
[
j
].
fqdn
);
...
@@ -2465,7 +2465,7 @@ void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) {
...
@@ -2465,7 +2465,7 @@ void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) {
return
NULL
;
return
NULL
;
}
}
void
tscS
CMVgroupInfoCopy
(
SCMVgroupInfo
*
dst
,
const
SCM
VgroupInfo
*
src
)
{
void
tscS
VgroupInfoCopy
(
SVgroupInfo
*
dst
,
const
S
VgroupInfo
*
src
)
{
dst
->
vgId
=
src
->
vgId
;
dst
->
vgId
=
src
->
vgId
;
dst
->
numOfEps
=
src
->
numOfEps
;
dst
->
numOfEps
=
src
->
numOfEps
;
for
(
int32_t
i
=
0
;
i
<
dst
->
numOfEps
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
dst
->
numOfEps
;
++
i
)
{
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
582cacc5
...
@@ -352,7 +352,7 @@ static void dnodeCloseVnodes() {
...
@@ -352,7 +352,7 @@ static void dnodeCloseVnodes() {
}
}
static
void
*
dnodeParseVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
static
void
*
dnodeParseVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
S
MD
CreateVnodeMsg
*
pCreate
=
rpcMsg
->
pCont
;
SCreateVnodeMsg
*
pCreate
=
rpcMsg
->
pCont
;
pCreate
->
cfg
.
vgId
=
htonl
(
pCreate
->
cfg
.
vgId
);
pCreate
->
cfg
.
vgId
=
htonl
(
pCreate
->
cfg
.
vgId
);
pCreate
->
cfg
.
cfgVersion
=
htonl
(
pCreate
->
cfg
.
cfgVersion
);
pCreate
->
cfg
.
cfgVersion
=
htonl
(
pCreate
->
cfg
.
cfgVersion
);
pCreate
->
cfg
.
maxTables
=
htonl
(
pCreate
->
cfg
.
maxTables
);
pCreate
->
cfg
.
maxTables
=
htonl
(
pCreate
->
cfg
.
maxTables
);
...
@@ -375,7 +375,7 @@ static void* dnodeParseVnodeMsg(SRpcMsg *rpcMsg) {
...
@@ -375,7 +375,7 @@ static void* dnodeParseVnodeMsg(SRpcMsg *rpcMsg) {
}
}
static
int32_t
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
static
int32_t
dnodeProcessCreateVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
S
MD
CreateVnodeMsg
*
pCreate
=
dnodeParseVnodeMsg
(
rpcMsg
);
SCreateVnodeMsg
*
pCreate
=
dnodeParseVnodeMsg
(
rpcMsg
);
void
*
pVnode
=
vnodeAcquire
(
pCreate
->
cfg
.
vgId
);
void
*
pVnode
=
vnodeAcquire
(
pCreate
->
cfg
.
vgId
);
if
(
pVnode
!=
NULL
)
{
if
(
pVnode
!=
NULL
)
{
...
@@ -389,7 +389,7 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
...
@@ -389,7 +389,7 @@ static int32_t dnodeProcessCreateVnodeMsg(SRpcMsg *rpcMsg) {
}
}
static
int32_t
dnodeProcessAlterVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
static
int32_t
dnodeProcessAlterVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
S
MD
AlterVnodeMsg
*
pAlter
=
dnodeParseVnodeMsg
(
rpcMsg
);
SAlterVnodeMsg
*
pAlter
=
dnodeParseVnodeMsg
(
rpcMsg
);
void
*
pVnode
=
vnodeAcquire
(
pAlter
->
cfg
.
vgId
);
void
*
pVnode
=
vnodeAcquire
(
pAlter
->
cfg
.
vgId
);
if
(
pVnode
!=
NULL
)
{
if
(
pVnode
!=
NULL
)
{
...
@@ -404,14 +404,14 @@ static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *rpcMsg) {
...
@@ -404,14 +404,14 @@ static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *rpcMsg) {
}
}
static
int32_t
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
static
int32_t
dnodeProcessDropVnodeMsg
(
SRpcMsg
*
rpcMsg
)
{
S
MD
DropVnodeMsg
*
pDrop
=
rpcMsg
->
pCont
;
SDropVnodeMsg
*
pDrop
=
rpcMsg
->
pCont
;
pDrop
->
vgId
=
htonl
(
pDrop
->
vgId
);
pDrop
->
vgId
=
htonl
(
pDrop
->
vgId
);
return
vnodeDrop
(
pDrop
->
vgId
);
return
vnodeDrop
(
pDrop
->
vgId
);
}
}
static
int32_t
dnodeProcessAlterStreamMsg
(
SRpcMsg
*
pMsg
)
{
static
int32_t
dnodeProcessAlterStreamMsg
(
SRpcMsg
*
pMsg
)
{
// S
MD
AlterStreamMsg *pStream = pCont;
// SAlterStreamMsg *pStream = pCont;
// pStream->uid = htobe64(pStream->uid);
// pStream->uid = htobe64(pStream->uid);
// pStream->stime = htobe64(pStream->stime);
// pStream->stime = htobe64(pStream->stime);
// pStream->vnode = htonl(pStream->vnode);
// pStream->vnode = htonl(pStream->vnode);
...
@@ -424,12 +424,12 @@ static int32_t dnodeProcessAlterStreamMsg(SRpcMsg *pMsg) {
...
@@ -424,12 +424,12 @@ static int32_t dnodeProcessAlterStreamMsg(SRpcMsg *pMsg) {
}
}
static
int32_t
dnodeProcessConfigDnodeMsg
(
SRpcMsg
*
pMsg
)
{
static
int32_t
dnodeProcessConfigDnodeMsg
(
SRpcMsg
*
pMsg
)
{
S
MD
CfgDnodeMsg
*
pCfg
=
pMsg
->
pCont
;
SCfgDnodeMsg
*
pCfg
=
pMsg
->
pCont
;
return
taosCfgDynamicOptions
(
pCfg
->
config
);
return
taosCfgDynamicOptions
(
pCfg
->
config
);
}
}
static
int32_t
dnodeProcessCreateMnodeMsg
(
SRpcMsg
*
pMsg
)
{
static
int32_t
dnodeProcessCreateMnodeMsg
(
SRpcMsg
*
pMsg
)
{
S
MD
CreateMnodeMsg
*
pCfg
=
pMsg
->
pCont
;
SCreateMnodeMsg
*
pCfg
=
pMsg
->
pCont
;
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
if
(
pCfg
->
dnodeId
!=
dnodeGetDnodeId
())
{
if
(
pCfg
->
dnodeId
!=
dnodeGetDnodeId
())
{
dError
(
"dnodeId:%d, in create mnode msg is not equal with saved dnodeId:%d"
,
pCfg
->
dnodeId
,
dnodeGetDnodeId
());
dError
(
"dnodeId:%d, in create mnode msg is not equal with saved dnodeId:%d"
,
pCfg
->
dnodeId
,
dnodeGetDnodeId
());
...
@@ -459,7 +459,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
...
@@ -459,7 +459,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
return
;
return
;
}
}
S
DM
StatusRsp
*
pStatusRsp
=
pMsg
->
pCont
;
SStatusRsp
*
pStatusRsp
=
pMsg
->
pCont
;
SMnodeInfos
*
minfos
=
&
pStatusRsp
->
mnodes
;
SMnodeInfos
*
minfos
=
&
pStatusRsp
->
mnodes
;
dnodeUpdateMInfos
(
minfos
);
dnodeUpdateMInfos
(
minfos
);
...
@@ -471,7 +471,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
...
@@ -471,7 +471,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
vnodeSetAccess
(
pStatusRsp
->
vgAccess
,
pCfg
->
numOfVnodes
);
vnodeSetAccess
(
pStatusRsp
->
vgAccess
,
pCfg
->
numOfVnodes
);
SDnodeEps
*
pEps
=
(
SDnodeEps
*
)((
char
*
)
pStatusRsp
->
vgAccess
+
pCfg
->
numOfVnodes
*
sizeof
(
S
DM
VgroupAccess
));
SDnodeEps
*
pEps
=
(
SDnodeEps
*
)((
char
*
)
pStatusRsp
->
vgAccess
+
pCfg
->
numOfVnodes
*
sizeof
(
SVgroupAccess
));
dnodeUpdateEps
(
pEps
);
dnodeUpdateEps
(
pEps
);
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
...
@@ -489,8 +489,8 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
...
@@ -489,8 +489,8 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
return
;
return
;
}
}
int32_t
contLen
=
sizeof
(
S
DM
StatusMsg
)
+
TSDB_MAX_VNODES
*
sizeof
(
SVnodeLoad
);
int32_t
contLen
=
sizeof
(
SStatusMsg
)
+
TSDB_MAX_VNODES
*
sizeof
(
SVnodeLoad
);
S
DM
StatusMsg
*
pStatus
=
rpcMallocCont
(
contLen
);
SStatusMsg
*
pStatus
=
rpcMallocCont
(
contLen
);
if
(
pStatus
==
NULL
)
{
if
(
pStatus
==
NULL
)
{
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
dError
(
"failed to malloc status message"
);
dError
(
"failed to malloc status message"
);
...
@@ -523,7 +523,7 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
...
@@ -523,7 +523,7 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
tstrncpy
(
pStatus
->
clusterCfg
.
charset
,
tsCharset
,
TSDB_LOCALE_LEN
);
tstrncpy
(
pStatus
->
clusterCfg
.
charset
,
tsCharset
,
TSDB_LOCALE_LEN
);
vnodeBuildStatusMsg
(
pStatus
);
vnodeBuildStatusMsg
(
pStatus
);
contLen
=
sizeof
(
S
DM
StatusMsg
)
+
pStatus
->
openVnodes
*
sizeof
(
SVnodeLoad
);
contLen
=
sizeof
(
SStatusMsg
)
+
pStatus
->
openVnodes
*
sizeof
(
SVnodeLoad
);
pStatus
->
openVnodes
=
htons
(
pStatus
->
openVnodes
);
pStatus
->
openVnodes
=
htons
(
pStatus
->
openVnodes
);
SRpcMsg
rpcMsg
=
{
SRpcMsg
rpcMsg
=
{
...
...
src/dnode/src/dnodePeer.c
浏览文件 @
582cacc5
...
@@ -137,7 +137,7 @@ int32_t dnodeInitClient() {
...
@@ -137,7 +137,7 @@ int32_t dnodeInitClient() {
return
-
1
;
return
-
1
;
}
}
dInfo
(
"
initialized
inter-dnodes rpc client is initialized"
);
dInfo
(
"
dnode
inter-dnodes rpc client is initialized"
);
return
0
;
return
0
;
}
}
...
@@ -145,7 +145,7 @@ void dnodeCleanupClient() {
...
@@ -145,7 +145,7 @@ void dnodeCleanupClient() {
if
(
tsDnodeClientRpc
)
{
if
(
tsDnodeClientRpc
)
{
rpcClose
(
tsDnodeClientRpc
);
rpcClose
(
tsDnodeClientRpc
);
tsDnodeClientRpc
=
NULL
;
tsDnodeClientRpc
=
NULL
;
dInfo
(
"inter-dnodes rpc client is closed"
);
dInfo
(
"
dnode
inter-dnodes rpc client is closed"
);
}
}
}
}
...
...
src/dnode/src/dnodeShell.c
浏览文件 @
582cacc5
...
@@ -146,12 +146,12 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
...
@@ -146,12 +146,12 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
int
code
=
mnodeRetriveAuth
(
user
,
spi
,
encrypt
,
secret
,
ckey
);
int
code
=
mnodeRetriveAuth
(
user
,
spi
,
encrypt
,
secret
,
ckey
);
if
(
code
!=
TSDB_CODE_APP_NOT_READY
)
return
code
;
if
(
code
!=
TSDB_CODE_APP_NOT_READY
)
return
code
;
S
DMAuthMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
SDM
AuthMsg
));
S
AuthMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
S
AuthMsg
));
tstrncpy
(
pMsg
->
user
,
user
,
sizeof
(
pMsg
->
user
));
tstrncpy
(
pMsg
->
user
,
user
,
sizeof
(
pMsg
->
user
));
SRpcMsg
rpcMsg
=
{
0
};
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pMsg
;
rpcMsg
.
pCont
=
pMsg
;
rpcMsg
.
contLen
=
sizeof
(
S
DM
AuthMsg
);
rpcMsg
.
contLen
=
sizeof
(
SAuthMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DM_AUTH
;
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_DM_AUTH
;
dDebug
(
"user:%s, send auth msg to mnodes"
,
user
);
dDebug
(
"user:%s, send auth msg to mnodes"
,
user
);
...
@@ -161,7 +161,7 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
...
@@ -161,7 +161,7 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
if
(
rpcRsp
.
code
!=
0
)
{
if
(
rpcRsp
.
code
!=
0
)
{
dError
(
"user:%s, auth msg received from mnodes, error:%s"
,
user
,
tstrerror
(
rpcRsp
.
code
));
dError
(
"user:%s, auth msg received from mnodes, error:%s"
,
user
,
tstrerror
(
rpcRsp
.
code
));
}
else
{
}
else
{
S
DM
AuthRsp
*
pRsp
=
rpcRsp
.
pCont
;
SAuthRsp
*
pRsp
=
rpcRsp
.
pCont
;
dDebug
(
"user:%s, auth msg received from mnodes"
,
user
);
dDebug
(
"user:%s, auth msg received from mnodes"
,
user
);
memcpy
(
secret
,
pRsp
->
secret
,
TSDB_KEY_LEN
);
memcpy
(
secret
,
pRsp
->
secret
,
TSDB_KEY_LEN
);
memcpy
(
ckey
,
pRsp
->
ckey
,
TSDB_KEY_LEN
);
memcpy
(
ckey
,
pRsp
->
ckey
,
TSDB_KEY_LEN
);
...
@@ -176,8 +176,8 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
...
@@ -176,8 +176,8 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
tid
)
{
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
tid
)
{
dDebug
(
"vgId:%d, tid:%d send config table msg to mnode"
,
vgId
,
tid
);
dDebug
(
"vgId:%d, tid:%d send config table msg to mnode"
,
vgId
,
tid
);
int32_t
contLen
=
sizeof
(
S
DM
ConfigTableMsg
);
int32_t
contLen
=
sizeof
(
SConfigTableMsg
);
S
DM
ConfigTableMsg
*
pMsg
=
rpcMallocCont
(
contLen
);
SConfigTableMsg
*
pMsg
=
rpcMallocCont
(
contLen
);
pMsg
->
dnodeId
=
htonl
(
dnodeGetDnodeId
());
pMsg
->
dnodeId
=
htonl
(
dnodeGetDnodeId
());
pMsg
->
vgId
=
htonl
(
vgId
);
pMsg
->
vgId
=
htonl
(
vgId
);
...
...
src/inc/taosmsg.h
浏览文件 @
582cacc5
...
@@ -291,7 +291,7 @@ typedef struct {
...
@@ -291,7 +291,7 @@ typedef struct {
SSchema
schema
[];
SSchema
schema
[];
// tagVal is padded after schema
// tagVal is padded after schema
// char tagVal[];
// char tagVal[];
}
S
CM
AlterTableMsg
;
}
SAlterTableMsg
;
typedef
struct
{
typedef
struct
{
SMsgHead
head
;
SMsgHead
head
;
...
@@ -348,14 +348,14 @@ typedef struct {
...
@@ -348,14 +348,14 @@ typedef struct {
typedef
struct
{
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
}
S
CMDropUserMsg
,
SCM
DropAcctMsg
;
}
S
DropUserMsg
,
S
DropAcctMsg
;
typedef
struct
{
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
char
pass
[
TSDB_KEY_LEN
];
int8_t
privilege
;
int8_t
privilege
;
int8_t
flag
;
int8_t
flag
;
}
SC
MCreateUserMsg
,
SCM
AlterUserMsg
;
}
SC
reateUserMsg
,
S
AlterUserMsg
;
typedef
struct
{
typedef
struct
{
int32_t
contLen
;
int32_t
contLen
;
...
@@ -370,11 +370,11 @@ typedef struct {
...
@@ -370,11 +370,11 @@ typedef struct {
int32_t
vgId
;
int32_t
vgId
;
uint64_t
uid
;
uint64_t
uid
;
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
}
S
MD
DropSTableMsg
;
}
SDropSTableMsg
;
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
}
S
MD
DropVnodeMsg
;
}
SDropVnodeMsg
;
typedef
struct
SColIndex
{
typedef
struct
SColIndex
{
int16_t
colId
;
// column id
int16_t
colId
;
// column id
...
@@ -540,12 +540,12 @@ typedef struct {
...
@@ -540,12 +540,12 @@ typedef struct {
int8_t
replications
;
int8_t
replications
;
int8_t
quorum
;
int8_t
quorum
;
int8_t
ignoreExist
;
int8_t
ignoreExist
;
}
SC
MCreateDbMsg
,
SCM
AlterDbMsg
;
}
SC
reateDbMsg
,
S
AlterDbMsg
;
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_TABLE_FNAME_LEN
];
uint8_t
ignoreNotExists
;
uint8_t
ignoreNotExists
;
}
S
CMDropDbMsg
,
SCM
UseDbMsg
;
}
S
DropDbMsg
,
S
UseDbMsg
;
// IMPORTANT: sizeof(SVnodeStatisticInfo) should not exceed
// IMPORTANT: sizeof(SVnodeStatisticInfo) should not exceed
// TSDB_FILE_HEADER_LEN/4 - TSDB_FILE_HEADER_VERSION_SIZE
// TSDB_FILE_HEADER_LEN/4 - TSDB_FILE_HEADER_VERSION_SIZE
...
@@ -560,7 +560,7 @@ typedef struct {
...
@@ -560,7 +560,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
int8_t
accessState
;
int8_t
accessState
;
}
S
DM
VgroupAccess
;
}
SVgroupAccess
;
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
...
@@ -622,13 +622,13 @@ typedef struct {
...
@@ -622,13 +622,13 @@ typedef struct {
uint8_t
reserve2
[
15
];
uint8_t
reserve2
[
15
];
SClusterCfg
clusterCfg
;
SClusterCfg
clusterCfg
;
SVnodeLoad
load
[];
SVnodeLoad
load
[];
}
S
DM
StatusMsg
;
}
SStatusMsg
;
typedef
struct
{
typedef
struct
{
SMnodeInfos
mnodes
;
SMnodeInfos
mnodes
;
SDnodeCfg
dnodeCfg
;
SDnodeCfg
dnodeCfg
;
S
DM
VgroupAccess
vgAccess
[];
SVgroupAccess
vgAccess
[];
}
S
DM
StatusRsp
;
}
SStatusRsp
;
typedef
struct
{
typedef
struct
{
uint32_t
vgId
;
uint32_t
vgId
;
...
@@ -651,54 +651,54 @@ typedef struct {
...
@@ -651,54 +651,54 @@ typedef struct {
int8_t
wals
;
int8_t
wals
;
int8_t
quorum
;
int8_t
quorum
;
int8_t
reserved
[
16
];
int8_t
reserved
[
16
];
}
S
MD
VnodeCfg
;
}
SVnodeCfg
;
typedef
struct
{
typedef
struct
{
int32_t
nodeId
;
int32_t
nodeId
;
char
nodeEp
[
TSDB_EP_LEN
];
char
nodeEp
[
TSDB_EP_LEN
];
}
S
MD
VnodeDesc
;
}
SVnodeDesc
;
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
S
MD
VnodeCfg
cfg
;
SVnodeCfg
cfg
;
S
MD
VnodeDesc
nodes
[
TSDB_MAX_REPLICA
];
SVnodeDesc
nodes
[
TSDB_MAX_REPLICA
];
}
S
MDCreateVnodeMsg
,
SMD
AlterVnodeMsg
;
}
S
CreateVnodeMsg
,
S
AlterVnodeMsg
;
typedef
struct
{
typedef
struct
{
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
int16_t
createFlag
;
int16_t
createFlag
;
char
tags
[];
char
tags
[];
}
S
CM
TableInfoMsg
;
}
STableInfoMsg
;
typedef
struct
{
typedef
struct
{
int32_t
numOfTables
;
int32_t
numOfTables
;
char
tableIds
[];
char
tableIds
[];
}
S
CM
MultiTableInfoMsg
;
}
SMultiTableInfoMsg
;
typedef
struct
S
CM
STableVgroupMsg
{
typedef
struct
SSTableVgroupMsg
{
int32_t
numOfTables
;
int32_t
numOfTables
;
}
S
CMSTableVgroupMsg
,
SCM
STableVgroupRspMsg
;
}
S
STableVgroupMsg
,
S
STableVgroupRspMsg
;
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
int8_t
numOfEps
;
int8_t
numOfEps
;
SEpAddr1
epAddr
[
TSDB_MAX_REPLICA
];
SEpAddr1
epAddr
[
TSDB_MAX_REPLICA
];
}
S
CM
VgroupInfo
;
}
SVgroupInfo
;
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
int8_t
numOfEps
;
int8_t
numOfEps
;
SEpAddrMsg
epAddr
[
TSDB_MAX_REPLICA
];
SEpAddrMsg
epAddr
[
TSDB_MAX_REPLICA
];
}
S
CM
VgroupMsg
;
}
SVgroupMsg
;
typedef
struct
{
typedef
struct
{
int32_t
numOfVgroups
;
int32_t
numOfVgroups
;
S
CM
VgroupInfo
vgroups
[];
SVgroupInfo
vgroups
[];
}
SVgroupsInfo
;
}
SVgroupsInfo
;
typedef
struct
{
typedef
struct
{
int32_t
numOfVgroups
;
int32_t
numOfVgroups
;
S
CM
VgroupMsg
vgroups
[];
SVgroupMsg
vgroups
[];
}
SVgroupsMsg
;
}
SVgroupsMsg
;
typedef
struct
STableMetaMsg
{
typedef
struct
STableMetaMsg
{
...
@@ -713,7 +713,7 @@ typedef struct STableMetaMsg {
...
@@ -713,7 +713,7 @@ typedef struct STableMetaMsg {
int16_t
tversion
;
int16_t
tversion
;
int32_t
tid
;
int32_t
tid
;
uint64_t
uid
;
uint64_t
uid
;
S
CMVgroupMsg
vgroup
;
S
VgroupMsg
vgroup
;
SSchema
schema
[];
SSchema
schema
[];
}
STableMetaMsg
;
}
STableMetaMsg
;
...
@@ -739,38 +739,38 @@ typedef struct {
...
@@ -739,38 +739,38 @@ typedef struct {
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_ACCT_LEN
+
TSDB_DB_NAME_LEN
];
uint16_t
payloadLen
;
uint16_t
payloadLen
;
char
payload
[];
char
payload
[];
}
S
CM
ShowMsg
;
}
SShowMsg
;
typedef
struct
S
CM
ShowRsp
{
typedef
struct
SShowRsp
{
uint64_t
qhandle
;
uint64_t
qhandle
;
STableMetaMsg
tableMeta
;
STableMetaMsg
tableMeta
;
}
S
CM
ShowRsp
;
}
SShowRsp
;
typedef
struct
{
typedef
struct
{
char
ep
[
TSDB_EP_LEN
];
// end point, hostname:port
char
ep
[
TSDB_EP_LEN
];
// end point, hostname:port
}
SC
MCreateDnodeMsg
,
SCM
DropDnodeMsg
;
}
SC
reateDnodeMsg
,
S
DropDnodeMsg
;
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
char
dnodeEp
[
TSDB_EP_LEN
];
// end point, hostname:port
char
dnodeEp
[
TSDB_EP_LEN
];
// end point, hostname:port
SMnodeInfos
mnodes
;
SMnodeInfos
mnodes
;
}
S
MD
CreateMnodeMsg
;
}
SCreateMnodeMsg
;
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
int32_t
vgId
;
int32_t
vgId
;
int32_t
tid
;
int32_t
tid
;
}
S
DM
ConfigTableMsg
;
}
SConfigTableMsg
;
typedef
struct
{
typedef
struct
{
uint32_t
dnodeId
;
uint32_t
dnodeId
;
int32_t
vgId
;
int32_t
vgId
;
}
S
DM
ConfigVnodeMsg
;
}
SConfigVnodeMsg
;
typedef
struct
{
typedef
struct
{
char
ep
[
TSDB_EP_LEN
];
// end point, hostname:port
char
ep
[
TSDB_EP_LEN
];
// end point, hostname:port
char
config
[
64
];
char
config
[
64
];
}
S
MDCfgDnodeMsg
,
SCM
CfgDnodeMsg
;
}
SCfgDnodeMsg
;
typedef
struct
{
typedef
struct
{
char
sql
[
TSDB_SHOW_SQL_LEN
];
char
sql
[
TSDB_SHOW_SQL_LEN
];
...
@@ -798,7 +798,7 @@ typedef struct {
...
@@ -798,7 +798,7 @@ typedef struct {
int32_t
numOfStreams
;
int32_t
numOfStreams
;
char
appName
[
TSDB_APPNAME_LEN
];
char
appName
[
TSDB_APPNAME_LEN
];
char
pData
[];
char
pData
[];
}
S
CM
HeartBeatMsg
;
}
SHeartBeatMsg
;
typedef
struct
{
typedef
struct
{
uint32_t
queryId
;
uint32_t
queryId
;
...
@@ -808,11 +808,11 @@ typedef struct {
...
@@ -808,11 +808,11 @@ typedef struct {
uint32_t
connId
;
uint32_t
connId
;
int8_t
killConnection
;
int8_t
killConnection
;
SRpcEpSet
epSet
;
SRpcEpSet
epSet
;
}
S
CM
HeartBeatRsp
;
}
SHeartBeatRsp
;
typedef
struct
{
typedef
struct
{
char
queryId
[
TSDB_KILL_MSG_LEN
+
1
];
char
queryId
[
TSDB_KILL_MSG_LEN
+
1
];
}
S
CMKillQueryMsg
,
SCMKillStreamMsg
,
SCM
KillConnMsg
;
}
S
KillQueryMsg
,
SKillStreamMsg
,
S
KillConnMsg
;
typedef
struct
{
typedef
struct
{
int32_t
vnode
;
int32_t
vnode
;
...
@@ -821,7 +821,7 @@ typedef struct {
...
@@ -821,7 +821,7 @@ typedef struct {
uint64_t
stime
;
// stream starting time
uint64_t
stime
;
// stream starting time
int32_t
status
;
int32_t
status
;
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
}
S
MD
AlterStreamMsg
;
}
SAlterStreamMsg
;
typedef
struct
{
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
...
@@ -829,7 +829,7 @@ typedef struct {
...
@@ -829,7 +829,7 @@ typedef struct {
char
encrypt
;
char
encrypt
;
char
secret
[
TSDB_KEY_LEN
];
char
secret
[
TSDB_KEY_LEN
];
char
ckey
[
TSDB_KEY_LEN
];
char
ckey
[
TSDB_KEY_LEN
];
}
S
DMAuthMsg
,
SDM
AuthRsp
;
}
S
AuthMsg
,
S
AuthRsp
;
#pragma pack(pop)
#pragma pack(pop)
...
...
src/inc/vnode.h
浏览文件 @
582cacc5
...
@@ -43,10 +43,10 @@ typedef struct {
...
@@ -43,10 +43,10 @@ typedef struct {
extern
char
*
vnodeStatus
[];
extern
char
*
vnodeStatus
[];
int32_t
vnodeCreate
(
S
MD
CreateVnodeMsg
*
pVnodeCfg
);
int32_t
vnodeCreate
(
SCreateVnodeMsg
*
pVnodeCfg
);
int32_t
vnodeDrop
(
int32_t
vgId
);
int32_t
vnodeDrop
(
int32_t
vgId
);
int32_t
vnodeOpen
(
int32_t
vgId
,
char
*
rootDir
);
int32_t
vnodeOpen
(
int32_t
vgId
,
char
*
rootDir
);
int32_t
vnodeAlter
(
void
*
pVnode
,
S
MD
CreateVnodeMsg
*
pVnodeCfg
);
int32_t
vnodeAlter
(
void
*
pVnode
,
SCreateVnodeMsg
*
pVnodeCfg
);
int32_t
vnodeClose
(
int32_t
vgId
);
int32_t
vnodeClose
(
int32_t
vgId
);
void
*
vnodeAcquire
(
int32_t
vgId
);
// add refcount
void
*
vnodeAcquire
(
int32_t
vgId
);
// add refcount
...
@@ -60,7 +60,7 @@ int32_t vnodeCheckWrite(void *pVnode);
...
@@ -60,7 +60,7 @@ int32_t vnodeCheckWrite(void *pVnode);
int32_t
vnodeGetVnodeList
(
int32_t
vnodeList
[],
int32_t
*
numOfVnodes
);
int32_t
vnodeGetVnodeList
(
int32_t
vnodeList
[],
int32_t
*
numOfVnodes
);
void
vnodeBuildStatusMsg
(
void
*
param
);
void
vnodeBuildStatusMsg
(
void
*
param
);
void
vnodeConfirmForward
(
void
*
param
,
uint64_t
version
,
int32_t
code
);
void
vnodeConfirmForward
(
void
*
param
,
uint64_t
version
,
int32_t
code
);
void
vnodeSetAccess
(
S
DM
VgroupAccess
*
pAccess
,
int32_t
numOfVnodes
);
void
vnodeSetAccess
(
SVgroupAccess
*
pAccess
,
int32_t
numOfVnodes
);
int32_t
vnodeInitResources
();
int32_t
vnodeInitResources
();
void
vnodeCleanupResources
();
void
vnodeCleanupResources
();
...
...
src/mnode/inc/mnodeProfile.h
浏览文件 @
582cacc5
...
@@ -45,7 +45,7 @@ void mnodeCleanupProfile();
...
@@ -45,7 +45,7 @@ void mnodeCleanupProfile();
SConnObj
*
mnodeCreateConn
(
char
*
user
,
uint32_t
ip
,
uint16_t
port
,
int32_t
pid
,
const
char
*
app
);
SConnObj
*
mnodeCreateConn
(
char
*
user
,
uint32_t
ip
,
uint16_t
port
,
int32_t
pid
,
const
char
*
app
);
SConnObj
*
mnodeAccquireConn
(
int32_t
connId
,
char
*
user
,
uint32_t
ip
,
uint16_t
port
);
SConnObj
*
mnodeAccquireConn
(
int32_t
connId
,
char
*
user
,
uint32_t
ip
,
uint16_t
port
);
void
mnodeReleaseConn
(
SConnObj
*
pConn
);
void
mnodeReleaseConn
(
SConnObj
*
pConn
);
int32_t
mnodeSaveQueryStreamList
(
SConnObj
*
pConn
,
S
CM
HeartBeatMsg
*
pHBMsg
);
int32_t
mnodeSaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeatMsg
*
pHBMsg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
582cacc5
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
static
void
*
tsDbSdb
=
NULL
;
static
void
*
tsDbSdb
=
NULL
;
static
int32_t
tsDbUpdateSize
;
static
int32_t
tsDbUpdateSize
;
static
int32_t
mnodeCreateDb
(
SAcctObj
*
pAcct
,
SC
MC
reateDbMsg
*
pCreate
,
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeCreateDb
(
SAcctObj
*
pAcct
,
SCreateDbMsg
*
pCreate
,
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeDropDb
(
SMnodeMsg
*
newMsg
);
static
int32_t
mnodeDropDb
(
SMnodeMsg
*
newMsg
);
static
int32_t
mnodeSetDbDropping
(
SDbObj
*
pDb
);
static
int32_t
mnodeSetDbDropping
(
SDbObj
*
pDb
);
static
int32_t
mnodeGetDbMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
static
int32_t
mnodeGetDbMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
...
@@ -352,7 +352,7 @@ static int32_t mnodeCreateDbCb(SMnodeMsg *pMsg, int32_t code) {
...
@@ -352,7 +352,7 @@ static int32_t mnodeCreateDbCb(SMnodeMsg *pMsg, int32_t code) {
return
code
;
return
code
;
}
}
static
int32_t
mnodeCreateDb
(
SAcctObj
*
pAcct
,
SC
MC
reateDbMsg
*
pCreate
,
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeCreateDb
(
SAcctObj
*
pAcct
,
SCreateDbMsg
*
pCreate
,
SMnodeMsg
*
pMsg
)
{
int32_t
code
=
acctCheck
(
pAcct
,
ACCT_GRANT_DB
);
int32_t
code
=
acctCheck
(
pAcct
,
ACCT_GRANT_DB
);
if
(
code
!=
0
)
return
code
;
if
(
code
!=
0
)
return
code
;
...
@@ -805,7 +805,7 @@ static int32_t mnodeSetDbDropping(SDbObj *pDb) {
...
@@ -805,7 +805,7 @@ static int32_t mnodeSetDbDropping(SDbObj *pDb) {
}
}
static
int32_t
mnodeProcessCreateDbMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessCreateDbMsg
(
SMnodeMsg
*
pMsg
)
{
SC
MCreateDbMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SC
reateDbMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
pCreate
->
maxTables
=
htonl
(
pCreate
->
maxTables
);
pCreate
->
maxTables
=
htonl
(
pCreate
->
maxTables
);
pCreate
->
cacheBlockSize
=
htonl
(
pCreate
->
cacheBlockSize
);
pCreate
->
cacheBlockSize
=
htonl
(
pCreate
->
cacheBlockSize
);
pCreate
->
totalBlocks
=
htonl
(
pCreate
->
totalBlocks
);
pCreate
->
totalBlocks
=
htonl
(
pCreate
->
totalBlocks
);
...
@@ -830,7 +830,7 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
...
@@ -830,7 +830,7 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
return
code
;
return
code
;
}
}
static
SDbCfg
mnodeGetAlterDbOption
(
SDbObj
*
pDb
,
S
CM
AlterDbMsg
*
pAlter
)
{
static
SDbCfg
mnodeGetAlterDbOption
(
SDbObj
*
pDb
,
SAlterDbMsg
*
pAlter
)
{
SDbCfg
newCfg
=
pDb
->
cfg
;
SDbCfg
newCfg
=
pDb
->
cfg
;
int32_t
maxTables
=
htonl
(
pAlter
->
maxTables
);
int32_t
maxTables
=
htonl
(
pAlter
->
maxTables
);
int32_t
cacheBlockSize
=
htonl
(
pAlter
->
cacheBlockSize
);
int32_t
cacheBlockSize
=
htonl
(
pAlter
->
cacheBlockSize
);
...
@@ -977,7 +977,7 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
...
@@ -977,7 +977,7 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
mnodeAlterDb
(
SDbObj
*
pDb
,
S
CM
AlterDbMsg
*
pAlter
,
void
*
pMsg
)
{
static
int32_t
mnodeAlterDb
(
SDbObj
*
pDb
,
SAlterDbMsg
*
pAlter
,
void
*
pMsg
)
{
SDbCfg
newCfg
=
mnodeGetAlterDbOption
(
pDb
,
pAlter
);
SDbCfg
newCfg
=
mnodeGetAlterDbOption
(
pDb
,
pAlter
);
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
{
return
terrno
;
return
terrno
;
...
@@ -1009,7 +1009,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SCMAlterDbMsg *pAlter, void *pMsg) {
...
@@ -1009,7 +1009,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SCMAlterDbMsg *pAlter, void *pMsg) {
}
}
static
int32_t
mnodeProcessAlterDbMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessAlterDbMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
AlterDbMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
SAlterDbMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"db:%s, alter db msg is received from thandle:%p"
,
pAlter
->
db
,
pMsg
->
rpcMsg
.
handle
);
mDebug
(
"db:%s, alter db msg is received from thandle:%p"
,
pAlter
->
db
,
pMsg
->
rpcMsg
.
handle
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pAlter
->
db
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pAlter
->
db
);
...
@@ -1060,7 +1060,7 @@ static int32_t mnodeDropDb(SMnodeMsg *pMsg) {
...
@@ -1060,7 +1060,7 @@ static int32_t mnodeDropDb(SMnodeMsg *pMsg) {
}
}
static
int32_t
mnodeProcessDropDbMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessDropDbMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
DropDbMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SDropDbMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"db:%s, drop db msg is received from thandle:%p"
,
pDrop
->
db
,
pMsg
->
rpcMsg
.
handle
);
mDebug
(
"db:%s, drop db msg is received from thandle:%p"
,
pDrop
->
db
,
pMsg
->
rpcMsg
.
handle
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pDrop
->
db
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pDrop
->
db
);
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
582cacc5
...
@@ -314,7 +314,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
...
@@ -314,7 +314,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_NO_RIGHTS
;
return
TSDB_CODE_MND_NO_RIGHTS
;
}
}
SC
MC
fgDnodeMsg
*
pCmCfgDnode
=
pMsg
->
rpcMsg
.
pCont
;
SCfgDnodeMsg
*
pCmCfgDnode
=
pMsg
->
rpcMsg
.
pCont
;
if
(
pCmCfgDnode
->
ep
[
0
]
==
0
)
{
if
(
pCmCfgDnode
->
ep
[
0
]
==
0
)
{
tstrncpy
(
pCmCfgDnode
->
ep
,
tsLocalEp
,
TSDB_EP_LEN
);
tstrncpy
(
pCmCfgDnode
->
ep
,
tsLocalEp
,
TSDB_EP_LEN
);
}
}
...
@@ -349,7 +349,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
...
@@ -349,7 +349,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
mnodeDecDnodeRef
(
pDnode
);
mnodeDecDnodeRef
(
pDnode
);
return
code
;
return
code
;
}
else
{
}
else
{
S
MDCfgDnodeMsg
*
pMdCfgDnode
=
rpcMallocCont
(
sizeof
(
SMD
CfgDnodeMsg
));
S
CfgDnodeMsg
*
pMdCfgDnode
=
rpcMallocCont
(
sizeof
(
S
CfgDnodeMsg
));
strcpy
(
pMdCfgDnode
->
ep
,
pCmCfgDnode
->
ep
);
strcpy
(
pMdCfgDnode
->
ep
,
pCmCfgDnode
->
ep
);
strcpy
(
pMdCfgDnode
->
config
,
pCmCfgDnode
->
config
);
strcpy
(
pMdCfgDnode
->
config
,
pCmCfgDnode
->
config
);
...
@@ -358,7 +358,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
...
@@ -358,7 +358,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
.
code
=
0
,
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_CONFIG_DNODE
,
.
msgType
=
TSDB_MSG_TYPE_MD_CONFIG_DNODE
,
.
pCont
=
pMdCfgDnode
,
.
pCont
=
pMdCfgDnode
,
.
contLen
=
sizeof
(
S
MD
CfgDnodeMsg
)
.
contLen
=
sizeof
(
SCfgDnodeMsg
)
};
};
mInfo
(
"dnode:%s, is configured by %s"
,
pCmCfgDnode
->
ep
,
pMsg
->
pUser
->
user
);
mInfo
(
"dnode:%s, is configured by %s"
,
pCmCfgDnode
->
ep
,
pMsg
->
pUser
->
user
);
...
@@ -480,7 +480,7 @@ static void mnodeUpdateDnodeEps() {
...
@@ -480,7 +480,7 @@ static void mnodeUpdateDnodeEps() {
static
int32_t
mnodeProcessDnodeStatusMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessDnodeStatusMsg
(
SMnodeMsg
*
pMsg
)
{
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
S
DMStatusMsg
*
pStatus
=
pMsg
->
rpcMsg
.
pCont
;
S
StatusMsg
*
pStatus
=
pMsg
->
rpcMsg
.
pCont
;
pStatus
->
dnodeId
=
htonl
(
pStatus
->
dnodeId
);
pStatus
->
dnodeId
=
htonl
(
pStatus
->
dnodeId
);
pStatus
->
moduleStatus
=
htonl
(
pStatus
->
moduleStatus
);
pStatus
->
moduleStatus
=
htonl
(
pStatus
->
moduleStatus
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
...
@@ -538,10 +538,10 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -538,10 +538,10 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
int32_t
openVnodes
=
htons
(
pStatus
->
openVnodes
);
int32_t
openVnodes
=
htons
(
pStatus
->
openVnodes
);
int32_t
epsSize
=
mnodeGetDnodeEpsSize
();
int32_t
epsSize
=
mnodeGetDnodeEpsSize
();
int32_t
vgAccessSize
=
openVnodes
*
sizeof
(
S
DM
VgroupAccess
);
int32_t
vgAccessSize
=
openVnodes
*
sizeof
(
SVgroupAccess
);
int32_t
contLen
=
sizeof
(
S
DM
StatusRsp
)
+
vgAccessSize
+
epsSize
;
int32_t
contLen
=
sizeof
(
SStatusRsp
)
+
vgAccessSize
+
epsSize
;
S
DM
StatusRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
SStatusRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
mnodeDecDnodeRef
(
pDnode
);
mnodeDecDnodeRef
(
pDnode
);
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
...
@@ -551,7 +551,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -551,7 +551,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pRsp
->
dnodeCfg
.
moduleStatus
=
htonl
((
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeCfg
.
moduleStatus
=
htonl
((
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeCfg
.
numOfVnodes
=
htonl
(
openVnodes
);
pRsp
->
dnodeCfg
.
numOfVnodes
=
htonl
(
openVnodes
);
tstrncpy
(
pRsp
->
dnodeCfg
.
clusterId
,
mnodeGetClusterId
(),
TSDB_CLUSTER_ID_LEN
);
tstrncpy
(
pRsp
->
dnodeCfg
.
clusterId
,
mnodeGetClusterId
(),
TSDB_CLUSTER_ID_LEN
);
S
DMVgroupAccess
*
pAccess
=
(
SDMVgroupAccess
*
)((
char
*
)
pRsp
+
sizeof
(
SDM
StatusRsp
));
S
VgroupAccess
*
pAccess
=
(
SVgroupAccess
*
)((
char
*
)
pRsp
+
sizeof
(
S
StatusRsp
));
for
(
int32_t
j
=
0
;
j
<
openVnodes
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
openVnodes
;
++
j
)
{
SVnodeLoad
*
pVload
=
&
pStatus
->
load
[
j
];
SVnodeLoad
*
pVload
=
&
pStatus
->
load
[
j
];
...
@@ -602,7 +602,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -602,7 +602,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
mnodeDecDnodeRef
(
pDnode
);
mnodeDecDnodeRef
(
pDnode
);
SDnodeEps
*
pEps
=
(
SDnodeEps
*
)((
char
*
)
pRsp
+
sizeof
(
S
DM
StatusRsp
)
+
vgAccessSize
);
SDnodeEps
*
pEps
=
(
SDnodeEps
*
)((
char
*
)
pRsp
+
sizeof
(
SStatusRsp
)
+
vgAccessSize
);
mnodeGetDnodeEpsData
(
pEps
,
epsSize
);
mnodeGetDnodeEpsData
(
pEps
,
epsSize
);
pMsg
->
rpcRsp
.
len
=
contLen
;
pMsg
->
rpcRsp
.
len
=
contLen
;
...
@@ -711,7 +711,7 @@ static int32_t mnodeDropDnodeByEp(char *ep, SMnodeMsg *pMsg) {
...
@@ -711,7 +711,7 @@ static int32_t mnodeDropDnodeByEp(char *ep, SMnodeMsg *pMsg) {
}
}
static
int32_t
mnodeProcessCreateDnodeMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessCreateDnodeMsg
(
SMnodeMsg
*
pMsg
)
{
SC
MC
reateDnodeMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SCreateDnodeMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
if
(
strcmp
(
pMsg
->
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
{
if
(
strcmp
(
pMsg
->
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
{
return
TSDB_CODE_MND_NO_RIGHTS
;
return
TSDB_CODE_MND_NO_RIGHTS
;
...
@@ -721,7 +721,7 @@ static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
...
@@ -721,7 +721,7 @@ static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
}
}
static
int32_t
mnodeProcessDropDnodeMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessDropDnodeMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
DropDnodeMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SDropDnodeMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
if
(
strcmp
(
pMsg
->
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
{
if
(
strcmp
(
pMsg
->
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
{
return
TSDB_CODE_MND_NO_RIGHTS
;
return
TSDB_CODE_MND_NO_RIGHTS
;
...
...
src/mnode/src/mnodeMnode.c
浏览文件 @
582cacc5
...
@@ -273,7 +273,7 @@ void mnodeGetMnodeInfos(void *mnodeInfos) {
...
@@ -273,7 +273,7 @@ void mnodeGetMnodeInfos(void *mnodeInfos) {
static
int32_t
mnodeSendCreateMnodeMsg
(
int32_t
dnodeId
,
char
*
dnodeEp
)
{
static
int32_t
mnodeSendCreateMnodeMsg
(
int32_t
dnodeId
,
char
*
dnodeEp
)
{
mDebug
(
"dnode:%d, send create mnode msg to dnode %s"
,
dnodeId
,
dnodeEp
);
mDebug
(
"dnode:%d, send create mnode msg to dnode %s"
,
dnodeId
,
dnodeEp
);
S
MDCreateMnodeMsg
*
pCreate
=
rpcMallocCont
(
sizeof
(
SMD
CreateMnodeMsg
));
S
CreateMnodeMsg
*
pCreate
=
rpcMallocCont
(
sizeof
(
S
CreateMnodeMsg
));
if
(
pCreate
==
NULL
)
{
if
(
pCreate
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
else
{
}
else
{
...
@@ -295,7 +295,7 @@ static int32_t mnodeSendCreateMnodeMsg(int32_t dnodeId, char *dnodeEp) {
...
@@ -295,7 +295,7 @@ static int32_t mnodeSendCreateMnodeMsg(int32_t dnodeId, char *dnodeEp) {
SRpcMsg
rpcMsg
=
{
0
};
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pCreate
;
rpcMsg
.
pCont
=
pCreate
;
rpcMsg
.
contLen
=
sizeof
(
S
MD
CreateMnodeMsg
);
rpcMsg
.
contLen
=
sizeof
(
SCreateMnodeMsg
);
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_MD_CREATE_MNODE
;
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_MD_CREATE_MNODE
;
SRpcMsg
rpcRsp
=
{
0
};
SRpcMsg
rpcRsp
=
{
0
};
...
...
src/mnode/src/mnodeProfile.c
浏览文件 @
582cacc5
...
@@ -280,7 +280,7 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi
...
@@ -280,7 +280,7 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi
}
}
// not thread safe, need optimized
// not thread safe, need optimized
int32_t
mnodeSaveQueryStreamList
(
SConnObj
*
pConn
,
S
CM
HeartBeatMsg
*
pHBMsg
)
{
int32_t
mnodeSaveQueryStreamList
(
SConnObj
*
pConn
,
SHeartBeatMsg
*
pHBMsg
)
{
pConn
->
numOfQueries
=
htonl
(
pHBMsg
->
numOfQueries
);
pConn
->
numOfQueries
=
htonl
(
pHBMsg
->
numOfQueries
);
if
(
pConn
->
numOfQueries
>
0
)
{
if
(
pConn
->
numOfQueries
>
0
)
{
if
(
pConn
->
pQueries
==
NULL
)
{
if
(
pConn
->
pQueries
==
NULL
)
{
...
@@ -561,7 +561,7 @@ static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
...
@@ -561,7 +561,7 @@ static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
SUserObj
*
pUser
=
pMsg
->
pUser
;
SUserObj
*
pUser
=
pMsg
->
pUser
;
if
(
strcmp
(
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
return
TSDB_CODE_MND_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
return
TSDB_CODE_MND_NO_RIGHTS
;
S
CM
KillQueryMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
SKillQueryMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
mInfo
(
"kill query msg is received, queryId:%s"
,
pKill
->
queryId
);
mInfo
(
"kill query msg is received, queryId:%s"
,
pKill
->
queryId
);
const
char
delim
=
':'
;
const
char
delim
=
':'
;
...
@@ -592,7 +592,7 @@ static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
...
@@ -592,7 +592,7 @@ static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
SUserObj
*
pUser
=
pMsg
->
pUser
;
SUserObj
*
pUser
=
pMsg
->
pUser
;
if
(
strcmp
(
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
return
TSDB_CODE_MND_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
return
TSDB_CODE_MND_NO_RIGHTS
;
S
CM
KillQueryMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
SKillQueryMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
mInfo
(
"kill stream msg is received, streamId:%s"
,
pKill
->
queryId
);
mInfo
(
"kill stream msg is received, streamId:%s"
,
pKill
->
queryId
);
const
char
delim
=
':'
;
const
char
delim
=
':'
;
...
@@ -623,7 +623,7 @@ static int32_t mnodeProcessKillConnectionMsg(SMnodeMsg *pMsg) {
...
@@ -623,7 +623,7 @@ static int32_t mnodeProcessKillConnectionMsg(SMnodeMsg *pMsg) {
SUserObj
*
pUser
=
pMsg
->
pUser
;
SUserObj
*
pUser
=
pMsg
->
pUser
;
if
(
strcmp
(
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
return
TSDB_CODE_MND_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
return
TSDB_CODE_MND_NO_RIGHTS
;
S
CM
KillConnMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
SKillConnMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
int32_t
connId
=
atoi
(
pKill
->
queryId
);
int32_t
connId
=
atoi
(
pKill
->
queryId
);
SConnObj
*
pConn
=
taosCacheAcquireByKey
(
tsMnodeConnCache
,
&
connId
,
sizeof
(
int32_t
));
SConnObj
*
pConn
=
taosCacheAcquireByKey
(
tsMnodeConnCache
,
&
connId
,
sizeof
(
int32_t
));
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
582cacc5
...
@@ -110,7 +110,7 @@ static char *mnodeGetShowType(int32_t showType) {
...
@@ -110,7 +110,7 @@ static char *mnodeGetShowType(int32_t showType) {
}
}
static
int32_t
mnodeProcessShowMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessShowMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
ShowMsg
*
pShowMsg
=
pMsg
->
rpcMsg
.
pCont
;
SShowMsg
*
pShowMsg
=
pMsg
->
rpcMsg
.
pCont
;
if
(
pShowMsg
->
type
>=
TSDB_MGMT_TABLE_MAX
)
{
if
(
pShowMsg
->
type
>=
TSDB_MGMT_TABLE_MAX
)
{
return
TSDB_CODE_MND_INVALID_MSG_TYPE
;
return
TSDB_CODE_MND_INVALID_MSG_TYPE
;
}
}
...
@@ -132,8 +132,8 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
...
@@ -132,8 +132,8 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
}
int32_t
size
=
sizeof
(
S
CM
ShowRsp
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
+
TSDB_EXTRA_PAYLOAD_SIZE
;
int32_t
size
=
sizeof
(
SShowRsp
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
+
TSDB_EXTRA_PAYLOAD_SIZE
;
S
CM
ShowRsp
*
pShowRsp
=
rpcMallocCont
(
size
);
SShowRsp
*
pShowRsp
=
rpcMallocCont
(
size
);
if
(
pShowRsp
==
NULL
)
{
if
(
pShowRsp
==
NULL
)
{
mnodeReleaseShowObj
(
pShow
,
true
);
mnodeReleaseShowObj
(
pShow
,
true
);
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
...
@@ -146,7 +146,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
...
@@ -146,7 +146,7 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
pMsg
->
rpcRsp
.
rsp
=
pShowRsp
;
pMsg
->
rpcRsp
.
rsp
=
pShowRsp
;
pMsg
->
rpcRsp
.
len
=
sizeof
(
S
CM
ShowRsp
)
+
sizeof
(
SSchema
)
*
pShow
->
numOfColumns
;
pMsg
->
rpcRsp
.
len
=
sizeof
(
SShowRsp
)
+
sizeof
(
SSchema
)
*
pShow
->
numOfColumns
;
mnodeReleaseShowObj
(
pShow
,
false
);
mnodeReleaseShowObj
(
pShow
,
false
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
{
}
else
{
...
@@ -232,12 +232,12 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
...
@@ -232,12 +232,12 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
}
}
static
int32_t
mnodeProcessHeartBeatMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessHeartBeatMsg
(
SMnodeMsg
*
pMsg
)
{
S
CMHeartBeatRsp
*
pHBRsp
=
(
SCMHeartBeatRsp
*
)
rpcMallocCont
(
sizeof
(
SCM
HeartBeatRsp
));
S
HeartBeatRsp
*
pHBRsp
=
(
SHeartBeatRsp
*
)
rpcMallocCont
(
sizeof
(
S
HeartBeatRsp
));
if
(
pHBRsp
==
NULL
)
{
if
(
pHBRsp
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
}
S
CM
HeartBeatMsg
*
pHBMsg
=
pMsg
->
rpcMsg
.
pCont
;
SHeartBeatMsg
*
pHBMsg
=
pMsg
->
rpcMsg
.
pCont
;
SRpcConnInfo
connInfo
=
{
0
};
SRpcConnInfo
connInfo
=
{
0
};
rpcGetConnInfo
(
pMsg
->
rpcMsg
.
handle
,
&
connInfo
);
rpcGetConnInfo
(
pMsg
->
rpcMsg
.
handle
,
&
connInfo
);
...
@@ -276,7 +276,7 @@ static int32_t mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) {
...
@@ -276,7 +276,7 @@ static int32_t mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) {
mnodeGetMnodeEpSetForShell
(
&
pHBRsp
->
epSet
);
mnodeGetMnodeEpSetForShell
(
&
pHBRsp
->
epSet
);
pMsg
->
rpcRsp
.
rsp
=
pHBRsp
;
pMsg
->
rpcRsp
.
rsp
=
pHBRsp
;
pMsg
->
rpcRsp
.
len
=
sizeof
(
S
CM
HeartBeatRsp
);
pMsg
->
rpcRsp
.
len
=
sizeof
(
SHeartBeatRsp
);
mnodeReleaseConn
(
pConn
);
mnodeReleaseConn
(
pConn
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -356,7 +356,7 @@ connect_over:
...
@@ -356,7 +356,7 @@ connect_over:
}
}
static
int32_t
mnodeProcessUseMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessUseMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
UseDbMsg
*
pUseDbMsg
=
pMsg
->
rpcMsg
.
pCont
;
SUseDbMsg
*
pUseDbMsg
=
pMsg
->
rpcMsg
.
pCont
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pUseDbMsg
->
db
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pUseDbMsg
->
db
);
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
582cacc5
...
@@ -778,7 +778,7 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
...
@@ -778,7 +778,7 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
}
}
static
int32_t
mnodeProcessTableMetaMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessTableMetaMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
TableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
STableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
pInfo
->
createFlag
=
htons
(
pInfo
->
createFlag
);
pInfo
->
createFlag
=
htons
(
pInfo
->
createFlag
);
mDebug
(
"app:%p:%p, table:%s, table meta msg is received from thandle:%p, createFlag:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
mDebug
(
"app:%p:%p, table:%s, table meta msg is received from thandle:%p, createFlag:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pInfo
->
tableId
,
pMsg
->
rpcMsg
.
handle
,
pInfo
->
createFlag
);
pInfo
->
tableId
,
pMsg
->
rpcMsg
.
handle
,
pInfo
->
createFlag
);
...
@@ -915,8 +915,8 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
...
@@ -915,8 +915,8 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
SVgObj
*
pVgroup
=
mnodeGetVgroup
(
*
pVgId
);
SVgObj
*
pVgroup
=
mnodeGetVgroup
(
*
pVgId
);
if
(
pVgroup
==
NULL
)
break
;
if
(
pVgroup
==
NULL
)
break
;
S
MDDropSTableMsg
*
pDrop
=
rpcMallocCont
(
sizeof
(
SMD
DropSTableMsg
));
S
DropSTableMsg
*
pDrop
=
rpcMallocCont
(
sizeof
(
S
DropSTableMsg
));
pDrop
->
contLen
=
htonl
(
sizeof
(
S
MD
DropSTableMsg
));
pDrop
->
contLen
=
htonl
(
sizeof
(
SDropSTableMsg
));
pDrop
->
vgId
=
htonl
(
pVgroup
->
vgId
);
pDrop
->
vgId
=
htonl
(
pVgroup
->
vgId
);
pDrop
->
uid
=
htobe64
(
pStable
->
uid
);
pDrop
->
uid
=
htobe64
(
pStable
->
uid
);
mnodeExtractTableName
(
pStable
->
info
.
tableId
,
pDrop
->
tableId
);
mnodeExtractTableName
(
pStable
->
info
.
tableId
,
pDrop
->
tableId
);
...
@@ -924,7 +924,7 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
...
@@ -924,7 +924,7 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
mInfo
(
"app:%p:%p, stable:%s, send drop stable msg to vgId:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pStable
->
info
.
tableId
,
mInfo
(
"app:%p:%p, stable:%s, send drop stable msg to vgId:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pStable
->
info
.
tableId
,
pVgroup
->
vgId
);
pVgroup
->
vgId
);
SRpcEpSet
epSet
=
mnodeGetEpSetFromVgroup
(
pVgroup
);
SRpcEpSet
epSet
=
mnodeGetEpSetFromVgroup
(
pVgroup
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pDrop
,
.
contLen
=
sizeof
(
S
MD
DropSTableMsg
),
.
msgType
=
TSDB_MSG_TYPE_MD_DROP_STABLE
};
SRpcMsg
rpcMsg
=
{.
pCont
=
pDrop
,
.
contLen
=
sizeof
(
SDropSTableMsg
),
.
msgType
=
TSDB_MSG_TYPE_MD_DROP_STABLE
};
dnodeSendMsgToDnode
(
&
epSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
&
epSet
,
&
rpcMsg
);
mnodeDecVgroupRef
(
pVgroup
);
mnodeDecVgroupRef
(
pVgroup
);
}
}
...
@@ -1472,31 +1472,31 @@ static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg) {
...
@@ -1472,31 +1472,31 @@ static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg) {
}
}
static
int32_t
mnodeProcessSuperTableVgroupMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessSuperTableVgroupMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
STableVgroupMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
SSTableVgroupMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
int32_t
numOfTable
=
htonl
(
pInfo
->
numOfTables
);
int32_t
numOfTable
=
htonl
(
pInfo
->
numOfTables
);
// reserve space
// reserve space
int32_t
contLen
=
sizeof
(
S
CMSTableVgroupRspMsg
)
+
32
*
sizeof
(
SCM
VgroupMsg
)
+
sizeof
(
SVgroupsMsg
);
int32_t
contLen
=
sizeof
(
S
STableVgroupRspMsg
)
+
32
*
sizeof
(
S
VgroupMsg
)
+
sizeof
(
SVgroupsMsg
);
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SCMSTableVgroupMsg
)
+
(
TSDB_TABLE_FNAME_LEN
)
*
i
;
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SSTableVgroupMsg
)
+
(
TSDB_TABLE_FNAME_LEN
)
*
i
;
SSuperTableObj
*
pTable
=
mnodeGetSuperTable
(
stableName
);
SSuperTableObj
*
pTable
=
mnodeGetSuperTable
(
stableName
);
if
(
pTable
!=
NULL
&&
pTable
->
vgHash
!=
NULL
)
{
if
(
pTable
!=
NULL
&&
pTable
->
vgHash
!=
NULL
)
{
contLen
+=
(
taosHashGetSize
(
pTable
->
vgHash
)
*
sizeof
(
S
CM
VgroupMsg
)
+
sizeof
(
SVgroupsMsg
));
contLen
+=
(
taosHashGetSize
(
pTable
->
vgHash
)
*
sizeof
(
SVgroupMsg
)
+
sizeof
(
SVgroupsMsg
));
}
}
mnodeDecTableRef
(
pTable
);
mnodeDecTableRef
(
pTable
);
}
}
S
CM
STableVgroupRspMsg
*
pRsp
=
rpcMallocCont
(
contLen
);
SSTableVgroupRspMsg
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
}
pRsp
->
numOfTables
=
0
;
pRsp
->
numOfTables
=
0
;
char
*
msg
=
(
char
*
)
pRsp
+
sizeof
(
S
CM
STableVgroupRspMsg
);
char
*
msg
=
(
char
*
)
pRsp
+
sizeof
(
SSTableVgroupRspMsg
);
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
S
CM
STableVgroupMsg
)
+
(
TSDB_TABLE_FNAME_LEN
)
*
i
;
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SSTableVgroupMsg
)
+
(
TSDB_TABLE_FNAME_LEN
)
*
i
;
SSuperTableObj
*
pTable
=
mnodeGetSuperTable
(
stableName
);
SSuperTableObj
*
pTable
=
mnodeGetSuperTable
(
stableName
);
if
(
pTable
==
NULL
)
{
if
(
pTable
==
NULL
)
{
mError
(
"app:%p:%p, stable:%s, not exist while get stable vgroup info"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
stableName
);
mError
(
"app:%p:%p, stable:%s, not exist while get stable vgroup info"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
stableName
);
...
@@ -1548,7 +1548,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
...
@@ -1548,7 +1548,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
pVgroupMsg
->
numOfVgroups
=
htonl
(
vgSize
);
pVgroupMsg
->
numOfVgroups
=
htonl
(
vgSize
);
// one table is done, try the next table
// one table is done, try the next table
msg
+=
sizeof
(
SVgroupsMsg
)
+
vgSize
*
sizeof
(
S
CM
VgroupMsg
);
msg
+=
sizeof
(
SVgroupsMsg
)
+
vgSize
*
sizeof
(
SVgroupMsg
);
pRsp
->
numOfTables
++
;
pRsp
->
numOfTables
++
;
}
}
}
}
...
@@ -2146,7 +2146,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
...
@@ -2146,7 +2146,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
}
}
static
int32_t
mnodeAutoCreateChildTable
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeAutoCreateChildTable
(
SMnodeMsg
*
pMsg
)
{
S
CM
TableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
STableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
STagData
*
pTags
=
(
STagData
*
)
pInfo
->
tags
;
STagData
*
pTags
=
(
STagData
*
)
pInfo
->
tags
;
int32_t
tagLen
=
htonl
(
pTags
->
dataLen
);
int32_t
tagLen
=
htonl
(
pTags
->
dataLen
);
if
(
pTags
->
name
[
0
]
==
0
)
{
if
(
pTags
->
name
[
0
]
==
0
)
{
...
@@ -2307,7 +2307,7 @@ static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t tid) {
...
@@ -2307,7 +2307,7 @@ static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t tid) {
static
int32_t
mnodeProcessTableCfgMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessTableCfgMsg
(
SMnodeMsg
*
pMsg
)
{
return
TSDB_CODE_COM_OPS_NOT_SUPPORT
;
return
TSDB_CODE_COM_OPS_NOT_SUPPORT
;
#if 0
#if 0
S
DM
ConfigTableMsg *pCfg = pMsg->rpcMsg.pCont;
SConfigTableMsg *pCfg = pMsg->rpcMsg.pCont;
pCfg->dnodeId = htonl(pCfg->dnodeId);
pCfg->dnodeId = htonl(pCfg->dnodeId);
pCfg->vgId = htonl(pCfg->vgId);
pCfg->vgId = htonl(pCfg->vgId);
pCfg->sid = htonl(pCfg->sid);
pCfg->sid = htonl(pCfg->sid);
...
@@ -2469,7 +2469,7 @@ static void mnodeProcessAlterTableRsp(SRpcMsg *rpcMsg) {
...
@@ -2469,7 +2469,7 @@ static void mnodeProcessAlterTableRsp(SRpcMsg *rpcMsg) {
}
}
static
int32_t
mnodeProcessMultiTableMetaMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessMultiTableMetaMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
MultiTableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
SMultiTableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
pInfo
->
numOfTables
=
htonl
(
pInfo
->
numOfTables
);
pInfo
->
numOfTables
=
htonl
(
pInfo
->
numOfTables
);
int32_t
totalMallocLen
=
4
*
1024
*
1024
;
// first malloc 4 MB, subsequent reallocation as twice
int32_t
totalMallocLen
=
4
*
1024
*
1024
;
// first malloc 4 MB, subsequent reallocation as twice
...
@@ -2705,7 +2705,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
...
@@ -2705,7 +2705,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
}
}
static
int32_t
mnodeProcessAlterTableMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessAlterTableMsg
(
SMnodeMsg
*
pMsg
)
{
S
CM
AlterTableMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
SAlterTableMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"app:%p:%p, table:%s, alter table msg is received from thandle:%p"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
mDebug
(
"app:%p:%p, table:%s, alter table msg is received from thandle:%p"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pAlter
->
tableId
,
pMsg
->
rpcMsg
.
handle
);
pAlter
->
tableId
,
pMsg
->
rpcMsg
.
handle
);
...
...
src/mnode/src/mnodeUser.c
浏览文件 @
582cacc5
...
@@ -414,7 +414,7 @@ static int32_t mnodeProcessCreateUserMsg(SMnodeMsg *pMsg) {
...
@@ -414,7 +414,7 @@ static int32_t mnodeProcessCreateUserMsg(SMnodeMsg *pMsg) {
SUserObj
*
pOperUser
=
pMsg
->
pUser
;
SUserObj
*
pOperUser
=
pMsg
->
pUser
;
if
(
pOperUser
->
superAuth
)
{
if
(
pOperUser
->
superAuth
)
{
SC
MC
reateUserMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SCreateUserMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
return
mnodeCreateUser
(
pOperUser
->
pAcct
,
pCreate
->
user
,
pCreate
->
pass
,
pMsg
);
return
mnodeCreateUser
(
pOperUser
->
pAcct
,
pCreate
->
user
,
pCreate
->
pass
,
pMsg
);
}
else
{
}
else
{
mError
(
"user:%s, no rights to create user"
,
pOperUser
->
user
);
mError
(
"user:%s, no rights to create user"
,
pOperUser
->
user
);
...
@@ -426,7 +426,7 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg) {
...
@@ -426,7 +426,7 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg) {
int32_t
code
;
int32_t
code
;
SUserObj
*
pOperUser
=
pMsg
->
pUser
;
SUserObj
*
pOperUser
=
pMsg
->
pUser
;
S
CM
AlterUserMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
SAlterUserMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
SUserObj
*
pUser
=
mnodeGetUser
(
pAlter
->
user
);
SUserObj
*
pUser
=
mnodeGetUser
(
pAlter
->
user
);
if
(
pUser
==
NULL
)
{
if
(
pUser
==
NULL
)
{
return
TSDB_CODE_MND_INVALID_USER
;
return
TSDB_CODE_MND_INVALID_USER
;
...
@@ -514,7 +514,7 @@ static int32_t mnodeProcessDropUserMsg(SMnodeMsg *pMsg) {
...
@@ -514,7 +514,7 @@ static int32_t mnodeProcessDropUserMsg(SMnodeMsg *pMsg) {
int32_t
code
;
int32_t
code
;
SUserObj
*
pOperUser
=
pMsg
->
pUser
;
SUserObj
*
pOperUser
=
pMsg
->
pUser
;
S
CM
DropUserMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SDropUserMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SUserObj
*
pUser
=
mnodeGetUser
(
pDrop
->
user
);
SUserObj
*
pUser
=
mnodeGetUser
(
pDrop
->
user
);
if
(
pUser
==
NULL
)
{
if
(
pUser
==
NULL
)
{
return
TSDB_CODE_MND_INVALID_USER
;
return
TSDB_CODE_MND_INVALID_USER
;
...
@@ -604,11 +604,11 @@ int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, cha
...
@@ -604,11 +604,11 @@ int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, cha
}
}
static
int32_t
mnodeProcessAuthMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessAuthMsg
(
SMnodeMsg
*
pMsg
)
{
S
DM
AuthMsg
*
pAuthMsg
=
pMsg
->
rpcMsg
.
pCont
;
SAuthMsg
*
pAuthMsg
=
pMsg
->
rpcMsg
.
pCont
;
S
DMAuthRsp
*
pAuthRsp
=
rpcMallocCont
(
sizeof
(
SDM
AuthRsp
));
S
AuthRsp
*
pAuthRsp
=
rpcMallocCont
(
sizeof
(
S
AuthRsp
));
pMsg
->
rpcRsp
.
rsp
=
pAuthRsp
;
pMsg
->
rpcRsp
.
rsp
=
pAuthRsp
;
pMsg
->
rpcRsp
.
len
=
sizeof
(
S
DM
AuthRsp
);
pMsg
->
rpcRsp
.
len
=
sizeof
(
SAuthRsp
);
return
mnodeRetriveAuth
(
pAuthMsg
->
user
,
&
pAuthRsp
->
spi
,
&
pAuthRsp
->
encrypt
,
pAuthRsp
->
secret
,
pAuthRsp
->
ckey
);
return
mnodeRetriveAuth
(
pAuthMsg
->
user
,
&
pAuthRsp
->
spi
,
&
pAuthRsp
->
encrypt
,
pAuthRsp
->
secret
,
pAuthRsp
->
ckey
);
}
}
src/mnode/src/mnodeVgroup.c
浏览文件 @
582cacc5
...
@@ -818,11 +818,11 @@ void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SChildTableObj *pTable) {
...
@@ -818,11 +818,11 @@ void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SChildTableObj *pTable) {
}
}
}
}
static
S
MD
CreateVnodeMsg
*
mnodeBuildVnodeMsg
(
SVgObj
*
pVgroup
)
{
static
SCreateVnodeMsg
*
mnodeBuildVnodeMsg
(
SVgObj
*
pVgroup
)
{
SDbObj
*
pDb
=
pVgroup
->
pDb
;
SDbObj
*
pDb
=
pVgroup
->
pDb
;
if
(
pDb
==
NULL
)
return
NULL
;
if
(
pDb
==
NULL
)
return
NULL
;
S
MDCreateVnodeMsg
*
pVnode
=
rpcMallocCont
(
sizeof
(
SMD
CreateVnodeMsg
));
S
CreateVnodeMsg
*
pVnode
=
rpcMallocCont
(
sizeof
(
S
CreateVnodeMsg
));
if
(
pVnode
==
NULL
)
return
NULL
;
if
(
pVnode
==
NULL
)
return
NULL
;
strcpy
(
pVnode
->
db
,
pVgroup
->
dbName
);
strcpy
(
pVnode
->
db
,
pVgroup
->
dbName
);
...
@@ -830,7 +830,7 @@ static SMDCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) {
...
@@ -830,7 +830,7 @@ static SMDCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) {
//TODO: dynamic alloc tables in tsdb
//TODO: dynamic alloc tables in tsdb
maxTables
=
MAX
(
10000
,
tsMaxTablePerVnode
);
maxTables
=
MAX
(
10000
,
tsMaxTablePerVnode
);
S
MD
VnodeCfg
*
pCfg
=
&
pVnode
->
cfg
;
SVnodeCfg
*
pCfg
=
&
pVnode
->
cfg
;
pCfg
->
vgId
=
htonl
(
pVgroup
->
vgId
);
pCfg
->
vgId
=
htonl
(
pVgroup
->
vgId
);
pCfg
->
cfgVersion
=
htonl
(
pDb
->
cfgVersion
);
pCfg
->
cfgVersion
=
htonl
(
pDb
->
cfgVersion
);
pCfg
->
cacheBlockSize
=
htonl
(
pDb
->
cfg
.
cacheBlockSize
);
pCfg
->
cacheBlockSize
=
htonl
(
pDb
->
cfg
.
cacheBlockSize
);
...
@@ -851,7 +851,7 @@ static SMDCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) {
...
@@ -851,7 +851,7 @@ static SMDCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) {
pCfg
->
wals
=
3
;
pCfg
->
wals
=
3
;
pCfg
->
quorum
=
pDb
->
cfg
.
quorum
;
pCfg
->
quorum
=
pDb
->
cfg
.
quorum
;
S
MD
VnodeDesc
*
pNodes
=
pVnode
->
nodes
;
SVnodeDesc
*
pNodes
=
pVnode
->
nodes
;
for
(
int32_t
j
=
0
;
j
<
pVgroup
->
numOfVnodes
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pVgroup
->
numOfVnodes
;
++
j
)
{
SDnodeObj
*
pDnode
=
pVgroup
->
vnodeGid
[
j
].
pDnode
;
SDnodeObj
*
pDnode
=
pVgroup
->
vnodeGid
[
j
].
pDnode
;
if
(
pDnode
!=
NULL
)
{
if
(
pDnode
!=
NULL
)
{
...
@@ -886,11 +886,11 @@ SRpcEpSet mnodeGetEpSetFromIp(char *ep) {
...
@@ -886,11 +886,11 @@ SRpcEpSet mnodeGetEpSetFromIp(char *ep) {
}
}
static
void
mnodeSendAlterVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcEpSet
*
epSet
)
{
static
void
mnodeSendAlterVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcEpSet
*
epSet
)
{
S
MD
AlterVnodeMsg
*
pAlter
=
mnodeBuildVnodeMsg
(
pVgroup
);
SAlterVnodeMsg
*
pAlter
=
mnodeBuildVnodeMsg
(
pVgroup
);
SRpcMsg
rpcMsg
=
{
SRpcMsg
rpcMsg
=
{
.
ahandle
=
NULL
,
.
ahandle
=
NULL
,
.
pCont
=
pAlter
,
.
pCont
=
pAlter
,
.
contLen
=
pAlter
?
sizeof
(
S
MD
AlterVnodeMsg
)
:
0
,
.
contLen
=
pAlter
?
sizeof
(
SAlterVnodeMsg
)
:
0
,
.
code
=
0
,
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_ALTER_VNODE
.
msgType
=
TSDB_MSG_TYPE_MD_ALTER_VNODE
};
};
...
@@ -909,11 +909,11 @@ void mnodeSendAlterVgroupMsg(SVgObj *pVgroup) {
...
@@ -909,11 +909,11 @@ void mnodeSendAlterVgroupMsg(SVgObj *pVgroup) {
}
}
static
void
mnodeSendCreateVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcEpSet
*
epSet
,
void
*
ahandle
)
{
static
void
mnodeSendCreateVnodeMsg
(
SVgObj
*
pVgroup
,
SRpcEpSet
*
epSet
,
void
*
ahandle
)
{
S
MD
CreateVnodeMsg
*
pCreate
=
mnodeBuildVnodeMsg
(
pVgroup
);
SCreateVnodeMsg
*
pCreate
=
mnodeBuildVnodeMsg
(
pVgroup
);
SRpcMsg
rpcMsg
=
{
SRpcMsg
rpcMsg
=
{
.
ahandle
=
ahandle
,
.
ahandle
=
ahandle
,
.
pCont
=
pCreate
,
.
pCont
=
pCreate
,
.
contLen
=
pCreate
?
sizeof
(
S
MD
CreateVnodeMsg
)
:
0
,
.
contLen
=
pCreate
?
sizeof
(
SCreateVnodeMsg
)
:
0
,
.
code
=
0
,
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_CREATE_VNODE
.
msgType
=
TSDB_MSG_TYPE_MD_CREATE_VNODE
};
};
...
@@ -982,8 +982,8 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
...
@@ -982,8 +982,8 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
}
}
}
}
static
S
MD
DropVnodeMsg
*
mnodeBuildDropVnodeMsg
(
int32_t
vgId
)
{
static
SDropVnodeMsg
*
mnodeBuildDropVnodeMsg
(
int32_t
vgId
)
{
S
MDDropVnodeMsg
*
pDrop
=
rpcMallocCont
(
sizeof
(
SMD
DropVnodeMsg
));
S
DropVnodeMsg
*
pDrop
=
rpcMallocCont
(
sizeof
(
S
DropVnodeMsg
));
if
(
pDrop
==
NULL
)
return
NULL
;
if
(
pDrop
==
NULL
)
return
NULL
;
pDrop
->
vgId
=
htonl
(
vgId
);
pDrop
->
vgId
=
htonl
(
vgId
);
...
@@ -991,11 +991,11 @@ static SMDDropVnodeMsg *mnodeBuildDropVnodeMsg(int32_t vgId) {
...
@@ -991,11 +991,11 @@ static SMDDropVnodeMsg *mnodeBuildDropVnodeMsg(int32_t vgId) {
}
}
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpcEpSet
*
epSet
,
void
*
ahandle
)
{
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpcEpSet
*
epSet
,
void
*
ahandle
)
{
S
MD
DropVnodeMsg
*
pDrop
=
mnodeBuildDropVnodeMsg
(
vgId
);
SDropVnodeMsg
*
pDrop
=
mnodeBuildDropVnodeMsg
(
vgId
);
SRpcMsg
rpcMsg
=
{
SRpcMsg
rpcMsg
=
{
.
ahandle
=
ahandle
,
.
ahandle
=
ahandle
,
.
pCont
=
pDrop
,
.
pCont
=
pDrop
,
.
contLen
=
pDrop
?
sizeof
(
S
MD
DropVnodeMsg
)
:
0
,
.
contLen
=
pDrop
?
sizeof
(
SDropVnodeMsg
)
:
0
,
.
code
=
0
,
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_DROP_VNODE
.
msgType
=
TSDB_MSG_TYPE_MD_DROP_VNODE
};
};
...
@@ -1044,7 +1044,7 @@ static void mnodeProcessDropVnodeRsp(SRpcMsg *rpcMsg) {
...
@@ -1044,7 +1044,7 @@ static void mnodeProcessDropVnodeRsp(SRpcMsg *rpcMsg) {
}
}
static
int32_t
mnodeProcessVnodeCfgMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mnodeProcessVnodeCfgMsg
(
SMnodeMsg
*
pMsg
)
{
S
DM
ConfigVnodeMsg
*
pCfg
=
pMsg
->
rpcMsg
.
pCont
;
SConfigVnodeMsg
*
pCfg
=
pMsg
->
rpcMsg
.
pCont
;
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pCfg
->
vgId
=
htonl
(
pCfg
->
vgId
);
pCfg
->
vgId
=
htonl
(
pCfg
->
vgId
);
...
...
src/vnode/inc/vnodeCfg.h
浏览文件 @
582cacc5
...
@@ -21,7 +21,7 @@ extern "C" {
...
@@ -21,7 +21,7 @@ extern "C" {
#endif
#endif
int32_t
vnodeReadCfg
(
SVnodeObj
*
pVnode
);
int32_t
vnodeReadCfg
(
SVnodeObj
*
pVnode
);
int32_t
vnodeWriteCfg
(
S
MD
CreateVnodeMsg
*
pVnodeCfg
);
int32_t
vnodeWriteCfg
(
SCreateVnodeMsg
*
pVnodeCfg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/vnode/src/vnodeCfg.c
浏览文件 @
582cacc5
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#include "vnodeVersion.h"
#include "vnodeVersion.h"
#include "vnodeCfg.h"
#include "vnodeCfg.h"
static
void
vnodeLoadCfg
(
SVnodeObj
*
pVnode
,
S
MD
CreateVnodeMsg
*
vnodeMsg
)
{
static
void
vnodeLoadCfg
(
SVnodeObj
*
pVnode
,
SCreateVnodeMsg
*
vnodeMsg
)
{
strcpy
(
pVnode
->
db
,
vnodeMsg
->
db
);
strcpy
(
pVnode
->
db
,
vnodeMsg
->
db
);
pVnode
->
cfgVersion
=
vnodeMsg
->
cfg
.
cfgVersion
;
pVnode
->
cfgVersion
=
vnodeMsg
->
cfg
.
cfgVersion
;
pVnode
->
tsdbCfg
.
cacheBlockSize
=
vnodeMsg
->
cfg
.
cacheBlockSize
;
pVnode
->
tsdbCfg
.
cacheBlockSize
=
vnodeMsg
->
cfg
.
cacheBlockSize
;
...
@@ -46,7 +46,7 @@ static void vnodeLoadCfg(SVnodeObj *pVnode, SMDCreateVnodeMsg* vnodeMsg) {
...
@@ -46,7 +46,7 @@ static void vnodeLoadCfg(SVnodeObj *pVnode, SMDCreateVnodeMsg* vnodeMsg) {
pVnode
->
syncCfg
.
quorum
=
vnodeMsg
->
cfg
.
quorum
;
pVnode
->
syncCfg
.
quorum
=
vnodeMsg
->
cfg
.
quorum
;
for
(
int
i
=
0
;
i
<
pVnode
->
syncCfg
.
replica
;
++
i
)
{
for
(
int
i
=
0
;
i
<
pVnode
->
syncCfg
.
replica
;
++
i
)
{
S
MD
VnodeDesc
*
node
=
&
vnodeMsg
->
nodes
[
i
];
SVnodeDesc
*
node
=
&
vnodeMsg
->
nodes
[
i
];
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeId
=
node
->
nodeId
;
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeId
=
node
->
nodeId
;
taosGetFqdnPortFromEp
(
node
->
nodeEp
,
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeFqdn
,
&
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodePort
);
taosGetFqdnPortFromEp
(
node
->
nodeEp
,
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeFqdn
,
&
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodePort
);
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodePort
+=
TSDB_PORT_SYNC
;
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodePort
+=
TSDB_PORT_SYNC
;
...
@@ -67,7 +67,7 @@ int32_t vnodeReadCfg(SVnodeObj *pVnode) {
...
@@ -67,7 +67,7 @@ int32_t vnodeReadCfg(SVnodeObj *pVnode) {
cJSON
*
root
=
NULL
;
cJSON
*
root
=
NULL
;
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
bool
nodeChanged
=
false
;
bool
nodeChanged
=
false
;
S
MD
CreateVnodeMsg
vnodeMsg
;
SCreateVnodeMsg
vnodeMsg
;
char
file
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
char
file
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
sprintf
(
file
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
sprintf
(
file
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
...
@@ -226,7 +226,7 @@ int32_t vnodeReadCfg(SVnodeObj *pVnode) {
...
@@ -226,7 +226,7 @@ int32_t vnodeReadCfg(SVnodeObj *pVnode) {
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
cJSON
*
nodeInfo
=
cJSON_GetArrayItem
(
nodeInfos
,
i
);
cJSON
*
nodeInfo
=
cJSON_GetArrayItem
(
nodeInfos
,
i
);
if
(
nodeInfo
==
NULL
)
continue
;
if
(
nodeInfo
==
NULL
)
continue
;
S
MD
VnodeDesc
*
node
=
&
vnodeMsg
.
nodes
[
i
];
SVnodeDesc
*
node
=
&
vnodeMsg
.
nodes
[
i
];
cJSON
*
nodeId
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeId"
);
cJSON
*
nodeId
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeId"
);
if
(
!
nodeId
||
nodeId
->
type
!=
cJSON_Number
)
{
if
(
!
nodeId
||
nodeId
->
type
!=
cJSON_Number
)
{
...
@@ -266,7 +266,7 @@ PARSE_VCFG_ERROR:
...
@@ -266,7 +266,7 @@ PARSE_VCFG_ERROR:
return
ret
;
return
ret
;
}
}
int32_t
vnodeWriteCfg
(
S
MD
CreateVnodeMsg
*
pMsg
)
{
int32_t
vnodeWriteCfg
(
SCreateVnodeMsg
*
pMsg
)
{
char
file
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
char
file
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
sprintf
(
file
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pMsg
->
cfg
.
vgId
);
sprintf
(
file
,
"%s/vnode%d/config.json"
,
tsVnodeDir
,
pMsg
->
cfg
.
vgId
);
...
@@ -301,7 +301,7 @@ int32_t vnodeWriteCfg(SMDCreateVnodeMsg *pMsg) {
...
@@ -301,7 +301,7 @@ int32_t vnodeWriteCfg(SMDCreateVnodeMsg *pMsg) {
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
quorum
\"
: %d,
\n
"
,
pMsg
->
cfg
.
quorum
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
quorum
\"
: %d,
\n
"
,
pMsg
->
cfg
.
quorum
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeInfos
\"
: [{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeInfos
\"
: [{
\n
"
);
for
(
int32_t
i
=
0
;
i
<
pMsg
->
cfg
.
replications
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pMsg
->
cfg
.
replications
;
i
++
)
{
S
MD
VnodeDesc
*
node
=
&
pMsg
->
nodes
[
i
];
SVnodeDesc
*
node
=
&
pMsg
->
nodes
[
i
];
dnodeUpdateEp
(
node
->
nodeId
,
node
->
nodeEp
,
NULL
,
NULL
);
dnodeUpdateEp
(
node
->
nodeId
,
node
->
nodeEp
,
NULL
,
NULL
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeId
\"
: %d,
\n
"
,
node
->
nodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeId
\"
: %d,
\n
"
,
node
->
nodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeEp
\"
:
\"
%s
\"\n
"
,
node
->
nodeEp
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeEp
\"
:
\"
%s
\"\n
"
,
node
->
nodeEp
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
582cacc5
...
@@ -86,7 +86,7 @@ void vnodeCleanupResources() {
...
@@ -86,7 +86,7 @@ void vnodeCleanupResources() {
syncCleanUp
();
syncCleanUp
();
}
}
int32_t
vnodeCreate
(
S
MD
CreateVnodeMsg
*
pVnodeCfg
)
{
int32_t
vnodeCreate
(
SCreateVnodeMsg
*
pVnodeCfg
)
{
int32_t
code
;
int32_t
code
;
SVnodeObj
*
pVnode
=
vnodeAcquire
(
pVnodeCfg
->
cfg
.
vgId
);
SVnodeObj
*
pVnode
=
vnodeAcquire
(
pVnodeCfg
->
cfg
.
vgId
);
...
@@ -171,7 +171,7 @@ int32_t vnodeDrop(int32_t vgId) {
...
@@ -171,7 +171,7 @@ int32_t vnodeDrop(int32_t vgId) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
vnodeAlter
(
void
*
param
,
S
MD
CreateVnodeMsg
*
pVnodeCfg
)
{
int32_t
vnodeAlter
(
void
*
param
,
SCreateVnodeMsg
*
pVnodeCfg
)
{
SVnodeObj
*
pVnode
=
param
;
SVnodeObj
*
pVnode
=
param
;
// vnode in non-ready state and still needs to return success instead of TSDB_CODE_VND_INVALID_STATUS
// vnode in non-ready state and still needs to return success instead of TSDB_CODE_VND_INVALID_STATUS
...
@@ -490,7 +490,7 @@ void *vnodeGetWal(void *pVnode) {
...
@@ -490,7 +490,7 @@ void *vnodeGetWal(void *pVnode) {
return
((
SVnodeObj
*
)
pVnode
)
->
wal
;
return
((
SVnodeObj
*
)
pVnode
)
->
wal
;
}
}
static
void
vnodeBuildVloadMsg
(
SVnodeObj
*
pVnode
,
S
DM
StatusMsg
*
pStatus
)
{
static
void
vnodeBuildVloadMsg
(
SVnodeObj
*
pVnode
,
SStatusMsg
*
pStatus
)
{
int64_t
totalStorage
=
0
;
int64_t
totalStorage
=
0
;
int64_t
compStorage
=
0
;
int64_t
compStorage
=
0
;
int64_t
pointsWritten
=
0
;
int64_t
pointsWritten
=
0
;
...
@@ -534,7 +534,7 @@ int32_t vnodeGetVnodeList(int32_t vnodeList[], int32_t *numOfVnodes) {
...
@@ -534,7 +534,7 @@ int32_t vnodeGetVnodeList(int32_t vnodeList[], int32_t *numOfVnodes) {
}
}
void
vnodeBuildStatusMsg
(
void
*
param
)
{
void
vnodeBuildStatusMsg
(
void
*
param
)
{
S
DM
StatusMsg
*
pStatus
=
param
;
SStatusMsg
*
pStatus
=
param
;
SHashMutableIterator
*
pIter
=
taosHashCreateIter
(
tsDnodeVnodesHash
);
SHashMutableIterator
*
pIter
=
taosHashCreateIter
(
tsDnodeVnodesHash
);
while
(
taosHashIterNext
(
pIter
))
{
while
(
taosHashIterNext
(
pIter
))
{
...
@@ -548,7 +548,7 @@ void vnodeBuildStatusMsg(void *param) {
...
@@ -548,7 +548,7 @@ void vnodeBuildStatusMsg(void *param) {
taosHashDestroyIter
(
pIter
);
taosHashDestroyIter
(
pIter
);
}
}
void
vnodeSetAccess
(
S
DM
VgroupAccess
*
pAccess
,
int32_t
numOfVnodes
)
{
void
vnodeSetAccess
(
SVgroupAccess
*
pAccess
,
int32_t
numOfVnodes
)
{
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfVnodes
;
++
i
)
{
pAccess
[
i
].
vgId
=
htonl
(
pAccess
[
i
].
vgId
);
pAccess
[
i
].
vgId
=
htonl
(
pAccess
[
i
].
vgId
);
SVnodeObj
*
pVnode
=
vnodeAcquire
(
pAccess
[
i
].
vgId
);
SVnodeObj
*
pVnode
=
vnodeAcquire
(
pAccess
[
i
].
vgId
);
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
582cacc5
...
@@ -183,7 +183,7 @@ static int32_t vnodeProcessAlterTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet
...
@@ -183,7 +183,7 @@ static int32_t vnodeProcessAlterTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet
}
}
static
int32_t
vnodeProcessDropStableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
pRet
)
{
static
int32_t
vnodeProcessDropStableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
pRet
)
{
S
MD
DropSTableMsg
*
pTable
=
pCont
;
SDropSTableMsg
*
pTable
=
pCont
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
vDebug
(
"vgId:%d, stable:%s, start to drop"
,
pVnode
->
vgId
,
pTable
->
tableId
);
vDebug
(
"vgId:%d, stable:%s, start to drop"
,
pVnode
->
vgId
,
pTable
->
tableId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录