Need to delete stb when deleting database
This commit is contained in:
parent
9a927afbd9
commit
2f4148e8d4
|
@ -26,6 +26,7 @@ int32_t mndInitStb(SMnode *pMnode);
|
||||||
void mndCleanupStb(SMnode *pMnode);
|
void mndCleanupStb(SMnode *pMnode);
|
||||||
SStbObj *mndAcquireStb(SMnode *pMnode, char *stbName);
|
SStbObj *mndAcquireStb(SMnode *pMnode, char *stbName);
|
||||||
void mndReleaseStb(SMnode *pMnode, SStbObj *pStb);
|
void mndReleaseStb(SMnode *pMnode, SStbObj *pStb);
|
||||||
|
SSdbRaw *mndStbActionEncode(SStbObj *pStb);
|
||||||
int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *pStbs, int32_t numOfStbs, void **ppRsp,
|
int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *pStbs, int32_t numOfStbs, void **ppRsp,
|
||||||
int32_t *pRspLen);
|
int32_t *pRspLen);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "mndAuth.h"
|
#include "mndAuth.h"
|
||||||
#include "mndDnode.h"
|
#include "mndDnode.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
|
#include "mndStb.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
#include "mndVgroup.h"
|
#include "mndVgroup.h"
|
||||||
|
@ -722,6 +723,24 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
SStbObj *pStb = NULL;
|
||||||
|
pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb);
|
||||||
|
if (pIter == NULL) break;
|
||||||
|
|
||||||
|
if (pStb->dbUid == pDb->uid) {
|
||||||
|
SSdbRaw *pStbRaw = mndStbActionEncode(pStb);
|
||||||
|
if (pStbRaw == NULL || mndTransAppendCommitlog(pTrans, pStbRaw) != 0) {
|
||||||
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
sdbRelease(pSdb, pStbRaw);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
sdbRelease(pSdb, pStb);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#define TSDB_STB_VER_NUMBER 1
|
#define TSDB_STB_VER_NUMBER 1
|
||||||
#define TSDB_STB_RESERVE_SIZE 64
|
#define TSDB_STB_RESERVE_SIZE 64
|
||||||
|
|
||||||
static SSdbRaw *mndStbActionEncode(SStbObj *pStb);
|
|
||||||
static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw);
|
static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw);
|
||||||
static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb);
|
static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb);
|
||||||
static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb);
|
static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb);
|
||||||
|
@ -70,7 +69,7 @@ int32_t mndInitStb(SMnode *pMnode) {
|
||||||
|
|
||||||
void mndCleanupStb(SMnode *pMnode) {}
|
void mndCleanupStb(SMnode *pMnode) {}
|
||||||
|
|
||||||
static SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + TSDB_STB_RESERVE_SIZE;
|
int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + TSDB_STB_RESERVE_SIZE;
|
||||||
|
|
Loading…
Reference in New Issue