From 8f54cb6768ab1352f92a05e4c9fd843e433cf1a3 Mon Sep 17 00:00:00 2001 From: slguan Date: Wed, 8 Apr 2020 23:27:10 +0800 Subject: [PATCH] fix crash while drop databases --- src/vnode/main/src/vnodeMain.c | 5 ++--- src/vnode/wal/src/walMain.c | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vnode/main/src/vnodeMain.c b/src/vnode/main/src/vnodeMain.c index 9512cf4c6c..13210e496f 100644 --- a/src/vnode/main/src/vnodeMain.c +++ b/src/vnode/main/src/vnodeMain.c @@ -36,7 +36,7 @@ static int vnodeWALCallback(void *arg); static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg); static int32_t vnodeReadCfg(SVnodeObj *pVnode); -static int tsOpennedVnodes; +static int32_t tsOpennedVnodes; static pthread_once_t vnodeModuleInit = PTHREAD_ONCE_INIT; static void vnodeInit() { @@ -104,8 +104,7 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { } int32_t vnodeDrop(int32_t vgId) { - - SVnodeObj *pVnode = (SVnodeObj *) taosGetIntHashData(tsDnodeVnodesHash, vgId); + SVnodeObj *pVnode = *(SVnodeObj **)taosGetIntHashData(tsDnodeVnodesHash, vgId); if (pVnode == NULL) { dTrace("vgId:%d, failed to drop, vgId not exist", vgId); return TSDB_CODE_INVALID_VGROUP_ID; diff --git a/src/vnode/wal/src/walMain.c b/src/vnode/wal/src/walMain.c index 99de5cceda..504e370279 100644 --- a/src/vnode/wal/src/walMain.c +++ b/src/vnode/wal/src/walMain.c @@ -80,7 +80,8 @@ void *walOpen(char *path, int max, int level) { } void walClose(void *handle) { - + if (handle == NULL) return; + SWal *pWal = (SWal *)handle; close(pWal->fd); -- GitLab