From c541d35462d5884f174fdb9808265981e4d9e79d Mon Sep 17 00:00:00 2001 From: slguan Date: Tue, 24 Mar 2020 15:34:22 +0800 Subject: [PATCH] [TD-15] sdb may crash while received close signal --- src/mnode/src/mgmtSdb.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index e950761a31..0b1ac3be97 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -722,18 +722,20 @@ int32_t sdbUpdateRow(SSdbOperDesc *pOper) { void sdbCloseTable(void *handle) { SSdbTable *pTable = (SSdbTable *)handle; void * pNode = NULL; - void * row; - + if (pTable == NULL) return; while (1) { - pNode = sdbFetchRow(handle, pNode, &row); - if (row == NULL) break; + SRowMeta * pMeta; + pNode = (*sdbFetchRowFp[pTable->keyType])(pTable->iHandle, pNode, (void **)&pMeta); + if (pMeta == NULL) break; SSdbOperDesc oper = { + .pObj = pMeta->row, .table = pTable, - .rowData = row, + .version = pMeta->version, }; + (*pTable->destroyFp)(&oper); } -- GitLab