minor changes
This commit is contained in:
parent
ad94dff047
commit
3c3f32bdae
|
@ -73,7 +73,7 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DndTestQnode, 01_Drop_Qnode) {
|
TEST_F(DndTestQnode, 02_Drop_Qnode) {
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SDDropQnodeReq);
|
int32_t contLen = sizeof(SDDropQnodeReq);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
static SSdbRaw *mndTransActionEncode(STrans *pTrans);
|
static SSdbRaw *mndTransActionEncode(STrans *pTrans);
|
||||||
static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans);
|
static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans);
|
||||||
static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *OldTrans, STrans *pOldTrans);
|
static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *OldTrans, STrans *pOld);
|
||||||
static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans);
|
static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans);
|
||||||
|
|
||||||
static int32_t mndTransAppendLog(SArray *pArray, SSdbRaw *pRaw);
|
static int32_t mndTransAppendLog(SArray *pArray, SSdbRaw *pRaw);
|
||||||
|
@ -314,9 +314,10 @@ static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOldTrans, STrans *pNewTrans) {
|
static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
|
||||||
mTrace("trans:%d, perform update action, old_row:%p new_row:%p", pOldTrans->id, pOldTrans, pNewTrans);
|
mTrace("trans:%d, perform update action, old row:%p stage:%d, new row:%p stage:%d", pOld->id, pOld, pOld->stage, pNew,
|
||||||
pOldTrans->stage = pNewTrans->stage;
|
pNew->stage);
|
||||||
|
pOld->stage = pNew->stage;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,16 +465,16 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
|
||||||
}
|
}
|
||||||
mDebug("trans:%d, prepare finished", pTrans->id);
|
mDebug("trans:%d, prepare finished", pTrans->id);
|
||||||
|
|
||||||
STrans *pNewTrans = mndAcquireTrans(pMnode, pTrans->id);
|
STrans *pNew = mndAcquireTrans(pMnode, pTrans->id);
|
||||||
if (pNewTrans == NULL) {
|
if (pNew == NULL) {
|
||||||
mError("trans:%d, failed to read from sdb since %s", pTrans->id, terrstr());
|
mError("trans:%d, failed to read from sdb since %s", pTrans->id, terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pNewTrans->rpcHandle = pTrans->rpcHandle;
|
pNew->rpcHandle = pTrans->rpcHandle;
|
||||||
pNewTrans->rpcAHandle = pTrans->rpcAHandle;
|
pNew->rpcAHandle = pTrans->rpcAHandle;
|
||||||
mndTransExecute(pMnode, pNewTrans);
|
mndTransExecute(pMnode, pNew);
|
||||||
mndReleaseTrans(pMnode, pNewTrans);
|
mndReleaseTrans(pMnode, pNew);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sut.h"
|
#include "sut.h"
|
||||||
#include "os.h"
|
|
||||||
|
|
||||||
class MndTestTrans : public ::testing::Test {
|
class MndTestTrans : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
|
@ -84,3 +83,44 @@ TEST_F(MndTestTrans, 01_Create_User_Crash) {
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
CheckBinary("root", TSDB_USER_LEN);
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
CheckBinary("root", TSDB_USER_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(MndTestTrans, 02_Create_Qnode_Crash) {
|
||||||
|
{
|
||||||
|
int32_t contLen = sizeof(SMCreateQnodeReq);
|
||||||
|
|
||||||
|
SMCreateQnodeReq* pReq = (SMCreateQnodeReq*)rpcMallocCont(contLen);
|
||||||
|
pReq->dnodeId = htonl(1);
|
||||||
|
|
||||||
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
|
|
||||||
|
test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, "");
|
||||||
|
CHECK_META("show qnodes", 3);
|
||||||
|
test.SendShowRetrieveReq();
|
||||||
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
KillThenRestartServer();
|
||||||
|
{
|
||||||
|
int32_t retry = 0;
|
||||||
|
int32_t retryMax = 10;
|
||||||
|
|
||||||
|
for (retry = 0; retry < retryMax; retry++) {
|
||||||
|
int32_t contLen = sizeof(SMCreateQnodeReq);
|
||||||
|
|
||||||
|
SMCreateQnodeReq* pReq = (SMCreateQnodeReq*)rpcMallocCont(contLen);
|
||||||
|
pReq->dnodeId = htonl(2);
|
||||||
|
|
||||||
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_QNODE, pReq, contLen);
|
||||||
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
if (pRsp->code == 0) break;
|
||||||
|
taosMsleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
test.SendShowMetaReq(TSDB_MGMT_TABLE_QNODE, "");
|
||||||
|
CHECK_META("show qnodes", 3);
|
||||||
|
test.SendShowRetrieveReq();
|
||||||
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue