Merge pull request #769 from taosdata/feature/slguan
Solve the bug of incomplete vnode deletion and vpeer synchronization
This commit is contained in:
commit
40617f5dd1
|
@ -224,6 +224,7 @@ int64_t str2int64(char *str);
|
||||||
|
|
||||||
void taosSetCoreDump();
|
void taosSetCoreDump();
|
||||||
|
|
||||||
|
void taosBlockSIGPIPE();
|
||||||
|
|
||||||
#define BUILDIN_CLZL(val) __builtin_clzl(val)
|
#define BUILDIN_CLZL(val) __builtin_clzl(val)
|
||||||
#define BUILDIN_CLZ(val) __builtin_clz(val)
|
#define BUILDIN_CLZ(val) __builtin_clz(val)
|
||||||
|
|
|
@ -341,3 +341,13 @@ bool taosSkipSocketCheck() {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void taosBlockSIGPIPE() {
|
||||||
|
sigset_t signal_mask;
|
||||||
|
sigemptyset(&signal_mask);
|
||||||
|
sigaddset(&signal_mask, SIGPIPE);
|
||||||
|
int rc = pthread_sigmask(SIG_BLOCK, &signal_mask, NULL);
|
||||||
|
if (rc != 0) {
|
||||||
|
pError("failed to block SIGPIPE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -350,8 +350,9 @@ int vnodeProcessVPeerCfg(char *msg, int msgLen, SMgmtObj *pMgmtObj) {
|
||||||
pCfg->rowsInFileBlock = htonl(pCfg->rowsInFileBlock);
|
pCfg->rowsInFileBlock = htonl(pCfg->rowsInFileBlock);
|
||||||
|
|
||||||
if (pCfg->replications > 0) {
|
if (pCfg->replications > 0) {
|
||||||
dPrint("vid:%d, vpeer cfg received, replica:%d session:%d, vnodeList replica:%d session:%d",
|
dPrint("vid:%d, vpeer cfg received, replica:%d session:%d, vnodeList replica:%d session:%d, acct:%s db:%s",
|
||||||
vnode, pCfg->replications, pCfg->maxSessions, vnodeList[vnode].cfg.replications, vnodeList[vnode].cfg.maxSessions);
|
vnode, pCfg->replications, pCfg->maxSessions, vnodeList[vnode].cfg.replications, vnodeList[vnode].cfg.maxSessions,
|
||||||
|
pCfg->acct, pCfg->db);
|
||||||
for (i = 0; i < pCfg->replications; ++i) {
|
for (i = 0; i < pCfg->replications; ++i) {
|
||||||
pMsg->vpeerDesc[i].vnode = htonl(pMsg->vpeerDesc[i].vnode);
|
pMsg->vpeerDesc[i].vnode = htonl(pMsg->vpeerDesc[i].vnode);
|
||||||
pMsg->vpeerDesc[i].ip = htonl(pMsg->vpeerDesc[i].ip);
|
pMsg->vpeerDesc[i].ip = htonl(pMsg->vpeerDesc[i].ip);
|
||||||
|
|
|
@ -142,7 +142,7 @@ int mgmtProcessVPeersRsp(char *msg, int msgLen, SDnodeObj *pObj) {
|
||||||
|
|
||||||
SDbObj *pDb = mgmtGetDb(pRsp->more);
|
SDbObj *pDb = mgmtGetDb(pRsp->more);
|
||||||
if (!pDb) {
|
if (!pDb) {
|
||||||
mError("dnode:%s, db not find, code:%d", taosIpStr(pObj->privateIp), pRsp->code);
|
mError("dnode:%s, db:%s not find, code:%d", taosIpStr(pObj->privateIp), pRsp->more, pRsp->code);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "vnodeMgmt.h"
|
#include "vnodeMgmt.h"
|
||||||
#include "vnodeShell.h"
|
#include "vnodeShell.h"
|
||||||
#include "vnodeUtil.h"
|
#include "vnodeUtil.h"
|
||||||
|
#include "tstatus.h"
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wpointer-sign"
|
#pragma GCC diagnostic ignored "-Wpointer-sign"
|
||||||
|
|
||||||
|
@ -717,7 +718,8 @@ void vnodeUpdateMeter(void *param, void *tmrId) {
|
||||||
SVnodeObj* pVnode = &vnodeList[pNew->vnode];
|
SVnodeObj* pVnode = &vnodeList[pNew->vnode];
|
||||||
|
|
||||||
if (pVnode->meterList == NULL) {
|
if (pVnode->meterList == NULL) {
|
||||||
dTrace("vid:%d sid:%d id:%s, vnode is deleted, abort update schema", pNew->vnode, pNew->sid, pNew->meterId);
|
dTrace("vid:%d sid:%d id:%s, vnode is deleted, status:%s, abort update schema",
|
||||||
|
pNew->vnode, pNew->sid, pNew->meterId, taosGetVnodeStatusStr(vnodeList[pNew->vnode].vnodeStatus));
|
||||||
free(pNew->schema);
|
free(pNew->schema);
|
||||||
free(pNew);
|
free(pNew);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -184,13 +184,15 @@ int vnodeOpenShellVnode(int vnode) {
|
||||||
|
|
||||||
static void vnodeDelayedFreeResource(void *param, void *tmrId) {
|
static void vnodeDelayedFreeResource(void *param, void *tmrId) {
|
||||||
int32_t vnode = *(int32_t*) param;
|
int32_t vnode = *(int32_t*) param;
|
||||||
dTrace("vid:%d, start to free resources", vnode);
|
dTrace("vid:%d, start to free resources for 500ms arrived", vnode);
|
||||||
|
|
||||||
taosCloseRpcChann(pShellServer, vnode); // close connection
|
taosCloseRpcChann(pShellServer, vnode); // close connection
|
||||||
tfree(shellList[vnode]); //free SShellObj
|
tfree(shellList[vnode]); //free SShellObj
|
||||||
tfree(param);
|
tfree(param);
|
||||||
|
|
||||||
memset(vnodeList + vnode, 0, sizeof(SVnodeObj));
|
memset(vnodeList + vnode, 0, sizeof(SVnodeObj));
|
||||||
|
dTrace("vid:%d, status set to %s", vnode, taosGetVnodeStatusStr(vnodeList[vnode].vnodeStatus));
|
||||||
|
|
||||||
vnodeCalcOpenVnodes();
|
vnodeCalcOpenVnodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ static void vnodeRemoveDataFiles(int vnode) {
|
||||||
|
|
||||||
sprintf(vnodeDir, "%s/vnode%d", tsDirectory, vnode);
|
sprintf(vnodeDir, "%s/vnode%d", tsDirectory, vnode);
|
||||||
rmdir(vnodeDir);
|
rmdir(vnodeDir);
|
||||||
dPrint("vid:%d, vnode is removed!", vnode);
|
dPrint("vid:%d, vnode is removed, status:%s", vnode, taosGetVnodeStatusStr(vnodeList[vnode].vnodeStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
int vnodeRemoveVnode(int vnode) {
|
int vnodeRemoveVnode(int vnode) {
|
||||||
|
@ -261,7 +261,7 @@ int vnodeRemoveVnode(int vnode) {
|
||||||
if (pVnode->vnodeStatus == TSDB_VN_STATUS_CREATING
|
if (pVnode->vnodeStatus == TSDB_VN_STATUS_CREATING
|
||||||
|| pVnode->vnodeStatus == TSDB_VN_STATUS_OFFLINE
|
|| pVnode->vnodeStatus == TSDB_VN_STATUS_OFFLINE
|
||||||
|| pVnode->vnodeStatus == TSDB_VN_STATUS_DELETING) {
|
|| pVnode->vnodeStatus == TSDB_VN_STATUS_DELETING) {
|
||||||
dError("vid:%d, status:%s, cannot enter close/delete operation", vnode, taosGetVnodeStatusStr(pVnode->vnodeStatus));
|
dTrace("vid:%d, status:%s, cannot enter close/delete operation", vnode, taosGetVnodeStatusStr(pVnode->vnodeStatus));
|
||||||
return TSDB_CODE_ACTION_IN_PROGRESS;
|
return TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
} else {
|
} else {
|
||||||
int32_t ret = vnodeCloseVnode(vnode);
|
int32_t ret = vnodeCloseVnode(vnode);
|
||||||
|
@ -269,6 +269,7 @@ int vnodeRemoveVnode(int vnode) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dTrace("vid:%d, status:%s, do delete operation", vnode, taosGetVnodeStatusStr(pVnode->vnodeStatus));
|
||||||
vnodeRemoveDataFiles(vnode);
|
vnodeRemoveDataFiles(vnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue