diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index fc014df6359116b55e156cf738d82957c3d8845b..0fd8dcc010842c4d5d4e0e759607dbdb1e672cc7 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -177,6 +177,7 @@ extern char tsLogDir[]; extern char tsScriptDir[]; extern int64_t tsTickPerDay[3]; extern int32_t tsTopicBianryLen; +extern int32_t tsMetaSyncOption; // system info extern char tsOsName[]; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index aa5962a846088437fd228a17581a51c5c6a89413..3e45cc98b843d4d2162b894c1b3420a88c755c75 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -232,6 +232,7 @@ int32_t tsKeepTimeOffset = 0; int32_t tsDiskCfgNum = 0; int32_t tsTopicBianryLen = 16000; +int32_t tsMetaSyncOption = 0; #ifndef _STORAGE SDiskCfg tsDiskCfg[1]; diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index 8fec9b7d8e158552a98573f83474df55cc6de1c5..68d07968fb7e4ee721f1541d341410e9b2315469 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -131,6 +131,7 @@ STableCfg *tsdbCreateTableCfgFromMsg(SMDCreateTableMsg *pMsg); int tsdbCreateTable(STsdbRepo *repo, STableCfg *pCfg); int tsdbDropTable(STsdbRepo *pRepo, STableId tableId); int tsdbUpdateTableTagValue(STsdbRepo *repo, SUpdateTableTagValMsg *pMsg); +int tsdbPrintTables(STsdbRepo *repo); uint32_t tsdbGetFileInfo(STsdbRepo *repo, char *name, uint32_t *index, uint32_t eindex, int64_t *size); diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 1ee78aa9b4f84a30e218800b8d1454ae94507612..8520e1b25e146eb8403e2597fec50d37915c674b 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -52,7 +52,6 @@ // informal #define META_SYNC_TABLE_NAME "_taos_meta_sync_table_name_taos_" #define META_SYNC_TABLE_NAME_LEN 32 -static int32_t tsMetaSyncOption = 0; // informal int64_t tsCTableRid = -1; diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 8c249d3483a0ad1aa41c6fa3cb4bb93d9c672a24..d8cccbcdbc9b68b145314b9ca97ad61dfa4b0a4a 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -204,6 +204,20 @@ _err: return -1; } +int tsdbPrintTables(STsdbRepo *pRepo) { + STsdbMeta *pMeta = pRepo->tsdbMeta; + if (tsdbRLockRepoMeta(pRepo) < 0) return -1; + for (int32_t i = 0; i < pMeta->maxTables; ++i) { + if (pMeta->tables[i] != NULL) { + STable *pTable = pMeta->tables[i]; + tsdbDebug("vgId:%d tbname:%s tid:%d uid:%" PRIu64, REPO_ID(pRepo), pTable->name->data, pTable->tableId.tid, + pTable->tableId.uid); + } + } + if (tsdbUnlockRepoMeta(pRepo) < 0) return -1; + return 0; +} + void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type) { // TODO: this function should be changed also @@ -224,7 +238,7 @@ void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type) { return val; } -char *tsdbGetTableName(void* pTable) { +char *tsdbGetTableName(void *pTable) { // TODO: need to change as thread-safe if (pTable == NULL) { diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index fdafd6a15fdd0ac2ea3006d799b29707ffc1ef3b..c2758e799515b20531c5caebaa68bd129bab176a 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -28,6 +28,7 @@ #include "qFilter.h" #include "cJSON.h" + #define EXTRA_BYTES 2 #define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC) #define QH_GET_NUM_OF_COLS(handle) ((size_t)(taosArrayGetSize((handle)->pColumns))) @@ -2808,6 +2809,10 @@ int32_t tsdbGetFileBlocksDistInfo(TsdbQueryHandleT* queryHandle, STableBlockDist tsdbFSIterSeek(&pQueryHandle->fileIter, fid); tsdbUnLockFS(pFileHandle); + if(tsMetaSyncOption) { + tsdbPrintTables(pQueryHandle->pTsdb); + } + pTableBlockInfo->numOfFiles += 1; int32_t code = TSDB_CODE_SUCCESS;