fix drop dnode errors
This commit is contained in:
parent
9748f4be67
commit
c31dc87763
|
@ -661,8 +661,6 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
int64_t clusterId;
|
int64_t clusterId;
|
||||||
int8_t dropped;
|
|
||||||
char reserved[7];
|
|
||||||
} SDnodeCfg;
|
} SDnodeCfg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -393,13 +393,11 @@ void dndSendStatusMsg(SDnode *pDnode) {
|
||||||
|
|
||||||
static void dndUpdateDnodeCfg(SDnode *pDnode, SDnodeCfg *pCfg) {
|
static void dndUpdateDnodeCfg(SDnode *pDnode, SDnodeCfg *pCfg) {
|
||||||
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
|
SDnodeMgmt *pMgmt = &pDnode->dmgmt;
|
||||||
if (pMgmt->dnodeId == 0 || pMgmt->dropped != pCfg->dropped) {
|
if (pMgmt->dnodeId == 0) {
|
||||||
dInfo("set dnodeId:%d clusterId:% " PRId64 " dropped:%d", pCfg->dnodeId, pCfg->clusterId, pCfg->dropped);
|
dInfo("set dnodeId:%d clusterId:% " PRId64, pCfg->dnodeId, pCfg->clusterId);
|
||||||
|
|
||||||
taosWLockLatch(&pMgmt->latch);
|
taosWLockLatch(&pMgmt->latch);
|
||||||
pMgmt->dnodeId = pCfg->dnodeId;
|
pMgmt->dnodeId = pCfg->dnodeId;
|
||||||
pMgmt->clusterId = pCfg->clusterId;
|
pMgmt->clusterId = pCfg->clusterId;
|
||||||
pMgmt->dropped = pCfg->dropped;
|
|
||||||
dndWriteDnodes(pDnode);
|
dndWriteDnodes(pDnode);
|
||||||
taosWUnLockLatch(&pMgmt->latch);
|
taosWUnLockLatch(&pMgmt->latch);
|
||||||
}
|
}
|
||||||
|
@ -430,6 +428,11 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pMsg) {
|
||||||
|
|
||||||
if (pMsg->code != TSDB_CODE_SUCCESS) {
|
if (pMsg->code != TSDB_CODE_SUCCESS) {
|
||||||
pMgmt->statusSent = 0;
|
pMgmt->statusSent = 0;
|
||||||
|
if (pMsg->code == TSDB_CODE_MND_DNODE_NOT_EXIST && !pMgmt->dropped && pMgmt->dnodeId > 0) {
|
||||||
|
dInfo("dnode:%d, set to dropped since not exist in mnode", pMgmt->dnodeId);
|
||||||
|
pMgmt->dropped = 1;
|
||||||
|
dndWriteDnodes(pDnode);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,11 +442,6 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pMsg) {
|
||||||
pCfg->clusterId = htobe64(pCfg->clusterId);
|
pCfg->clusterId = htobe64(pCfg->clusterId);
|
||||||
dndUpdateDnodeCfg(pDnode, pCfg);
|
dndUpdateDnodeCfg(pDnode, pCfg);
|
||||||
|
|
||||||
if (pCfg->dropped) {
|
|
||||||
pMgmt->statusSent = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDnodeEps *pDnodeEps = &pRsp->dnodeEps;
|
SDnodeEps *pDnodeEps = &pRsp->dnodeEps;
|
||||||
pDnodeEps->num = htonl(pDnodeEps->num);
|
pDnodeEps->num = htonl(pDnodeEps->num);
|
||||||
for (int32_t i = 0; i < pDnodeEps->num; ++i) {
|
for (int32_t i = 0; i < pDnodeEps->num; ++i) {
|
||||||
|
@ -487,7 +485,7 @@ static void *dnodeThreadRoutine(void *param) {
|
||||||
pthread_testcancel();
|
pthread_testcancel();
|
||||||
taosMsleep(ms);
|
taosMsleep(ms);
|
||||||
|
|
||||||
if (dndGetStat(pDnode) == DND_STAT_RUNNING && !pMgmt->statusSent) {
|
if (dndGetStat(pDnode) == DND_STAT_RUNNING && !pMgmt->statusSent && !pMgmt->dropped) {
|
||||||
dndSendStatusMsg(pDnode);
|
dndSendStatusMsg(pDnode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,6 +520,11 @@ int32_t dndInitDnode(SDnode *pDnode) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pMgmt->dropped) {
|
||||||
|
dError("dnode will not start for its already dropped");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (dndInitMgmtWorker(pDnode) != 0) {
|
if (dndInitMgmtWorker(pDnode) != 0) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -370,7 +370,6 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pRsp->dnodeCfg.dnodeId = htonl(pDnode->id);
|
pRsp->dnodeCfg.dnodeId = htonl(pDnode->id);
|
||||||
pRsp->dnodeCfg.dropped = 0;
|
|
||||||
pRsp->dnodeCfg.clusterId = htobe64(pMnode->clusterId);
|
pRsp->dnodeCfg.clusterId = htobe64(pMnode->clusterId);
|
||||||
mndGetDnodeData(pMnode, &pRsp->dnodeEps, numOfEps);
|
mndGetDnodeData(pMnode, &pRsp->dnodeEps, numOfEps);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue