Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cd8a0e89
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
cd8a0e89
编写于
4月 09, 2022
作者:
D
dapan1121
提交者:
GitHub
4月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11330 from taosdata/feature/qnode
Feature/qnode
上级
2aa6534c
a8f740bc
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
266 addition
and
7 deletion
+266
-7
include/common/tmsg.h
include/common/tmsg.h
+18
-0
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+3
-0
include/util/taoserror.h
include/util/taoserror.h
+1
-0
include/util/tdef.h
include/util/tdef.h
+6
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+58
-0
source/dnode/mgmt/mm/mmHandle.c
source/dnode/mgmt/mm/mmHandle.c
+1
-0
source/dnode/mnode/impl/inc/mndSma.h
source/dnode/mnode/impl/inc/mndSma.h
+1
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+51
-1
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+6
-5
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+33
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+49
-1
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+37
-0
source/util/src/terror.c
source/util/src/terror.c
+1
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
cd8a0e89
...
...
@@ -2305,6 +2305,24 @@ static FORCE_INLINE void* tDecodeTSmaWrapper(void* buf, STSmaWrapper* pSW) {
return
buf
;
}
typedef
struct
{
char
indexFName
[
TSDB_INDEX_FNAME_LEN
];
}
SUserIndexReq
;
int32_t
tSerializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
);
int32_t
tDeserializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
);
typedef
struct
{
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
tblFName
[
TSDB_TABLE_FNAME_LEN
];
char
colName
[
TSDB_COL_NAME_LEN
];
char
indexType
[
TSDB_INDEX_TYPE_LEN
];
char
indexExts
[
TSDB_INDEX_EXTS_LEN
];
}
SUserIndexRsp
;
int32_t
tSerializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUserIndexRsp
*
pRsp
);
int32_t
tDeserializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexRsp
*
pRsp
);
typedef
struct
{
int8_t
mqMsgType
;
int32_t
code
;
...
...
include/common/tmsgdef.h
浏览文件 @
cd8a0e89
...
...
@@ -156,6 +156,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_STREAM
,
"mnode-alter-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_STREAM
,
"mnode-drop-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_DB_CFG
,
"mnode-get-db-cfg"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_INDEX
,
"mnode-get-index"
,
NULL
,
NULL
)
// Requests handled by VNODE
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
...
...
include/libs/catalog/catalog.h
浏览文件 @
cd8a0e89
...
...
@@ -78,6 +78,7 @@ typedef struct SDbVgVersion {
}
SDbVgVersion
;
typedef
SDbCfgRsp
SDbCfgInfo
;
typedef
SUserIndexRsp
SIndexInfo
;
int32_t
catalogInit
(
SCatalogCfg
*
cfg
);
...
...
@@ -221,6 +222,8 @@ int32_t catalogGetExpiredDBs(SCatalog* pCatalog, SDbVgVersion **dbs, uint32_t *n
int32_t
catalogGetDBCfg
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbFName
,
SDbCfgInfo
*
pDbCfg
);
int32_t
catalogGetIndexInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
indexName
,
SIndexInfo
*
pInfo
);
/**
* Destroy catalog and relase all resources
...
...
include/util/taoserror.h
浏览文件 @
cd8a0e89
...
...
@@ -217,6 +217,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0385)
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0386)
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x0387)
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388)
// mnode-vgroup
#define TSDB_CODE_MND_VGROUP_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0390)
...
...
include/util/tdef.h
浏览文件 @
cd8a0e89
...
...
@@ -109,6 +109,9 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_INS_TABLE_USER_USERS "user_users"
#define TSDB_INS_TABLE_VGROUPS "vgroups"
#define TSDB_INDEX_TYPE_SMA "SMA"
#define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT"
#define TSDB_INS_USER_STABLES_DBNAME_COLID 2
#define TSDB_TICK_PER_SECOND(precision) \
...
...
@@ -213,6 +216,9 @@ typedef enum ELogicConditionType {
#define TSDB_FUNC_MAX_RETRIEVE 1024
#define TSDB_INDEX_NAME_LEN 65 // 64 + 1 '\0'
#define TSDB_INDEX_TYPE_LEN 10
#define TSDB_INDEX_EXTS_LEN 256
#define TSDB_INDEX_FNAME_LEN (TSDB_DB_FNAME_LEN + TSDB_INDEX_NAME_LEN + TSDB_NAME_DELIMITER_LEN)
#define TSDB_TYPE_STR_MAX_LEN 32
#define TSDB_TABLE_FNAME_LEN (TSDB_DB_FNAME_LEN + TSDB_TABLE_NAME_LEN + TSDB_NAME_DELIMITER_LEN)
#define TSDB_TOPIC_FNAME_LEN TSDB_TABLE_FNAME_LEN
...
...
source/common/src/tmsg.c
浏览文件 @
cd8a0e89
...
...
@@ -2033,6 +2033,64 @@ int32_t tDeserializeSDbCfgRsp(void* buf, int32_t bufLen, SDbCfgRsp* pRsp) {
return
0
;
}
int32_t
tSerializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
indexFName
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
indexFName
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUserIndexRsp
*
pRsp
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
tblFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
colName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
indexType
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
indexExts
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexRsp
*
pRsp
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
tblFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
colName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
indexType
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
indexExts
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
...
...
source/dnode/mgmt/mm/mmHandle.c
浏览文件 @
cd8a0e89
...
...
@@ -179,6 +179,7 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_CREATE_STREAM
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_DEPLOY_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GET_DB_CFG
,
mmProcessReadMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GET_INDEX
,
mmProcessReadMsg
,
DEFAULT_HANDLE
);
// Requests handled by VNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CONN_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
...
...
source/dnode/mnode/impl/inc/mndSma.h
浏览文件 @
cd8a0e89
...
...
@@ -26,6 +26,7 @@ int32_t mndInitSma(SMnode *pMnode);
void
mndCleanupSma
(
SMnode
*
pMnode
);
SSmaObj
*
mndAcquireSma
(
SMnode
*
pMnode
,
char
*
smaName
);
void
mndReleaseSma
(
SMnode
*
pMnode
,
SSmaObj
*
pSma
);
int32_t
mndProcessGetSmaReq
(
SMnode
*
pMnode
,
SUserIndexReq
*
indexReq
,
SUserIndexRsp
*
rsp
,
bool
*
exist
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
cd8a0e89
...
...
@@ -22,6 +22,7 @@
#include "mndTrans.h"
#include "mndUser.h"
#include "mndVgroup.h"
#include "mndSma.h"
#define TSDB_DB_VER_NUMBER 1
#define TSDB_DB_RESERVE_SIZE 64
...
...
@@ -40,7 +41,8 @@ static int32_t mndProcessCompactDbReq(SNodeMsg *pReq);
static
int32_t
mndGetDbMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveDbs
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextDb
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessGetDbCfgReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessGetDbCfgReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessGetIndexReq
(
SNodeMsg
*
pReq
);
int32_t
mndInitDb
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_DB
,
...
...
@@ -58,6 +60,7 @@ int32_t mndInitDb(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_SYNC_DB
,
mndProcessSyncDbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_COMPACT_DB
,
mndProcessCompactDbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_DB_CFG
,
mndProcessGetDbCfgReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_INDEX
,
mndProcessGetIndexReq
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_DB
,
mndGetDbMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_DB
,
mndRetrieveDbs
);
...
...
@@ -1661,3 +1664,50 @@ static void mndCancelGetNextDb(SMnode *pMnode, void *pIter) {
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
}
static
int32_t
mndProcessGetIndexReq
(
SNodeMsg
*
pReq
)
{
SUserIndexReq
indexReq
=
{
0
};
SMnode
*
pMnode
=
pReq
->
pNode
;
int32_t
code
=
-
1
;
SUserIndexRsp
rsp
=
{
0
};
bool
exist
=
false
;
if
(
tDeserializeSUserIndexReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
indexReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
code
=
mndProcessGetSmaReq
(
pMnode
,
&
indexReq
,
&
rsp
,
&
exist
);
if
(
code
)
{
goto
_OVER
;
}
if
(
!
exist
)
{
//TODO GET INDEX FROM FULLTEXT
code
=
-
1
;
terrno
=
TSDB_CODE_MND_DB_INDEX_NOT_EXIST
;
}
else
{
int32_t
contLen
=
tSerializeSUserIndexRsp
(
NULL
,
0
,
&
rsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
-
1
;
goto
_OVER
;
}
tSerializeSUserIndexRsp
(
pRsp
,
contLen
,
&
rsp
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
code
=
0
;
}
_OVER:
if
(
code
!=
0
)
{
mError
(
"failed to get index %s since %s"
,
indexReq
.
indexFName
,
terrstr
());
}
return
code
;
}
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
cd8a0e89
...
...
@@ -18,6 +18,7 @@
#define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
//!!!! Note: only APPEND columns in below tables, NO insert !!!!
static
const
SInfosTableSchema
dnodesSchema
[]
=
{
...
...
@@ -79,11 +80,11 @@ static const SInfosTableSchema userFuncSchema[] = {
{.
name
=
"status"
,
.
bytes
=
10
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
};
static
const
SInfosTableSchema
userIdxSchema
[]
=
{
{.
name
=
"db_name"
,
.
bytes
=
32
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"table_name"
,
.
bytes
=
SYSTABLE_SCH_
DB
_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_database"
,
.
bytes
=
32
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_name"
,
.
bytes
=
SYSTABLE_SCH_
DB
_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"column_name"
,
.
bytes
=
64
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"table_name"
,
.
bytes
=
SYSTABLE_SCH_
TABLE
_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_database"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_name"
,
.
bytes
=
SYSTABLE_SCH_
TABLE
_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"column_name"
,
.
bytes
=
SYSTABLE_SCH_COL_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_type"
,
.
bytes
=
10
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_extensions"
,
.
bytes
=
256
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
};
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
cd8a0e89
...
...
@@ -688,6 +688,39 @@ _OVER:
return
code
;
}
int32_t
mndProcessGetSmaReq
(
SMnode
*
pMnode
,
SUserIndexReq
*
indexReq
,
SUserIndexRsp
*
rsp
,
bool
*
exist
)
{
int32_t
code
=
-
1
;
SSmaObj
*
pSma
=
NULL
;
pSma
=
mndAcquireSma
(
pMnode
,
indexReq
->
indexFName
);
if
(
pSma
==
NULL
)
{
*
exist
=
false
;
return
0
;
}
memcpy
(
rsp
->
dbFName
,
pSma
->
db
,
sizeof
(
pSma
->
db
));
memcpy
(
rsp
->
tblFName
,
pSma
->
stb
,
sizeof
(
pSma
->
stb
));
strcpy
(
rsp
->
indexType
,
TSDB_INDEX_TYPE_SMA
);
SNodeList
*
pList
=
NULL
;
int32_t
extOffset
=
0
;
code
=
nodesStringToList
(
pSma
->
expr
,
&
pList
);
if
(
0
==
code
)
{
SNode
*
node
=
NULL
;
FOREACH
(
node
,
pList
)
{
SFunctionNode
*
pFunc
=
(
SFunctionNode
*
)
node
;
extOffset
+=
snprintf
(
rsp
->
indexExts
+
extOffset
,
sizeof
(
rsp
->
indexExts
)
-
extOffset
-
1
,
"%s%s"
,
(
extOffset
?
","
:
""
),
pFunc
->
functionName
);
}
*
exist
=
true
;
}
mndReleaseSma
(
pMnode
,
pSma
);
return
code
;
}
static
int32_t
mndProcessVDropSmaRsp
(
SNodeMsg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
cd8a0e89
...
...
@@ -606,6 +606,43 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps,
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgGetIndexInfoFromMnode
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
indexName
,
SIndexInfo
*
out
)
{
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
ctgDebug
(
"try to get index from mnode, indexName:%s"
,
indexName
);
int32_t
code
=
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_INDEX
)]((
void
*
)
indexName
,
&
msg
,
0
,
&
msgLen
);
if
(
code
)
{
ctgError
(
"Build get index msg failed, code:%x, db:%s"
,
code
,
indexName
);
CTG_ERR_RET
(
code
);
}
SRpcMsg
rpcMsg
=
{
.
msgType
=
TDMT_MND_GET_INDEX
,
.
pCont
=
msg
,
.
contLen
=
msgLen
,
};
SRpcMsg
rpcRsp
=
{
0
};
rpcSendRecv
(
pRpc
,
(
SEpSet
*
)
pMgmtEps
,
&
rpcMsg
,
&
rpcRsp
);
if
(
TSDB_CODE_SUCCESS
!=
rpcRsp
.
code
)
{
ctgError
(
"error rsp for get index, error:%s, indexName:%s"
,
tstrerror
(
rpcRsp
.
code
),
indexName
);
CTG_ERR_RET
(
rpcRsp
.
code
);
}
code
=
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_INDEX
)](
out
,
rpcRsp
.
pCont
,
rpcRsp
.
contLen
);
if
(
code
)
{
ctgError
(
"Process get index rsp failed, code:%x, indexName:%s"
,
code
,
indexName
);
CTG_ERR_RET
(
code
);
}
ctgDebug
(
"Got index from mnode, indexName:%s"
,
indexName
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgIsTableMetaExistInCache
(
SCatalog
*
pCtg
,
char
*
dbFName
,
char
*
tbName
,
int32_t
*
exist
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
...
...
@@ -1776,7 +1813,7 @@ int32_t ctgGetTableMeta(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
if
(
NULL
==
pCtg
||
NULL
==
pRpc
||
NULL
==
pMgmtEps
||
NULL
==
pTableName
||
NULL
==
pTableMeta
)
{
CTG_ERR_RET
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
bool
inCache
=
false
;
int32_t
code
=
0
;
uint64_t
dbId
=
0
;
...
...
@@ -2764,6 +2801,17 @@ int32_t catalogGetDBCfg(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
CTG_API_LEAVE
(
ctgGetDBCfgFromMnode
(
pCtg
,
pRpc
,
pMgmtEps
,
dbFName
,
pDbCfg
));
}
int32_t
catalogGetIndexInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
indexName
,
SIndexInfo
*
pInfo
)
{
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
pRpc
||
NULL
==
pMgmtEps
||
NULL
==
indexName
||
NULL
==
pInfo
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
CTG_API_LEAVE
(
ctgGetIndexInfoFromMnode
(
pCtg
,
pRpc
,
pMgmtEps
,
indexName
,
pInfo
));
}
void
catalogDestroy
(
void
)
{
qInfo
(
"start to destroy catalog"
);
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
cd8a0e89
...
...
@@ -139,6 +139,25 @@ int32_t queryBuildGetDBCfgMsg(void *input, char **msg, int32_t msgSize, int32_t
return
TSDB_CODE_SUCCESS
;
}
int32_t
queryBuildGetIndexMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
{
if
(
NULL
==
msg
||
NULL
==
msgLen
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
SUserIndexReq
indexReq
=
{
0
};
strcpy
(
indexReq
.
indexFName
,
input
);
int32_t
bufLen
=
tSerializeSUserIndexReq
(
NULL
,
0
,
&
indexReq
);
void
*
pBuf
=
rpcMallocCont
(
bufLen
);
tSerializeSUserIndexReq
(
pBuf
,
bufLen
,
&
indexReq
);
*
msg
=
pBuf
;
*
msgLen
=
bufLen
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
queryProcessUseDBRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
SUseDbOutput
*
pOut
=
output
;
SUseDbRsp
usedbRsp
=
{
0
};
...
...
@@ -343,6 +362,22 @@ int32_t queryProcessGetDbCfgRsp(void *output, char *msg, int32_t msgSize) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
queryProcessGetIndexRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
SUserIndexRsp
out
=
{
0
};
if
(
NULL
==
output
||
NULL
==
msg
||
msgSize
<=
0
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
if
(
tDeserializeSUserIndexRsp
(
msg
,
msgSize
,
&
out
)
!=
0
)
{
qError
(
"tDeserializeSUserIndexRsp failed, msgSize:%d"
,
msgSize
);
return
TSDB_CODE_INVALID_MSG
;
}
memcpy
(
output
,
&
out
,
sizeof
(
out
));
return
TSDB_CODE_SUCCESS
;
}
void
initQueryModuleMsgHandle
()
{
queryBuildMsg
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)]
=
queryBuildTableMetaReqMsg
;
...
...
@@ -350,12 +385,14 @@ void initQueryModuleMsgHandle() {
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_USE_DB
)]
=
queryBuildUseDbMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_QNODE_LIST
)]
=
queryBuildQnodeListMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_DB_CFG
)]
=
queryBuildGetDBCfgMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_INDEX
)]
=
queryBuildGetIndexMsg
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_USE_DB
)]
=
queryProcessUseDBRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_QNODE_LIST
)]
=
queryProcessQnodeListRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_DB_CFG
)]
=
queryProcessGetDbCfgRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_INDEX
)]
=
queryProcessGetIndexRsp
;
}
#pragma GCC diagnostic pop
source/util/src/terror.c
浏览文件 @
cd8a0e89
...
...
@@ -224,6 +224,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB, "Invalid database name
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_OPTION
,
"Invalid database options"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_ACCT
,
"Invalid database account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_OPTION_UNCHANGED
,
"Database options not changed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_INDEX_NOT_EXIST
,
"Index not exist"
)
// mnode-vgroup
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE
,
"Vgroup already in dnode"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录