From eae7947c685d3223d2015b960c43bb962ffad0fe Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 8 Sep 2022 17:58:33 +0800 Subject: [PATCH] more refact --- include/util/tdef.h | 4 ++-- source/dnode/mnode/impl/src/mndDb.c | 2 +- source/dnode/vnode/src/inc/tsdb.h | 7 +++---- source/dnode/vnode/src/tsdb/tsdbCommit.c | 6 +++--- source/dnode/vnode/src/tsdb/tsdbReaderWriter.c | 2 +- source/libs/parser/src/parTranslater.c | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 57fde32bed..21f879cd93 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -359,8 +359,8 @@ typedef enum ELogicConditionType { #define TSDB_DB_SCHEMALESS_ON 1 #define TSDB_DB_SCHEMALESS_OFF 0 #define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF -#define TSDB_MIN_SST_TRIGGER 1 -#define TSDB_MAX_SST_TRIGGER 128 +#define TSDB_MIN_STT_TRIGGER 1 +#define TSDB_MAX_STT_TRIGGER 16 #define TSDB_DEFAULT_SST_TRIGGER 8 #define TSDB_MIN_HASH_PREFIX 0 #define TSDB_MAX_HASH_PREFIX 128 diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index feb69bf74f..84bca239d2 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -338,7 +338,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) { if (pCfg->walRetentionSize < TSDB_DB_MIN_WAL_RETENTION_SIZE) return -1; if (pCfg->walRollPeriod < TSDB_DB_MIN_WAL_ROLL_PERIOD) return -1; if (pCfg->walSegmentSize < TSDB_DB_MIN_WAL_SEGMENT_SIZE) return -1; - if (pCfg->sstTrigger < TSDB_MIN_SST_TRIGGER || pCfg->sstTrigger > TSDB_MAX_SST_TRIGGER) return -1; + if (pCfg->sstTrigger < TSDB_MIN_STT_TRIGGER || pCfg->sstTrigger > TSDB_MAX_STT_TRIGGER) return -1; if (pCfg->hashPrefix < TSDB_MIN_HASH_PREFIX || pCfg->hashPrefix > TSDB_MAX_HASH_PREFIX) return -1; if (pCfg->hashSuffix < TSDB_MIN_HASH_SUFFIX || pCfg->hashSuffix > TSDB_MAX_HASH_SUFFIX) return -1; diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 0575fa91f0..7eb907c5a6 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -69,7 +69,6 @@ typedef struct SLDataIter SLDataIter; #define TSDB_FILE_DLMT ((uint32_t)0xF00AFA0F) #define TSDB_MAX_SUBBLOCKS 8 -#define TSDB_MAX_STT_FILE 16 #define TSDB_FHDR_SIZE 512 #define TSDB_DEFAULT_PAGE_SIZE 4096 @@ -571,7 +570,7 @@ struct SDFileSet { SDataFile *pDataF; SSmaFile *pSmaF; uint8_t nSttF; - SSttFile *aSttF[TSDB_MAX_STT_FILE]; + SSttFile *aSttF[TSDB_MAX_STT_TRIGGER]; }; struct SRowIter { @@ -621,7 +620,7 @@ struct SDataFWriter { SHeadFile fHead; SDataFile fData; SSmaFile fSma; - SSttFile fStt[TSDB_MAX_STT_FILE]; + SSttFile fStt[TSDB_MAX_STT_TRIGGER]; uint8_t *aBuf[4]; }; @@ -632,7 +631,7 @@ struct SDataFReader { STsdbFD *pHeadFD; STsdbFD *pDataFD; STsdbFD *pSmaFD; - STsdbFD *aSttFD[TSDB_MAX_STT_FILE]; + STsdbFD *aSttFD[TSDB_MAX_STT_TRIGGER]; uint8_t *aBuf[3]; }; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 12a81a0660..4b5df2d7a0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -71,7 +71,7 @@ typedef struct { SDataIter *pIter; SRBTree rbt; SDataIter dataIter; - SDataIter aDataIter[TSDB_MAX_STT_FILE]; + SDataIter aDataIter[TSDB_MAX_STT_TRIGGER]; int8_t toLastOnly; }; struct { @@ -787,7 +787,7 @@ static int32_t tsdbCommitDataStart(SCommitter *pCommitter) { if (code) goto _exit; // merger - for (int32_t iStt = 0; iStt < TSDB_MAX_STT_FILE; iStt++) { + for (int32_t iStt = 0; iStt < TSDB_MAX_STT_TRIGGER; iStt++) { SDataIter *pIter = &pCommitter->aDataIter[iStt]; pIter->aSttBlk = taosArrayInit(0, sizeof(SSttBlk)); if (pIter->aSttBlk == NULL) { @@ -829,7 +829,7 @@ static void tsdbCommitDataEnd(SCommitter *pCommitter) { tBlockDataDestroy(&pCommitter->dReader.bData, 1); // merger - for (int32_t iStt = 0; iStt < TSDB_MAX_STT_FILE; iStt++) { + for (int32_t iStt = 0; iStt < TSDB_MAX_STT_TRIGGER; iStt++) { SDataIter *pIter = &pCommitter->aDataIter[iStt]; taosArrayDestroy(pIter->aSttBlk); tBlockDataDestroy(&pIter->bData, 1); diff --git a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c index 128bfe37da..b171d52dfc 100644 --- a/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c +++ b/source/dnode/vnode/src/tsdb/tsdbReaderWriter.c @@ -780,7 +780,7 @@ int32_t tsdbDataFReaderClose(SDataFReader **ppReader) { tsdbCloseFile(&(*ppReader)->pSmaFD); // stt - for (int32_t iStt = 0; iStt < TSDB_MAX_STT_FILE; iStt++) { + for (int32_t iStt = 0; iStt < TSDB_MAX_STT_TRIGGER; iStt++) { if ((*ppReader)->aSttFD[iStt]) { tsdbCloseFile(&(*ppReader)->aSttFD[iStt]); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ad9a467dee..91787f5a72 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3770,7 +3770,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName checkDbRangeOption(pCxt, "walSegmentSize", pOptions->walSegmentSize, TSDB_DB_MIN_WAL_SEGMENT_SIZE, INT32_MAX); } if (TSDB_CODE_SUCCESS == code) { - code = checkDbRangeOption(pCxt, "sstTrigger", pOptions->sstTrigger, TSDB_MIN_SST_TRIGGER, TSDB_MAX_SST_TRIGGER); + code = checkDbRangeOption(pCxt, "sstTrigger", pOptions->sstTrigger, TSDB_MIN_STT_TRIGGER, TSDB_MAX_STT_TRIGGER); } if (TSDB_CODE_SUCCESS == code) { code = checkDbRangeOption(pCxt, "tablePrefix", pOptions->tablePrefix, TSDB_MIN_HASH_PREFIX, TSDB_MAX_HASH_PREFIX); @@ -6606,7 +6606,7 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema); if (QUERY_NODE_VALUE != pStmt->pVal->node.type) { - SValueNode *pVal = NULL; + SValueNode* pVal = NULL; pCxt->errCode = createTagValFromExpr(pCxt, targetDt, (SNode*)pStmt->pVal, &pVal); if (pCxt->errCode) { return pCxt->errCode; -- GitLab