minor changes
This commit is contained in:
parent
7974143dc7
commit
268c3343d5
|
@ -851,15 +851,15 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
int32_t dnodeId;
|
||||
} SMCreateQnodeMsg, SMDropQnodeMsg, SDCreateQnodeMsg, SDDropQnodeMsg;
|
||||
} SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq;
|
||||
|
||||
typedef struct {
|
||||
int32_t dnodeId;
|
||||
} SMCreateSnodeMsg, SMDropSnodeMsg, SDCreateSnodeMsg, SDDropSnodeMsg;
|
||||
} SMCreateSnodeReq, SMDropSnodeReq, SDCreateSnodeReq, SDDropSnodeReq;
|
||||
|
||||
typedef struct {
|
||||
int32_t dnodeId;
|
||||
} SMCreateBnodeMsg, SMDropBnodeMsg, SDCreateBnodeMsg, SDDropBnodeMsg;
|
||||
} SMCreateBnodeReq, SMDropBnodeReq, SDCreateBnodeReq, SDDropBnodeReq;
|
||||
|
||||
typedef struct {
|
||||
int32_t dnodeId;
|
||||
|
|
|
@ -60,7 +60,7 @@ static int32_t dndReadBnodeFile(SDnode *pDnode) {
|
|||
SBnodeMgmt *pMgmt = &pDnode->bmgmt;
|
||||
int32_t code = TSDB_CODE_DND_BNODE_READ_FILE_ERROR;
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 4096;
|
||||
int32_t maxLen = 1024;
|
||||
char *content = calloc(1, maxLen + 1);
|
||||
cJSON *root = NULL;
|
||||
|
||||
|
@ -127,7 +127,7 @@ static int32_t dndWriteBnodeFile(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 4096;
|
||||
int32_t maxLen = 1024;
|
||||
char *content = calloc(1, maxLen + 1);
|
||||
|
||||
len += snprintf(content + len, maxLen - len, "{\n");
|
||||
|
@ -256,7 +256,7 @@ static int32_t dndDropBnode(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
||||
SDCreateBnodeMsg *pMsg = pRpcMsg->pCont;
|
||||
SDCreateBnodeReq *pMsg = pRpcMsg->pCont;
|
||||
pMsg->dnodeId = htonl(pMsg->dnodeId);
|
||||
|
||||
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
|
||||
|
@ -268,7 +268,7 @@ int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
|||
}
|
||||
|
||||
int32_t dndProcessDropBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
||||
SDDropBnodeMsg *pMsg = pRpcMsg->pCont;
|
||||
SDDropBnodeReq *pMsg = pRpcMsg->pCont;
|
||||
pMsg->dnodeId = htonl(pMsg->dnodeId);
|
||||
|
||||
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
|
||||
|
|
|
@ -60,7 +60,7 @@ static int32_t dndReadQnodeFile(SDnode *pDnode) {
|
|||
SQnodeMgmt *pMgmt = &pDnode->qmgmt;
|
||||
int32_t code = TSDB_CODE_DND_QNODE_READ_FILE_ERROR;
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 4096;
|
||||
int32_t maxLen = 1024;
|
||||
char *content = calloc(1, maxLen + 1);
|
||||
cJSON *root = NULL;
|
||||
|
||||
|
@ -127,7 +127,7 @@ static int32_t dndWriteQnodeFile(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 4096;
|
||||
int32_t maxLen = 1024;
|
||||
char *content = calloc(1, maxLen + 1);
|
||||
|
||||
len += snprintf(content + len, maxLen - len, "{\n");
|
||||
|
@ -261,7 +261,7 @@ static int32_t dndDropQnode(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
||||
SDCreateQnodeMsg *pMsg = pRpcMsg->pCont;
|
||||
SDCreateQnodeReq *pMsg = pRpcMsg->pCont;
|
||||
pMsg->dnodeId = htonl(pMsg->dnodeId);
|
||||
|
||||
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
|
||||
|
@ -273,7 +273,7 @@ int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
|||
}
|
||||
|
||||
int32_t dndProcessDropQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
||||
SDDropQnodeMsg *pMsg = pRpcMsg->pCont;
|
||||
SDDropQnodeReq *pMsg = pRpcMsg->pCont;
|
||||
pMsg->dnodeId = htonl(pMsg->dnodeId);
|
||||
|
||||
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
|
||||
|
|
|
@ -60,7 +60,7 @@ static int32_t dndReadSnodeFile(SDnode *pDnode) {
|
|||
SSnodeMgmt *pMgmt = &pDnode->smgmt;
|
||||
int32_t code = TSDB_CODE_DND_SNODE_READ_FILE_ERROR;
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 4096;
|
||||
int32_t maxLen = 1024;
|
||||
char *content = calloc(1, maxLen + 1);
|
||||
cJSON *root = NULL;
|
||||
|
||||
|
@ -127,7 +127,7 @@ static int32_t dndWriteSnodeFile(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
int32_t len = 0;
|
||||
int32_t maxLen = 4096;
|
||||
int32_t maxLen = 1024;
|
||||
char *content = calloc(1, maxLen + 1);
|
||||
|
||||
len += snprintf(content + len, maxLen - len, "{\n");
|
||||
|
@ -256,7 +256,7 @@ static int32_t dndDropSnode(SDnode *pDnode) {
|
|||
}
|
||||
|
||||
int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
||||
SDCreateSnodeMsg *pMsg = pRpcMsg->pCont;
|
||||
SDCreateSnodeReq *pMsg = pRpcMsg->pCont;
|
||||
pMsg->dnodeId = htonl(pMsg->dnodeId);
|
||||
|
||||
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
|
||||
|
@ -268,7 +268,7 @@ int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
|||
}
|
||||
|
||||
int32_t dndProcessDropSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
|
||||
SDDropSnodeMsg *pMsg = pRpcMsg->pCont;
|
||||
SDDropSnodeReq *pMsg = pRpcMsg->pCont;
|
||||
pMsg->dnodeId = htonl(pMsg->dnodeId);
|
||||
|
||||
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
|
||||
|
|
|
@ -52,9 +52,9 @@ TEST_F(DndTestBnode, 01_ShowBnode) {
|
|||
|
||||
TEST_F(DndTestBnode, 02_Create_Bnode_Invalid_Id) {
|
||||
{
|
||||
int32_t contLen = sizeof(SMCreateBnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateBnodeReq);
|
||||
|
||||
SMCreateBnodeMsg* pReq = (SMCreateBnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateBnodeReq* pReq = (SMCreateBnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(1);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
|
@ -79,9 +79,9 @@ TEST_F(DndTestBnode, 02_Create_Bnode_Invalid_Id) {
|
|||
|
||||
TEST_F(DndTestBnode, 03_Create_Bnode_Invalid_Id) {
|
||||
{
|
||||
int32_t contLen = sizeof(SMCreateBnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateBnodeReq);
|
||||
|
||||
SMCreateBnodeMsg* pReq = (SMCreateBnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateBnodeReq* pReq = (SMCreateBnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
|
@ -111,9 +111,9 @@ TEST_F(DndTestBnode, 04_Create_Bnode) {
|
|||
|
||||
{
|
||||
// create bnode
|
||||
int32_t contLen = sizeof(SMCreateBnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateBnodeReq);
|
||||
|
||||
SMCreateBnodeMsg* pReq = (SMCreateBnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateBnodeReq* pReq = (SMCreateBnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
|
@ -134,9 +134,9 @@ TEST_F(DndTestBnode, 04_Create_Bnode) {
|
|||
|
||||
{
|
||||
// drop bnode
|
||||
int32_t contLen = sizeof(SMDropBnodeMsg);
|
||||
int32_t contLen = sizeof(SMDropBnodeReq);
|
||||
|
||||
SMDropBnodeMsg* pReq = (SMDropBnodeMsg*)rpcMallocCont(contLen);
|
||||
SMDropBnodeReq* pReq = (SMDropBnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||
|
|
|
@ -24,3 +24,44 @@ class DndTestQnode : public ::testing::Test {
|
|||
};
|
||||
|
||||
Testbase DndTestQnode::test;
|
||||
|
||||
TEST_F(DndTestQnode, 04_Drop_User) {
|
||||
{
|
||||
int32_t contLen = sizeof(SDropUserReq);
|
||||
|
||||
SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
|
||||
strcpy(pReq->user, "");
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_USER, pReq, contLen);
|
||||
ASSERT_NE(pMsg, nullptr);
|
||||
ASSERT_EQ(pMsg->code, TSDB_CODE_MND_INVALID_USER_FORMAT);
|
||||
}
|
||||
|
||||
// {
|
||||
// int32_t contLen = sizeof(SDropUserReq);
|
||||
|
||||
// SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
|
||||
// strcpy(pReq->user, "u4");
|
||||
|
||||
// SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_USER, pReq, contLen);
|
||||
// ASSERT_NE(pMsg, nullptr);
|
||||
// ASSERT_EQ(pMsg->code, TSDB_CODE_MND_USER_NOT_EXIST);
|
||||
// }
|
||||
|
||||
// {
|
||||
// int32_t contLen = sizeof(SDropUserReq);
|
||||
|
||||
// SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
|
||||
// strcpy(pReq->user, "u1");
|
||||
|
||||
// SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_USER, pReq, contLen);
|
||||
// ASSERT_NE(pMsg, nullptr);
|
||||
// ASSERT_EQ(pMsg->code, 0);
|
||||
// }
|
||||
|
||||
// test.SendShowMetaMsg(TSDB_MGMT_TABLE_USER, "");
|
||||
// CHECK_META("show users", 4);
|
||||
|
||||
// test.SendShowRetrieveMsg();
|
||||
// EXPECT_EQ(test.GetShowRows(), 1);
|
||||
}
|
|
@ -178,7 +178,7 @@ static int32_t mndSetCreateBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) {
|
|||
}
|
||||
|
||||
static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBnodeObj *pObj) {
|
||||
SDCreateBnodeMsg *pMsg = malloc(sizeof(SDCreateBnodeMsg));
|
||||
SDCreateBnodeReq *pMsg = malloc(sizeof(SDCreateBnodeReq));
|
||||
if (pMsg == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -188,7 +188,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
action.pCont = pMsg;
|
||||
action.contLen = sizeof(SDCreateBnodeMsg);
|
||||
action.contLen = sizeof(SDCreateBnodeReq);
|
||||
action.msgType = TDMT_DND_CREATE_BNODE;
|
||||
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
|
@ -199,7 +199,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndCreateBnode(SMnode *pMnode, SMnodeMsg *pMsg, SDnodeObj *pDnode, SMCreateBnodeMsg *pCreate) {
|
||||
static int32_t mndCreateBnode(SMnode *pMnode, SMnodeMsg *pMsg, SDnodeObj *pDnode, SMCreateBnodeReq *pCreate) {
|
||||
SBnodeObj bnodeObj = {0};
|
||||
bnodeObj.id = pDnode->id;
|
||||
bnodeObj.createdTime = taosGetTimestampMs();
|
||||
|
@ -242,7 +242,7 @@ CREATE_BNODE_OVER:
|
|||
|
||||
static int32_t mndProcessCreateBnodeReq(SMnodeMsg *pMsg) {
|
||||
SMnode *pMnode = pMsg->pMnode;
|
||||
SMCreateBnodeMsg *pCreate = pMsg->rpcMsg.pCont;
|
||||
SMCreateBnodeReq *pCreate = pMsg->rpcMsg.pCont;
|
||||
|
||||
pCreate->dnodeId = htonl(pCreate->dnodeId);
|
||||
|
||||
|
@ -290,7 +290,7 @@ static int32_t mndSetDropBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) {
|
|||
}
|
||||
|
||||
static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBnodeObj *pObj) {
|
||||
SDDropBnodeMsg *pMsg = malloc(sizeof(SDDropBnodeMsg));
|
||||
SDDropBnodeReq *pMsg = malloc(sizeof(SDDropBnodeReq));
|
||||
if (pMsg == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -300,7 +300,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
|
|||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
action.pCont = pMsg;
|
||||
action.contLen = sizeof(SDDropBnodeMsg);
|
||||
action.contLen = sizeof(SDDropBnodeReq);
|
||||
action.msgType = TDMT_DND_DROP_BNODE;
|
||||
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
|
@ -350,7 +350,7 @@ DROP_BNODE_OVER:
|
|||
|
||||
static int32_t mndProcessDropBnodeReq(SMnodeMsg *pMsg) {
|
||||
SMnode *pMnode = pMsg->pMnode;
|
||||
SMDropBnodeMsg *pDrop = pMsg->rpcMsg.pCont;
|
||||
SMDropBnodeReq *pDrop = pMsg->rpcMsg.pCont;
|
||||
pDrop->dnodeId = htonl(pDrop->dnodeId);
|
||||
|
||||
mDebug("bnode:%d, start to drop", pDrop->dnodeId);
|
||||
|
|
|
@ -178,7 +178,7 @@ static int32_t mndSetCreateQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) {
|
|||
}
|
||||
|
||||
static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQnodeObj *pObj) {
|
||||
SDCreateQnodeMsg *pMsg = malloc(sizeof(SDCreateQnodeMsg));
|
||||
SDCreateQnodeReq *pMsg = malloc(sizeof(SDCreateQnodeReq));
|
||||
if (pMsg == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -188,7 +188,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
action.pCont = pMsg;
|
||||
action.contLen = sizeof(SDCreateQnodeMsg);
|
||||
action.contLen = sizeof(SDCreateQnodeReq);
|
||||
action.msgType = TDMT_DND_CREATE_QNODE;
|
||||
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
|
@ -199,7 +199,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndCreateQnode(SMnode *pMnode, SMnodeMsg *pMsg, SDnodeObj *pDnode, SMCreateQnodeMsg *pCreate) {
|
||||
static int32_t mndCreateQnode(SMnode *pMnode, SMnodeMsg *pMsg, SDnodeObj *pDnode, SMCreateQnodeReq *pCreate) {
|
||||
SQnodeObj qnodeObj = {0};
|
||||
qnodeObj.id = pDnode->id;
|
||||
qnodeObj.createdTime = taosGetTimestampMs();
|
||||
|
@ -242,7 +242,7 @@ CREATE_QNODE_OVER:
|
|||
|
||||
static int32_t mndProcessCreateQnodeReq(SMnodeMsg *pMsg) {
|
||||
SMnode *pMnode = pMsg->pMnode;
|
||||
SMCreateQnodeMsg *pCreate = pMsg->rpcMsg.pCont;
|
||||
SMCreateQnodeReq *pCreate = pMsg->rpcMsg.pCont;
|
||||
|
||||
pCreate->dnodeId = htonl(pCreate->dnodeId);
|
||||
|
||||
|
@ -290,7 +290,7 @@ static int32_t mndSetDropQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) {
|
|||
}
|
||||
|
||||
static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQnodeObj *pObj) {
|
||||
SDDropQnodeMsg *pMsg = malloc(sizeof(SDDropQnodeMsg));
|
||||
SDDropQnodeReq *pMsg = malloc(sizeof(SDDropQnodeReq));
|
||||
if (pMsg == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -300,7 +300,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
|
|||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
action.pCont = pMsg;
|
||||
action.contLen = sizeof(SDDropQnodeMsg);
|
||||
action.contLen = sizeof(SDDropQnodeReq);
|
||||
action.msgType = TDMT_DND_DROP_QNODE;
|
||||
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
|
@ -350,7 +350,7 @@ DROP_QNODE_OVER:
|
|||
|
||||
static int32_t mndProcessDropQnodeReq(SMnodeMsg *pMsg) {
|
||||
SMnode *pMnode = pMsg->pMnode;
|
||||
SMDropQnodeMsg *pDrop = pMsg->rpcMsg.pCont;
|
||||
SMDropQnodeReq *pDrop = pMsg->rpcMsg.pCont;
|
||||
pDrop->dnodeId = htonl(pDrop->dnodeId);
|
||||
|
||||
mDebug("qnode:%d, start to drop", pDrop->dnodeId);
|
||||
|
|
|
@ -178,7 +178,7 @@ static int32_t mndSetCreateSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) {
|
|||
}
|
||||
|
||||
static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSnodeObj *pObj) {
|
||||
SDCreateSnodeMsg *pMsg = malloc(sizeof(SDCreateSnodeMsg));
|
||||
SDCreateSnodeReq *pMsg = malloc(sizeof(SDCreateSnodeReq));
|
||||
if (pMsg == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -188,7 +188,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
action.pCont = pMsg;
|
||||
action.contLen = sizeof(SDCreateSnodeMsg);
|
||||
action.contLen = sizeof(SDCreateSnodeReq);
|
||||
action.msgType = TDMT_DND_CREATE_SNODE;
|
||||
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
|
@ -199,7 +199,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndCreateSnode(SMnode *pMnode, SMnodeMsg *pMsg, SDnodeObj *pDnode, SMCreateSnodeMsg *pCreate) {
|
||||
static int32_t mndCreateSnode(SMnode *pMnode, SMnodeMsg *pMsg, SDnodeObj *pDnode, SMCreateSnodeReq *pCreate) {
|
||||
SSnodeObj snodeObj = {0};
|
||||
snodeObj.id = pDnode->id;
|
||||
snodeObj.createdTime = taosGetTimestampMs();
|
||||
|
@ -242,7 +242,7 @@ CREATE_SNODE_OVER:
|
|||
|
||||
static int32_t mndProcessCreateSnodeReq(SMnodeMsg *pMsg) {
|
||||
SMnode *pMnode = pMsg->pMnode;
|
||||
SMCreateSnodeMsg *pCreate = pMsg->rpcMsg.pCont;
|
||||
SMCreateSnodeReq *pCreate = pMsg->rpcMsg.pCont;
|
||||
|
||||
pCreate->dnodeId = htonl(pCreate->dnodeId);
|
||||
|
||||
|
@ -290,7 +290,7 @@ static int32_t mndSetDropSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) {
|
|||
}
|
||||
|
||||
static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSnodeObj *pObj) {
|
||||
SDDropSnodeMsg *pMsg = malloc(sizeof(SDDropSnodeMsg));
|
||||
SDDropSnodeReq *pMsg = malloc(sizeof(SDDropSnodeReq));
|
||||
if (pMsg == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -300,7 +300,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
|
|||
STransAction action = {0};
|
||||
action.epSet = mndGetDnodeEpset(pDnode);
|
||||
action.pCont = pMsg;
|
||||
action.contLen = sizeof(SDDropSnodeMsg);
|
||||
action.contLen = sizeof(SDDropSnodeReq);
|
||||
action.msgType = TDMT_DND_DROP_SNODE;
|
||||
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
|
@ -350,7 +350,7 @@ DROP_SNODE_OVER:
|
|||
|
||||
static int32_t mndProcessDropSnodeReq(SMnodeMsg *pMsg) {
|
||||
SMnode *pMnode = pMsg->pMnode;
|
||||
SMDropSnodeMsg *pDrop = pMsg->rpcMsg.pCont;
|
||||
SMDropSnodeReq *pDrop = pMsg->rpcMsg.pCont;
|
||||
pDrop->dnodeId = htonl(pDrop->dnodeId);
|
||||
|
||||
mDebug("snode:%d, start to drop", pDrop->dnodeId);
|
||||
|
|
|
@ -52,9 +52,9 @@ TEST_F(MndTestBnode, 01_Show_Bnode) {
|
|||
|
||||
TEST_F(MndTestBnode, 02_Create_Bnode_Invalid_Id) {
|
||||
{
|
||||
int32_t contLen = sizeof(SMCreateBnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateBnodeReq);
|
||||
|
||||
SMCreateBnodeMsg* pReq = (SMCreateBnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateBnodeReq* pReq = (SMCreateBnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(1);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
|
@ -79,9 +79,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode_Invalid_Id) {
|
|||
|
||||
TEST_F(MndTestBnode, 03_Create_Bnode_Invalid_Id) {
|
||||
{
|
||||
int32_t contLen = sizeof(SMCreateBnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateBnodeReq);
|
||||
|
||||
SMCreateBnodeMsg* pReq = (SMCreateBnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateBnodeReq* pReq = (SMCreateBnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
|
@ -111,9 +111,9 @@ TEST_F(MndTestBnode, 04_Create_Bnode) {
|
|||
|
||||
{
|
||||
// create bnode
|
||||
int32_t contLen = sizeof(SMCreateBnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateBnodeReq);
|
||||
|
||||
SMCreateBnodeMsg* pReq = (SMCreateBnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateBnodeReq* pReq = (SMCreateBnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
|
||||
|
@ -134,9 +134,9 @@ TEST_F(MndTestBnode, 04_Create_Bnode) {
|
|||
|
||||
{
|
||||
// drop bnode
|
||||
int32_t contLen = sizeof(SMDropBnodeMsg);
|
||||
int32_t contLen = sizeof(SMDropBnodeReq);
|
||||
|
||||
SMDropBnodeMsg* pReq = (SMDropBnodeMsg*)rpcMallocCont(contLen);
|
||||
SMDropBnodeReq* pReq = (SMDropBnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_BNODE, pReq, contLen);
|
||||
|
|
|
@ -52,9 +52,9 @@ TEST_F(MndTestQnode, 01_Show_Qnode) {
|
|||
|
||||
TEST_F(MndTestQnode, 02_Create_Qnode_Invalid_Id) {
|
||||
{
|
||||
int32_t contLen = sizeof(SMCreateQnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateQnodeReq);
|
||||
|
||||
SMCreateQnodeMsg* pReq = (SMCreateQnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateQnodeReq* pReq = (SMCreateQnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(1);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||
|
@ -79,9 +79,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode_Invalid_Id) {
|
|||
|
||||
TEST_F(MndTestQnode, 03_Create_Qnode_Invalid_Id) {
|
||||
{
|
||||
int32_t contLen = sizeof(SMCreateQnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateQnodeReq);
|
||||
|
||||
SMCreateQnodeMsg* pReq = (SMCreateQnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateQnodeReq* pReq = (SMCreateQnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||
|
@ -111,9 +111,9 @@ TEST_F(MndTestQnode, 04_Create_Qnode) {
|
|||
|
||||
{
|
||||
// create qnode
|
||||
int32_t contLen = sizeof(SMCreateQnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateQnodeReq);
|
||||
|
||||
SMCreateQnodeMsg* pReq = (SMCreateQnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateQnodeReq* pReq = (SMCreateQnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||
|
@ -134,9 +134,9 @@ TEST_F(MndTestQnode, 04_Create_Qnode) {
|
|||
|
||||
{
|
||||
// drop qnode
|
||||
int32_t contLen = sizeof(SMDropQnodeMsg);
|
||||
int32_t contLen = sizeof(SMDropQnodeReq);
|
||||
|
||||
SMDropQnodeMsg* pReq = (SMDropQnodeMsg*)rpcMallocCont(contLen);
|
||||
SMDropQnodeReq* pReq = (SMDropQnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_QNODE, pReq, contLen);
|
||||
|
|
|
@ -52,9 +52,9 @@ TEST_F(MndTestSnode, 01_Show_Snode) {
|
|||
|
||||
TEST_F(MndTestSnode, 02_Create_Snode_Invalid_Id) {
|
||||
{
|
||||
int32_t contLen = sizeof(SMCreateSnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateSnodeReq);
|
||||
|
||||
SMCreateSnodeMsg* pReq = (SMCreateSnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateSnodeReq* pReq = (SMCreateSnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(1);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||
|
@ -79,9 +79,9 @@ TEST_F(MndTestSnode, 02_Create_Snode_Invalid_Id) {
|
|||
|
||||
TEST_F(MndTestSnode, 03_Create_Snode_Invalid_Id) {
|
||||
{
|
||||
int32_t contLen = sizeof(SMCreateSnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateSnodeReq);
|
||||
|
||||
SMCreateSnodeMsg* pReq = (SMCreateSnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateSnodeReq* pReq = (SMCreateSnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||
|
@ -111,9 +111,9 @@ TEST_F(MndTestSnode, 04_Create_Snode) {
|
|||
|
||||
{
|
||||
// create snode
|
||||
int32_t contLen = sizeof(SMCreateSnodeMsg);
|
||||
int32_t contLen = sizeof(SMCreateSnodeReq);
|
||||
|
||||
SMCreateSnodeMsg* pReq = (SMCreateSnodeMsg*)rpcMallocCont(contLen);
|
||||
SMCreateSnodeReq* pReq = (SMCreateSnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen);
|
||||
|
@ -134,9 +134,9 @@ TEST_F(MndTestSnode, 04_Create_Snode) {
|
|||
|
||||
{
|
||||
// drop snode
|
||||
int32_t contLen = sizeof(SMDropSnodeMsg);
|
||||
int32_t contLen = sizeof(SMDropSnodeReq);
|
||||
|
||||
SMDropSnodeMsg* pReq = (SMDropSnodeMsg*)rpcMallocCont(contLen);
|
||||
SMDropSnodeReq* pReq = (SMDropSnodeReq*)rpcMallocCont(contLen);
|
||||
pReq->dnodeId = htonl(2);
|
||||
|
||||
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_SNODE, pReq, contLen);
|
||||
|
|
Loading…
Reference in New Issue