feat: drop dnode
This commit is contained in:
parent
7f8b260194
commit
f5c0ab8579
|
@ -508,7 +508,7 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("dnode:%s:%d, start to create", createReq.fqdn, createReq.port);
|
mInfo("dnode:%s:%d, start to create", createReq.fqdn, createReq.port);
|
||||||
|
|
||||||
if (createReq.fqdn[0] == 0 || createReq.port <= 0 || createReq.port > UINT16_MAX) {
|
if (createReq.fqdn[0] == 0 || createReq.port <= 0 || createReq.port > UINT16_MAX) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_DNODE_EP;
|
terrno = TSDB_CODE_MND_INVALID_DNODE_EP;
|
||||||
|
@ -546,7 +546,7 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
|
||||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
|
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_GLOBAL, pReq);
|
||||||
if (pTrans == NULL) goto _OVER;
|
if (pTrans == NULL) goto _OVER;
|
||||||
mndTransSetSerial(pTrans);
|
mndTransSetSerial(pTrans);
|
||||||
mDebug("trans:%d, used to drop dnode:%d", pTrans->id, pDnode->id);
|
mInfo("trans:%d, used to drop dnode:%d", pTrans->id, pDnode->id);
|
||||||
|
|
||||||
pRaw = mndDnodeActionEncode(pDnode);
|
pRaw = mndDnodeActionEncode(pDnode);
|
||||||
if (pRaw == NULL || mndTransAppendRedolog(pTrans, pRaw) != 0) goto _OVER;
|
if (pRaw == NULL || mndTransAppendRedolog(pTrans, pRaw) != 0) goto _OVER;
|
||||||
|
@ -559,11 +559,11 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode, SM
|
||||||
pRaw = NULL;
|
pRaw = NULL;
|
||||||
|
|
||||||
if (pMObj != NULL) {
|
if (pMObj != NULL) {
|
||||||
mDebug("trans:%d, mnode on dnode:%d will be dropped", pTrans->id, pDnode->id);
|
mInfo("trans:%d, mnode on dnode:%d will be dropped", pTrans->id, pDnode->id);
|
||||||
if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pMObj) != 0) goto _OVER;
|
if (mndSetDropMnodeInfoToTrans(pMnode, pTrans, pMObj) != 0) goto _OVER;
|
||||||
}
|
}
|
||||||
if (numOfVnodes > 0) {
|
if (numOfVnodes > 0) {
|
||||||
mDebug("trans:%d, %d vnodes on dnode:%d will be dropped", pTrans->id, numOfVnodes, pDnode->id);
|
mInfo("trans:%d, %d vnodes on dnode:%d will be dropped", pTrans->id, numOfVnodes, pDnode->id);
|
||||||
if (mndSetMoveVgroupsInfoToTrans(pMnode, pTrans, pDnode->id) != 0) goto _OVER;
|
if (mndSetMoveVgroupsInfoToTrans(pMnode, pTrans, pDnode->id) != 0) goto _OVER;
|
||||||
}
|
}
|
||||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||||
|
@ -588,7 +588,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDebug("dnode:%d, start to drop", dropReq.dnodeId);
|
mInfo("dnode:%d, start to drop", dropReq.dnodeId);
|
||||||
|
|
||||||
if (dropReq.dnodeId <= 0) {
|
if (dropReq.dnodeId <= 0) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_DNODE_ID;
|
terrno = TSDB_CODE_MND_INVALID_DNODE_ID;
|
||||||
|
|
|
@ -447,7 +447,7 @@ static int32_t mndUpdateAppInfo(SMnode *pMnode, SClientHbReq *pHbReq, SRpcConnIn
|
||||||
mError("failed to create new app %" PRIx64 " since %s", pReq->appId, terrstr());
|
mError("failed to create new app %" PRIx64 " since %s", pReq->appId, terrstr());
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
mDebug("a new app %" PRIx64 "created", pReq->appId);
|
mDebug("a new app %" PRIx64 " is created", pReq->appId);
|
||||||
mndReleaseApp(pMnode, pApp);
|
mndReleaseApp(pMnode, pApp);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSyncGetSnapshot(struct SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pReaderParam, void **ppReader) {
|
int32_t mndSyncGetSnapshot(struct SSyncFSM *pFsm, SSnapshot *pSnapshot, void *pReaderParam, void **ppReader) {
|
||||||
mInfo("start to read snapshot from sdb in atomic way");
|
mDebug("start to read snapshot from sdb in atomic way");
|
||||||
SMnode *pMnode = pFsm->data;
|
SMnode *pMnode = pFsm->data;
|
||||||
return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, &pSnapshot->lastApplyIndex, &pSnapshot->lastApplyTerm,
|
return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, &pSnapshot->lastApplyIndex, &pSnapshot->lastApplyTerm,
|
||||||
&pSnapshot->lastConfigIndex);
|
&pSnapshot->lastConfigIndex);
|
||||||
|
@ -96,7 +96,7 @@ void mndRestoreFinish(struct SSyncFSM *pFsm) {
|
||||||
mndTransPullup(pMnode);
|
mndTransPullup(pMnode);
|
||||||
mndSetRestore(pMnode, true);
|
mndSetRestore(pMnode, true);
|
||||||
} else {
|
} else {
|
||||||
mInfo("mnode sync restore finished, and will set ready after first deploy");
|
mInfo("mnode sync restore finished");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,13 +118,13 @@ void mndReConfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReConfigCbMeta cbM
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSnapshotStartRead(struct SSyncFSM *pFsm, void **ppReader) {
|
int32_t mndSnapshotStartRead(struct SSyncFSM *pFsm, void **ppReader) {
|
||||||
mInfo("start to read snapshot from sdb");
|
mDebug("start to read snapshot from sdb");
|
||||||
SMnode *pMnode = pFsm->data;
|
SMnode *pMnode = pFsm->data;
|
||||||
return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, NULL, NULL, NULL);
|
return sdbStartRead(pMnode->pSdb, (SSdbIter **)ppReader, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) {
|
int32_t mndSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) {
|
||||||
mInfo("stop to read snapshot from sdb");
|
mDebug("stop to read snapshot from sdb");
|
||||||
SMnode *pMnode = pFsm->data;
|
SMnode *pMnode = pFsm->data;
|
||||||
return sdbStopRead(pMnode->pSdb, pReader);
|
return sdbStopRead(pMnode->pSdb, pReader);
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,11 +432,11 @@ static const char *mndTransStr(ETrnStage stage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mndTransTestStartFunc(SMnode *pMnode, void *param, int32_t paramLen) {
|
static void mndTransTestStartFunc(SMnode *pMnode, void *param, int32_t paramLen) {
|
||||||
mInfo("test trans start, param:%s, len:%d", (char *)param, paramLen);
|
mDebug("test trans start, param:%s, len:%d", (char *)param, paramLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mndTransTestStopFunc(SMnode *pMnode, void *param, int32_t paramLen) {
|
static void mndTransTestStopFunc(SMnode *pMnode, void *param, int32_t paramLen) {
|
||||||
mInfo("test trans stop, param:%s, len:%d", (char *)param, paramLen);
|
mDebug("test trans stop, param:%s, len:%d", (char *)param, paramLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TransCbFp mndTransGetCbFp(ETrnFunc ftype) {
|
static TransCbFp mndTransGetCbFp(ETrnFunc ftype) {
|
||||||
|
|
|
@ -1017,6 +1017,11 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
||||||
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg, &del, true) != 0) return -1;
|
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg, &del, true) != 0) return -1;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
|
||||||
|
|
||||||
|
SSdbRaw *pRaw = mndVgroupActionEncode(&newVg);
|
||||||
|
if (pRaw == NULL || mndTransAppendCommitlog(pTrans, pRaw) != 0) return -1;
|
||||||
|
sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
||||||
|
pRaw = NULL;
|
||||||
|
|
||||||
mInfo("vgId:%d, vgroup info after move, replica:%d", newVg.vgId, newVg.replica);
|
mInfo("vgId:%d, vgroup info after move, replica:%d", newVg.vgId, newVg.replica);
|
||||||
for (int32_t i = 0; i < newVg.replica; ++i) {
|
for (int32_t i = 0; i < newVg.replica; ++i) {
|
||||||
mInfo("vgId:%d, vnode:%d dnode:%d", newVg.vgId, i, newVg.vnodeGid[i].dnodeId);
|
mInfo("vgId:%d, vnode:%d dnode:%d", newVg.vgId, i, newVg.vnodeGid[i].dnodeId);
|
||||||
|
@ -1025,6 +1030,7 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t delDnodeId) {
|
int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t delDnodeId) {
|
||||||
|
int32_t code = 0;
|
||||||
SArray *pArray = mndBuildDnodesArray(pMnode, delDnodeId);
|
SArray *pArray = mndBuildDnodesArray(pMnode, delDnodeId);
|
||||||
if (pArray == NULL) return -1;
|
if (pArray == NULL) return -1;
|
||||||
|
|
||||||
|
@ -1042,18 +1048,24 @@ int32_t mndSetMoveVgroupsInfoToTrans(SMnode *pMnode, STrans *pTrans, int32_t del
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
code = 0;
|
||||||
if (vnIndex != -1) {
|
if (vnIndex != -1) {
|
||||||
mInfo("vgId:%d, vnode:%d will be removed from dnode:%d", pVgroup->vgId, vnIndex, delDnodeId);
|
mInfo("vgId:%d, vnode:%d will be removed from dnode:%d", pVgroup->vgId, vnIndex, delDnodeId);
|
||||||
SDbObj *pDb = mndAcquireDb(pMnode, pVgroup->dbName);
|
SDbObj *pDb = mndAcquireDb(pMnode, pVgroup->dbName);
|
||||||
mndSetMoveVgroupInfoToTrans(pMnode, pTrans, pDb, pVgroup, vnIndex, pArray);
|
code = mndSetMoveVgroupInfoToTrans(pMnode, pTrans, pDb, pVgroup, vnIndex, pArray);
|
||||||
mndReleaseDb(pMnode, pDb);
|
mndReleaseDb(pMnode, pDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
sdbRelease(pMnode->pSdb, pVgroup);
|
sdbRelease(pMnode->pSdb, pVgroup);
|
||||||
|
|
||||||
|
if (code != 0) {
|
||||||
|
sdbCancelFetch(pMnode->pSdb, pIter);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pArray);
|
taosArrayDestroy(pArray);
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup,
|
static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup,
|
||||||
|
|
|
@ -519,7 +519,7 @@ static void sdbCloseIter(SSdbIter *pIter) {
|
||||||
pIter->name = NULL;
|
pIter->name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInfo("sdbiter:%p, is closed, total:%" PRId64, pIter, pIter->total);
|
mDebug("sdbiter:%p, is closed, total:%" PRId64, pIter, pIter->total);
|
||||||
taosMemoryFree(pIter);
|
taosMemoryFree(pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *ter
|
||||||
if (term != NULL) *term = commitTerm;
|
if (term != NULL) *term = commitTerm;
|
||||||
if (config != NULL) *config = commitConfig;
|
if (config != NULL) *config = commitConfig;
|
||||||
|
|
||||||
mInfo("sdbiter:%p, is created to read snapshot, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " file:%s",
|
mDebug("sdbiter:%p, is created to read snapshot, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " file:%s",
|
||||||
pIter, commitIndex, commitTerm, commitConfig, pIter->name);
|
pIter, commitIndex, commitTerm, commitConfig, pIter->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -583,14 +583,14 @@ int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) {
|
||||||
taosMemoryFree(pBuf);
|
taosMemoryFree(pBuf);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (readlen == 0) {
|
} else if (readlen == 0) {
|
||||||
mInfo("sdbiter:%p, read snapshot to the end, total:%" PRId64, pIter, pIter->total);
|
mDebug("sdbiter:%p, read snapshot to the end, total:%" PRId64, pIter, pIter->total);
|
||||||
*ppBuf = NULL;
|
*ppBuf = NULL;
|
||||||
*len = 0;
|
*len = 0;
|
||||||
taosMemoryFree(pBuf);
|
taosMemoryFree(pBuf);
|
||||||
return 0;
|
return 0;
|
||||||
} else { // (readlen <= maxlen)
|
} else { // (readlen <= maxlen)
|
||||||
pIter->total += readlen;
|
pIter->total += readlen;
|
||||||
mInfo("sdbiter:%p, read:%d bytes from snapshot, total:%" PRId64, pIter, readlen, pIter->total);
|
mDebug("sdbiter:%p, read:%d bytes from snapshot, total:%" PRId64, pIter, readlen, pIter->total);
|
||||||
*ppBuf = pBuf;
|
*ppBuf = pBuf;
|
||||||
*len = readlen;
|
*len = readlen;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -609,7 +609,7 @@ int32_t sdbStartWrite(SSdb *pSdb, SSdbIter **ppIter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
*ppIter = pIter;
|
*ppIter = pIter;
|
||||||
mInfo("sdbiter:%p, is created to write snapshot, file:%s", pIter, pIter->name);
|
mDebug("sdbiter:%p, is created to write snapshot, file:%s", pIter, pIter->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +618,7 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply) {
|
||||||
|
|
||||||
if (!isApply) {
|
if (!isApply) {
|
||||||
sdbCloseIter(pIter);
|
sdbCloseIter(pIter);
|
||||||
mInfo("sdbiter:%p, not apply to sdb", pIter);
|
mDebug("sdbiter:%p, not apply to sdb", pIter);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInfo("sdbiter:%p, successfully applyed to sdb", pIter);
|
mDebug("sdbiter:%p, successfully applyed to sdb", pIter);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,6 +654,6 @@ int32_t sdbDoWrite(SSdb *pSdb, SSdbIter *pIter, void *pBuf, int32_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pIter->total += writelen;
|
pIter->total += writelen;
|
||||||
mInfo("sdbiter:%p, write:%d bytes to snapshot, total:%" PRId64, pIter, writelen, pIter->total);
|
mDebug("sdbiter:%p, write:%d bytes to snapshot, total:%" PRId64, pIter, writelen, pIter->total);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -23,6 +23,7 @@
|
||||||
# ---- dnode
|
# ---- dnode
|
||||||
./test.sh -f tsim/dnode/create_dnode.sim
|
./test.sh -f tsim/dnode/create_dnode.sim
|
||||||
./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim
|
./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim
|
||||||
|
./test.sh -f tsim/dnode/drop_dnode_has_vnode_replica1.sim
|
||||||
|
|
||||||
# ---- insert
|
# ---- insert
|
||||||
./test.sh -f tsim/insert/basic0.sim
|
./test.sh -f tsim/insert/basic0.sim
|
||||||
|
|
|
@ -70,6 +70,7 @@ if $data(2)[2] != follower then
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print =============== step4: drop dnode 2
|
print =============== step4: drop dnode 2
|
||||||
|
sql_error drop dnode 1
|
||||||
sql drop dnode 2
|
sql drop dnode 2
|
||||||
|
|
||||||
print show dnodes;
|
print show dnodes;
|
||||||
|
@ -83,7 +84,7 @@ if $data00 != 1 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
print show dnodes;
|
print show mnodes;
|
||||||
sql show mnodes
|
sql show mnodes
|
||||||
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
||||||
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||||
|
|
|
@ -0,0 +1,151 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/deploy.sh -n dnode3 -i 3
|
||||||
|
system sh/cfg.sh -n dnode1 -c supportVnodes -v 0
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== step1 create dnode2
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sql create dnode $hostname port 7300
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
step1:
|
||||||
|
$ = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
print ====> dnode not online!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql show dnodes
|
||||||
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
if $rows != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(1)[4] != ready then
|
||||||
|
goto step1
|
||||||
|
endi
|
||||||
|
if $data(2)[4] != ready then
|
||||||
|
goto step1
|
||||||
|
endi
|
||||||
|
if $data(3)[4] != offline then
|
||||||
|
goto step1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step2 drop dnode which not exist
|
||||||
|
sql_error drop dnode 1
|
||||||
|
sql_error drop dnode 4
|
||||||
|
|
||||||
|
print =============== step3 create database
|
||||||
|
sql create database d1 vgroups 1
|
||||||
|
sql use d1
|
||||||
|
sql create table d1.st (ts timestamp, i int) tags (j int)
|
||||||
|
sql create table d1.c1 using st tags(1)
|
||||||
|
sql show d1.tables
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show d1.vgroups
|
||||||
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(2)[3] != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step4: drop dnode 2
|
||||||
|
print cant drop since no enough vnodes
|
||||||
|
sql_error drop dnode 2
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode2 -s stop
|
||||||
|
system sh/exec.sh -n dnode3 -s start
|
||||||
|
$x = 0
|
||||||
|
step4:
|
||||||
|
$ = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
print ====> dnode not online!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql show dnodes
|
||||||
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
if $rows != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(1)[4] != ready then
|
||||||
|
goto step4
|
||||||
|
endi
|
||||||
|
if $data(2)[4] != offline then
|
||||||
|
goto step4
|
||||||
|
endi
|
||||||
|
if $data(3)[4] != ready then
|
||||||
|
goto step4
|
||||||
|
endi
|
||||||
|
|
||||||
|
# cant drop since offline
|
||||||
|
sql_error drop dnode 2
|
||||||
|
|
||||||
|
print =============== step5: start dnode2
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
step5:
|
||||||
|
$ = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
print ====> dnode not online!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql show dnodes
|
||||||
|
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
if $rows != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(1)[4] != ready then
|
||||||
|
goto step5
|
||||||
|
endi
|
||||||
|
if $data(2)[4] != ready then
|
||||||
|
goto step5
|
||||||
|
endi
|
||||||
|
if $data(3)[4] != ready then
|
||||||
|
goto step5
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step6: drop dnode2
|
||||||
|
sql drop dnode 2
|
||||||
|
|
||||||
|
print show dnodes;
|
||||||
|
sql show dnodes;
|
||||||
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
||||||
|
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4]
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print show d1.vgroups
|
||||||
|
sql show d1.vgroups
|
||||||
|
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4]
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(2)[3] != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step7: select data
|
||||||
|
sql show d1.tables
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
return
|
||||||
|
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 dnode2 -s stop -x SIGINT
|
Loading…
Reference in New Issue