This commit is contained in:
Hongze Cheng 2020-06-19 01:41:14 +00:00
parent 496c5da86c
commit 7f9df4c361
1 changed files with 11 additions and 2 deletions

View File

@ -112,6 +112,8 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) {
STsdbRepo *pRepo = (STsdbRepo *)repo;
STsdbMeta *pMeta = pRepo->tsdbMeta;
uint64_t uid = tableId.uid;
int tid = 0;
char * tbname = NULL;
STable *pTable = tsdbGetTableByUid(pMeta, uid);
if (pTable == NULL) {
@ -121,6 +123,13 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) {
return -1;
}
tid = TABLE_TID(pTable);
tbname = strdup(TABLE_CHAR_NAME(pTable));
if (tbname == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
return -1;
}
if (TABLE_TYPE(pTable) == TSDB_STREAM_TABLE) {
if (pTable->cqhandle) pRepo->appH.cqDropFunc(pTable->cqhandle);
}
@ -140,8 +149,8 @@ int tsdbDropTable(TSDB_REPO_T *repo, STableId tableId) {
tsdbRemoveTableFromMeta(pRepo, pTable, true);
tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, varDataVal(pTable->name),
tableId.tid, tableId.uid);
tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, tbname, tid, uid);
free(tbname);
return 0;
}