set tsdb to NULL if vnode needs to reset tsdb
This commit is contained in:
parent
67a0474447
commit
2e9753526c
|
@ -193,10 +193,12 @@ int32_t vnodeAlter(void *param, SMDCreateVnodeMsg *pVnodeCfg) {
|
|||
return code;
|
||||
}
|
||||
|
||||
code = tsdbConfigRepo(pVnode->tsdb, &pVnode->tsdbCfg);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
pVnode->status = TAOS_VN_STATUS_READY;
|
||||
return code;
|
||||
if (pVnode->tsdb) {
|
||||
code = tsdbConfigRepo(pVnode->tsdb, &pVnode->tsdbCfg);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
pVnode->status = TAOS_VN_STATUS_READY;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
pVnode->status = TAOS_VN_STATUS_READY;
|
||||
|
@ -572,7 +574,9 @@ static void vnodeNotifyFileSynced(void *ahandle, uint64_t fversion) {
|
|||
char rootDir[128] = "\0";
|
||||
sprintf(rootDir, "%s/tsdb", pVnode->rootDir);
|
||||
// clsoe tsdb, then open tsdb
|
||||
tsdbCloseRepo(pVnode->tsdb, 0);
|
||||
void *tsdb = pVnode->tsdb;
|
||||
pVnode->tsdb = NULL;
|
||||
tsdbCloseRepo(tsdb, 0);
|
||||
STsdbAppH appH = {0};
|
||||
appH.appH = (void *)pVnode;
|
||||
appH.notifyStatus = vnodeProcessTsdbStatus;
|
||||
|
|
|
@ -59,13 +59,16 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
|
|||
return TSDB_CODE_VND_NO_WRITE_AUTH;
|
||||
}
|
||||
|
||||
// tsdb may be in reset state
|
||||
if (pVnode->tsdb == NULL) return 0;
|
||||
|
||||
if (pHead->version == 0) { // from client or CQ
|
||||
if (pVnode->status != TAOS_VN_STATUS_READY) {
|
||||
vDebug("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[pHead->msgType], pVnode->status);
|
||||
return TSDB_CODE_VND_INVALID_STATUS; // it may be in deleting or closing state
|
||||
}
|
||||
|
||||
if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) {
|
||||
if (pVnode->role != TAOS_SYNC_ROLE_MASTER) {
|
||||
vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[pHead->msgType], pVnode->syncCfg.replica, pVnode->role);
|
||||
return TSDB_CODE_RPC_NOT_READY;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue