From a247a43863e17b4ebb79dd3d196670ca609bd5f8 Mon Sep 17 00:00:00 2001 From: Yihao Deng Date: Wed, 8 May 2024 06:55:29 +0000 Subject: [PATCH] change compress --- source/common/src/tglobal.c | 8 ++++---- source/libs/parser/src/parAstParser.c | 24 ++++++++++-------------- source/util/src/tcompression.c | 6 +++--- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index fa4e60eb89..3aaf6531c0 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -127,7 +127,7 @@ bool tsEnableTelem = true; int32_t tsTelemInterval = 43200; char tsTelemServer[TSDB_FQDN_LEN] = "telemetry.tdengine.com"; uint16_t tsTelemPort = 80; -char * tsTelemUri = "/report"; +char *tsTelemUri = "/report"; #ifdef TD_ENTERPRISE bool tsEnableCrashReport = false; @@ -1452,7 +1452,7 @@ void taosCleanupCfg() { typedef struct { const char *optionName; - void * optionVar; + void *optionVar; } OptionNameAndVar; static int32_t taosCfgSetOption(OptionNameAndVar *pOptions, int32_t optionSize, SConfigItem *pItem, bool isDebugflag) { @@ -1465,7 +1465,7 @@ static int32_t taosCfgSetOption(OptionNameAndVar *pOptions, int32_t optionSize, switch (pItem->dtype) { case CFG_DTYPE_BOOL: { int32_t flag = pItem->i32; - bool * pVar = pOptions[d].optionVar; + bool *pVar = pOptions[d].optionVar; uInfo("%s set from %d to %d", optName, *pVar, flag); *pVar = flag; terrno = TSDB_CODE_SUCCESS; @@ -1863,7 +1863,7 @@ static void taosSetAllDebugFlag(SConfig *pCfg, int32_t flag) { return; } - SArray * noNeedToSetVars = NULL; + SArray *noNeedToSetVars = NULL; SConfigItem *pItem = cfgGetItem(pCfg, "debugFlag"); if (pItem != NULL) { pItem->i32 = flag; diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index 3da6ac668c..40d2c33087 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -42,7 +42,6 @@ int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placehol return TSDB_CODE_SUCCESS; } - int32_t parse(SParseContext* pParseCxt, SQuery** pQuery) { SAstCreateContext cxt; initAstCreateContext(pParseCxt, &cxt); @@ -631,8 +630,8 @@ static int32_t collectMetaKeyFromShowCompacts(SCollectMetaKeyCxt* pCxt, SShowStm } static int32_t collectMetaKeyFromShowCompactDetails(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { - int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_COMPACT_DETAILS, - pCxt->pMetaCache); + int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, + TSDB_INS_TABLE_COMPACT_DETAILS, pCxt->pMetaCache); return code; } @@ -687,7 +686,7 @@ static int32_t collectMetaKeyFromShowCreateView(SCollectMetaKeyCxt* pCxt, SShowC int32_t code = catalogRemoveViewMeta(pCxt->pParseCxt->pCatalog, dbFName, 0, pStmt->viewName, 0); if (TSDB_CODE_SUCCESS == code) { code = reserveViewUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->viewName, - AUTH_TYPE_READ, pCxt->pMetaCache); + AUTH_TYPE_READ, pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code) { code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, pCxt->pMetaCache); @@ -696,7 +695,6 @@ static int32_t collectMetaKeyFromShowCreateView(SCollectMetaKeyCxt* pCxt, SShowC return code; } - static int32_t collectMetaKeyFromShowApps(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) { return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_PERFORMANCE_SCHEMA_DB, TSDB_PERFS_TABLE_APPS, pCxt->pMetaCache); @@ -755,24 +753,22 @@ static int32_t collectMetaKeyFromRevoke(SCollectMetaKeyCxt* pCxt, SRevokeStmt* p return reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, pCxt->pMetaCache); } - static int32_t collectMetaKeyFromCreateViewStmt(SCollectMetaKeyCxt* pCxt, SCreateViewStmt* pStmt) { - int32_t code = - reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, pCxt->pMetaCache); + int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->viewName, pCxt->pMetaCache); if (TSDB_CODE_SUCCESS == code) { code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, NULL, AUTH_TYPE_WRITE, pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code) { - code = reserveViewUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->viewName, AUTH_TYPE_ALTER, - pCxt->pMetaCache); + code = reserveViewUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->viewName, + AUTH_TYPE_ALTER, pCxt->pMetaCache); } return code; } static int32_t collectMetaKeyFromDropViewStmt(SCollectMetaKeyCxt* pCxt, SDropViewStmt* pStmt) { - int32_t code = reserveViewUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->viewName, AUTH_TYPE_ALTER, - pCxt->pMetaCache); + int32_t code = reserveViewUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, + pStmt->viewName, AUTH_TYPE_ALTER, pCxt->pMetaCache); return code; } @@ -783,7 +779,7 @@ static int32_t collectMetaKeyFromCreateTSMAStmt(SCollectMetaKeyCxt* pCxt, SCreat code = reserveTSMAInfoInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); if (TSDB_CODE_SUCCESS == code) { char dstTbName[TSDB_TABLE_NAME_LEN] = {0}; - snprintf(dstTbName, TSDB_TABLE_NAME_LEN, "%s"TSMA_RES_STB_POSTFIX, pStmt->tableName); + snprintf(dstTbName, TSDB_TABLE_NAME_LEN, "%s" TSMA_RES_STB_POSTFIX, pStmt->tableName); code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, dstTbName, pCxt->pMetaCache); if (TSDB_CODE_SUCCESS == code) { code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, dstTbName, pCxt->pMetaCache); @@ -921,7 +917,7 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { case QUERY_NODE_SHOW_COMPACTS_STMT: return collectMetaKeyFromShowCompacts(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_COMPACT_DETAILS_STMT: - return collectMetaKeyFromShowCompactDetails(pCxt, (SShowStmt*)pStmt); + return collectMetaKeyFromShowCompactDetails(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_GRANTS_FULL_STMT: return collectMetaKeyFromShowGrantsFull(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_GRANTS_LOGS_STMT: diff --git a/source/util/src/tcompression.c b/source/util/src/tcompression.c index cc515b1b49..5a3dc867e6 100644 --- a/source/util/src/tcompression.c +++ b/source/util/src/tcompression.c @@ -347,8 +347,8 @@ int32_t tsCompressINTImp(const char *const input, const int32_t nelements, char char bit_per_integer[] = {0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 15, 20, 30, 60}; int32_t selector_to_elems[] = {240, 120, 60, 30, 20, 15, 12, 10, 8, 7, 6, 5, 4, 3, 2, 1}; char bit_to_selector[] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}; + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}; // get the byte limit. int32_t word_length = getWordLength(type); @@ -1070,7 +1070,7 @@ void encodeFloatValue(uint32_t diff, uint8_t flag, char *const output, int32_t * } int32_t tsCompressFloatImp(const char *const input, const int32_t nelements, char *const output) { - float * istream = (float *)input; + float *istream = (float *)input; int32_t byte_limit = nelements * FLOAT_BYTES + 1; int32_t opos = 1;