Merge pull request #11343 from taosdata/feature/node
feat[cluster]: create and drop qnode
This commit is contained in:
commit
d758a102f8
|
@ -1023,10 +1023,11 @@ int32_t tDeserializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
} SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq;
|
} SMCreateMnodeReq, SMDropMnodeReq, SDDropMnodeReq, SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq, SMCreateSnodeReq, SMDropSnodeReq,
|
||||||
|
SDCreateSnodeReq, SDDropSnodeReq, SMCreateBnodeReq, SMDropBnodeReq, SDCreateBnodeReq, SDDropBnodeReq;
|
||||||
|
|
||||||
int32_t tSerializeSMCreateDropMnodeReq(void* buf, int32_t bufLen, SMCreateMnodeReq* pReq);
|
int32_t tSerializeSCreateDropMQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
||||||
int32_t tDeserializeSMCreateDropMnodeReq(void* buf, int32_t bufLen, SMCreateMnodeReq* pReq);
|
int32_t tDeserializeSCreateDropMQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
|
@ -1037,14 +1038,6 @@ typedef struct {
|
||||||
int32_t tSerializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
int32_t tSerializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
||||||
int32_t tDeserializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
int32_t tDeserializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int32_t dnodeId;
|
|
||||||
} SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq, SMCreateSnodeReq, SMDropSnodeReq,
|
|
||||||
SDCreateSnodeReq, SDDropSnodeReq, SMCreateBnodeReq, SMDropBnodeReq, SDCreateBnodeReq, SDDropBnodeReq;
|
|
||||||
|
|
||||||
int32_t tSerializeSMCreateDropQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
|
||||||
int32_t tDeserializeSMCreateDropQSBNodeReq(void* buf, int32_t bufLen, SMCreateQnodeReq* pReq);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char sql[TSDB_SHOW_SQL_LEN];
|
char sql[TSDB_SHOW_SQL_LEN];
|
||||||
int32_t queryId;
|
int32_t queryId;
|
||||||
|
|
|
@ -64,31 +64,35 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016)
|
#define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016)
|
||||||
|
|
||||||
//common & util
|
//common & util
|
||||||
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
|
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0100)
|
||||||
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0101)
|
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0101)
|
||||||
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0102)
|
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0102)
|
||||||
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0103)
|
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0103)
|
||||||
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104)
|
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0104)
|
||||||
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0106)
|
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0105)
|
||||||
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0107)
|
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0106)
|
||||||
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0108)
|
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0107)
|
||||||
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0109)
|
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0108)
|
||||||
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x010A)
|
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x0109)
|
||||||
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x010B)
|
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x010A)
|
||||||
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x010C)
|
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x010B)
|
||||||
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x010D)
|
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x010C)
|
||||||
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x010E)
|
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x010D)
|
||||||
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x010F)
|
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010E)
|
||||||
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0110)
|
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010F)
|
||||||
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0111)
|
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110)
|
||||||
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0112)
|
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0111)
|
||||||
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0113)
|
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0112)
|
||||||
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0114)
|
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0113)
|
||||||
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0115)
|
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0114)
|
||||||
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x0120)
|
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x0115)
|
||||||
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x0121)
|
|
||||||
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x0122)
|
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0140)
|
||||||
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0123)
|
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0141)
|
||||||
|
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0152)
|
||||||
|
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0153)
|
||||||
|
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0154)
|
||||||
|
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0155)
|
||||||
|
|
||||||
//client
|
//client
|
||||||
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
|
||||||
|
@ -284,17 +288,9 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0402)
|
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0402)
|
||||||
|
|
||||||
// dnode
|
// dnode
|
||||||
#define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x04A0)
|
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
|
||||||
#define TSDB_CODE_DND_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
|
|
||||||
#define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x04A2)
|
|
||||||
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A3)
|
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A3)
|
||||||
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A4)
|
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A4)
|
||||||
#define TSDB_CODE_NODE_PARSE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x04A5)
|
|
||||||
#define TSDB_CODE_NODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A6)
|
|
||||||
#define TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A7)
|
|
||||||
#define TSDB_CODE_DND_VNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A8)
|
|
||||||
#define TSDB_CODE_DND_VNODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A9)
|
|
||||||
#define TSDB_CODE_DND_VNODE_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x04AA)
|
|
||||||
|
|
||||||
// vnode
|
// vnode
|
||||||
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
|
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
|
||||||
|
|
|
@ -1203,7 +1203,7 @@ int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
int32_t tSerializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
||||||
SCoder encoder = {0};
|
SCoder encoder = {0};
|
||||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||||
|
|
||||||
|
@ -1216,7 +1216,7 @@ int32_t tSerializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnod
|
||||||
return tlen;
|
return tlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tDeserializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
int32_t tDeserializeSCreateDropMQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) {
|
||||||
SCoder decoder = {0};
|
SCoder decoder = {0};
|
||||||
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
|
||||||
|
|
||||||
|
@ -1257,14 +1257,6 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tSerializeSMCreateDropMnodeReq(void *buf, int32_t bufLen, SMCreateMnodeReq *pReq) {
|
|
||||||
return tSerializeSMCreateDropQSBNodeReq(buf, bufLen, (SMCreateQnodeReq *)pReq);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tDeserializeSMCreateDropMnodeReq(void *buf, int32_t bufLen, SMCreateMnodeReq *pReq) {
|
|
||||||
return tDeserializeSMCreateDropQSBNodeReq(buf, bufLen, (SMCreateQnodeReq *)pReq);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t tSerializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq) {
|
int32_t tSerializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq) {
|
||||||
SCoder encoder = {0};
|
SCoder encoder = {0};
|
||||||
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "bmInt.h"
|
#include "bmInt.h"
|
||||||
|
|
||||||
void bmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonBmInfo *bmInfo) {
|
void bmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonBmInfo *bmInfo) {}
|
||||||
}
|
|
||||||
|
|
||||||
int32_t bmProcessGetMonBmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
int32_t bmProcessGetMonBmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
||||||
SMonBmInfo bmInfo = {0};
|
SMonBmInfo bmInfo = {0};
|
||||||
|
@ -49,13 +48,13 @@ int32_t bmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to create bnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
dError("failed to create bnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,13 +67,13 @@ int32_t bmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to drop bnode since %s", terrstr());
|
dError("failed to drop bnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "bmInt.h"
|
#include "bmInt.h"
|
||||||
|
|
||||||
static void bmSendErrorRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
static void bmSendErrorRsp(SNodeMsg *pMsg, int32_t code) {
|
||||||
SRpcMsg rpcRsp = {.handle = pMsg->rpcMsg.handle, .ahandle = pMsg->rpcMsg.ahandle, .code = code};
|
SRpcMsg rpcRsp = {.handle = pMsg->rpcMsg.handle, .ahandle = pMsg->rpcMsg.ahandle, .code = code};
|
||||||
tmsgSendRsp(&rpcRsp);
|
tmsgSendRsp(&rpcRsp);
|
||||||
|
|
||||||
|
@ -25,15 +25,17 @@ static void bmSendErrorRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code)
|
||||||
taosFreeQitem(pMsg);
|
taosFreeQitem(pMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bmSendErrorRsps(SMgmtWrapper *pWrapper, STaosQall *qall, int32_t numOfMsgs, int32_t code) {
|
static void bmSendErrorRsps(STaosQall *qall, int32_t numOfMsgs, int32_t code) {
|
||||||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
||||||
SNodeMsg *pMsg = NULL;
|
SNodeMsg *pMsg = NULL;
|
||||||
taosGetQitem(qall, (void **)&pMsg);
|
taosGetQitem(qall, (void **)&pMsg);
|
||||||
bmSendErrorRsp(pWrapper, pMsg, code);
|
if (pMsg != NULL) {
|
||||||
|
bmSendErrorRsp(pMsg, code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
static inline void bmSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||||
.ahandle = pMsg->rpcMsg.ahandle,
|
.ahandle = pMsg->rpcMsg.ahandle,
|
||||||
.code = code,
|
.code = code,
|
||||||
|
@ -42,20 +44,22 @@ static inline void bmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void bmProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, get from bnode monitor queue", pMsg);
|
dTrace("msg:%p, get from bnode-monitor queue", pMsg);
|
||||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
if (pMsg->rpcMsg.msgType == TDMT_MON_BM_INFO) {
|
if (pMsg->rpcMsg.msgType == TDMT_MON_BM_INFO) {
|
||||||
code = bmProcessGetMonBmInfoReq(pMgmt->pWrapper, pMsg);
|
code = bmProcessGetMonBmInfoReq(pMgmt->pWrapper, pMsg);
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRpc->msgType & 1U) {
|
if (pRpc->msgType & 1U) {
|
||||||
if (code != 0 && terrno != 0) code = terrno;
|
if (code != 0 && terrno != 0) code = terrno;
|
||||||
bmSendRsp(pMgmt->pWrapper, pMsg, code);
|
bmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -64,21 +68,22 @@ static void bmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
|
||||||
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
SBnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
SMgmtWrapper *pWrapper = pMgmt->pWrapper;
|
|
||||||
|
|
||||||
SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SNodeMsg *));
|
SArray *pArray = taosArrayInit(numOfMsgs, sizeof(SNodeMsg *));
|
||||||
if (pArray == NULL) {
|
if (pArray == NULL) {
|
||||||
bmSendErrorRsps(pWrapper, qall, numOfMsgs, TSDB_CODE_OUT_OF_MEMORY);
|
bmSendErrorRsps(qall, numOfMsgs, TSDB_CODE_OUT_OF_MEMORY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
||||||
SNodeMsg *pMsg = NULL;
|
SNodeMsg *pMsg = NULL;
|
||||||
taosGetQitem(qall, (void **)&pMsg);
|
taosGetQitem(qall, (void **)&pMsg);
|
||||||
dTrace("msg:%p, will be processed in bnode queue", pMsg);
|
if (pMsg != NULL) {
|
||||||
if (taosArrayPush(pArray, &pMsg) == NULL) {
|
dTrace("msg:%p, get from bnode-write queue", pMsg);
|
||||||
bmSendErrorRsp(pWrapper, pMsg, TSDB_CODE_OUT_OF_MEMORY);
|
if (taosArrayPush(pArray, &pMsg) == NULL) {
|
||||||
|
bmSendErrorRsp(pMsg, TSDB_CODE_OUT_OF_MEMORY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,9 +91,11 @@ static void bmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
|
||||||
|
|
||||||
for (size_t i = 0; i < numOfMsgs; i++) {
|
for (size_t i = 0; i < numOfMsgs; i++) {
|
||||||
SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i);
|
SNodeMsg *pMsg = *(SNodeMsg **)taosArrayGet(pArray, i);
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
if (pMsg != NULL) {
|
||||||
rpcFreeCont(pMsg->rpcMsg.pCont);
|
dTrace("msg:%p, is freed", pMsg);
|
||||||
taosFreeQitem(pMsg);
|
rpcFreeCont(pMsg->rpcMsg.pCont);
|
||||||
|
taosFreeQitem(pMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
taosArrayDestroy(pArray);
|
taosArrayDestroy(pArray);
|
||||||
}
|
}
|
||||||
|
@ -120,12 +127,12 @@ int32_t bmStartWorker(SBnodeMgmt *pMgmt) {
|
||||||
|
|
||||||
if (tsMultiProcess) {
|
if (tsMultiProcess) {
|
||||||
SSingleWorkerCfg mCfg = {
|
SSingleWorkerCfg mCfg = {
|
||||||
.min = 1, .max = 1, .name = "bnode-monitor", .fp = (FItem)bmProcessMonQueue, .param = pMgmt};
|
.min = 1, .max = 1, .name = "bnode-monitor", .fp = (FItem)bmProcessMonitorQueue, .param = pMgmt};
|
||||||
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
||||||
dError("failed to start bnode-monitor worker since %s", terrstr());
|
dError("failed to start bnode-monitor worker since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dDebug("bnode workers are initialized");
|
dDebug("bnode workers are initialized");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,7 +21,7 @@ static bool dmIsEpChanged(SDnodeMgmt *pMgmt, int32_t dnodeId, const char *ep);
|
||||||
static void dmResetDnodes(SDnodeMgmt *pMgmt, SArray *dnodeEps);
|
static void dmResetDnodes(SDnodeMgmt *pMgmt, SArray *dnodeEps);
|
||||||
|
|
||||||
int32_t dmReadFile(SDnodeMgmt *pMgmt) {
|
int32_t dmReadFile(SDnodeMgmt *pMgmt) {
|
||||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 256 * 1024;
|
int32_t maxLen = 256 * 1024;
|
||||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||||
|
|
|
@ -90,7 +90,7 @@ static int32_t dndNewProc(SMgmtWrapper *pWrapper, EDndType n) {
|
||||||
|
|
||||||
static void dndProcessProcHandle(void *handle) {
|
static void dndProcessProcHandle(void *handle) {
|
||||||
dWarn("handle:%p, the child process dies and send an offline rsp", handle);
|
dWarn("handle:%p, the child process dies and send an offline rsp", handle);
|
||||||
SRpcMsg rpcMsg = {.handle = handle, .code = TSDB_CODE_DND_OFFLINE};
|
SRpcMsg rpcMsg = {.handle = handle, .code = TSDB_CODE_NODE_OFFLINE};
|
||||||
rpcSendResponse(&rpcMsg);
|
rpcSendResponse(&rpcMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#define MAXLEN 1024
|
#define MAXLEN 1024
|
||||||
|
|
||||||
int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed) {
|
int32_t dndReadFile(SMgmtWrapper *pWrapper, bool *pDeployed) {
|
||||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
int64_t len = 0;
|
int64_t len = 0;
|
||||||
char content[MAXLEN + 1] = {0};
|
char content[MAXLEN + 1] = {0};
|
||||||
cJSON *root = NULL;
|
cJSON *root = NULL;
|
||||||
|
@ -159,7 +159,7 @@ int32_t dndReadShmFile(SDnode *pDnode) {
|
||||||
if (taosReadFile(pFile, content, MAXLEN) > 0) {
|
if (taosReadFile(pFile, content, MAXLEN) > 0) {
|
||||||
root = cJSON_Parse(content);
|
root = cJSON_Parse(content);
|
||||||
if (root == NULL) {
|
if (root == NULL) {
|
||||||
terrno = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
terrno = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
dError("failed to read %s since invalid json format", file);
|
dError("failed to read %s since invalid json format", file);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ static void dndProcessMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
||||||
|
|
||||||
if (isReq && pMsg->pCont == NULL) {
|
if (isReq && pMsg->pCont == NULL) {
|
||||||
dError("req:%s not processed since its empty, handle:%p app:%p", TMSG_INFO(msgType), pMsg->handle, pMsg->ahandle);
|
dError("req:%s not processed since its empty, handle:%p app:%p", TMSG_INFO(msgType), pMsg->handle, pMsg->ahandle);
|
||||||
SRpcMsg rspMsg = {.handle = pMsg->handle, .code = TSDB_CODE_DND_INVALID_MSG_LEN, .ahandle = pMsg->ahandle};
|
SRpcMsg rspMsg = {.handle = pMsg->handle, .code = TSDB_CODE_INVALID_MSG_LEN, .ahandle = pMsg->ahandle};
|
||||||
rpcSendResponse(&rspMsg);
|
rpcSendResponse(&rspMsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ int32_t dndInitMsgHandle(SDnode *pDnode) {
|
||||||
|
|
||||||
static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
static int32_t dndSendRpcReq(STransMgmt *pMgmt, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
||||||
if (pMgmt->clientRpc == NULL) {
|
if (pMgmt->clientRpc == NULL) {
|
||||||
terrno = TSDB_CODE_DND_OFFLINE;
|
terrno = TSDB_CODE_NODE_OFFLINE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ static void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
|
||||||
|
|
||||||
static int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
static int32_t dndSendReq(SMgmtWrapper *pWrapper, const SEpSet *pEpSet, SRpcMsg *pReq) {
|
||||||
if (dndGetStatus(pWrapper->pDnode) != DND_STAT_RUNNING) {
|
if (dndGetStatus(pWrapper->pDnode) != DND_STAT_RUNNING) {
|
||||||
terrno = TSDB_CODE_DND_OFFLINE;
|
terrno = TSDB_CODE_NODE_OFFLINE;
|
||||||
dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle);
|
dError("failed to send rpc msg since %s, handle:%p", terrstr(), pReq->handle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "mmInt.h"
|
#include "mmInt.h"
|
||||||
|
|
||||||
int32_t mmReadFile(SMnodeMgmt *pMgmt, bool *pDeployed) {
|
int32_t mmReadFile(SMnodeMgmt *pMgmt, bool *pDeployed) {
|
||||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 4096;
|
int32_t maxLen = 4096;
|
||||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||||
|
|
|
@ -57,7 +57,7 @@ int32_t mmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.replica <= 1 || createReq.dnodeId != pDnode->dnodeId) {
|
if (createReq.replica <= 1 || createReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to create mnode since %s", terrstr());
|
dError("failed to create mnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -70,13 +70,13 @@ int32_t mmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
if (tDeserializeSMCreateDropMnodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to drop mnode since %s", terrstr());
|
dError("failed to drop mnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +95,7 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alterReq.dnodeId != pDnode->dnodeId) {
|
if (alterReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to alter mnode since %s", terrstr());
|
dError("failed to alter mnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "qmInt.h"
|
#include "qmInt.h"
|
||||||
|
|
||||||
void qmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonQmInfo *qmInfo) {
|
void qmGetMonitorInfo(SMgmtWrapper *pWrapper, SMonQmInfo *qmInfo) {}
|
||||||
}
|
|
||||||
|
|
||||||
int32_t qmProcessGetMonQmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
int32_t qmProcessGetMonQmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
|
||||||
SMonQmInfo qmInfo = {0};
|
SMonQmInfo qmInfo = {0};
|
||||||
|
@ -49,14 +48,14 @@ int32_t qmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to create qnode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
dError("failed to create qnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return qmOpen(pWrapper);
|
return qmOpen(pWrapper);
|
||||||
|
@ -68,13 +67,13 @@ int32_t qmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to drop qnode since %s", terrstr());
|
dError("failed to drop qnode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "qmInt.h"
|
#include "qmInt.h"
|
||||||
|
|
||||||
static inline void qmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
static inline void qmSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||||
.ahandle = pMsg->rpcMsg.ahandle,
|
.ahandle = pMsg->rpcMsg.ahandle,
|
||||||
.code = code,
|
.code = code,
|
||||||
|
@ -25,20 +25,22 @@ static inline void qmSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
||||||
tmsgSendRsp(&rsp);
|
tmsgSendRsp(&rsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void qmProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, get from qnode monitor queue", pMsg);
|
dTrace("msg:%p, get from qnode-monitor queue", pMsg);
|
||||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
||||||
code = qmProcessGetMonQmInfoReq(pMgmt->pWrapper, pMsg);
|
code = qmProcessGetMonQmInfoReq(pMgmt->pWrapper, pMsg);
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRpc->msgType & 1U) {
|
if (pRpc->msgType & 1U) {
|
||||||
if (code != 0 && terrno != 0) code = terrno;
|
if (code != 0 && terrno != 0) code = terrno;
|
||||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
qmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -49,10 +51,12 @@ static void qmProcessMonQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, will be processed in qnode-query queue", pMsg);
|
dTrace("msg:%p, get from qnode-query queue", pMsg);
|
||||||
int32_t code = qndProcessQueryMsg(pMgmt->pQnode, &pMsg->rpcMsg);
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
if (code != 0) {
|
int32_t code = qndProcessQueryMsg(pMgmt->pQnode, pRpc);
|
||||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
|
||||||
|
if (pRpc->msgType & 1U && code != 0) {
|
||||||
|
qmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -63,10 +67,12 @@ static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
static void qmProcessFetchQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void qmProcessFetchQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
SQnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, will be processed in qnode-fetch queue", pMsg);
|
dTrace("msg:%p, get from qnode-fetch queue", pMsg);
|
||||||
int32_t code = qndProcessFetchMsg(pMgmt->pQnode, &pMsg->rpcMsg);
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
if (code != 0) {
|
int32_t code = qndProcessFetchMsg(pMgmt->pQnode, pRpc);
|
||||||
qmSendRsp(pMgmt->pWrapper, pMsg, code);
|
|
||||||
|
if (pRpc->msgType & 1U && code != 0) {
|
||||||
|
qmSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -92,11 +98,8 @@ int32_t qmProcessFetchMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t qmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
int32_t qmProcessMonitorMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
||||||
SSingleWorker *pWorker = &pMgmt->monitorWorker;
|
qmPutMsgToWorker(&pMgmt->monitorWorker, pMsg);
|
||||||
|
|
||||||
dTrace("msg:%p, put into worker:%s", pMsg, pWorker->name);
|
|
||||||
taosWriteQitem(pWorker->queue, pMsg);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +128,7 @@ int32_t qmPutMsgToFetchQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc) {
|
||||||
int32_t qmGetQueueSize(SMgmtWrapper *pWrapper, int32_t vgId, EQueueType qtype) {
|
int32_t qmGetQueueSize(SMgmtWrapper *pWrapper, int32_t vgId, EQueueType qtype) {
|
||||||
int32_t size = -1;
|
int32_t size = -1;
|
||||||
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
SQnodeMgmt *pMgmt = pWrapper->pMgmt;
|
||||||
|
|
||||||
switch (qtype) {
|
switch (qtype) {
|
||||||
case QUERY_QUEUE:
|
case QUERY_QUEUE:
|
||||||
size = taosQueueSize(pMgmt->queryWorker.queue);
|
size = taosQueueSize(pMgmt->queryWorker.queue);
|
||||||
|
@ -164,7 +168,7 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt) {
|
||||||
|
|
||||||
if (tsMultiProcess) {
|
if (tsMultiProcess) {
|
||||||
SSingleWorkerCfg mCfg = {
|
SSingleWorkerCfg mCfg = {
|
||||||
.min = 1, .max = 1, .name = "qnode-monitor", .fp = (FItem)qmProcessMonQueue, .param = pMgmt};
|
.min = 1, .max = 1, .name = "qnode-monitor", .fp = (FItem)qmProcessMonitorQueue, .param = pMgmt};
|
||||||
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
if (tSingleWorkerInit(&pMgmt->monitorWorker, &mCfg) != 0) {
|
||||||
dError("failed to start qnode-monitor worker since %s", terrstr());
|
dError("failed to start qnode-monitor worker since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -48,14 +48,14 @@ int32_t smProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createReq.dnodeId != pDnode->dnodeId) {
|
if (createReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to create snode since %s, input:%d cur:%d", terrstr(), createReq.dnodeId, pDnode->dnodeId);
|
dError("failed to create snode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
return smOpen(pWrapper);
|
return smOpen(pWrapper);
|
||||||
|
@ -67,13 +67,13 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
SRpcMsg *pReq = &pMsg->rpcMsg;
|
SRpcMsg *pReq = &pMsg->rpcMsg;
|
||||||
|
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->pCont, pReq->contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dropReq.dnodeId != pDnode->dnodeId) {
|
if (dropReq.dnodeId != pDnode->dnodeId) {
|
||||||
terrno = TSDB_CODE_NODE_INVALID_OPTION;
|
terrno = TSDB_CODE_INVALID_OPTION;
|
||||||
dError("failed to drop snode since %s", terrstr());
|
dError("failed to drop snode since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "smInt.h"
|
#include "smInt.h"
|
||||||
|
|
||||||
static inline void smSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code) {
|
static inline void smSendRsp(SNodeMsg *pMsg, int32_t code) {
|
||||||
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
SRpcMsg rsp = {.handle = pMsg->rpcMsg.handle,
|
||||||
.ahandle = pMsg->rpcMsg.ahandle,
|
.ahandle = pMsg->rpcMsg.ahandle,
|
||||||
.code = code,
|
.code = code,
|
||||||
|
@ -28,17 +28,19 @@ static inline void smSendRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t cod
|
||||||
static void smProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void smProcessMonitorQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, get from snode monitor queue", pMsg);
|
dTrace("msg:%p, get from snode-monitor queue", pMsg);
|
||||||
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
SRpcMsg *pRpc = &pMsg->rpcMsg;
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
if (pMsg->rpcMsg.msgType == TDMT_MON_SM_INFO) {
|
||||||
code = smProcessGetMonSmInfoReq(pMgmt->pWrapper, pMsg);
|
code = smProcessGetMonSmInfoReq(pMgmt->pWrapper, pMsg);
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_MSG_NOT_PROCESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRpc->msgType & 1U) {
|
if (pRpc->msgType & 1U) {
|
||||||
if (code != 0 && terrno != 0) code = terrno;
|
if (code != 0 && terrno != 0) code = terrno;
|
||||||
smSendRsp(pMgmt->pWrapper, pMsg, code);
|
smSendRsp(pMsg, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
dTrace("msg:%p, is freed, result:0x%04x:%s", pMsg, code & 0XFFFF, tstrerror(code));
|
||||||
|
@ -53,7 +55,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
|
||||||
SNodeMsg *pMsg = NULL;
|
SNodeMsg *pMsg = NULL;
|
||||||
taosGetQitem(qall, (void **)&pMsg);
|
taosGetQitem(qall, (void **)&pMsg);
|
||||||
|
|
||||||
dTrace("msg:%p, will be processed in snode unique queue", pMsg);
|
dTrace("msg:%p, get from snode-unique queue", pMsg);
|
||||||
sndProcessUMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
sndProcessUMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
||||||
|
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
dTrace("msg:%p, is freed", pMsg);
|
||||||
|
@ -65,7 +67,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
|
||||||
static void smProcessSharedQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
static void smProcessSharedQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
|
||||||
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
SSnodeMgmt *pMgmt = pInfo->ahandle;
|
||||||
|
|
||||||
dTrace("msg:%p, will be processed in snode shared queue", pMsg);
|
dTrace("msg:%p, get from snode-shared queue", pMsg);
|
||||||
sndProcessSMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
sndProcessSMsg(pMgmt->pSnode, &pMsg->rpcMsg);
|
||||||
|
|
||||||
dTrace("msg:%p, is freed", pMsg);
|
dTrace("msg:%p, is freed", pMsg);
|
||||||
|
@ -88,7 +90,6 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMultiWorkerCfg cfg = {.max = 1, .name = "snode-unique", .fp = smProcessUniqueQueue, .param = pMgmt};
|
SMultiWorkerCfg cfg = {.max = 1, .name = "snode-unique", .fp = smProcessUniqueQueue, .param = pMgmt};
|
||||||
|
|
||||||
if (tMultiWorkerInit(pUniqueWorker, &cfg) != 0) {
|
if (tMultiWorkerInit(pUniqueWorker, &cfg) != 0) {
|
||||||
dError("failed to start snode-unique worker since %s", terrstr());
|
dError("failed to start snode-unique worker since %s", terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -193,7 +194,7 @@ int32_t smProcessSharedMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t smProcessExecMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
int32_t smProcessExecMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
|
||||||
int32_t workerType = smGetSWTypeFromMsg(&pMsg->rpcMsg);
|
int32_t workerType = smGetSWTypeFromMsg(&pMsg->rpcMsg);
|
||||||
if (workerType == SND_WORKER_TYPE__SHARED) {
|
if (workerType == SND_WORKER_TYPE__SHARED) {
|
||||||
return smProcessSharedMsg(pWrapper, pMsg);
|
return smProcessSharedMsg(pWrapper, pMsg);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,22 +33,22 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -59,9 +59,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -74,9 +74,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
||||||
|
@ -88,22 +88,22 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -114,9 +114,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -129,9 +129,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -142,9 +142,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -96,7 +96,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_ALTER_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -139,22 +139,22 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -165,9 +165,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -30,22 +30,22 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -56,9 +56,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -71,9 +71,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -86,22 +86,22 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -112,9 +112,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -127,9 +127,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -140,9 +140,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -30,22 +30,22 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -56,9 +56,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -71,9 +71,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -86,22 +86,22 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_INVALID_OPTION);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_INVALID_OPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -112,9 +112,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -127,9 +127,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 1;
|
dropReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -140,9 +140,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_DND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -67,7 +67,7 @@ TEST_F(DndTestVnode, 01_Create_Vnode) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
test.Restart();
|
test.Restart();
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_ALREADY_DEPLOYED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ TEST_F(DndTestVnode, 06_Drop_Vnode) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
test.Restart();
|
test.Restart();
|
||||||
} else {
|
} else {
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_DND_VNODE_NOT_DEPLOYED);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_NODE_NOT_DEPLOYED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -45,7 +45,7 @@ SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes) {
|
int32_t vmGetVnodesFromFile(SVnodesMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t *numOfVnodes) {
|
||||||
int32_t code = TSDB_CODE_NODE_PARSE_FILE_ERROR;
|
int32_t code = TSDB_CODE_INVALID_JSON_FORMAT;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t maxLen = 30000;
|
int32_t maxLen = 30000;
|
||||||
char *content = taosMemoryCalloc(1, maxLen + 1);
|
char *content = taosMemoryCalloc(1, maxLen + 1);
|
||||||
|
|
|
@ -139,7 +139,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
|
||||||
tFreeSCreateVnodeReq(&createReq);
|
tFreeSCreateVnodeReq(&createReq);
|
||||||
dDebug("vgId:%d, already exist", createReq.vgId);
|
dDebug("vgId:%d, already exist", createReq.vgId);
|
||||||
vmReleaseVnode(pMgmt, pVnode);
|
vmReleaseVnode(pMgmt, pVnode);
|
||||||
terrno = TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED;
|
terrno = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
|
||||||
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
SVnodeObj *pVnode = vmAcquireVnode(pMgmt, vgId);
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
dDebug("vgId:%d, failed to drop since %s", vgId, terrstr());
|
||||||
terrno = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
terrno = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,17 @@
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
||||||
#define TSDB_BNODE_VER_NUMBER 1
|
#define BNODE_VER_NUMBER 1
|
||||||
#define TSDB_BNODE_RESERVE_SIZE 64
|
#define BNODE_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj);
|
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj);
|
||||||
static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndBnodeActionInsert(SSdb *pSdb, SBnodeObj *pObj);
|
static int32_t mndBnodeActionInsert(SSdb *pSdb, SBnodeObj *pObj);
|
||||||
static int32_t mndBnodeActionDelete(SSdb *pSdb, SBnodeObj *pObj);
|
|
||||||
static int32_t mndBnodeActionUpdate(SSdb *pSdb, SBnodeObj *pOld, SBnodeObj *pNew);
|
static int32_t mndBnodeActionUpdate(SSdb *pSdb, SBnodeObj *pOld, SBnodeObj *pNew);
|
||||||
|
static int32_t mndBnodeActionDelete(SSdb *pSdb, SBnodeObj *pObj);
|
||||||
static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq);
|
static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq);
|
|
||||||
static int32_t mndProcessCreateBnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessCreateBnodeRsp(SNodeMsg *pRsp);
|
||||||
|
static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessDropBnodeRsp(SNodeMsg *pRsp);
|
||||||
static int32_t mndGetBnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
static int32_t mndGetBnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||||
static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
static int32_t mndRetrieveBnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||||
|
@ -76,18 +76,18 @@ static void mndReleaseBnode(SMnode *pMnode, SBnodeObj *pObj) {
|
||||||
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj) {
|
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_BNODE, TSDB_BNODE_VER_NUMBER, sizeof(SBnodeObj) + TSDB_BNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_BNODE, BNODE_VER_NUMBER, sizeof(SBnodeObj) + BNODE_RESERVE_SIZE);
|
||||||
if (pRaw == NULL) goto BNODE_ENCODE_OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, BNODE_ENCODE_OVER)
|
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, BNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, BNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_BNODE_RESERVE_SIZE, BNODE_ENCODE_OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, BNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
BNODE_ENCODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("bnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("bnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
|
@ -102,28 +102,28 @@ static SSdbRow *mndBnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto BNODE_DECODE_OVER;
|
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||||
|
|
||||||
if (sver != TSDB_BNODE_VER_NUMBER) {
|
if (sver != BNODE_VER_NUMBER) {
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||||
goto BNODE_DECODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *pRow = sdbAllocRow(sizeof(SBnodeObj));
|
SSdbRow *pRow = sdbAllocRow(sizeof(SBnodeObj));
|
||||||
if (pRow == NULL) goto BNODE_DECODE_OVER;
|
if (pRow == NULL) goto _OVER;
|
||||||
|
|
||||||
SBnodeObj *pObj = sdbGetRowObj(pRow);
|
SBnodeObj *pObj = sdbGetRowObj(pRow);
|
||||||
if (pObj == NULL) goto BNODE_DECODE_OVER;
|
if (pObj == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, BNODE_DECODE_OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, BNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, BNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_BNODE_RESERVE_SIZE, BNODE_DECODE_OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, BNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
BNODE_DECODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("bnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("bnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
taosMemoryFreeClear(pRow);
|
taosMemoryFreeClear(pRow);
|
||||||
|
@ -190,13 +190,13 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDCreateBnodeReq createReq = {0};
|
SDCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = pDnode->id;
|
createReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -217,13 +217,13 @@ static int32_t mndSetCreateBnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -249,19 +249,19 @@ static int32_t mndCreateBnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
||||||
bnodeObj.updateTime = bnodeObj.createdTime;
|
bnodeObj.updateTime = bnodeObj.createdTime;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_BNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_BNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto CREATE_BNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
|
mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
|
||||||
if (mndSetCreateBnodeRedoLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeRedoLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateBnodeUndoLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeUndoLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateBnodeCommitLogs(pTrans, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeCommitLogs(pTrans, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateBnodeRedoActions(pTrans, pDnode, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeRedoActions(pTrans, pDnode, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateBnodeUndoActions(pTrans, pDnode, &bnodeObj) != 0) goto CREATE_BNODE_OVER;
|
if (mndSetCreateBnodeUndoActions(pTrans, pDnode, &bnodeObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_BNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
CREATE_BNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -274,9 +274,9 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("bnode:%d, start to create", createReq.dnodeId);
|
mDebug("bnode:%d, start to create", createReq.dnodeId);
|
||||||
|
@ -284,31 +284,31 @@ static int32_t mndProcessCreateBnodeReq(SNodeMsg *pReq) {
|
||||||
pObj = mndAcquireBnode(pMnode, createReq.dnodeId);
|
pObj = mndAcquireBnode(pMnode, createReq.dnodeId);
|
||||||
if (pObj != NULL) {
|
if (pObj != NULL) {
|
||||||
terrno = TSDB_CODE_MND_BNODE_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_BNODE_ALREADY_EXIST;
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
} else if (terrno != TSDB_CODE_MND_BNODE_NOT_EXIST) {
|
} else if (terrno != TSDB_CODE_MND_BNODE_NOT_EXIST) {
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||||
if (pDnode == NULL) {
|
if (pDnode == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto CREATE_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndCreateBnode(pMnode, pReq, pDnode, &createReq);
|
code = mndCreateBnode(pMnode, pReq, pDnode, &createReq);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
CREATE_BNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("bnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
mError("bnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,6 @@ CREATE_BNODE_OVER:
|
||||||
mndReleaseBnode(pMnode, pObj);
|
mndReleaseBnode(pMnode, pObj);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
mndReleaseUser(pMnode, pUser);
|
mndReleaseUser(pMnode, pUser);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,13 +339,13 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
|
||||||
SDDropBnodeReq dropReq = {0};
|
SDDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -367,17 +366,17 @@ static int32_t mndDropBnode(SMnode *pMnode, SNodeMsg *pReq, SBnodeObj *pObj) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_BNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_BNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto DROP_BNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
|
mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
|
||||||
if (mndSetDropBnodeRedoLogs(pTrans, pObj) != 0) goto DROP_BNODE_OVER;
|
if (mndSetDropBnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropBnodeCommitLogs(pTrans, pObj) != 0) goto DROP_BNODE_OVER;
|
if (mndSetDropBnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropBnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_BNODE_OVER;
|
if (mndSetDropBnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_BNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
DROP_BNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -389,37 +388,37 @@ static int32_t mndProcessDropBnodeReq(SNodeMsg *pReq) {
|
||||||
SBnodeObj *pObj = NULL;
|
SBnodeObj *pObj = NULL;
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("bnode:%d, start to drop", dropReq.dnodeId);
|
mDebug("bnode:%d, start to drop", dropReq.dnodeId);
|
||||||
|
|
||||||
if (dropReq.dnodeId <= 0) {
|
if (dropReq.dnodeId <= 0) {
|
||||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pObj = mndAcquireBnode(pMnode, dropReq.dnodeId);
|
pObj = mndAcquireBnode(pMnode, dropReq.dnodeId);
|
||||||
if (pObj == NULL) {
|
if (pObj == NULL) {
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto DROP_BNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndDropBnode(pMnode, pReq, pObj);
|
code = mndDropBnode(pMnode, pReq, pObj);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
DROP_BNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("bnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
mError("bnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,7 @@ static int32_t mndSetCreateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_CREATE_VNODE;
|
action.msgType = TDMT_DND_CREATE_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_NODE_ALREADY_DEPLOYED;
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -412,7 +412,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_VNODE;
|
action.msgType = TDMT_DND_DROP_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||||
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
if (mndTransAppendUndoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -880,7 +880,7 @@ static int32_t mndBuildDropVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
action.contLen = contLen;
|
action.contLen = contLen;
|
||||||
action.msgType = TDMT_DND_DROP_VNODE;
|
action.msgType = TDMT_DND_DROP_VNODE;
|
||||||
action.acceptableCode = TSDB_CODE_DND_VNODE_NOT_DEPLOYED;
|
action.acceptableCode = TSDB_CODE_NODE_NOT_DEPLOYED;
|
||||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||||
taosMemoryFree(pReq);
|
taosMemoryFree(pReq);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -554,7 +554,7 @@ static int32_t mndProcessDropDnodeReq(SNodeMsg *pReq) {
|
||||||
SDnodeObj *pDnode = NULL;
|
SDnodeObj *pDnode = NULL;
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_DNODE_OVER;
|
goto DROP_DNODE_OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,17 @@ static const SInfosTableSchema modulesSchema[] = {
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema qnodesSchema[] = {
|
static const SInfosTableSchema qnodesSchema[] = {
|
||||||
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
{.name = "endpoint", .bytes = 134, .type = TSDB_DATA_TYPE_BINARY},
|
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
|
};
|
||||||
|
static const SInfosTableSchema snodesSchema[] = {
|
||||||
|
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
|
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
|
};
|
||||||
|
static const SInfosTableSchema bnodesSchema[] = {
|
||||||
|
{.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT},
|
||||||
|
{.name = "endpoint", .bytes = TSDB_EP_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_BINARY},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP},
|
||||||
};
|
};
|
||||||
static const SInfosTableSchema userDBSchema[] = {
|
static const SInfosTableSchema userDBSchema[] = {
|
||||||
|
@ -184,6 +194,8 @@ static const SInfosTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema)},
|
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema)},
|
||||||
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema)},
|
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema)},
|
||||||
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
|
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema)},
|
||||||
|
{TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema)},
|
||||||
|
{TSDB_INS_TABLE_BNODES, bnodesSchema, tListLen(snodesSchema)},
|
||||||
{TSDB_INS_TABLE_USER_DATABASES, userDBSchema, tListLen(userDBSchema)},
|
{TSDB_INS_TABLE_USER_DATABASES, userDBSchema, tListLen(userDBSchema)},
|
||||||
{TSDB_INS_TABLE_USER_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
|
{TSDB_INS_TABLE_USER_FUNCTIONS, userFuncSchema, tListLen(userFuncSchema)},
|
||||||
{TSDB_INS_TABLE_USER_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
|
{TSDB_INS_TABLE_USER_INDEXES, userIdxSchema, tListLen(userIdxSchema)},
|
||||||
|
|
|
@ -388,7 +388,7 @@ static int32_t mndProcessCreateMnodeReq(SNodeMsg *pReq) {
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto CREATE_MNODE_OVER;
|
goto CREATE_MNODE_OVER;
|
||||||
}
|
}
|
||||||
|
@ -509,9 +509,9 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
|
||||||
|
|
||||||
SDDropMnodeReq dropReq = {0};
|
SDDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pObj->id;
|
dropReq.dnodeId = pObj->id;
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
|
@ -554,7 +554,7 @@ static int32_t mndProcessDropMnodeReq(SNodeMsg *pReq) {
|
||||||
SMnodeObj *pObj = NULL;
|
SMnodeObj *pObj = NULL;
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropMnodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_MNODE_OVER;
|
goto DROP_MNODE_OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,22 @@
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
||||||
#define TSDB_QNODE_VER_NUMBER 1
|
#define QNODE_VER_NUMBER 1
|
||||||
#define TSDB_QNODE_RESERVE_SIZE 64
|
#define QNODE_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj);
|
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj);
|
||||||
static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndQnodeActionInsert(SSdb *pSdb, SQnodeObj *pObj);
|
static int32_t mndQnodeActionInsert(SSdb *pSdb, SQnodeObj *pObj);
|
||||||
static int32_t mndQnodeActionDelete(SSdb *pSdb, SQnodeObj *pObj);
|
|
||||||
static int32_t mndQnodeActionUpdate(SSdb *pSdb, SQnodeObj *pOld, SQnodeObj *pNew);
|
static int32_t mndQnodeActionUpdate(SSdb *pSdb, SQnodeObj *pOld, SQnodeObj *pNew);
|
||||||
|
static int32_t mndQnodeActionDelete(SSdb *pSdb, SQnodeObj *pObj);
|
||||||
static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq);
|
static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq);
|
|
||||||
static int32_t mndProcessCreateQnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessCreateQnodeRsp(SNodeMsg *pRsp);
|
||||||
|
static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessDropQnodeRsp(SNodeMsg *pRsp);
|
||||||
|
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq);
|
||||||
static int32_t mndGetQnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
static int32_t mndGetQnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||||
static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
static int32_t mndRetrieveQnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||||
static void mndCancelGetNextQnode(SMnode *pMnode, void *pIter);
|
static void mndCancelGetNextQnode(SMnode *pMnode, void *pIter);
|
||||||
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq);
|
|
||||||
|
|
||||||
int32_t mndInitQnode(SMnode *pMnode) {
|
int32_t mndInitQnode(SMnode *pMnode) {
|
||||||
SSdbTable table = {.sdbType = SDB_QNODE,
|
SSdbTable table = {.sdbType = SDB_QNODE,
|
||||||
|
@ -49,9 +49,9 @@ int32_t mndInitQnode(SMnode *pMnode) {
|
||||||
|
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_QNODE, mndProcessCreateQnodeReq);
|
mndSetMsgHandle(pMnode, TDMT_MND_CREATE_QNODE, mndProcessCreateQnodeReq);
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_DROP_QNODE, mndProcessDropQnodeReq);
|
mndSetMsgHandle(pMnode, TDMT_MND_DROP_QNODE, mndProcessDropQnodeReq);
|
||||||
mndSetMsgHandle(pMnode, TDMT_MND_QNODE_LIST, mndProcessQnodeListReq);
|
|
||||||
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_QNODE_RSP, mndProcessCreateQnodeRsp);
|
mndSetMsgHandle(pMnode, TDMT_DND_CREATE_QNODE_RSP, mndProcessCreateQnodeRsp);
|
||||||
mndSetMsgHandle(pMnode, TDMT_DND_DROP_QNODE_RSP, mndProcessDropQnodeRsp);
|
mndSetMsgHandle(pMnode, TDMT_DND_DROP_QNODE_RSP, mndProcessDropQnodeRsp);
|
||||||
|
mndSetMsgHandle(pMnode, TDMT_MND_QNODE_LIST, mndProcessQnodeListReq);
|
||||||
|
|
||||||
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndGetQnodeMeta);
|
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndGetQnodeMeta);
|
||||||
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndRetrieveQnodes);
|
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QNODE, mndRetrieveQnodes);
|
||||||
|
@ -78,18 +78,18 @@ static void mndReleaseQnode(SMnode *pMnode, SQnodeObj *pObj) {
|
||||||
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj) {
|
static SSdbRaw *mndQnodeActionEncode(SQnodeObj *pObj) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_QNODE, TSDB_QNODE_VER_NUMBER, sizeof(SQnodeObj) + TSDB_QNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_QNODE, QNODE_VER_NUMBER, sizeof(SQnodeObj) + QNODE_RESERVE_SIZE);
|
||||||
if (pRaw == NULL) goto QNODE_ENCODE_OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, QNODE_ENCODE_OVER)
|
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, QNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, QNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_QNODE_RESERVE_SIZE, QNODE_ENCODE_OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, QNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
QNODE_ENCODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("qnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("qnode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
|
@ -104,28 +104,28 @@ static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto QNODE_DECODE_OVER;
|
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||||
|
|
||||||
if (sver != TSDB_QNODE_VER_NUMBER) {
|
if (sver != QNODE_VER_NUMBER) {
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||||
goto QNODE_DECODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *pRow = sdbAllocRow(sizeof(SQnodeObj));
|
SSdbRow *pRow = sdbAllocRow(sizeof(SQnodeObj));
|
||||||
if (pRow == NULL) goto QNODE_DECODE_OVER;
|
if (pRow == NULL) goto _OVER;
|
||||||
|
|
||||||
SQnodeObj *pObj = sdbGetRowObj(pRow);
|
SQnodeObj *pObj = sdbGetRowObj(pRow);
|
||||||
if (pObj == NULL) goto QNODE_DECODE_OVER;
|
if (pObj == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, QNODE_DECODE_OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, QNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, QNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_QNODE_RESERVE_SIZE, QNODE_DECODE_OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, QNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
QNODE_DECODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("qnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("qnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
taosMemoryFreeClear(pRow);
|
taosMemoryFreeClear(pRow);
|
||||||
|
@ -192,13 +192,13 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDCreateQnodeReq createReq = {0};
|
SDCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = pDnode->id;
|
createReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -219,13 +219,13 @@ static int32_t mndSetCreateQnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -251,19 +251,19 @@ static int32_t mndCreateQnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
||||||
qnodeObj.updateTime = qnodeObj.createdTime;
|
qnodeObj.updateTime = qnodeObj.createdTime;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_QNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_QNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto CREATE_QNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
|
mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
|
||||||
if (mndSetCreateQnodeRedoLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeRedoLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateQnodeUndoLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeUndoLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateQnodeCommitLogs(pTrans, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeCommitLogs(pTrans, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateQnodeRedoActions(pTrans, pDnode, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeRedoActions(pTrans, pDnode, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateQnodeUndoActions(pTrans, pDnode, &qnodeObj) != 0) goto CREATE_QNODE_OVER;
|
if (mndSetCreateQnodeUndoActions(pTrans, pDnode, &qnodeObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_QNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
CREATE_QNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -276,9 +276,9 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("qnode:%d, start to create", createReq.dnodeId);
|
mDebug("qnode:%d, start to create", createReq.dnodeId);
|
||||||
|
@ -286,31 +286,31 @@ static int32_t mndProcessCreateQnodeReq(SNodeMsg *pReq) {
|
||||||
pObj = mndAcquireQnode(pMnode, createReq.dnodeId);
|
pObj = mndAcquireQnode(pMnode, createReq.dnodeId);
|
||||||
if (pObj != NULL) {
|
if (pObj != NULL) {
|
||||||
terrno = TSDB_CODE_MND_QNODE_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_QNODE_ALREADY_EXIST;
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
} else if (terrno != TSDB_CODE_MND_QNODE_NOT_EXIST) {
|
} else if (terrno != TSDB_CODE_MND_QNODE_NOT_EXIST) {
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||||
if (pDnode == NULL) {
|
if (pDnode == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto CREATE_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndCreateQnode(pMnode, pReq, pDnode, &createReq);
|
code = mndCreateQnode(pMnode, pReq, pDnode, &createReq);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
CREATE_QNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
mError("qnode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,6 @@ CREATE_QNODE_OVER:
|
||||||
mndReleaseQnode(pMnode, pObj);
|
mndReleaseQnode(pMnode, pObj);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
mndReleaseUser(pMnode, pUser);
|
mndReleaseUser(pMnode, pUser);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,13 +341,13 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
|
||||||
SDDropQnodeReq dropReq = {0};
|
SDDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -369,17 +368,17 @@ static int32_t mndDropQnode(SMnode *pMnode, SNodeMsg *pReq, SQnodeObj *pObj) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_QNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_QNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto DROP_QNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
|
mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
|
||||||
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) goto DROP_QNODE_OVER;
|
if (mndSetDropQnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) goto DROP_QNODE_OVER;
|
if (mndSetDropQnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_QNODE_OVER;
|
if (mndSetDropQnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_QNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
DROP_QNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -391,37 +390,37 @@ static int32_t mndProcessDropQnodeReq(SNodeMsg *pReq) {
|
||||||
SQnodeObj *pObj = NULL;
|
SQnodeObj *pObj = NULL;
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("qnode:%d, start to drop", dropReq.dnodeId);
|
mDebug("qnode:%d, start to drop", dropReq.dnodeId);
|
||||||
|
|
||||||
if (dropReq.dnodeId <= 0) {
|
if (dropReq.dnodeId <= 0) {
|
||||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pObj = mndAcquireQnode(pMnode, dropReq.dnodeId);
|
pObj = mndAcquireQnode(pMnode, dropReq.dnodeId);
|
||||||
if (pObj == NULL) {
|
if (pObj == NULL) {
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto DROP_QNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndDropQnode(pMnode, pReq, pObj);
|
code = mndDropQnode(pMnode, pReq, pObj);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
DROP_QNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
mError("qnode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
@ -433,37 +432,36 @@ DROP_QNODE_OVER:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
SQnodeListReq qlistReq = {0};
|
int32_t numOfRows = 0;
|
||||||
int32_t numOfRows = 0;
|
SMnode *pMnode = pReq->pNode;
|
||||||
SMnode *pMnode = pReq->pNode;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SQnodeObj *pObj = NULL;
|
||||||
SQnodeObj *pObj = NULL;
|
SQnodeListReq qlistReq = {0};
|
||||||
SQnodeListRsp qlistRsp = {0};
|
SQnodeListRsp qlistRsp = {0};
|
||||||
|
|
||||||
if (tDeserializeSQnodeListReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &qlistReq) != 0) {
|
if (tDeserializeSQnodeListReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &qlistReq) != 0) {
|
||||||
mError("invalid qnode list msg");
|
mError("failed to parse qnode list req");
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto QNODE_LIST_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
qlistRsp.epSetList = taosArrayInit(5, sizeof(SEpSet));
|
qlistRsp.epSetList = taosArrayInit(5, sizeof(SEpSet));
|
||||||
if (NULL == qlistRsp.epSetList) {
|
if (NULL == qlistRsp.epSetList) {
|
||||||
mError("taosArrayInit epSet failed");
|
mError("failed to alloc epSet while process qnode list req");
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto QNODE_LIST_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
void *pIter = sdbFetch(pSdb, SDB_QNODE, NULL, (void **)&pObj);
|
void *pIter = sdbFetch(pSdb, SDB_QNODE, NULL, (void **)&pObj);
|
||||||
if (pIter == NULL) break;
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
SEpSet epSet = {0};
|
SEpSet epSet = {.numOfEps = 1};
|
||||||
strcpy(epSet.eps[0].fqdn, pObj->pDnode->fqdn);
|
tstrncpy(epSet.eps[0].fqdn, pObj->pDnode->fqdn, TSDB_FQDN_LEN);
|
||||||
epSet.eps[0].port = pObj->pDnode->port;
|
epSet.eps[0].port = pObj->pDnode->port;
|
||||||
epSet.numOfEps = 1;
|
|
||||||
|
|
||||||
taosArrayPush(qlistRsp.epSetList, &epSet);
|
(void)taosArrayPush(qlistRsp.epSetList, &epSet);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
|
@ -477,7 +475,7 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
||||||
void *pRsp = taosMemoryMalloc(rspLen);
|
void *pRsp = taosMemoryMalloc(rspLen);
|
||||||
if (pRsp == NULL) {
|
if (pRsp == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto QNODE_LIST_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
tSerializeSQnodeListRsp(pRsp, rspLen, &qlistRsp);
|
tSerializeSQnodeListRsp(pRsp, rspLen, &qlistRsp);
|
||||||
|
@ -486,10 +484,8 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
|
||||||
pReq->pRsp = pRsp;
|
pReq->pRsp = pRsp;
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
QNODE_LIST_OVER:
|
_OVER:
|
||||||
|
|
||||||
tFreeSQnodeListRsp(&qlistRsp);
|
tFreeSQnodeListRsp(&qlistRsp);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,17 @@
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
|
||||||
#define TSDB_SNODE_VER_NUMBER 1
|
#define SNODE_VER_NUMBER 1
|
||||||
#define TSDB_SNODE_RESERVE_SIZE 64
|
#define SNODE_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj);
|
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj);
|
||||||
static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndSnodeActionInsert(SSdb *pSdb, SSnodeObj *pObj);
|
static int32_t mndSnodeActionInsert(SSdb *pSdb, SSnodeObj *pObj);
|
||||||
static int32_t mndSnodeActionDelete(SSdb *pSdb, SSnodeObj *pObj);
|
|
||||||
static int32_t mndSnodeActionUpdate(SSdb *pSdb, SSnodeObj *pOld, SSnodeObj *pNew);
|
static int32_t mndSnodeActionUpdate(SSdb *pSdb, SSnodeObj *pOld, SSnodeObj *pNew);
|
||||||
|
static int32_t mndSnodeActionDelete(SSdb *pSdb, SSnodeObj *pObj);
|
||||||
static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq);
|
static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq);
|
|
||||||
static int32_t mndProcessCreateSnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessCreateSnodeRsp(SNodeMsg *pRsp);
|
||||||
|
static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq);
|
||||||
static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp);
|
static int32_t mndProcessDropSnodeRsp(SNodeMsg *pRsp);
|
||||||
static int32_t mndGetSnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
static int32_t mndGetSnodeMeta(SNodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
|
||||||
static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
static int32_t mndRetrieveSnodes(SNodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
|
||||||
|
@ -61,11 +61,9 @@ int32_t mndInitSnode(SMnode *pMnode) {
|
||||||
void mndCleanupSnode(SMnode *pMnode) {}
|
void mndCleanupSnode(SMnode *pMnode) {}
|
||||||
|
|
||||||
SEpSet mndAcquireEpFromSnode(SMnode *pMnode, const SSnodeObj *pSnode) {
|
SEpSet mndAcquireEpFromSnode(SMnode *pMnode, const SSnodeObj *pSnode) {
|
||||||
SEpSet epSet;
|
SEpSet epSet = {.numOfEps = 1, .inUse = 0};
|
||||||
memcpy(epSet.eps->fqdn, pSnode->pDnode->fqdn, 128);
|
memcpy(epSet.eps[0].fqdn, pSnode->pDnode->fqdn, TSDB_FQDN_LEN);
|
||||||
epSet.eps->port = pSnode->pDnode->port;
|
epSet.eps[0].port = pSnode->pDnode->port;
|
||||||
epSet.numOfEps = 1;
|
|
||||||
epSet.inUse = 0;
|
|
||||||
return epSet;
|
return epSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,18 +83,18 @@ static void mndReleaseSnode(SMnode *pMnode, SSnodeObj *pObj) {
|
||||||
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj) {
|
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_SNODE, TSDB_SNODE_VER_NUMBER, sizeof(SSnodeObj) + TSDB_SNODE_RESERVE_SIZE);
|
SSdbRaw *pRaw = sdbAllocRaw(SDB_SNODE, SNODE_VER_NUMBER, sizeof(SSnodeObj) + SNODE_RESERVE_SIZE);
|
||||||
if (pRaw == NULL) goto SNODE_ENCODE_OVER;
|
if (pRaw == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_SET_INT32(pRaw, dataPos, pObj->id, SNODE_ENCODE_OVER)
|
SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, SNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
|
||||||
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, SNODE_ENCODE_OVER)
|
SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
|
||||||
SDB_SET_RESERVE(pRaw, dataPos, TSDB_SNODE_RESERVE_SIZE, SNODE_ENCODE_OVER)
|
SDB_SET_RESERVE(pRaw, dataPos, SNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
SNODE_ENCODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("snode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("snode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
|
@ -111,28 +109,28 @@ static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int8_t sver = 0;
|
int8_t sver = 0;
|
||||||
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto SNODE_DECODE_OVER;
|
if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
|
||||||
|
|
||||||
if (sver != TSDB_SNODE_VER_NUMBER) {
|
if (sver != SNODE_VER_NUMBER) {
|
||||||
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
|
||||||
goto SNODE_DECODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSdbRow *pRow = sdbAllocRow(sizeof(SSnodeObj));
|
SSdbRow *pRow = sdbAllocRow(sizeof(SSnodeObj));
|
||||||
if (pRow == NULL) goto SNODE_DECODE_OVER;
|
if (pRow == NULL) goto _OVER;
|
||||||
|
|
||||||
SSnodeObj *pObj = sdbGetRowObj(pRow);
|
SSnodeObj *pObj = sdbGetRowObj(pRow);
|
||||||
if (pObj == NULL) goto SNODE_DECODE_OVER;
|
if (pObj == NULL) goto _OVER;
|
||||||
|
|
||||||
int32_t dataPos = 0;
|
int32_t dataPos = 0;
|
||||||
SDB_GET_INT32(pRaw, dataPos, &pObj->id, SNODE_DECODE_OVER)
|
SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, SNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
|
||||||
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, SNODE_DECODE_OVER)
|
SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, TSDB_SNODE_RESERVE_SIZE, SNODE_DECODE_OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, SNODE_RESERVE_SIZE, _OVER)
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
|
|
||||||
SNODE_DECODE_OVER:
|
_OVER:
|
||||||
if (terrno != 0) {
|
if (terrno != 0) {
|
||||||
mError("snode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
mError("snode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr());
|
||||||
taosMemoryFreeClear(pRow);
|
taosMemoryFreeClear(pRow);
|
||||||
|
@ -199,13 +197,13 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDCreateSnodeReq createReq = {0};
|
SDCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = pDnode->id;
|
createReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -226,13 +224,13 @@ static int32_t mndSetCreateSnodeUndoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -258,20 +256,20 @@ static int32_t mndCreateSnode(SMnode *pMnode, SNodeMsg *pReq, SDnodeObj *pDnode,
|
||||||
snodeObj.updateTime = snodeObj.createdTime;
|
snodeObj.updateTime = snodeObj.createdTime;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_SNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_SNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto CREATE_SNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
|
mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
|
||||||
|
|
||||||
if (mndSetCreateSnodeRedoLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeRedoLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateSnodeUndoLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeUndoLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateSnodeCommitLogs(pTrans, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeCommitLogs(pTrans, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateSnodeRedoActions(pTrans, pDnode, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeRedoActions(pTrans, pDnode, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndSetCreateSnodeUndoActions(pTrans, pDnode, &snodeObj) != 0) goto CREATE_SNODE_OVER;
|
if (mndSetCreateSnodeUndoActions(pTrans, pDnode, &snodeObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto CREATE_SNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
CREATE_SNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -284,9 +282,9 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
|
||||||
SUserObj *pUser = NULL;
|
SUserObj *pUser = NULL;
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &createReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("snode:%d, start to create", createReq.dnodeId);
|
mDebug("snode:%d, start to create", createReq.dnodeId);
|
||||||
|
@ -294,31 +292,31 @@ static int32_t mndProcessCreateSnodeReq(SNodeMsg *pReq) {
|
||||||
pObj = mndAcquireSnode(pMnode, createReq.dnodeId);
|
pObj = mndAcquireSnode(pMnode, createReq.dnodeId);
|
||||||
if (pObj != NULL) {
|
if (pObj != NULL) {
|
||||||
terrno = TSDB_CODE_MND_SNODE_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_SNODE_ALREADY_EXIST;
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
} else if (terrno != TSDB_CODE_MND_SNODE_NOT_EXIST) {
|
} else if (terrno != TSDB_CODE_MND_SNODE_NOT_EXIST) {
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
pDnode = mndAcquireDnode(pMnode, createReq.dnodeId);
|
||||||
if (pDnode == NULL) {
|
if (pDnode == NULL) {
|
||||||
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
terrno = TSDB_CODE_MND_DNODE_NOT_EXIST;
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto CREATE_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndCreateSnode(pMnode, pReq, pDnode, &createReq);
|
code = mndCreateSnode(pMnode, pReq, pDnode, &createReq);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
CREATE_SNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("snode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
mError("snode:%d, failed to create since %s", createReq.dnodeId, terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -327,7 +325,6 @@ CREATE_SNODE_OVER:
|
||||||
mndReleaseSnode(pMnode, pObj);
|
mndReleaseSnode(pMnode, pObj);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
mndReleaseUser(pMnode, pUser);
|
mndReleaseUser(pMnode, pUser);
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,13 +348,13 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
|
||||||
SDDropSnodeReq dropReq = {0};
|
SDDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = pDnode->id;
|
dropReq.dnodeId = pDnode->id;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void *pReq = taosMemoryMalloc(contLen);
|
void *pReq = taosMemoryMalloc(contLen);
|
||||||
if (pReq == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetDnodeEpset(pDnode);
|
action.epSet = mndGetDnodeEpset(pDnode);
|
||||||
|
@ -378,18 +375,18 @@ static int32_t mndDropSnode(SMnode *pMnode, SNodeMsg *pReq, SSnodeObj *pObj) {
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
|
||||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_SNODE, &pReq->rpcMsg);
|
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_SNODE, &pReq->rpcMsg);
|
||||||
if (pTrans == NULL) goto DROP_SNODE_OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
|
|
||||||
mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
|
mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
|
||||||
|
|
||||||
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) goto DROP_SNODE_OVER;
|
if (mndSetDropSnodeRedoLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) goto DROP_SNODE_OVER;
|
if (mndSetDropSnodeCommitLogs(pTrans, pObj) != 0) goto _OVER;
|
||||||
if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto DROP_SNODE_OVER;
|
if (mndSetDropSnodeRedoActions(pTrans, pObj->pDnode, pObj) != 0) goto _OVER;
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto DROP_SNODE_OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
DROP_SNODE_OVER:
|
_OVER:
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -401,37 +398,37 @@ static int32_t mndProcessDropSnodeReq(SNodeMsg *pReq) {
|
||||||
SSnodeObj *pObj = NULL;
|
SSnodeObj *pObj = NULL;
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
|
|
||||||
if (tDeserializeSMCreateDropQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
if (tDeserializeSCreateDropMQSBNodeReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &dropReq) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("snode:%d, start to drop", dropReq.dnodeId);
|
mDebug("snode:%d, start to drop", dropReq.dnodeId);
|
||||||
|
|
||||||
if (dropReq.dnodeId <= 0) {
|
if (dropReq.dnodeId <= 0) {
|
||||||
terrno = TSDB_CODE_SDB_APP_ERROR;
|
terrno = TSDB_CODE_SDB_APP_ERROR;
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pObj = mndAcquireSnode(pMnode, dropReq.dnodeId);
|
pObj = mndAcquireSnode(pMnode, dropReq.dnodeId);
|
||||||
if (pObj == NULL) {
|
if (pObj == NULL) {
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUser = mndAcquireUser(pMnode, pReq->user);
|
pUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mndCheckNodeAuth(pUser)) {
|
if (mndCheckNodeAuth(pUser)) {
|
||||||
goto DROP_SNODE_OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = mndDropSnode(pMnode, pReq, pObj);
|
code = mndDropSnode(pMnode, pReq, pObj);
|
||||||
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
DROP_SNODE_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
mError("snode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
mError("snode:%d, failed to drop since %s", dropReq.dnodeId, terrstr());
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -68,9 +68,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -90,9 +90,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -124,9 +124,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -148,9 +148,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -169,9 +169,9 @@ TEST_F(MndTestBnode, 03_Drop_Bnode) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -185,9 +185,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
|
@ -200,9 +200,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -214,9 +214,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -235,9 +235,9 @@ TEST_F(MndTestBnode, 03_Create_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -255,9 +255,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
|
@ -270,9 +270,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -284,9 +284,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
||||||
SMDropBnodeReq dropReq = {0};
|
SMDropBnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -305,9 +305,9 @@ TEST_F(MndTestBnode, 04_Drop_Bnode_Rollback) {
|
||||||
SMCreateBnodeReq createReq = {0};
|
SMCreateBnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -63,9 +63,9 @@ TEST_F(MndTestMnode, 02_Create_Mnode_Invalid_Id) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -78,9 +78,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Invalid_Id) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -114,9 +114,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -143,9 +143,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -167,9 +167,9 @@ TEST_F(MndTestMnode, 04_Create_Mnode) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -183,9 +183,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
|
@ -198,9 +198,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -212,9 +212,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -233,9 +233,9 @@ TEST_F(MndTestMnode, 03_Create_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -253,9 +253,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
|
@ -268,9 +268,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -282,9 +282,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
|
||||||
SMDropMnodeReq dropReq = {0};
|
SMDropMnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -303,9 +303,9 @@ TEST_F(MndTestMnode, 04_Drop_Mnode_Rollback) {
|
||||||
SMCreateMnodeReq createReq = {0};
|
SMCreateMnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropMnodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropMnodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_MNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -55,9 +55,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -68,9 +68,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -90,9 +90,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -124,9 +124,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -148,9 +148,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -169,9 +169,9 @@ TEST_F(MndTestQnode, 03_Drop_Qnode) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -185,9 +185,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
taosMsleep(1000);
|
taosMsleep(1000);
|
||||||
|
@ -203,9 +203,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -217,9 +217,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -239,9 +239,9 @@ TEST_F(MndTestQnode, 03_Create_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -258,9 +258,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
|
@ -273,9 +273,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_DROPPING);
|
ASSERT_EQ(pRsp->code, TSDB_CODE_SDB_OBJ_DROPPING);
|
||||||
|
@ -286,9 +286,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
|
||||||
SMDropQnodeReq dropReq = {0};
|
SMDropQnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -307,9 +307,9 @@ TEST_F(MndTestQnode, 04_Drop_Qnode_Rollback) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
if (pRsp->code == 0) break;
|
if (pRsp->code == 0) break;
|
||||||
|
|
|
@ -55,9 +55,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -68,9 +68,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -90,9 +90,9 @@ TEST_F(MndTestSnode, 02_Create_Snode) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -124,9 +124,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -148,9 +148,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -169,9 +169,9 @@ TEST_F(MndTestSnode, 03_Drop_Snode) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -185,9 +185,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
|
@ -200,9 +200,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -214,9 +214,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -235,9 +235,9 @@ TEST_F(MndTestSnode, 03_Create_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -255,9 +255,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
|
@ -270,9 +270,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -284,9 +284,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
|
||||||
SMDropSnodeReq dropReq = {0};
|
SMDropSnodeReq dropReq = {0};
|
||||||
dropReq.dnodeId = 2;
|
dropReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -305,9 +305,9 @@ TEST_F(MndTestSnode, 04_Drop_Snode_Rollback) {
|
||||||
SMCreateSnodeReq createReq = {0};
|
SMCreateSnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -136,9 +136,9 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -155,9 +155,9 @@ TEST_F(MndTestTrans, 02_Create_Qnode1_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 1;
|
createReq.dnodeId = 1;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -194,9 +194,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
server2.Stop();
|
server2.Stop();
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
|
@ -249,9 +249,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -274,9 +274,9 @@ TEST_F(MndTestTrans, 03_Create_Qnode2_Crash) {
|
||||||
SMCreateQnodeReq createReq = {0};
|
SMCreateQnodeReq createReq = {0};
|
||||||
createReq.dnodeId = 2;
|
createReq.dnodeId = 2;
|
||||||
|
|
||||||
int32_t contLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
int32_t contLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
tSerializeSMCreateDropQSBNodeReq(pReq, contLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pReq, contLen, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -783,6 +783,10 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
|
||||||
tableType = TSDB_MGMT_TABLE_MODULE;
|
tableType = TSDB_MGMT_TABLE_MODULE;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_QNODES, tListLen(pName->tname)) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_QNODES, tListLen(pName->tname)) == 0) {
|
||||||
tableType = TSDB_MGMT_TABLE_QNODE;
|
tableType = TSDB_MGMT_TABLE_QNODE;
|
||||||
|
} else if (strncasecmp(name, TSDB_INS_TABLE_SNODES, tListLen(pName->tname)) == 0) {
|
||||||
|
tableType = TSDB_MGMT_TABLE_SNODE;
|
||||||
|
} else if (strncasecmp(name, TSDB_INS_TABLE_BNODES, tListLen(pName->tname)) == 0) {
|
||||||
|
tableType = TSDB_MGMT_TABLE_BNODE;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_FUNCTIONS, tListLen(pName->tname)) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_FUNCTIONS, tListLen(pName->tname)) == 0) {
|
||||||
tableType = TSDB_MGMT_TABLE_FUNC;
|
tableType = TSDB_MGMT_TABLE_FUNC;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_INDEXES, tListLen(pName->tname)) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_USER_INDEXES, tListLen(pName->tname)) == 0) {
|
||||||
|
|
|
@ -158,6 +158,8 @@ SNodeptr nodesMakeNode(ENodeType type) {
|
||||||
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
|
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
|
||||||
case QUERY_NODE_SHOW_INDEXES_STMT:
|
case QUERY_NODE_SHOW_INDEXES_STMT:
|
||||||
case QUERY_NODE_SHOW_STREAMS_STMT:
|
case QUERY_NODE_SHOW_STREAMS_STMT:
|
||||||
|
case QUERY_NODE_SHOW_BNODES_STMT:
|
||||||
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
return makeNode(type, sizeof(SShowStmt));
|
return makeNode(type, sizeof(SShowStmt));
|
||||||
case QUERY_NODE_LOGIC_PLAN_SCAN:
|
case QUERY_NODE_LOGIC_PLAN_SCAN:
|
||||||
return makeNode(type, sizeof(SScanLogicNode));
|
return makeNode(type, sizeof(SScanLogicNode));
|
||||||
|
|
|
@ -2037,13 +2037,13 @@ static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt
|
||||||
static int16_t getCreateComponentNodeMsgType(ENodeType type) {
|
static int16_t getCreateComponentNodeMsgType(ENodeType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QUERY_NODE_CREATE_QNODE_STMT:
|
case QUERY_NODE_CREATE_QNODE_STMT:
|
||||||
return TDMT_DND_CREATE_QNODE;
|
return TDMT_MND_CREATE_QNODE;
|
||||||
case QUERY_NODE_CREATE_BNODE_STMT:
|
case QUERY_NODE_CREATE_BNODE_STMT:
|
||||||
return TDMT_DND_CREATE_BNODE;
|
return TDMT_MND_CREATE_BNODE;
|
||||||
case QUERY_NODE_CREATE_SNODE_STMT:
|
case QUERY_NODE_CREATE_SNODE_STMT:
|
||||||
return TDMT_DND_CREATE_SNODE;
|
return TDMT_MND_CREATE_SNODE;
|
||||||
case QUERY_NODE_CREATE_MNODE_STMT:
|
case QUERY_NODE_CREATE_MNODE_STMT:
|
||||||
return TDMT_DND_CREATE_MNODE;
|
return TDMT_MND_CREATE_MNODE;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2059,12 +2059,12 @@ static int32_t translateCreateComponentNode(STranslateContext* pCxt, SCreateComp
|
||||||
}
|
}
|
||||||
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
||||||
pCxt->pCmdMsg->msgType = getCreateComponentNodeMsgType(nodeType(pStmt));
|
pCxt->pCmdMsg->msgType = getCreateComponentNodeMsgType(nodeType(pStmt));
|
||||||
pCxt->pCmdMsg->msgLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &createReq);
|
pCxt->pCmdMsg->msgLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &createReq);
|
||||||
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
||||||
if (NULL == pCxt->pCmdMsg->pMsg) {
|
if (NULL == pCxt->pCmdMsg->pMsg) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
|
tSerializeSCreateDropMQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -2072,13 +2072,13 @@ static int32_t translateCreateComponentNode(STranslateContext* pCxt, SCreateComp
|
||||||
static int16_t getDropComponentNodeMsgType(ENodeType type) {
|
static int16_t getDropComponentNodeMsgType(ENodeType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QUERY_NODE_DROP_QNODE_STMT:
|
case QUERY_NODE_DROP_QNODE_STMT:
|
||||||
return TDMT_DND_DROP_QNODE;
|
return TDMT_MND_DROP_QNODE;
|
||||||
case QUERY_NODE_DROP_BNODE_STMT:
|
case QUERY_NODE_DROP_BNODE_STMT:
|
||||||
return TDMT_DND_DROP_BNODE;
|
return TDMT_MND_DROP_BNODE;
|
||||||
case QUERY_NODE_DROP_SNODE_STMT:
|
case QUERY_NODE_DROP_SNODE_STMT:
|
||||||
return TDMT_DND_DROP_SNODE;
|
return TDMT_MND_DROP_SNODE;
|
||||||
case QUERY_NODE_DROP_MNODE_STMT:
|
case QUERY_NODE_DROP_MNODE_STMT:
|
||||||
return TDMT_DND_DROP_MNODE;
|
return TDMT_MND_DROP_MNODE;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2094,12 +2094,12 @@ static int32_t translateDropComponentNode(STranslateContext* pCxt, SDropComponen
|
||||||
}
|
}
|
||||||
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet;
|
||||||
pCxt->pCmdMsg->msgType = getDropComponentNodeMsgType(nodeType(pStmt));
|
pCxt->pCmdMsg->msgType = getDropComponentNodeMsgType(nodeType(pStmt));
|
||||||
pCxt->pCmdMsg->msgLen = tSerializeSMCreateDropQSBNodeReq(NULL, 0, &dropReq);
|
pCxt->pCmdMsg->msgLen = tSerializeSCreateDropMQSBNodeReq(NULL, 0, &dropReq);
|
||||||
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
pCxt->pCmdMsg->pMsg = taosMemoryMalloc(pCxt->pCmdMsg->msgLen);
|
||||||
if (NULL == pCxt->pCmdMsg->pMsg) {
|
if (NULL == pCxt->pCmdMsg->pMsg) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
tSerializeSMCreateDropQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
|
tSerializeSCreateDropMQSBNodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq);
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1211,7 +1211,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte
|
||||||
rpcSendReqToServer(pRpc, pContext);
|
rpcSendReqToServer(pRpc, pContext);
|
||||||
rpcFreeCont(rpcMsg.pCont);
|
rpcFreeCont(rpcMsg.pCont);
|
||||||
} else if (pHead->code == TSDB_CODE_RPC_NOT_READY || pHead->code == TSDB_CODE_APP_NOT_READY ||
|
} else if (pHead->code == TSDB_CODE_RPC_NOT_READY || pHead->code == TSDB_CODE_APP_NOT_READY ||
|
||||||
pHead->code == TSDB_CODE_DND_OFFLINE) {
|
pHead->code == TSDB_CODE_NODE_OFFLINE) {
|
||||||
pContext->code = pHead->code;
|
pContext->code = pHead->code;
|
||||||
rpcProcessConnError(pContext, NULL);
|
rpcProcessConnError(pContext, NULL);
|
||||||
rpcFreeCont(rpcMsg.pCont);
|
rpcFreeCont(rpcMsg.pCont);
|
||||||
|
|
|
@ -70,21 +70,29 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQD
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_VERSION, "Invalid app version")
|
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_VERSION, "Invalid app version")
|
||||||
|
|
||||||
//common & util
|
//common & util
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_OPS_NOT_SUPPORT, "Operation not supported")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_MEMORY, "Out of Memory")
|
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_MEMORY, "Out of Memory")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_RANGE, "Out of range")
|
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_RANGE, "Out of range")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_SHM_MEM, "Out of Shared memory")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_SHM_ID, "Invalid SHM ID")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PTR, "Invalid pointer")
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PTR, "Invalid pointer")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG, "Invalid message")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG_LEN, "Invalid message len")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PARA, "Invalid parameters")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CFG, "Invalid config option")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_OPTION, "Invalid option")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_JSON_FORMAT, "Invalid json format")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_NUMBER, "Invalid version number")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_STRING, "Invalid version string")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_VERSION_NOT_COMPATIBLE, "Version not compatible")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MEMORY_CORRUPTED, "Memory corrupted")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MEMORY_CORRUPTED, "Memory corrupted")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, "Data file corrupted")
|
TAOS_DEFINE_ERROR(TSDB_CODE_FILE_CORRUPTED, "Data file corrupted")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_CHECKSUM_ERROR, "Checksum error")
|
TAOS_DEFINE_ERROR(TSDB_CODE_CHECKSUM_ERROR, "Checksum error")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MSG, "Invalid message")
|
TAOS_DEFINE_ERROR(TSDB_CODE_COMPRESS_ERROR, "Failed to compress msg")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_OPS_NOT_SUPPORT, "Operation not supported")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MSG_NOT_PROCESSED, "Message not processed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MSG_NOT_PROCESSED, "Message not processed")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_PARA, "Invalid parameters")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REPEAT_INIT, "Repeat initialization")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_CFG_NOT_FOUND, "Config not found")
|
TAOS_DEFINE_ERROR(TSDB_CODE_CFG_NOT_FOUND, "Config not found")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_CFG, "Invalid config option")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REPEAT_INIT, "Repeat initialization")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_OUT_OF_SHM_MEM, "Out of Share memory")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_SHM_ID, "Invalid SHM ID")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NO_MEMORY, "Ref out of memory")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NO_MEMORY, "Ref out of memory")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_FULL, "too many Ref Objs")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_FULL, "too many Ref Objs")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, "Ref ID is removed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ID_REMOVED, "Ref ID is removed")
|
||||||
|
@ -92,11 +100,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_REF_INVALID_ID, "Invalid Ref ID")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ALREADY_EXIST, "Ref is already there")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_ALREADY_EXIST, "Ref is already there")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NOT_EXIST, "Ref is not there")
|
TAOS_DEFINE_ERROR(TSDB_CODE_REF_NOT_EXIST, "Ref is not there")
|
||||||
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_NUMBER, "Invalid version number")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_VERSION_STRING, "Invalid version string")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VERSION_NOT_COMPATIBLE, "Version not compatible")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_COMPRESS_ERROR, "Failed to compress msg")
|
|
||||||
|
|
||||||
//client
|
//client
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_QHANDLE, "Invalid qhandle")
|
TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_QHANDLE, "Invalid qhandle")
|
||||||
|
@ -277,17 +280,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "SMA does not exist")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma option")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma option")
|
||||||
|
|
||||||
// dnode
|
// dnode
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_ACTION_IN_PROGRESS, "Action in progress")
|
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_OFFLINE, "Node is offline")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_OFFLINE, "Dnode is offline")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_INVALID_MSG_LEN, "Invalid message length")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_ALREADY_DEPLOYED, "Node already deployed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_ALREADY_DEPLOYED, "Node already deployed")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_NOT_DEPLOYED, "Node not deployed")
|
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_NOT_DEPLOYED, "Node not deployed")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_PARSE_FILE_ERROR, "Invalid json format")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_INVALID_OPTION, "Invalid node option")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED, "Vnode already deployed")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_NOT_DEPLOYED, "Vnode not deployed")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_INVALID_OPTION, "Vnode option invalid")
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DND_VNODE_TOO_MANY_VNODES, "Too many vnodes")
|
|
||||||
|
|
||||||
// vnode
|
// vnode
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, "Action in progress")
|
TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, "Action in progress")
|
||||||
|
|
|
@ -33,6 +33,15 @@
|
||||||
./test.sh -f tsim/query/scalarFunction.sim
|
./test.sh -f tsim/query/scalarFunction.sim
|
||||||
./test.sh -f tsim/query/charScalarFunction.sim
|
./test.sh -f tsim/query/charScalarFunction.sim
|
||||||
|
|
||||||
|
# ---- qnode
|
||||||
|
./test.sh -f tsim/qnode/basic1.sim
|
||||||
|
|
||||||
|
# ---- snode
|
||||||
|
./test.sh -f tsim/snode/basic1.sim
|
||||||
|
|
||||||
|
# ---- bnode
|
||||||
|
./test.sh -f tsim/bnode/basic1.sim
|
||||||
|
|
||||||
# ---- show
|
# ---- show
|
||||||
./test.sh -f tsim/show/basic.sim
|
./test.sh -f tsim/show/basic.sim
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== show dnodes
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create dnodes
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sleep 2000
|
||||||
|
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print $data02
|
||||||
|
if $data02 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data12 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data04 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data14 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create drop bnode 1
|
||||||
|
sql create bnode on dnode 1
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create bnode on dnode 1
|
||||||
|
|
||||||
|
sql drop bnode on dnode 1
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop bnode on dnode 1
|
||||||
|
|
||||||
|
print =============== create drop bnode 2
|
||||||
|
sql create bnode on dnode 2
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create bnode on dnode 2
|
||||||
|
|
||||||
|
sql drop bnode on dnode 2
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop bnode on dnode 2
|
||||||
|
|
||||||
|
print =============== create drop bnodes
|
||||||
|
sql create bnode on dnode 1
|
||||||
|
sql create bnode on dnode 2
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== restart
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
|
||||||
|
sleep 2000
|
||||||
|
sql show bnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
@ -0,0 +1,135 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== show dnodes
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create dnodes
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sleep 2000
|
||||||
|
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print $data02
|
||||||
|
if $data02 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data12 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data04 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data14 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create drop qnode 1
|
||||||
|
sql create qnode on dnode 1
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create qnode on dnode 1
|
||||||
|
|
||||||
|
sql drop qnode on dnode 1
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop qnode on dnode 1
|
||||||
|
|
||||||
|
print =============== create drop qnode 2
|
||||||
|
sql create qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create qnode on dnode 2
|
||||||
|
|
||||||
|
sql drop qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop qnode on dnode 2
|
||||||
|
|
||||||
|
print =============== create drop qnodes
|
||||||
|
sql create qnode on dnode 1
|
||||||
|
sql create qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== restart
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
|
||||||
|
sleep 2000
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
@ -0,0 +1,135 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== show dnodes
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create dnodes
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sleep 2000
|
||||||
|
|
||||||
|
sql show dnodes;
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data10 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print $data02
|
||||||
|
if $data02 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data12 != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data04 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data14 != ready then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show mnodes;
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
if $data02 != master then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create drop qnode 1
|
||||||
|
sql create qnode on dnode 1
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create qnode on dnode 1
|
||||||
|
|
||||||
|
sql drop qnode on dnode 1
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop qnode on dnode 1
|
||||||
|
|
||||||
|
print =============== create drop qnode 2
|
||||||
|
sql create qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error create qnode on dnode 2
|
||||||
|
|
||||||
|
sql drop qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql_error drop qnode on dnode 2
|
||||||
|
|
||||||
|
print =============== create drop qnodes
|
||||||
|
sql create qnode on dnode 1
|
||||||
|
sql create qnode on dnode 2
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== restart
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
|
||||||
|
sleep 2000
|
||||||
|
sql show qnodes
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
Loading…
Reference in New Issue