提交 1ad604a5 编写于 作者: S Shengliang Guan

enh: force drop dnode

上级 7ddde569
......@@ -2029,7 +2029,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
action.pCont = pReq;
action.contLen = contLen;
action.msgType = TDMT_VND_DROP_STB;
action.acceptableCode = TSDB_CODE_VND_TB_NOT_EXIST;
action.acceptableCode = TSDB_CODE_TDB_STB_NOT_EXIST;
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(pReq);
sdbCancelFetch(pSdb, pIter);
......
......@@ -284,7 +284,7 @@ int32_t vnodeProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
break;
}
vTrace("vgId:%d, process %s request success, index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), version);
vTrace("vgId:%d, process %s request, code:0x%x index:%" PRId64, TD_VID(pVnode), TMSG_INFO(pMsg->msgType), pRsp->code, version);
walApplyVer(pVnode->pWal, version);
......
......@@ -47,6 +47,7 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId);
static int32_t syncNodeEqNoop(SSyncNode* ths);
static int32_t syncNodeAppendNoop(SSyncNode* ths);
static void syncNodeEqPeerHeartbeatTimer(void* param, void* tmrId);
static bool syncIsConfigChanged(const SSyncCfg* pOldCfg, const SSyncCfg* pNewCfg);
// process message ----
int32_t syncNodeOnPing(SSyncNode* ths, SyncPing* pMsg);
......@@ -1132,7 +1133,8 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
sError("vgId:%d, failed to open raft cfg file at %s", pSyncNode->vgId, pSyncNode->configPath);
goto _error;
}
if (pSyncInfo->syncCfg.replicaNum > 0 && pSyncInfo->syncCfg.replicaNum != pSyncNode->pRaftCfg->cfg.replicaNum) {
if (syncIsConfigChanged(&pSyncNode->pRaftCfg->cfg, &pSyncInfo->syncCfg)) {
sInfo("vgId:%d, use sync config from input options and write to cfg file", pSyncNode->vgId);
pSyncNode->pRaftCfg->cfg = pSyncInfo->syncCfg;
if (raftCfgPersist(pSyncNode->pRaftCfg) != 0) {
......@@ -2095,12 +2097,11 @@ static bool syncIsConfigChanged(const SSyncCfg* pOldCfg, const SSyncCfg* pNewCfg
void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncIndex lastConfigChangeIndex) {
SSyncCfg oldConfig = pSyncNode->pRaftCfg->cfg;
#if 1
if (!syncIsConfigChanged(&oldConfig, pNewConfig)) {
sInfo("vgId:1, sync not reconfig since not changed");
return;
}
#endif
pSyncNode->pRaftCfg->cfg = *pNewConfig;
pSyncNode->pRaftCfg->lastConfigIndex = lastConfigChangeIndex;
......
......@@ -50,21 +50,26 @@ endi
print =============== step2 create database
sql create database d1 vgroups 1 replica 3
sql use d1
sql create table d1.st (ts timestamp, i int) tags (j int)
sql create table d1.c0 using st tags(0)
sql create table d1.c1 using st tags(1)
sql create table d1.c2 using st tags(2)
sql create table d1.c3 using st tags(3)
sql create table d1.c4 using st tags(4)
sql create table d1.c5 using st tags(5)
sql create table d1.c6 using st tags(6)
sql create table d1.c7 using st tags(7)
sql create table d1.c8 using st tags(8)
sql create table d1.c9 using st tags(9)
sql create table d1.st0 (ts timestamp, i int) tags (j int)
sql create table d1.c0 using st0 tags(0)
sql create table d1.c1 using st0 tags(1)
sql create table d1.c2 using st0 tags(2)
sql create table d1.c3 using st0 tags(3)
sql create table d1.c4 using st0 tags(4)
sql create table d1.c5 using st0 tags(5)
sql create table d1.c6 using st0 tags(6)
sql create table d1.c7 using st0 tags(7)
sql create table d1.c8 using st0 tags(8)
sql create table d1.c9 using st0 tags(9)
sql show d1.tables
if $rows != 10 then
return -1
endi
print d1.rows ===> $rows
sql select * from information_schema.ins_tables where stable_name = 'st0' and db_name = 'd1'
if $rows != 10 then
return -1
endi
sql create database d2 vgroups 3 replica 1
sql use d2
......@@ -79,10 +84,18 @@ sql create table d2.c16 using st1 tags(6)
sql create table d2.c17 using st1 tags(7)
sql create table d2.c18 using st1 tags(8)
sql create table d2.c19 using st1 tags(9)
sql create table d2.c190 using st1 tags(9)
sql show d2.tables
if $rows != 10 then
if $rows != 11 then
return -1
endi
sql reset query cache
sql select * from information_schema.ins_tables where stable_name = 'st1' and db_name = 'd2'
print d2.st1.tables ===> $rows
if $rows != 11 then
return -1
endi
sql create table d2.st2 (ts timestamp, i int) tags (j int)
sql create table d2.c20 using st2 tags(0)
sql create table d2.c21 using st2 tags(1)
......@@ -94,8 +107,16 @@ sql create table d2.c26 using st2 tags(6)
sql create table d2.c27 using st2 tags(7)
sql create table d2.c28 using st2 tags(8)
sql create table d2.c29 using st2 tags(9)
sql create table d2.c290 using st2 tags(9)
sql create table d2.c291 using st2 tags(9)
sql show d2.tables
if $rows != 20 then
if $rows != 23 then
return -1
endi
sql reset query cache
sql select * from information_schema.ins_tables where stable_name = 'st2' and db_name = 'd2'
print d2.st2.tables ===> $rows
if $rows != 12 then
return -1
endi
......@@ -204,6 +225,7 @@ if $rows != 0 then
endi
print =============== step6: check d1
sql reset query cache
sql show d1.tables
if $rows != 10 then
return -1
......@@ -211,31 +233,19 @@ endi
print =============== step7: check d2
sql show d2.tables
print ===> rows: $rows remained
if $rows > 10 then
print ===> d2.tables: $rows remained
if $rows > 23 then
return -1
endi
$remain = $rows
return
print =============== step8: alter stable
sql alter table d2.s1 add column b smallint
sql create table d2.c30 using st tags(0)
sql create table d2.c31 using st tags(1)
sql create table d2.c32 using st tags(2)
sql create table d2.c33 using st tags(3)
sql create table d2.c34 using st tags(4)
sql create table d2.c35 using st tags(5)
sql create table d2.c36 using st tags(6)
sql create table d2.c37 using st tags(7)
sql create table d2.c38 using st tags(8)
sql create table d2.c39 using st tags(9)
sql show d2.tables
if $rows != 10 then
if $rows <= 0 then
return -1
endi
print =============== step9: drop stable and recreate it
print =============== step8: drop stable and recreate it
sql select * from information_schema.ins_tables where stable_name = 'st2' and db_name = 'd2'
print d2.st2.tables ==> $rows
sql drop table d2.st2;
sql create table d2.st2 (ts timestamp, i int) tags (j int)
sql create table d2.c20 using st2 tags(0)
sql create table d2.c21 using st2 tags(1)
......@@ -247,11 +257,45 @@ sql create table d2.c26 using st2 tags(6)
sql create table d2.c27 using st2 tags(7)
sql create table d2.c28 using st2 tags(8)
sql create table d2.c29 using st2 tags(9)
sql show d2.tables
if $rows != 20 then
sql create table d2.c30 using st2 tags(9)
sql create table d2.c31 using st2 tags(9)
sql create table d2.c32 using st2 tags(9)
sql select * from information_schema.ins_tables where stable_name = 'st2' and db_name = 'd2'
print d2.st2.tables ==> $rows
if $rows != 13 then
return -1
endi
print =============== step9: alter stable
return
print By modifying the stable, the missing stable information can be reconstructed in the vnode.
print However, currently, getting the stable meta from the vnode, and return the table not exist
print To handle this, we need to modify the way stable-meta is fetched
sql select * from information_schema.ins_tables where stable_name = 'st1' and db_name = 'd2'
print d2.st1.tables ==> $rows
$remains = $rows
sql alter table d2.st1 add column b smallint
return
sql create table d2.c30 using st tags(0)
sql create table d2.c31 using st tags(1)
sql create table d2.c32 using st tags(2)
sql create table d2.c33 using st tags(3)
sql create table d2.c34 using st tags(4)
sql create table d2.c35 using st tags(5)
sql create table d2.c36 using st tags(6)
sql create table d2.c37 using st tags(7)
sql create table d2.c38 using st tags(8)
sql create table d2.c39 using st tags(9)
sql show d2.tables
print d2.st1.tables ==> $rows
$total = $remains + 10
if $rows != $total then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册