optimize remove chile table
This commit is contained in:
parent
0d8dd37eb2
commit
16e9d8fa65
|
@ -16,7 +16,7 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx)
|
||||||
static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable);
|
static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable);
|
||||||
static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable);
|
static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable);
|
||||||
static int tsdbEstimateTableEncodeSize(STable *pTable);
|
static int tsdbEstimateTableEncodeSize(STable *pTable);
|
||||||
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable);
|
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable, bool rmFromIdx);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encode a TSDB table object as a binary content
|
* Encode a TSDB table object as a binary content
|
||||||
|
@ -411,7 +411,7 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
|
||||||
|
|
||||||
tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, varDataVal(pTable->name),
|
tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, varDataVal(pTable->name),
|
||||||
tableId.tid, tableId.uid);
|
tableId.tid, tableId.uid);
|
||||||
if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1;
|
if (tsdbRemoveTableFromMeta(pMeta, pTable, true) < 0) return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) {
|
static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable, bool rmFromIdx) {
|
||||||
if (pTable->type == TSDB_SUPER_TABLE) {
|
if (pTable->type == TSDB_SUPER_TABLE) {
|
||||||
SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex);
|
SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex);
|
||||||
while (tSkipListIterNext(pIter)) {
|
while (tSkipListIterNext(pIter)) {
|
||||||
|
@ -509,7 +509,7 @@ static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) {
|
||||||
|
|
||||||
ASSERT(tTable != NULL && tTable->type == TSDB_CHILD_TABLE);
|
ASSERT(tTable != NULL && tTable->type == TSDB_CHILD_TABLE);
|
||||||
|
|
||||||
tsdbRemoveTableFromMeta(pMeta, tTable);
|
tsdbRemoveTableFromMeta(pMeta, tTable, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
tSkipListDestroyIter(pIter);
|
tSkipListDestroyIter(pIter);
|
||||||
|
@ -525,7 +525,7 @@ static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pMeta->tables[pTable->tableId.tid] = NULL;
|
pMeta->tables[pTable->tableId.tid] = NULL;
|
||||||
if (pTable->type == TSDB_CHILD_TABLE) {
|
if (pTable->type == TSDB_CHILD_TABLE && rmFromIdx) {
|
||||||
tsdbRemoveTableFromIndex(pMeta, pTable);
|
tsdbRemoveTableFromIndex(pMeta, pTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue