From e65be1be0d3e627149873033aa69609488ea089a Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 13 Jun 2020 12:56:48 +0800 Subject: [PATCH] [td-225] fix bugs in restore from core dump --- src/mnode/src/mnodeDb.c | 9 ++++++--- src/mnode/src/mnodeTable.c | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index 3666d61adc..69783defc7 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -84,9 +84,12 @@ static int32_t mnodeDbActionDelete(SSdbOper *pOper) { mnodeDropAllChildTables(pDb); mnodeDropAllSuperTables(pDb); mnodeDropAllDbVgroups(pDb); - mnodeDropDbFromAcct(pAcct, pDb); - mnodeDecAcctRef(pAcct); - + + if (pAcct) { + mnodeDropDbFromAcct(pAcct, pDb); + mnodeDecAcctRef(pAcct); + } + return TSDB_CODE_SUCCESS; } diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 478e7790fb..0ff198bf8f 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -157,10 +157,12 @@ static int32_t mnodeChildTableActionDelete(SSdbOper *pOper) { if (pDb != NULL) pAcct = mnodeGetAcct(pDb->acct); if (pTable->info.type == TSDB_CHILD_TABLE) { - grantRestore(TSDB_GRANT_TIMESERIES, pTable->superTable->numOfColumns - 1); - if (pAcct != NULL) pAcct->acctInfo.numOfTimeSeries -= (pTable->superTable->numOfColumns - 1); - mnodeRemoveTableFromStable(pTable->superTable, pTable); - mnodeDecTableRef(pTable->superTable); + if (pTable->superTable) { + grantRestore(TSDB_GRANT_TIMESERIES, pTable->superTable->numOfColumns - 1); + if (pAcct != NULL) pAcct->acctInfo.numOfTimeSeries -= (pTable->superTable->numOfColumns - 1); + mnodeRemoveTableFromStable(pTable->superTable, pTable); + mnodeDecTableRef(pTable->superTable); + } } else { grantRestore(TSDB_GRANT_TIMESERIES, pTable->numOfColumns - 1); if (pAcct != NULL) pAcct->acctInfo.numOfTimeSeries -= (pTable->numOfColumns - 1); -- GitLab