diff --git a/src/client/src/TSDBJNIConnector.c b/src/client/src/TSDBJNIConnector.c index fb175618c0..e98acfc9a6 100644 --- a/src/client/src/TSDBJNIConnector.c +++ b/src/client/src/TSDBJNIConnector.c @@ -13,8 +13,6 @@ * along with this program. If not, see . */ -#include - #include "os.h" #include "com_taosdata_jdbc_TSDBJNIConnector.h" #include "taos.h" diff --git a/src/client/src/tscAst.c b/src/client/src/tscAst.c index 845a9fd36d..fe0921c64d 100644 --- a/src/client/src/tscAst.c +++ b/src/client/src/tscAst.c @@ -13,12 +13,6 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include - #include "os.h" #include "taosmsg.h" #include "tast.h" diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 6e0e1ae7c5..aad0295959 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -13,8 +13,7 @@ * along with this program. If not, see . */ -#include -#include +#include "os.h" #include "tlog.h" #include "trpc.h" diff --git a/src/client/src/tscCache.c b/src/client/src/tscCache.c index 866b6e7dbc..f508857ce1 100644 --- a/src/client/src/tscCache.c +++ b/src/client/src/tscCache.c @@ -13,14 +13,7 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include +#include "os.h" #include "tglobalcfg.h" #include "tlog.h" diff --git a/src/client/src/tscFunctionImpl.c b/src/client/src/tscFunctionImpl.c index 0f9be90412..35011a259b 100644 --- a/src/client/src/tscFunctionImpl.c +++ b/src/client/src/tscFunctionImpl.c @@ -15,16 +15,6 @@ #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "os.h" #include "taosmsg.h" #include "tast.h" diff --git a/src/client/src/tscJoinProcess.c b/src/client/src/tscJoinProcess.c index 4965498eff..dfeebc8c61 100644 --- a/src/client/src/tscJoinProcess.c +++ b/src/client/src/tscJoinProcess.c @@ -13,13 +13,6 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include -#include - #include "os.h" #include "tcache.h" #include "tscJoinProcess.h" diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 9afb74fec2..d217d09588 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -13,9 +13,7 @@ * along with this program. If not, see . */ -#include -#include -#include +#include "os.h" #include "taosmsg.h" #include "tcache.h" diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 37a32e9ebb..c8ce728de1 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -21,22 +21,8 @@ #pragma GCC diagnostic ignored "-Woverflow" #pragma GCC diagnostic ignored "-Wunused-variable" -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "ihash.h" #include "os.h" +#include "ihash.h" #include "tscSecondaryMerge.h" #include "tscUtil.h" #include "tschemautil.h" diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index e956d6159e..03f644ac36 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -13,9 +13,6 @@ * along with this program. If not, see . */ -#include -#include - #include "taos.h" #include "tsclient.h" #include "tsql.h" diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index 770e61e278..7d74f62dcc 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -13,9 +13,6 @@ * along with this program. If not, see . */ -#include -#include - #include "os.h" #include "tlog.h" #include "tsclient.h" diff --git a/src/client/src/tscSQLParserImpl.c b/src/client/src/tscSQLParserImpl.c index 7e1b4a7cf1..4fefe1665c 100644 --- a/src/client/src/tscSQLParserImpl.c +++ b/src/client/src/tscSQLParserImpl.c @@ -13,13 +13,6 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include -#include - #include "os.h" #include "tglobalcfg.h" #include "tsql.h" diff --git a/src/client/src/tscSchemaUtil.c b/src/client/src/tscSchemaUtil.c index 9728811ae7..5e50c27ab1 100644 --- a/src/client/src/tscSchemaUtil.c +++ b/src/client/src/tscSchemaUtil.c @@ -13,10 +13,6 @@ * along with this program. If not, see . */ -#include -#include -#include - #include "os.h" #include "taosmsg.h" #include "tschemautil.h" diff --git a/src/client/src/tscSecondaryMerge.c b/src/client/src/tscSecondaryMerge.c index ac2638f635..398cd1cca6 100644 --- a/src/client/src/tscSecondaryMerge.c +++ b/src/client/src/tscSecondaryMerge.c @@ -13,13 +13,8 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include -#include "tlosertree.h" +#include "os.h" #include "tlosertree.h" #include "tscSecondaryMerge.h" #include "tscUtil.h" diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 6edec3d477..49368e4d17 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -13,12 +13,6 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include - #include "os.h" #include "tcache.h" #include "trpc.h" @@ -2848,7 +2842,7 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql) { return msgLen; } -int tscEstimateBuildHeartBeatMsgLength(SSqlObj *pSql) { +int tscEstimateHeartBeatMsgLength(SSqlObj *pSql) { int size = 0; STscObj *pObj = pSql->pTscObj; @@ -2881,7 +2875,7 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql) { pthread_mutex_lock(&pObj->mutex); - size = tscEstimateBuildHeartBeatMsgLength(pSql); + size = tscEstimateHeartBeatMsgLength(pSql); if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, size)) { tscError("%p failed to malloc for heartbeat msg", pSql); return -1; @@ -3613,7 +3607,7 @@ int tscRenewMeterMeta(SSqlObj *pSql, char *meterId) { code = tscDoGetMeterMeta(pSql, meterId, 0); // todo ?? } else { - tscTrace("%p metric query not update metric meta, numOfTags:%d, numOfCols:%d, uid:%d, addr:%p", pSql, + tscTrace("%p metric query not update metric meta, numOfTags:%d, numOfCols:%d, uid:%lld, addr:%p", pSql, pMeterMetaInfo->pMeterMeta->numOfTags, pCmd->numOfCols, pMeterMetaInfo->pMeterMeta->uid, pMeterMetaInfo->pMeterMeta); } diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index fa72b18d16..10eac0bb63 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -13,9 +13,6 @@ * along with this program. If not, see . */ -#include -#include - #include "os.h" #include "tcache.h" #include "tlog.h" diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index dee8f02118..bcbcaba4c4 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -13,7 +13,7 @@ * along with this program. If not, see . */ -#include +#include "os.h" #include "shash.h" #include "taos.h" diff --git a/src/client/src/tscSyntaxtreefunction.c b/src/client/src/tscSyntaxtreefunction.c index 00781919e4..bbd30c1fa9 100644 --- a/src/client/src/tscSyntaxtreefunction.c +++ b/src/client/src/tscSyntaxtreefunction.c @@ -13,10 +13,7 @@ * along with this program. If not, see . */ -#include -#include -#include -#include +#include "os.h" #include "tscSyntaxtreefunction.h" #include "tsql.h" diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 7ebd43cd19..708ceee405 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -13,15 +13,6 @@ * along with this program. If not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include - #include "os.h" #include "taosmsg.h" #include "tcache.h" diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index ec5c980612..5793656477 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -13,10 +13,6 @@ * along with this program. If not, see . */ -#include -#include -#include - #include "os.h" #include "ihash.h" #include "taosmsg.h" diff --git a/src/inc/ttimer.h b/src/inc/ttimer.h index ddfd3f1fdf..5424881e26 100644 --- a/src/inc/ttimer.h +++ b/src/inc/ttimer.h @@ -41,7 +41,7 @@ extern int taosTmrThreads; tprintf("TMR ", tmrDebugFlag, __VA_ARGS__); \ } } while(0) -#define MAX_NUM_OF_TMRCTL 32 +#define MAX_NUM_OF_TMRCTL 512 #define MSECONDS_PER_TICK 5 void *taosTmrInit(int maxTmr, int resoultion, int longest, const char *label); diff --git a/src/os/linux/inc/os.h b/src/os/linux/inc/os.h index 78065e6df0..ee65965a5b 100644 --- a/src/os/linux/inc/os.h +++ b/src/os/linux/inc/os.h @@ -1,17 +1,17 @@ /* -* Copyright (c) 2019 TAOS Data, Inc. -* -* This program is free software: you can use, redistribute, and/or modify -* it under the terms of the GNU Affero General Public License, version 3 -* or later ("AGPL"), as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but WITHOUT -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -* FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU Affero General Public License -* along with this program. If not, see . -*/ + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ #ifndef TDENGINE_PLATFORM_LINUX_H #define TDENGINE_PLATFORM_LINUX_H @@ -25,10 +25,12 @@ extern "C" { #include #include +#include #include #include #include #include +#include #include #include #include @@ -37,7 +39,8 @@ extern "C" { #include #include #include -#include +#include +#include #include #include #include @@ -45,21 +48,19 @@ extern "C" { #include #include #include +#include #include #include #include #include #include #include -#include #include #include #include #include #include #include -#include -#include #define taosCloseSocket(x) \ { \ @@ -110,7 +111,7 @@ extern "C" { #define __sync_sub_and_fetch_ptr __sync_sub_and_fetch int32_t __sync_val_load_32(int32_t *ptr); -void __sync_val_restore_32(int32_t *ptr, int32_t newval); +void __sync_val_restore_32(int32_t *ptr, int32_t newval); #define SWAP(a, b, c) \ do { \ @@ -168,9 +169,9 @@ bool taosSkipSocketCheck(); int64_t str2int64(char *str); #define BUILDIN_CLZL(val) __builtin_clzl(val) -#define BUILDIN_CLZ(val) __builtin_clz(val) +#define BUILDIN_CLZ(val) __builtin_clz(val) #define BUILDIN_CTZL(val) __builtin_ctzl(val) -#define BUILDIN_CTZ(val) __builtin_ctz(val) +#define BUILDIN_CTZ(val) __builtin_ctz(val) #ifdef __cplusplus } diff --git a/src/system/detail/src/mgmtMeter.c b/src/system/detail/src/mgmtMeter.c index bccf9a06c8..2692e39131 100644 --- a/src/system/detail/src/mgmtMeter.c +++ b/src/system/detail/src/mgmtMeter.c @@ -833,6 +833,7 @@ static void removeMeterFromMetricIndex(STabObj *pMetric, STabObj *pMeter) { } } + tSkipListDestroyKey(&key); if (num != 0) { free(pRes); } diff --git a/src/system/detail/src/vnodeQueryImpl.c b/src/system/detail/src/vnodeQueryImpl.c index 187269d30b..9c0d7883a5 100644 --- a/src/system/detail/src/vnodeQueryImpl.c +++ b/src/system/detail/src/vnodeQueryImpl.c @@ -3436,9 +3436,18 @@ void pointInterpSupporterSetData(SQInfo *pQInfo, SPointInterpoSupporter *pPointI if (pQuery->interpoType == TSDB_INTERPO_SET_VALUE) { for (int32_t i = 0; i < pQuery->numOfOutputCols; ++i) { SQLFunctionCtx *pCtx = &pRuntimeEnv->pCtx[i]; + + // only the function of interp needs the corresponding information + if (pCtx->functionId != TSDB_FUNC_INTERP) { + continue; + } + + pCtx->numOfParams = 4; + SInterpInfo * pInterpInfo = (SInterpInfo *)pRuntimeEnv->pCtx[i].aOutputBuf; pInterpInfo->pInterpDetail = calloc(1, sizeof(SInterpInfoDetail)); + SInterpInfoDetail *pInterpDetail = pInterpInfo->pInterpDetail; // for primary timestamp column, set the flag diff --git a/src/system/detail/src/vnodeShell.c b/src/system/detail/src/vnodeShell.c index 190c1d6ee6..353b2668ee 100644 --- a/src/system/detail/src/vnodeShell.c +++ b/src/system/detail/src/vnodeShell.c @@ -419,7 +419,7 @@ void vnodeExecuteRetrieveReq(SSchedMsg *pSched) { if (code == TSDB_CODE_SUCCESS) { pRsp->offset = htobe64(vnodeGetOffsetVal(pRetrieve->qhandle)); - pRsp->useconds = ((SQInfo *)(pRetrieve->qhandle))->useconds; + pRsp->useconds = htobe64(((SQInfo *)(pRetrieve->qhandle))->useconds); } else { pRsp->offset = 0; pRsp->useconds = 0;