提交 268c3343 编写于 作者: S Shengliang Guan

minor changes

上级 7974143d
...@@ -851,15 +851,15 @@ typedef struct { ...@@ -851,15 +851,15 @@ typedef struct {
typedef struct { typedef struct {
int32_t dnodeId; int32_t dnodeId;
} SMCreateQnodeMsg, SMDropQnodeMsg, SDCreateQnodeMsg, SDDropQnodeMsg; } SMCreateQnodeReq, SMDropQnodeReq, SDCreateQnodeReq, SDDropQnodeReq;
typedef struct { typedef struct {
int32_t dnodeId; int32_t dnodeId;
} SMCreateSnodeMsg, SMDropSnodeMsg, SDCreateSnodeMsg, SDDropSnodeMsg; } SMCreateSnodeReq, SMDropSnodeReq, SDCreateSnodeReq, SDDropSnodeReq;
typedef struct { typedef struct {
int32_t dnodeId; int32_t dnodeId;
} SMCreateBnodeMsg, SMDropBnodeMsg, SDCreateBnodeMsg, SDDropBnodeMsg; } SMCreateBnodeReq, SMDropBnodeReq, SDCreateBnodeReq, SDDropBnodeReq;
typedef struct { typedef struct {
int32_t dnodeId; int32_t dnodeId;
......
...@@ -60,7 +60,7 @@ static int32_t dndReadBnodeFile(SDnode *pDnode) { ...@@ -60,7 +60,7 @@ static int32_t dndReadBnodeFile(SDnode *pDnode) {
SBnodeMgmt *pMgmt = &pDnode->bmgmt; SBnodeMgmt *pMgmt = &pDnode->bmgmt;
int32_t code = TSDB_CODE_DND_BNODE_READ_FILE_ERROR; int32_t code = TSDB_CODE_DND_BNODE_READ_FILE_ERROR;
int32_t len = 0; int32_t len = 0;
int32_t maxLen = 4096; int32_t maxLen = 1024;
char *content = calloc(1, maxLen + 1); char *content = calloc(1, maxLen + 1);
cJSON *root = NULL; cJSON *root = NULL;
...@@ -127,7 +127,7 @@ static int32_t dndWriteBnodeFile(SDnode *pDnode) { ...@@ -127,7 +127,7 @@ static int32_t dndWriteBnodeFile(SDnode *pDnode) {
} }
int32_t len = 0; int32_t len = 0;
int32_t maxLen = 4096; int32_t maxLen = 1024;
char *content = calloc(1, maxLen + 1); char *content = calloc(1, maxLen + 1);
len += snprintf(content + len, maxLen - len, "{\n"); len += snprintf(content + len, maxLen - len, "{\n");
...@@ -256,7 +256,7 @@ static int32_t dndDropBnode(SDnode *pDnode) { ...@@ -256,7 +256,7 @@ static int32_t dndDropBnode(SDnode *pDnode) {
} }
int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
SDCreateBnodeMsg *pMsg = pRpcMsg->pCont; SDCreateBnodeReq *pMsg = pRpcMsg->pCont;
pMsg->dnodeId = htonl(pMsg->dnodeId); pMsg->dnodeId = htonl(pMsg->dnodeId);
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) { if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
...@@ -268,7 +268,7 @@ int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { ...@@ -268,7 +268,7 @@ int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
} }
int32_t dndProcessDropBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { int32_t dndProcessDropBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
SDDropBnodeMsg *pMsg = pRpcMsg->pCont; SDDropBnodeReq *pMsg = pRpcMsg->pCont;
pMsg->dnodeId = htonl(pMsg->dnodeId); pMsg->dnodeId = htonl(pMsg->dnodeId);
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) { if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
......
...@@ -60,7 +60,7 @@ static int32_t dndReadQnodeFile(SDnode *pDnode) { ...@@ -60,7 +60,7 @@ static int32_t dndReadQnodeFile(SDnode *pDnode) {
SQnodeMgmt *pMgmt = &pDnode->qmgmt; SQnodeMgmt *pMgmt = &pDnode->qmgmt;
int32_t code = TSDB_CODE_DND_QNODE_READ_FILE_ERROR; int32_t code = TSDB_CODE_DND_QNODE_READ_FILE_ERROR;
int32_t len = 0; int32_t len = 0;
int32_t maxLen = 4096; int32_t maxLen = 1024;
char *content = calloc(1, maxLen + 1); char *content = calloc(1, maxLen + 1);
cJSON *root = NULL; cJSON *root = NULL;
...@@ -127,7 +127,7 @@ static int32_t dndWriteQnodeFile(SDnode *pDnode) { ...@@ -127,7 +127,7 @@ static int32_t dndWriteQnodeFile(SDnode *pDnode) {
} }
int32_t len = 0; int32_t len = 0;
int32_t maxLen = 4096; int32_t maxLen = 1024;
char *content = calloc(1, maxLen + 1); char *content = calloc(1, maxLen + 1);
len += snprintf(content + len, maxLen - len, "{\n"); len += snprintf(content + len, maxLen - len, "{\n");
...@@ -261,7 +261,7 @@ static int32_t dndDropQnode(SDnode *pDnode) { ...@@ -261,7 +261,7 @@ static int32_t dndDropQnode(SDnode *pDnode) {
} }
int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
SDCreateQnodeMsg *pMsg = pRpcMsg->pCont; SDCreateQnodeReq *pMsg = pRpcMsg->pCont;
pMsg->dnodeId = htonl(pMsg->dnodeId); pMsg->dnodeId = htonl(pMsg->dnodeId);
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) { if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
...@@ -273,7 +273,7 @@ int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { ...@@ -273,7 +273,7 @@ int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
} }
int32_t dndProcessDropQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { int32_t dndProcessDropQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
SDDropQnodeMsg *pMsg = pRpcMsg->pCont; SDDropQnodeReq *pMsg = pRpcMsg->pCont;
pMsg->dnodeId = htonl(pMsg->dnodeId); pMsg->dnodeId = htonl(pMsg->dnodeId);
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) { if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
......
...@@ -60,7 +60,7 @@ static int32_t dndReadSnodeFile(SDnode *pDnode) { ...@@ -60,7 +60,7 @@ static int32_t dndReadSnodeFile(SDnode *pDnode) {
SSnodeMgmt *pMgmt = &pDnode->smgmt; SSnodeMgmt *pMgmt = &pDnode->smgmt;
int32_t code = TSDB_CODE_DND_SNODE_READ_FILE_ERROR; int32_t code = TSDB_CODE_DND_SNODE_READ_FILE_ERROR;
int32_t len = 0; int32_t len = 0;
int32_t maxLen = 4096; int32_t maxLen = 1024;
char *content = calloc(1, maxLen + 1); char *content = calloc(1, maxLen + 1);
cJSON *root = NULL; cJSON *root = NULL;
...@@ -127,7 +127,7 @@ static int32_t dndWriteSnodeFile(SDnode *pDnode) { ...@@ -127,7 +127,7 @@ static int32_t dndWriteSnodeFile(SDnode *pDnode) {
} }
int32_t len = 0; int32_t len = 0;
int32_t maxLen = 4096; int32_t maxLen = 1024;
char *content = calloc(1, maxLen + 1); char *content = calloc(1, maxLen + 1);
len += snprintf(content + len, maxLen - len, "{\n"); len += snprintf(content + len, maxLen - len, "{\n");
...@@ -256,7 +256,7 @@ static int32_t dndDropSnode(SDnode *pDnode) { ...@@ -256,7 +256,7 @@ static int32_t dndDropSnode(SDnode *pDnode) {
} }
int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
SDCreateSnodeMsg *pMsg = pRpcMsg->pCont; SDCreateSnodeReq *pMsg = pRpcMsg->pCont;
pMsg->dnodeId = htonl(pMsg->dnodeId); pMsg->dnodeId = htonl(pMsg->dnodeId);
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) { if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
...@@ -268,7 +268,7 @@ int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { ...@@ -268,7 +268,7 @@ int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
} }
int32_t dndProcessDropSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) { int32_t dndProcessDropSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
SDDropSnodeMsg *pMsg = pRpcMsg->pCont; SDDropSnodeReq *pMsg = pRpcMsg->pCont;
pMsg->dnodeId = htonl(pMsg->dnodeId); pMsg->dnodeId = htonl(pMsg->dnodeId);
if (pMsg->dnodeId != dndGetDnodeId(pDnode)) { if (pMsg->dnodeId != dndGetDnodeId(pDnode)) {
......
...@@ -52,9 +52,9 @@ TEST_F(DndTestBnode, 01_ShowBnode) { ...@@ -52,9 +52,9 @@ TEST_F(DndTestBnode, 01_ShowBnode) {
TEST_F(DndTestBnode, 02_Create_Bnode_Invalid_Id) { 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); pReq->dnodeId = htonl(1);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
...@@ -79,9 +79,9 @@ TEST_F(DndTestBnode, 02_Create_Bnode_Invalid_Id) { ...@@ -79,9 +79,9 @@ TEST_F(DndTestBnode, 02_Create_Bnode_Invalid_Id) {
TEST_F(DndTestBnode, 03_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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
...@@ -111,9 +111,9 @@ TEST_F(DndTestBnode, 04_Create_Bnode) { ...@@ -111,9 +111,9 @@ TEST_F(DndTestBnode, 04_Create_Bnode) {
{ {
// 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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
...@@ -134,9 +134,9 @@ TEST_F(DndTestBnode, 04_Create_Bnode) { ...@@ -134,9 +134,9 @@ TEST_F(DndTestBnode, 04_Create_Bnode) {
{ {
// drop 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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_BNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_BNODE, pReq, contLen);
......
...@@ -24,3 +24,44 @@ class DndTestQnode : public ::testing::Test { ...@@ -24,3 +24,44 @@ class DndTestQnode : public ::testing::Test {
}; };
Testbase DndTestQnode::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);
}
\ No newline at end of file
...@@ -178,7 +178,7 @@ static int32_t mndSetCreateBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) { ...@@ -178,7 +178,7 @@ static int32_t mndSetCreateBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) {
} }
static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, 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) { if (pMsg == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1; return -1;
...@@ -188,7 +188,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S ...@@ -188,7 +188,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetDnodeEpset(pDnode); action.epSet = mndGetDnodeEpset(pDnode);
action.pCont = pMsg; action.pCont = pMsg;
action.contLen = sizeof(SDCreateBnodeMsg); action.contLen = sizeof(SDCreateBnodeReq);
action.msgType = TDMT_DND_CREATE_BNODE; action.msgType = TDMT_DND_CREATE_BNODE;
if (mndTransAppendRedoAction(pTrans, &action) != 0) { if (mndTransAppendRedoAction(pTrans, &action) != 0) {
...@@ -199,7 +199,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S ...@@ -199,7 +199,7 @@ static int32_t mndSetCreateBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
return 0; 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}; SBnodeObj bnodeObj = {0};
bnodeObj.id = pDnode->id; bnodeObj.id = pDnode->id;
bnodeObj.createdTime = taosGetTimestampMs(); bnodeObj.createdTime = taosGetTimestampMs();
...@@ -242,7 +242,7 @@ CREATE_BNODE_OVER: ...@@ -242,7 +242,7 @@ CREATE_BNODE_OVER:
static int32_t mndProcessCreateBnodeReq(SMnodeMsg *pMsg) { static int32_t mndProcessCreateBnodeReq(SMnodeMsg *pMsg) {
SMnode *pMnode = pMsg->pMnode; SMnode *pMnode = pMsg->pMnode;
SMCreateBnodeMsg *pCreate = pMsg->rpcMsg.pCont; SMCreateBnodeReq *pCreate = pMsg->rpcMsg.pCont;
pCreate->dnodeId = htonl(pCreate->dnodeId); pCreate->dnodeId = htonl(pCreate->dnodeId);
...@@ -290,7 +290,7 @@ static int32_t mndSetDropBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) { ...@@ -290,7 +290,7 @@ static int32_t mndSetDropBnodeCommitLogs(STrans *pTrans, SBnodeObj *pObj) {
} }
static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, 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) { if (pMsg == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1; return -1;
...@@ -300,7 +300,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn ...@@ -300,7 +300,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetDnodeEpset(pDnode); action.epSet = mndGetDnodeEpset(pDnode);
action.pCont = pMsg; action.pCont = pMsg;
action.contLen = sizeof(SDDropBnodeMsg); action.contLen = sizeof(SDDropBnodeReq);
action.msgType = TDMT_DND_DROP_BNODE; action.msgType = TDMT_DND_DROP_BNODE;
if (mndTransAppendRedoAction(pTrans, &action) != 0) { if (mndTransAppendRedoAction(pTrans, &action) != 0) {
...@@ -350,7 +350,7 @@ DROP_BNODE_OVER: ...@@ -350,7 +350,7 @@ DROP_BNODE_OVER:
static int32_t mndProcessDropBnodeReq(SMnodeMsg *pMsg) { static int32_t mndProcessDropBnodeReq(SMnodeMsg *pMsg) {
SMnode *pMnode = pMsg->pMnode; SMnode *pMnode = pMsg->pMnode;
SMDropBnodeMsg *pDrop = pMsg->rpcMsg.pCont; SMDropBnodeReq *pDrop = pMsg->rpcMsg.pCont;
pDrop->dnodeId = htonl(pDrop->dnodeId); pDrop->dnodeId = htonl(pDrop->dnodeId);
mDebug("bnode:%d, start to drop", pDrop->dnodeId); mDebug("bnode:%d, start to drop", pDrop->dnodeId);
......
...@@ -178,7 +178,7 @@ static int32_t mndSetCreateQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) { ...@@ -178,7 +178,7 @@ static int32_t mndSetCreateQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) {
} }
static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, 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) { if (pMsg == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1; return -1;
...@@ -188,7 +188,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S ...@@ -188,7 +188,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetDnodeEpset(pDnode); action.epSet = mndGetDnodeEpset(pDnode);
action.pCont = pMsg; action.pCont = pMsg;
action.contLen = sizeof(SDCreateQnodeMsg); action.contLen = sizeof(SDCreateQnodeReq);
action.msgType = TDMT_DND_CREATE_QNODE; action.msgType = TDMT_DND_CREATE_QNODE;
if (mndTransAppendRedoAction(pTrans, &action) != 0) { if (mndTransAppendRedoAction(pTrans, &action) != 0) {
...@@ -199,7 +199,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S ...@@ -199,7 +199,7 @@ static int32_t mndSetCreateQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
return 0; 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}; SQnodeObj qnodeObj = {0};
qnodeObj.id = pDnode->id; qnodeObj.id = pDnode->id;
qnodeObj.createdTime = taosGetTimestampMs(); qnodeObj.createdTime = taosGetTimestampMs();
...@@ -242,7 +242,7 @@ CREATE_QNODE_OVER: ...@@ -242,7 +242,7 @@ CREATE_QNODE_OVER:
static int32_t mndProcessCreateQnodeReq(SMnodeMsg *pMsg) { static int32_t mndProcessCreateQnodeReq(SMnodeMsg *pMsg) {
SMnode *pMnode = pMsg->pMnode; SMnode *pMnode = pMsg->pMnode;
SMCreateQnodeMsg *pCreate = pMsg->rpcMsg.pCont; SMCreateQnodeReq *pCreate = pMsg->rpcMsg.pCont;
pCreate->dnodeId = htonl(pCreate->dnodeId); pCreate->dnodeId = htonl(pCreate->dnodeId);
...@@ -290,7 +290,7 @@ static int32_t mndSetDropQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) { ...@@ -290,7 +290,7 @@ static int32_t mndSetDropQnodeCommitLogs(STrans *pTrans, SQnodeObj *pObj) {
} }
static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, 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) { if (pMsg == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1; return -1;
...@@ -300,7 +300,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn ...@@ -300,7 +300,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetDnodeEpset(pDnode); action.epSet = mndGetDnodeEpset(pDnode);
action.pCont = pMsg; action.pCont = pMsg;
action.contLen = sizeof(SDDropQnodeMsg); action.contLen = sizeof(SDDropQnodeReq);
action.msgType = TDMT_DND_DROP_QNODE; action.msgType = TDMT_DND_DROP_QNODE;
if (mndTransAppendRedoAction(pTrans, &action) != 0) { if (mndTransAppendRedoAction(pTrans, &action) != 0) {
...@@ -350,7 +350,7 @@ DROP_QNODE_OVER: ...@@ -350,7 +350,7 @@ DROP_QNODE_OVER:
static int32_t mndProcessDropQnodeReq(SMnodeMsg *pMsg) { static int32_t mndProcessDropQnodeReq(SMnodeMsg *pMsg) {
SMnode *pMnode = pMsg->pMnode; SMnode *pMnode = pMsg->pMnode;
SMDropQnodeMsg *pDrop = pMsg->rpcMsg.pCont; SMDropQnodeReq *pDrop = pMsg->rpcMsg.pCont;
pDrop->dnodeId = htonl(pDrop->dnodeId); pDrop->dnodeId = htonl(pDrop->dnodeId);
mDebug("qnode:%d, start to drop", pDrop->dnodeId); mDebug("qnode:%d, start to drop", pDrop->dnodeId);
......
...@@ -178,7 +178,7 @@ static int32_t mndSetCreateSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) { ...@@ -178,7 +178,7 @@ static int32_t mndSetCreateSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) {
} }
static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, 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) { if (pMsg == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1; return -1;
...@@ -188,7 +188,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S ...@@ -188,7 +188,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetDnodeEpset(pDnode); action.epSet = mndGetDnodeEpset(pDnode);
action.pCont = pMsg; action.pCont = pMsg;
action.contLen = sizeof(SDCreateSnodeMsg); action.contLen = sizeof(SDCreateSnodeReq);
action.msgType = TDMT_DND_CREATE_SNODE; action.msgType = TDMT_DND_CREATE_SNODE;
if (mndTransAppendRedoAction(pTrans, &action) != 0) { if (mndTransAppendRedoAction(pTrans, &action) != 0) {
...@@ -199,7 +199,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S ...@@ -199,7 +199,7 @@ static int32_t mndSetCreateSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, S
return 0; 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}; SSnodeObj snodeObj = {0};
snodeObj.id = pDnode->id; snodeObj.id = pDnode->id;
snodeObj.createdTime = taosGetTimestampMs(); snodeObj.createdTime = taosGetTimestampMs();
...@@ -242,7 +242,7 @@ CREATE_SNODE_OVER: ...@@ -242,7 +242,7 @@ CREATE_SNODE_OVER:
static int32_t mndProcessCreateSnodeReq(SMnodeMsg *pMsg) { static int32_t mndProcessCreateSnodeReq(SMnodeMsg *pMsg) {
SMnode *pMnode = pMsg->pMnode; SMnode *pMnode = pMsg->pMnode;
SMCreateSnodeMsg *pCreate = pMsg->rpcMsg.pCont; SMCreateSnodeReq *pCreate = pMsg->rpcMsg.pCont;
pCreate->dnodeId = htonl(pCreate->dnodeId); pCreate->dnodeId = htonl(pCreate->dnodeId);
...@@ -290,7 +290,7 @@ static int32_t mndSetDropSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) { ...@@ -290,7 +290,7 @@ static int32_t mndSetDropSnodeCommitLogs(STrans *pTrans, SSnodeObj *pObj) {
} }
static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, 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) { if (pMsg == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1; return -1;
...@@ -300,7 +300,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn ...@@ -300,7 +300,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetDnodeEpset(pDnode); action.epSet = mndGetDnodeEpset(pDnode);
action.pCont = pMsg; action.pCont = pMsg;
action.contLen = sizeof(SDDropSnodeMsg); action.contLen = sizeof(SDDropSnodeReq);
action.msgType = TDMT_DND_DROP_SNODE; action.msgType = TDMT_DND_DROP_SNODE;
if (mndTransAppendRedoAction(pTrans, &action) != 0) { if (mndTransAppendRedoAction(pTrans, &action) != 0) {
...@@ -350,7 +350,7 @@ DROP_SNODE_OVER: ...@@ -350,7 +350,7 @@ DROP_SNODE_OVER:
static int32_t mndProcessDropSnodeReq(SMnodeMsg *pMsg) { static int32_t mndProcessDropSnodeReq(SMnodeMsg *pMsg) {
SMnode *pMnode = pMsg->pMnode; SMnode *pMnode = pMsg->pMnode;
SMDropSnodeMsg *pDrop = pMsg->rpcMsg.pCont; SMDropSnodeReq *pDrop = pMsg->rpcMsg.pCont;
pDrop->dnodeId = htonl(pDrop->dnodeId); pDrop->dnodeId = htonl(pDrop->dnodeId);
mDebug("snode:%d, start to drop", pDrop->dnodeId); mDebug("snode:%d, start to drop", pDrop->dnodeId);
......
...@@ -52,9 +52,9 @@ TEST_F(MndTestBnode, 01_Show_Bnode) { ...@@ -52,9 +52,9 @@ TEST_F(MndTestBnode, 01_Show_Bnode) {
TEST_F(MndTestBnode, 02_Create_Bnode_Invalid_Id) { 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); pReq->dnodeId = htonl(1);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
...@@ -79,9 +79,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode_Invalid_Id) { ...@@ -79,9 +79,9 @@ TEST_F(MndTestBnode, 02_Create_Bnode_Invalid_Id) {
TEST_F(MndTestBnode, 03_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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
...@@ -111,9 +111,9 @@ TEST_F(MndTestBnode, 04_Create_Bnode) { ...@@ -111,9 +111,9 @@ TEST_F(MndTestBnode, 04_Create_Bnode) {
{ {
// 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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_BNODE, pReq, contLen);
...@@ -134,9 +134,9 @@ TEST_F(MndTestBnode, 04_Create_Bnode) { ...@@ -134,9 +134,9 @@ TEST_F(MndTestBnode, 04_Create_Bnode) {
{ {
// drop 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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_BNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_BNODE, pReq, contLen);
......
...@@ -52,9 +52,9 @@ TEST_F(MndTestQnode, 01_Show_Qnode) { ...@@ -52,9 +52,9 @@ TEST_F(MndTestQnode, 01_Show_Qnode) {
TEST_F(MndTestQnode, 02_Create_Qnode_Invalid_Id) { 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); pReq->dnodeId = htonl(1);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen);
...@@ -79,9 +79,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode_Invalid_Id) { ...@@ -79,9 +79,9 @@ TEST_F(MndTestQnode, 02_Create_Qnode_Invalid_Id) {
TEST_F(MndTestQnode, 03_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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen);
...@@ -111,9 +111,9 @@ TEST_F(MndTestQnode, 04_Create_Qnode) { ...@@ -111,9 +111,9 @@ TEST_F(MndTestQnode, 04_Create_Qnode) {
{ {
// 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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_QNODE, pReq, contLen);
...@@ -134,9 +134,9 @@ TEST_F(MndTestQnode, 04_Create_Qnode) { ...@@ -134,9 +134,9 @@ TEST_F(MndTestQnode, 04_Create_Qnode) {
{ {
// drop 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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_QNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_QNODE, pReq, contLen);
......
...@@ -52,9 +52,9 @@ TEST_F(MndTestSnode, 01_Show_Snode) { ...@@ -52,9 +52,9 @@ TEST_F(MndTestSnode, 01_Show_Snode) {
TEST_F(MndTestSnode, 02_Create_Snode_Invalid_Id) { 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); pReq->dnodeId = htonl(1);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen);
...@@ -79,9 +79,9 @@ TEST_F(MndTestSnode, 02_Create_Snode_Invalid_Id) { ...@@ -79,9 +79,9 @@ TEST_F(MndTestSnode, 02_Create_Snode_Invalid_Id) {
TEST_F(MndTestSnode, 03_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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen);
...@@ -111,9 +111,9 @@ TEST_F(MndTestSnode, 04_Create_Snode) { ...@@ -111,9 +111,9 @@ TEST_F(MndTestSnode, 04_Create_Snode) {
{ {
// 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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_CREATE_SNODE, pReq, contLen);
...@@ -134,9 +134,9 @@ TEST_F(MndTestSnode, 04_Create_Snode) { ...@@ -134,9 +134,9 @@ TEST_F(MndTestSnode, 04_Create_Snode) {
{ {
// drop 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); pReq->dnodeId = htonl(2);
SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_SNODE, pReq, contLen); SRpcMsg* pMsg = test.SendMsg(TDMT_MND_DROP_SNODE, pReq, contLen);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册