Merge pull request #17326 from taosdata/refact/code_format
refact: code format
This commit is contained in:
commit
3950c8fc24
|
@ -47,14 +47,14 @@ extern "C" {
|
|||
#define TSDB_INS_TABLE_TOPICS "ins_topics"
|
||||
#define TSDB_INS_TABLE_STREAMS "ins_streams"
|
||||
|
||||
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
||||
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
|
||||
#define TSDB_PERFS_TABLE_CONNECTIONS "perf_connections"
|
||||
#define TSDB_PERFS_TABLE_QUERIES "perf_queries"
|
||||
#define TSDB_PERFS_TABLE_CONSUMERS "perf_consumers"
|
||||
#define TSDB_PERFS_TABLE_OFFSETS "perf_offsets"
|
||||
#define TSDB_PERFS_TABLE_TRANS "perf_trans"
|
||||
#define TSDB_PERFS_TABLE_APPS "perf_apps"
|
||||
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
||||
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
|
||||
#define TSDB_PERFS_TABLE_CONNECTIONS "perf_connections"
|
||||
#define TSDB_PERFS_TABLE_QUERIES "perf_queries"
|
||||
#define TSDB_PERFS_TABLE_CONSUMERS "perf_consumers"
|
||||
#define TSDB_PERFS_TABLE_OFFSETS "perf_offsets"
|
||||
#define TSDB_PERFS_TABLE_TRANS "perf_trans"
|
||||
#define TSDB_PERFS_TABLE_APPS "perf_apps"
|
||||
|
||||
typedef struct SSysDbTableSchema {
|
||||
const char* name;
|
||||
|
|
|
@ -47,22 +47,23 @@ typedef enum {
|
|||
int32_t grantCheck(EGrantType grant);
|
||||
|
||||
#ifndef GRANTS_CFG
|
||||
#define GRANTS_SCHEMA static const SSysDbTableSchema grantsSchema[] = { \
|
||||
{.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "storage", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "databases", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "users", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "accounts", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "connections", .bytes = 11 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "streams", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "cpu_cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "speed", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
}
|
||||
#define GRANTS_SCHEMA \
|
||||
static const SSysDbTableSchema grantsSchema[] = { \
|
||||
{.name = "version", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "expired", .bytes = 5 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "storage", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "timeseries", .bytes = 21 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "databases", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "users", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "accounts", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "dnodes", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "connections", .bytes = 11 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "streams", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "cpu_cores", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "speed", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
{.name = "querytime", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, \
|
||||
}
|
||||
#define GRANT_CFG_ADD
|
||||
#define GRANT_CFG_SET
|
||||
#define GRANT_CFG_GET
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
|
||||
// sql type
|
||||
|
||||
#ifdef TSDB_SQL_C
|
||||
|
@ -103,8 +105,10 @@ enum {
|
|||
TSDB_DEFINE_SQL_TYPE( TSDB_SQL_MAX, "max" )
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_COMMON_SQLMSGTYPE_H_*/
|
||||
#endif /*_TD_COMMON_SQLMSGTYPE_H_*/
|
||||
|
|
|
@ -49,7 +49,7 @@ bool tNameIsValid(const SName* name);
|
|||
|
||||
const char* tNameGetTableName(const SName* name);
|
||||
|
||||
int32_t tNameGetDbName(const SName* name, char* dst);
|
||||
int32_t tNameGetDbName(const SName* name, char* dst);
|
||||
const char* tNameGetDbNameP(const SName* name);
|
||||
|
||||
int32_t tNameGetFullDbName(const SName* name, char* dst);
|
||||
|
|
|
@ -285,11 +285,11 @@ static FORCE_INLINE void tdSRowInit(SRowBuilder *pBuilder, int16_t sver) {
|
|||
pBuilder->rowType = TD_ROW_TP; // default STpRow
|
||||
pBuilder->sver = sver;
|
||||
}
|
||||
int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, int32_t flen);
|
||||
int32_t tdSRowSetTpInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t flen);
|
||||
int32_t tdSRowSetExtendedInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, int32_t flen,
|
||||
int32_t allNullLen, int32_t boundNullLen);
|
||||
int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf);
|
||||
int32_t tdSRowSetInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, int32_t flen);
|
||||
int32_t tdSRowSetTpInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t flen);
|
||||
int32_t tdSRowSetExtendedInfo(SRowBuilder *pBuilder, int32_t nCols, int32_t nBoundCols, int32_t flen,
|
||||
int32_t allNullLen, int32_t boundNullLen);
|
||||
int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf);
|
||||
static FORCE_INLINE void tdSRowEnd(SRowBuilder *pBuilder) {
|
||||
STSRow *pRow = (STSRow *)pBuilder->pBuf;
|
||||
if (pBuilder->hasNull || pBuilder->hasNone) {
|
||||
|
|
|
@ -59,11 +59,11 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) {
|
|||
* precision == TSDB_TIME_PRECISION_NANO, it returns timestamp in nanosecond.
|
||||
*/
|
||||
static FORCE_INLINE int64_t taosGetTimestampToday(int32_t precision) {
|
||||
int64_t factor = (precision == TSDB_TIME_PRECISION_MILLI) ? 1000
|
||||
: (precision == TSDB_TIME_PRECISION_MICRO) ? 1000000
|
||||
: 1000000000;
|
||||
time_t t = taosTime(NULL);
|
||||
struct tm tm;
|
||||
int64_t factor = (precision == TSDB_TIME_PRECISION_MILLI) ? 1000
|
||||
: (precision == TSDB_TIME_PRECISION_MICRO) ? 1000000
|
||||
: 1000000000;
|
||||
time_t t = taosTime(NULL);
|
||||
struct tm tm;
|
||||
taosLocalTime(&t, &tm);
|
||||
tm.tm_hour = 0;
|
||||
tm.tm_min = 0;
|
||||
|
|
|
@ -144,4 +144,4 @@ bool tsBufIsValidElem(STSElem* pElem);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_COMMON_TTSZIP_H_*/
|
||||
#endif /*_TD_COMMON_TTSZIP_H_*/
|
||||
|
|
|
@ -115,7 +115,7 @@ typedef struct SSTableVersion {
|
|||
uint64_t dbId;
|
||||
uint64_t suid;
|
||||
int16_t sversion;
|
||||
int16_t tversion;
|
||||
int16_t tversion;
|
||||
int32_t smaVer;
|
||||
} SSTableVersion;
|
||||
|
||||
|
@ -182,7 +182,8 @@ int32_t catalogRemoveStbMeta(SCatalog* pCtg, const char* dbFName, uint64_t dbId,
|
|||
* @param pTableMeta(output, table meta data, NEED to free it by calller)
|
||||
* @return error code
|
||||
*/
|
||||
int32_t catalogGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta);
|
||||
int32_t catalogGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName,
|
||||
STableMeta** pTableMeta);
|
||||
|
||||
/**
|
||||
* Get a super table's meta data.
|
||||
|
@ -193,9 +194,10 @@ int32_t catalogGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const S
|
|||
* @param pTableMeta(output, table meta data, NEED to free it by calller)
|
||||
* @return error code
|
||||
*/
|
||||
int32_t catalogGetSTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta);
|
||||
int32_t catalogGetSTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName,
|
||||
STableMeta** pTableMeta);
|
||||
|
||||
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp *rspMsg);
|
||||
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
|
||||
|
||||
int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
|
||||
|
||||
|
@ -232,7 +234,8 @@ int32_t catalogRefreshTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, con
|
|||
* @param isSTable (input, is super table or not, 1:supposed to be stable, 0: supposed not to be stable, -1:not sure)
|
||||
* @return error code
|
||||
*/
|
||||
int32_t catalogRefreshGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName, STableMeta** pTableMeta, int32_t isSTable);
|
||||
int32_t catalogRefreshGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName,
|
||||
STableMeta** pTableMeta, int32_t isSTable);
|
||||
|
||||
/**
|
||||
* Get a table's actual vgroup, for stable it's all possible vgroup list.
|
||||
|
@ -243,7 +246,8 @@ int32_t catalogRefreshGetTableMeta(SCatalog* pCatalog, SRequestConnInfo* pConn,
|
|||
* @param pVgroupList (output, vgroup info list, element is SVgroupInfo, NEED to simply free the array by caller)
|
||||
* @return error code
|
||||
*/
|
||||
int32_t catalogGetTableDistVgInfo(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName, SArray** pVgroupList);
|
||||
int32_t catalogGetTableDistVgInfo(SCatalog* pCatalog, SRequestConnInfo* pConn, const SName* pTableName,
|
||||
SArray** pVgroupList);
|
||||
|
||||
/**
|
||||
* Get a table's vgroup from its name's hash value.
|
||||
|
@ -267,13 +271,14 @@ int32_t catalogGetTableHashVgroup(SCatalog* pCatalog, SRequestConnInfo* pConn, c
|
|||
*/
|
||||
int32_t catalogGetAllMeta(SCatalog* pCatalog, SRequestConnInfo* pConn, const SCatalogReq* pReq, SMetaData* pRsp);
|
||||
|
||||
int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SCatalogReq* pReq, catalogCallback fp, void* param, int64_t* jobId);
|
||||
int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const SCatalogReq* pReq, catalogCallback fp,
|
||||
void* param, int64_t* jobId);
|
||||
|
||||
int32_t catalogGetQnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray* pQnodeList);
|
||||
|
||||
int32_t catalogGetDnodeList(SCatalog* pCatalog, SRequestConnInfo* pConn, SArray** pDnodeList);
|
||||
|
||||
int32_t catalogGetExpiredSTables(SCatalog* pCatalog, SSTableVersion **stables, uint32_t *num);
|
||||
int32_t catalogGetExpiredSTables(SCatalog* pCatalog, SSTableVersion** stables, uint32_t* num);
|
||||
|
||||
int32_t catalogGetExpiredDBs(SCatalog* pCatalog, SDbVgVersion** dbs, uint32_t* num);
|
||||
|
||||
|
@ -285,19 +290,20 @@ int32_t catalogGetIndexMeta(SCatalog* pCtg, SRequestConnInfo* pConn, const char*
|
|||
|
||||
int32_t catalogGetTableIndex(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, SArray** pRes);
|
||||
|
||||
int32_t catalogRefreshGetTableCfg(SCatalog* pCtg, SRequestConnInfo *pConn, const SName* pTableName, STableCfg** pCfg);
|
||||
int32_t catalogRefreshGetTableCfg(SCatalog* pCtg, SRequestConnInfo* pConn, const SName* pTableName, STableCfg** pCfg);
|
||||
|
||||
int32_t catalogUpdateTableIndex(SCatalog* pCtg, STableIndexRsp *pRsp);
|
||||
int32_t catalogUpdateTableIndex(SCatalog* pCtg, STableIndexRsp* pRsp);
|
||||
|
||||
int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* funcName, SFuncInfo* pInfo);
|
||||
|
||||
int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type, bool *pass);
|
||||
int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type,
|
||||
bool* pass);
|
||||
|
||||
int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);
|
||||
|
||||
int32_t catalogUpdateVgEpSet(SCatalog* pCtg, const char* dbFName, int32_t vgId, SEpSet *epSet);
|
||||
int32_t catalogUpdateVgEpSet(SCatalog* pCtg, const char* dbFName, int32_t vgId, SEpSet* epSet);
|
||||
|
||||
int32_t catalogGetServerVersion(SCatalog* pCtg, SRequestConnInfo *pConn, char** pVersion);
|
||||
int32_t catalogGetServerVersion(SCatalog* pCtg, SRequestConnInfo* pConn, char** pVersion);
|
||||
|
||||
int32_t ctgdLaunchAsyncCall(SCatalog* pCtg, SRequestConnInfo* pConn, uint64_t reqId, bool forceUpdate);
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
#include "thash.h"
|
||||
#include "executor.h"
|
||||
#include "os.h"
|
||||
#include "plannodes.h"
|
||||
#include "thash.h"
|
||||
|
||||
#define DS_BUF_LOW 1
|
||||
#define DS_BUF_FULL 2
|
||||
|
@ -56,11 +56,11 @@ typedef struct SDataSinkStat {
|
|||
} SDataSinkStat;
|
||||
|
||||
typedef struct SDataSinkMgtCfg {
|
||||
uint32_t maxDataBlockNum; // todo: this should be numOfRows?
|
||||
uint32_t maxDataBlockNum; // todo: this should be numOfRows?
|
||||
uint32_t maxDataBlockNumPerQuery;
|
||||
} SDataSinkMgtCfg;
|
||||
|
||||
int32_t dsDataSinkMgtInit(SDataSinkMgtCfg *cfg);
|
||||
int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg);
|
||||
|
||||
typedef struct SInputData {
|
||||
const struct SSDataBlock* pData;
|
||||
|
@ -79,14 +79,14 @@ typedef struct SOutputData {
|
|||
} SOutputData;
|
||||
|
||||
/**
|
||||
* Create a subplan's datasinker handle for all later operations.
|
||||
* Create a subplan's datasinker handle for all later operations.
|
||||
* @param pDataSink
|
||||
* @param pHandle output
|
||||
* @return error code
|
||||
*/
|
||||
int32_t dsCreateDataSinker(const SDataSinkNode* pDataSink, DataSinkHandle* pHandle, void* pParam);
|
||||
|
||||
int32_t dsDataSinkGetCacheSize(SDataSinkStat *pStat);
|
||||
int32_t dsDataSinkGetCacheSize(SDataSinkStat* pStat);
|
||||
|
||||
/**
|
||||
* Put the result set returned by the executor into datasinker.
|
||||
|
@ -114,7 +114,7 @@ void dsGetDataLength(DataSinkHandle handle, int64_t* pLen, bool* pQueryEnd);
|
|||
*/
|
||||
int32_t dsGetDataBlock(DataSinkHandle handle, SOutputData* pOutput);
|
||||
|
||||
int32_t dsGetCacheSize(DataSinkHandle handle, uint64_t *pSize);
|
||||
int32_t dsGetCacheSize(DataSinkHandle handle, uint64_t* pSize);
|
||||
|
||||
/**
|
||||
* After dsGetStatus returns DS_NEED_SCHEDULE, the caller need to put this into the work queue.
|
||||
|
|
|
@ -176,9 +176,9 @@ struct SScalarParam {
|
|||
SColumnInfoData *columnData;
|
||||
SHashObj *pHashFilter;
|
||||
int32_t hashValueType;
|
||||
void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value
|
||||
void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value
|
||||
int32_t numOfRows;
|
||||
int32_t numOfQualified; // number of qualified elements in the final results
|
||||
int32_t numOfQualified; // number of qualified elements in the final results
|
||||
};
|
||||
|
||||
void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell);
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TDENGINE_TAOSUDF_H
|
||||
#define TDENGINE_TAOSUDF_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -52,16 +52,15 @@ typedef struct SUdfColumnData {
|
|||
} fixLenCol;
|
||||
|
||||
struct {
|
||||
int32_t varOffsetsLen;
|
||||
int32_t *varOffsets;
|
||||
int32_t payloadLen;
|
||||
char *payload;
|
||||
int32_t payloadAllocLen;
|
||||
int32_t varOffsetsLen;
|
||||
int32_t *varOffsets;
|
||||
int32_t payloadLen;
|
||||
char *payload;
|
||||
int32_t payloadAllocLen;
|
||||
} varLenCol;
|
||||
};
|
||||
} SUdfColumnData;
|
||||
|
||||
|
||||
typedef struct SUdfColumn {
|
||||
SUdfColumnMeta colMeta;
|
||||
bool hasNull;
|
||||
|
@ -69,15 +68,15 @@ typedef struct SUdfColumn {
|
|||
} SUdfColumn;
|
||||
|
||||
typedef struct SUdfDataBlock {
|
||||
int32_t numOfRows;
|
||||
int32_t numOfCols;
|
||||
int32_t numOfRows;
|
||||
int32_t numOfCols;
|
||||
SUdfColumn **udfCols;
|
||||
} SUdfDataBlock;
|
||||
|
||||
typedef struct SUdfInterBuf {
|
||||
int32_t bufLen;
|
||||
char* buf;
|
||||
int8_t numOfResult; //zero or one
|
||||
char *buf;
|
||||
int8_t numOfResult; // zero or one
|
||||
} SUdfInterBuf;
|
||||
typedef void *UdfcFuncHandle;
|
||||
|
||||
|
@ -86,28 +85,29 @@ typedef int32_t (*TUdfInitFunc)();
|
|||
typedef int32_t (*TUdfDestroyFunc)();
|
||||
|
||||
#define UDF_MEMORY_EXP_GROWTH 1.5
|
||||
#define NBIT (3u)
|
||||
#define BitPos(_n) ((_n) & ((1 << NBIT) - 1))
|
||||
#define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT])
|
||||
#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT)
|
||||
#define NBIT (3u)
|
||||
#define BitPos(_n) ((_n) & ((1 << NBIT) - 1))
|
||||
#define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT])
|
||||
#define BitmapLen(_n) (((_n) + ((1 << NBIT) - 1)) >> NBIT)
|
||||
|
||||
#define udfColDataIsNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] == -1)
|
||||
#define udfColDataIsNull_f(pColumn, row) ((BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row))))
|
||||
#define udfColDataIsNull_f(pColumn, row) \
|
||||
((BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) & (1u << (7u - BitPos(row)))) == (1u << (7u - BitPos(row))))
|
||||
#define udfColDataSetNull_f(pColumn, row) \
|
||||
do { \
|
||||
BMCharPos(pColumn->colData.fixLenCol.nullBitmap, row) |= (1u << (7u - BitPos(row))); \
|
||||
} while (0)
|
||||
|
||||
#define udfColDataSetNotNull_f(pColumn, r_) \
|
||||
do { \
|
||||
BMCharPos(pColumn->colData.fixLenCol.nullBitmap, r_) &= ~(1u << (7u - BitPos(r_))); \
|
||||
#define udfColDataSetNotNull_f(pColumn, r_) \
|
||||
do { \
|
||||
BMCharPos(pColumn->colData.fixLenCol.nullBitmap, r_) &= ~(1u << (7u - BitPos(r_))); \
|
||||
} while (0)
|
||||
#define udfColDataSetNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] = -1)
|
||||
#define udfColDataSetNull_var(pColumn, row) ((pColumn->colData.varLenCol.varOffsets)[row] = -1)
|
||||
|
||||
typedef uint16_t VarDataLenT; // maxVarDataLen: 32767
|
||||
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
|
||||
#define varDataLen(v) ((VarDataLenT *)(v))[0]
|
||||
#define varDataVal(v) ((char *)(v) + VARSTR_HEADER_SIZE)
|
||||
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
|
||||
#define varDataLen(v) ((VarDataLenT *)(v))[0]
|
||||
#define varDataVal(v) ((char *)(v) + VARSTR_HEADER_SIZE)
|
||||
#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
|
||||
#define varDataCopy(dst, v) memcpy((dst), (void *)(v), varDataTLen(v))
|
||||
#define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE))
|
||||
|
@ -116,8 +116,7 @@ typedef uint16_t VarDataLenT; // maxVarDataLen: 32767
|
|||
(((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON))
|
||||
#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR))
|
||||
|
||||
|
||||
static FORCE_INLINE char* udfColDataGetData(const SUdfColumn* pColumn, int32_t row) {
|
||||
static FORCE_INLINE char *udfColDataGetData(const SUdfColumn *pColumn, int32_t row) {
|
||||
if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) {
|
||||
return pColumn->colData.varLenCol.payload + pColumn->colData.varLenCol.varOffsets[row];
|
||||
} else {
|
||||
|
@ -125,13 +124,13 @@ static FORCE_INLINE char* udfColDataGetData(const SUdfColumn* pColumn, int32_t r
|
|||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE bool udfColDataIsNull(const SUdfColumn* pColumn, int32_t row) {
|
||||
static FORCE_INLINE bool udfColDataIsNull(const SUdfColumn *pColumn, int32_t row) {
|
||||
if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) {
|
||||
if (pColumn->colMeta.type == TSDB_DATA_TYPE_JSON) {
|
||||
if (udfColDataIsNull_var(pColumn, row)) {
|
||||
return true;
|
||||
}
|
||||
char* data = udfColDataGetData(pColumn, row);
|
||||
char *data = udfColDataGetData(pColumn, row);
|
||||
return (*data == TSDB_DATA_TYPE_NULL);
|
||||
} else {
|
||||
return udfColDataIsNull_var(pColumn, row);
|
||||
|
@ -141,29 +140,29 @@ static FORCE_INLINE bool udfColDataIsNull(const SUdfColumn* pColumn, int32_t row
|
|||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t newCapacity) {
|
||||
static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn *pColumn, int32_t newCapacity) {
|
||||
SUdfColumnMeta *meta = &pColumn->colMeta;
|
||||
SUdfColumnData *data = &pColumn->colData;
|
||||
|
||||
if (newCapacity== 0 || newCapacity <= data->rowsAlloc) {
|
||||
if (newCapacity == 0 || newCapacity <= data->rowsAlloc) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int allocCapacity = (data->rowsAlloc< 8) ? 8 : data->rowsAlloc;
|
||||
int allocCapacity = (data->rowsAlloc < 8) ? 8 : data->rowsAlloc;
|
||||
while (allocCapacity < newCapacity) {
|
||||
allocCapacity *= UDF_MEMORY_EXP_GROWTH;
|
||||
}
|
||||
|
||||
if (IS_VAR_DATA_TYPE(meta->type)) {
|
||||
char* tmp = (char*)realloc(data->varLenCol.varOffsets, sizeof(int32_t) * allocCapacity);
|
||||
char *tmp = (char *)realloc(data->varLenCol.varOffsets, sizeof(int32_t) * allocCapacity);
|
||||
if (tmp == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
data->varLenCol.varOffsets = (int32_t*)tmp;
|
||||
data->varLenCol.varOffsets = (int32_t *)tmp;
|
||||
data->varLenCol.varOffsetsLen = sizeof(int32_t) * allocCapacity;
|
||||
// for payload, add data in udfColDataAppend
|
||||
} else {
|
||||
char* tmp = (char*)realloc(data->fixLenCol.nullBitmap, BitmapLen(allocCapacity));
|
||||
char *tmp = (char *)realloc(data->fixLenCol.nullBitmap, BitmapLen(allocCapacity));
|
||||
if (tmp == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -173,13 +172,13 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t ne
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
tmp = (char*)realloc(data->fixLenCol.data, allocCapacity* meta->bytes);
|
||||
tmp = (char *)realloc(data->fixLenCol.data, allocCapacity * meta->bytes);
|
||||
if (tmp == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
data->fixLenCol.data = tmp;
|
||||
data->fixLenCol.dataLen = allocCapacity* meta->bytes;
|
||||
data->fixLenCol.dataLen = allocCapacity * meta->bytes;
|
||||
}
|
||||
|
||||
data->rowsAlloc = allocCapacity;
|
||||
|
@ -187,8 +186,8 @@ static FORCE_INLINE int32_t udfColEnsureCapacity(SUdfColumn* pColumn, int32_t ne
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
static FORCE_INLINE void udfColDataSetNull(SUdfColumn* pColumn, int32_t row) {
|
||||
udfColEnsureCapacity(pColumn, row+1);
|
||||
static FORCE_INLINE void udfColDataSetNull(SUdfColumn *pColumn, int32_t row) {
|
||||
udfColEnsureCapacity(pColumn, row + 1);
|
||||
if (IS_VAR_DATA_TYPE(pColumn->colMeta.type)) {
|
||||
udfColDataSetNull_var(pColumn, row);
|
||||
} else {
|
||||
|
@ -197,10 +196,10 @@ static FORCE_INLINE void udfColDataSetNull(SUdfColumn* pColumn, int32_t row) {
|
|||
pColumn->hasNull = true;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentRow, const char* pData, bool isNull) {
|
||||
static FORCE_INLINE int32_t udfColDataSet(SUdfColumn *pColumn, uint32_t currentRow, const char *pData, bool isNull) {
|
||||
SUdfColumnMeta *meta = &pColumn->colMeta;
|
||||
SUdfColumnData *data = &pColumn->colData;
|
||||
udfColEnsureCapacity(pColumn, currentRow+1);
|
||||
udfColEnsureCapacity(pColumn, currentRow + 1);
|
||||
bool isVarCol = IS_VAR_DATA_TYPE(meta->type);
|
||||
if (isNull) {
|
||||
udfColDataSetNull(pColumn, currentRow);
|
||||
|
@ -233,7 +232,7 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentR
|
|||
newSize = newSize * UDF_MEMORY_EXP_GROWTH;
|
||||
}
|
||||
|
||||
char *buf = (char*)realloc(data->varLenCol.payload, newSize);
|
||||
char *buf = (char *)realloc(data->varLenCol.payload, newSize);
|
||||
if (buf == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -249,11 +248,11 @@ static FORCE_INLINE int32_t udfColDataSet(SUdfColumn* pColumn, uint32_t currentR
|
|||
data->varLenCol.payloadLen += dataLen;
|
||||
}
|
||||
}
|
||||
data->numOfRows = (currentRow + 1 > data->numOfRows) ? (currentRow+1) : data->numOfRows;
|
||||
data->numOfRows = (currentRow + 1 > data->numOfRows) ? (currentRow + 1) : data->numOfRows;
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef int32_t (*TUdfScalarProcFunc)(SUdfDataBlock* block, SUdfColumn *resultCol);
|
||||
typedef int32_t (*TUdfScalarProcFunc)(SUdfDataBlock *block, SUdfColumn *resultCol);
|
||||
|
||||
typedef int32_t (*TUdfAggStartFunc)(SUdfInterBuf *buf);
|
||||
typedef int32_t (*TUdfAggProcessFunc)(SUdfDataBlock *block, SUdfInterBuf *interBuf, SUdfInterBuf *newInterBuf);
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
#define alloc alloc
|
||||
#include <taosudf.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "tmsg.h"
|
||||
#include "tcommon.h"
|
||||
#include <stdint.h>
|
||||
#include "function.h"
|
||||
#include "tcommon.h"
|
||||
#include "tdatablock.h"
|
||||
#include "tmsg.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -43,8 +43,7 @@ extern "C" {
|
|||
#endif
|
||||
#define UDF_DNODE_ID_ENV_NAME "DNODE_ID"
|
||||
|
||||
|
||||
//low level APIs
|
||||
// low level APIs
|
||||
/**
|
||||
* setup udf
|
||||
* @param udf, in
|
||||
|
@ -62,7 +61,8 @@ int32_t doCallUdfAggProcess(UdfcFuncHandle handle, SSDataBlock *block, SUdfInter
|
|||
int32_t doCallUdfAggFinalize(UdfcFuncHandle handle, SUdfInterBuf *interBuf, SUdfInterBuf *resultData);
|
||||
// input: interbuf1, interbuf2
|
||||
// output: resultBuf
|
||||
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2, SUdfInterBuf *resultBuf);
|
||||
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2,
|
||||
SUdfInterBuf *resultBuf);
|
||||
// input: block
|
||||
// output: resultData
|
||||
int32_t doCallUdfScalarFunc(UdfcFuncHandle handle, SScalarParam *input, int32_t numOfCols, SScalarParam *output);
|
||||
|
@ -75,11 +75,11 @@ int32_t doTeardownUdf(UdfcFuncHandle handle);
|
|||
|
||||
void freeUdfInterBuf(SUdfInterBuf *buf);
|
||||
|
||||
//high level APIs
|
||||
bool udfAggGetEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
|
||||
bool udfAggInit(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo* pResultCellInfo);
|
||||
// high level APIs
|
||||
bool udfAggGetEnv(struct SFunctionNode *pFunc, SFuncExecEnv *pEnv);
|
||||
bool udfAggInit(struct SqlFunctionCtx *pCtx, struct SResultRowEntryInfo *pResultCellInfo);
|
||||
int32_t udfAggProcess(struct SqlFunctionCtx *pCtx);
|
||||
int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock* pBlock);
|
||||
int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock);
|
||||
|
||||
int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols, SScalarParam *output);
|
||||
|
||||
|
|
|
@ -227,7 +227,6 @@ int32_t tDeserializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInf
|
|||
int32_t tSerializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo);
|
||||
int32_t tDeserializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo);
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *server;
|
||||
uint16_t port;
|
||||
|
|
|
@ -61,7 +61,6 @@ typedef struct STableComInfo {
|
|||
int32_t rowSize; // row size of the schema
|
||||
} STableComInfo;
|
||||
|
||||
|
||||
typedef struct SIndexMeta {
|
||||
#if defined(WINDOWS) || defined(_TD_DARWIN_64)
|
||||
size_t avoidCompilationErrors;
|
||||
|
@ -70,11 +69,11 @@ typedef struct SIndexMeta {
|
|||
} SIndexMeta;
|
||||
|
||||
typedef struct SExecResult {
|
||||
int32_t code;
|
||||
uint64_t numOfRows;
|
||||
uint64_t numOfBytes;
|
||||
int32_t msgType;
|
||||
void* res;
|
||||
int32_t code;
|
||||
uint64_t numOfRows;
|
||||
uint64_t numOfBytes;
|
||||
int32_t msgType;
|
||||
void* res;
|
||||
} SExecResult;
|
||||
|
||||
typedef struct STbVerInfo {
|
||||
|
@ -166,7 +165,7 @@ typedef struct SRequestConnInfo {
|
|||
SEpSet mgmtEps;
|
||||
} SRequestConnInfo;
|
||||
|
||||
typedef void (*__freeFunc)(void *param);
|
||||
typedef void (*__freeFunc)(void* param);
|
||||
|
||||
typedef struct SMsgSendInfo {
|
||||
__async_send_cb_fn_t fp; // async callback function
|
||||
|
@ -218,7 +217,7 @@ void initQueryModuleMsgHandle();
|
|||
const SSchema* tGetTbnameColumnSchema();
|
||||
bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags);
|
||||
|
||||
int32_t queryCreateCTableMetaFromMsg(STableMetaRsp *msg, SCTableMeta *pMeta);
|
||||
int32_t queryCreateCTableMetaFromMsg(STableMetaRsp* msg, SCTableMeta* pMeta);
|
||||
int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta);
|
||||
char* jobTaskStatusStr(int32_t status);
|
||||
|
||||
|
@ -250,64 +249,66 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
|
|||
#define NEED_CLIENT_HANDLE_ERROR(_code) \
|
||||
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
|
||||
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
|
||||
#define NEED_REDIRECT_ERROR(_code) \
|
||||
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \
|
||||
(_code) == TSDB_CODE_NODE_NOT_DEPLOYED || (_code) == TSDB_CODE_SYN_NOT_LEADER || \
|
||||
#define NEED_REDIRECT_ERROR(_code) \
|
||||
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \
|
||||
(_code) == TSDB_CODE_NODE_NOT_DEPLOYED || (_code) == TSDB_CODE_SYN_NOT_LEADER || \
|
||||
(_code) == TSDB_CODE_APP_NOT_READY || (_code) == TSDB_CODE_RPC_BROKEN_LINK)
|
||||
|
||||
|
||||
#define NEED_CLIENT_RM_TBLMETA_REQ(_type) \
|
||||
((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_MND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \
|
||||
(_type) == TDMT_MND_DROP_STB)
|
||||
|
||||
#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \
|
||||
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || \
|
||||
#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \
|
||||
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || \
|
||||
(_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_APP_NOT_READY)
|
||||
|
||||
#define REQUEST_TOTAL_EXEC_TIMES 2
|
||||
|
||||
#define IS_SYS_DBNAME(_dbname) (((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) || ((*(_dbname) == 'p') && (0 == strcmp(_dbname, TSDB_PERFORMANCE_SCHEMA_DB))))
|
||||
#define IS_SYS_DBNAME(_dbname) \
|
||||
(((*(_dbname) == 'i') && (0 == strcmp(_dbname, TSDB_INFORMATION_SCHEMA_DB))) || \
|
||||
((*(_dbname) == 'p') && (0 == strcmp(_dbname, TSDB_PERFORMANCE_SCHEMA_DB))))
|
||||
|
||||
#define qFatal(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_FATAL) { \
|
||||
#define qFatal(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_FATAL) { \
|
||||
taosPrintLog("QRY FATAL ", DEBUG_FATAL, qDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#define qError(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_ERROR) { \
|
||||
#define qError(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_ERROR) { \
|
||||
taosPrintLog("QRY ERROR ", DEBUG_ERROR, qDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#define qWarn(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_WARN) { \
|
||||
#define qWarn(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_WARN) { \
|
||||
taosPrintLog("QRY WARN ", DEBUG_WARN, qDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#define qInfo(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_INFO) { \
|
||||
#define qInfo(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_INFO) { \
|
||||
taosPrintLog("QRY ", DEBUG_INFO, qDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#define qDebug(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_DEBUG) { \
|
||||
#define qDebug(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_DEBUG) { \
|
||||
taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#define qTrace(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_TRACE) { \
|
||||
#define qTrace(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_TRACE) { \
|
||||
taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#define qDebugL(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_DEBUG) { \
|
||||
#define qDebugL(...) \
|
||||
do { \
|
||||
if (qDebugFlag & DEBUG_DEBUG) { \
|
||||
taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define QRY_ERR_RET(c) \
|
||||
|
|
|
@ -72,7 +72,6 @@ typedef struct SQWMsg {
|
|||
SRpcHandleInfo connInfo;
|
||||
} SQWMsg;
|
||||
|
||||
|
||||
int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const SMsgCb *pMsgCb);
|
||||
|
||||
int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg);
|
||||
|
@ -95,13 +94,15 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_
|
|||
|
||||
int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SDeleteRes *pRes);
|
||||
|
||||
void qWorkerDestroy(void **qWorkerMgmt);
|
||||
void qWorkerDestroy(void **qWorkerMgmt);
|
||||
|
||||
int32_t qWorkerGetStat(SReadHandle *handle, void *qWorkerMgmt, SQWorkerStat *pStat);
|
||||
|
||||
int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, SQWMsg *qwMsg, SArray *explainRes);
|
||||
int32_t qWorkerProcessLocalQuery(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId,
|
||||
SQWMsg *qwMsg, SArray *explainRes);
|
||||
|
||||
int32_t qWorkerProcessLocalFetch(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId, void** pRsp, SArray* explainRes);
|
||||
int32_t qWorkerProcessLocalFetch(void *pMgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId,
|
||||
void **pRsp, SArray *explainRes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ enum {
|
|||
FLT_OPTION_NEED_UNIQE = 4,
|
||||
};
|
||||
|
||||
#define FILTER_RESULT_ALL_QUALIFIED 0x1
|
||||
#define FILTER_RESULT_NONE_QUALIFIED 0x2
|
||||
#define FILTER_RESULT_PARTIAL_QUALIFIED 0x3
|
||||
#define FILTER_RESULT_ALL_QUALIFIED 0x1
|
||||
#define FILTER_RESULT_NONE_QUALIFIED 0x2
|
||||
#define FILTER_RESULT_PARTIAL_QUALIFIED 0x3
|
||||
|
||||
typedef struct SFilterColumnParam {
|
||||
int32_t numOfCols;
|
||||
|
@ -41,7 +41,8 @@ typedef struct SFilterColumnParam {
|
|||
} SFilterColumnParam;
|
||||
|
||||
extern int32_t filterInitFromNode(SNode *pNode, SFilterInfo **pinfo, uint32_t options);
|
||||
extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData** p, SColumnDataAgg *statis, int16_t numOfCols, int32_t* pFilterResStatus);
|
||||
extern bool filterExecute(SFilterInfo *info, SSDataBlock *pSrc, SColumnInfoData **p, SColumnDataAgg *statis,
|
||||
int16_t numOfCols, int32_t *pFilterResStatus);
|
||||
extern int32_t filterSetDataFromSlotId(SFilterInfo *info, void *param);
|
||||
extern int32_t filterSetDataFromColId(SFilterInfo *info, void *param);
|
||||
extern int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict);
|
||||
|
|
|
@ -26,18 +26,18 @@ extern "C" {
|
|||
extern tsem_t schdRspSem;
|
||||
|
||||
typedef struct SQueryProfileSummary {
|
||||
int64_t startTs; // Object created and added into the message queue
|
||||
int64_t endTs; // the timestamp when the task is completed
|
||||
int64_t cputime; // total cpu cost, not execute elapsed time
|
||||
int64_t startTs; // Object created and added into the message queue
|
||||
int64_t endTs; // the timestamp when the task is completed
|
||||
int64_t cputime; // total cpu cost, not execute elapsed time
|
||||
|
||||
int64_t loadRemoteDataDuration; // remote io time
|
||||
int64_t loadNativeDataDuration; // native disk io time
|
||||
int64_t loadRemoteDataDuration; // remote io time
|
||||
int64_t loadNativeDataDuration; // native disk io time
|
||||
|
||||
uint64_t loadNativeData; // blocks + SMA + header files
|
||||
uint64_t loadRemoteData; // remote data acquired by exchange operator.
|
||||
uint64_t loadNativeData; // blocks + SMA + header files
|
||||
uint64_t loadRemoteData; // remote data acquired by exchange operator.
|
||||
|
||||
uint64_t waitDuration; // the time to waiting to be scheduled in queue does matter, so we need to record it
|
||||
int64_t addQTs; // the time to be added into the message queue, used to calculate the waiting duration in queue.
|
||||
uint64_t waitDuration; // the time to waiting to be scheduled in queue does matter, so we need to record it
|
||||
int64_t addQTs; // the time to be added into the message queue, used to calculate the waiting duration in queue.
|
||||
|
||||
uint64_t totalRows;
|
||||
uint64_t loadRows;
|
||||
|
@ -45,16 +45,16 @@ typedef struct SQueryProfileSummary {
|
|||
uint32_t loadBlocks;
|
||||
uint32_t loadBlockAgg;
|
||||
uint32_t skipBlocks;
|
||||
uint64_t resultSize; // generated result size in Kb.
|
||||
uint64_t resultSize; // generated result size in Kb.
|
||||
} SQueryProfileSummary;
|
||||
|
||||
typedef struct STaskInfo {
|
||||
SQueryNodeAddr addr;
|
||||
SSubQueryMsg *msg;
|
||||
SSubQueryMsg* msg;
|
||||
} STaskInfo;
|
||||
|
||||
typedef struct SSchdFetchParam {
|
||||
void **pData;
|
||||
void** pData;
|
||||
int32_t* code;
|
||||
} SSchdFetchParam;
|
||||
|
||||
|
@ -63,35 +63,34 @@ typedef void (*schedulerFetchFp)(void* pResult, void* param, int32_t code);
|
|||
typedef bool (*schedulerChkKillFp)(void* param);
|
||||
|
||||
typedef struct SSchedulerReq {
|
||||
bool syncReq;
|
||||
bool localReq;
|
||||
SRequestConnInfo *pConn;
|
||||
SArray *pNodeList;
|
||||
SQueryPlan *pDag;
|
||||
int64_t allocatorRefId;
|
||||
const char *sql;
|
||||
int64_t startTs;
|
||||
schedulerExecFp execFp;
|
||||
schedulerFetchFp fetchFp;
|
||||
void* cbParam;
|
||||
schedulerChkKillFp chkKillFp;
|
||||
void* chkKillParam;
|
||||
SExecResult* pExecRes;
|
||||
void** pFetchRes;
|
||||
bool syncReq;
|
||||
bool localReq;
|
||||
SRequestConnInfo* pConn;
|
||||
SArray* pNodeList;
|
||||
SQueryPlan* pDag;
|
||||
int64_t allocatorRefId;
|
||||
const char* sql;
|
||||
int64_t startTs;
|
||||
schedulerExecFp execFp;
|
||||
schedulerFetchFp fetchFp;
|
||||
void* cbParam;
|
||||
schedulerChkKillFp chkKillFp;
|
||||
void* chkKillParam;
|
||||
SExecResult* pExecRes;
|
||||
void** pFetchRes;
|
||||
} SSchedulerReq;
|
||||
|
||||
|
||||
int32_t schedulerInit(void);
|
||||
|
||||
int32_t schedulerExecJob(SSchedulerReq *pReq, int64_t *pJob);
|
||||
int32_t schedulerExecJob(SSchedulerReq* pReq, int64_t* pJob);
|
||||
|
||||
int32_t schedulerFetchRows(int64_t jobId, SSchedulerReq *pReq);
|
||||
int32_t schedulerFetchRows(int64_t jobId, SSchedulerReq* pReq);
|
||||
|
||||
void schedulerFetchRowsA(int64_t job, schedulerFetchFp fp, void* param);
|
||||
|
||||
int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub);
|
||||
int32_t schedulerGetTasksStatus(int64_t job, SArray* pSub);
|
||||
|
||||
void schedulerStopQueryHb(void *pTrans);
|
||||
void schedulerStopQueryHb(void* pTrans);
|
||||
|
||||
int32_t schedulerUpdatePolicy(int32_t policy);
|
||||
int32_t schedulerEnableReSchedule(bool enableResche);
|
||||
|
@ -101,7 +100,7 @@ int32_t schedulerEnableReSchedule(bool enableResche);
|
|||
* @param pJob
|
||||
* @return
|
||||
*/
|
||||
//int32_t scheduleCancelJob(void *pJob);
|
||||
// int32_t scheduleCancelJob(void *pJob);
|
||||
|
||||
/**
|
||||
* Free the query job
|
||||
|
|
|
@ -132,7 +132,7 @@ typedef struct SSyncFSM {
|
|||
void (*FpRollBackCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
|
||||
|
||||
void (*FpRestoreFinishCb)(struct SSyncFSM* pFsm);
|
||||
void (*FpReConfigCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta *cbMeta);
|
||||
void (*FpReConfigCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SReConfigCbMeta* cbMeta);
|
||||
void (*FpLeaderTransferCb)(struct SSyncFSM* pFsm, const SRpcMsg* pMsg, SFsmCbMeta cbMeta);
|
||||
|
||||
void (*FpBecomeLeaderCb)(struct SSyncFSM* pFsm);
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
#ifndef _TD_TFS_H_
|
||||
#define _TD_TFS_H_
|
||||
|
||||
#include "tdef.h"
|
||||
#include "monitor.h"
|
||||
#include "tdef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ------------------------ TYPES EXPOSED ------------------------ */
|
||||
typedef struct STfs STfs;
|
||||
typedef struct STfs STfs;
|
||||
typedef struct STfsDir STfsDir;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -26,33 +26,33 @@ extern "C" {
|
|||
#include <regex.h>
|
||||
|
||||
#if !defined(WINDOWS)
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <sched.h>
|
||||
#include <wordexp.h>
|
||||
#include <libgen.h>
|
||||
#include <sched.h>
|
||||
#include <unistd.h>
|
||||
#include <wordexp.h>
|
||||
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/wait.h>
|
||||
#include <termios.h>
|
||||
|
||||
#if defined(DARWIN)
|
||||
#else
|
||||
#include <sys/prctl.h>
|
||||
#include <argp.h>
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
#else
|
||||
|
||||
#ifndef __func__
|
||||
#define __func__ __FUNCTION__
|
||||
#define __func__ __FUNCTION__
|
||||
#endif
|
||||
#include <malloc.h>
|
||||
#include <time.h>
|
||||
|
@ -82,11 +82,13 @@ extern "C" {
|
|||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#include "taoserror.h"
|
||||
#include "osThread.h"
|
||||
|
||||
#include "osAtomic.h"
|
||||
#include "osDef.h"
|
||||
#include "osDir.h"
|
||||
#include "osEndian.h"
|
||||
#include "osEnv.h"
|
||||
#include "osFile.h"
|
||||
#include "osLocale.h"
|
||||
#include "osLz4.h"
|
||||
|
@ -94,10 +96,9 @@ extern "C" {
|
|||
#include "osMemory.h"
|
||||
#include "osProc.h"
|
||||
#include "osRand.h"
|
||||
#include "osThread.h"
|
||||
#include "osSemaphore.h"
|
||||
#include "osSignal.h"
|
||||
#include "osShm.h"
|
||||
#include "osSignal.h"
|
||||
#include "osSleep.h"
|
||||
#include "osSocket.h"
|
||||
#include "osString.h"
|
||||
|
@ -106,7 +107,7 @@ extern "C" {
|
|||
#include "osTime.h"
|
||||
#include "osTimer.h"
|
||||
#include "osTimezone.h"
|
||||
#include "osEnv.h"
|
||||
#include "taoserror.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -21,105 +21,104 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#if defined(_TD_DARWIN_64)
|
||||
// specific
|
||||
// specific
|
||||
#ifndef __COMPAR_FN_T
|
||||
#define __COMPAR_FN_T
|
||||
typedef int(*__compar_fn_t)(const void *, const void *);
|
||||
typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
#endif
|
||||
|
||||
// for send function in tsocket.c
|
||||
#if defined(MSG_NOSIGNAL)
|
||||
#undef MSG_NOSIGNAL
|
||||
#endif
|
||||
// for send function in tsocket.c
|
||||
#if defined(MSG_NOSIGNAL)
|
||||
#undef MSG_NOSIGNAL
|
||||
#endif
|
||||
|
||||
#define MSG_NOSIGNAL 0
|
||||
#define MSG_NOSIGNAL 0
|
||||
|
||||
#define SO_NO_CHECK 0x1234
|
||||
#define SOL_TCP 0x1234
|
||||
#define TCP_KEEPIDLE 0x1234
|
||||
#define SO_NO_CHECK 0x1234
|
||||
#define SOL_TCP 0x1234
|
||||
#define TCP_KEEPIDLE 0x1234
|
||||
|
||||
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_ALPINE)
|
||||
#ifndef __COMPAR_FN_T
|
||||
#define __COMPAR_FN_T
|
||||
typedef int(*__compar_fn_t)(const void *, const void *);
|
||||
typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
#endif
|
||||
void error(int, int, const char *);
|
||||
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
void error (int, int, const char *);
|
||||
#ifndef PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(WINDOWS)
|
||||
char *stpcpy (char *dest, const char *src);
|
||||
char *stpncpy (char *dest, const char *src, int n);
|
||||
char *stpcpy(char *dest, const char *src);
|
||||
char *stpncpy(char *dest, const char *src, int n);
|
||||
|
||||
// specific
|
||||
// specific
|
||||
#ifndef __COMPAR_FN_T
|
||||
#define __COMPAR_FN_T
|
||||
typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
#endif
|
||||
#define ssize_t int
|
||||
#define _SSIZE_T_
|
||||
#define bzero(ptr, size) memset((ptr), 0, (size))
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define wcsncasecmp _wcsnicmp
|
||||
#define strtok_r strtok_s
|
||||
// #define snprintf _snprintf
|
||||
#define in_addr_t unsigned long
|
||||
#define ssize_t int
|
||||
#define _SSIZE_T_
|
||||
#define bzero(ptr, size) memset((ptr), 0, (size))
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#define wcsncasecmp _wcsnicmp
|
||||
#define strtok_r strtok_s
|
||||
// #define snprintf _snprintf
|
||||
#define in_addr_t unsigned long
|
||||
// #define socklen_t int
|
||||
|
||||
char * strsep(char **stringp, const char *delim);
|
||||
char * getpass(const char *prefix);
|
||||
char * strndup(const char *s, int n);
|
||||
char *strsep(char **stringp, const char *delim);
|
||||
char *getpass(const char *prefix);
|
||||
char *strndup(const char *s, int n);
|
||||
|
||||
// for send function in tsocket.c
|
||||
#define MSG_NOSIGNAL 0
|
||||
#define SO_NO_CHECK 0x1234
|
||||
#define SOL_TCP 0x1234
|
||||
// for send function in tsocket.c
|
||||
#define MSG_NOSIGNAL 0
|
||||
#define SO_NO_CHECK 0x1234
|
||||
#define SOL_TCP 0x1234
|
||||
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
#define SHUT_RD SD_RECEIVE
|
||||
#define SHUT_WR SD_SEND
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
#define SHUT_RD SD_RECEIVE
|
||||
#define SHUT_WR SD_SEND
|
||||
|
||||
#define LOCK_EX 1
|
||||
#define LOCK_NB 2
|
||||
#define LOCK_UN 3
|
||||
#define LOCK_EX 1
|
||||
#define LOCK_NB 2
|
||||
#define LOCK_UN 3
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 256
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int we_wordc;
|
||||
char *we_wordv[1];
|
||||
int we_offs;
|
||||
char wordPos[1025];
|
||||
} wordexp_t;
|
||||
int wordexp(char *words, wordexp_t *pwordexp, int flags);
|
||||
void wordfree(wordexp_t *pwordexp);
|
||||
|
||||
#define openlog(a, b, c)
|
||||
#define closelog()
|
||||
#define LOG_ERR 0
|
||||
#define LOG_INFO 1
|
||||
void syslog(int unused, const char *format, ...);
|
||||
#endif // WINDOWS
|
||||
|
||||
#ifndef WINDOWS
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 256
|
||||
#endif
|
||||
|
||||
#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b)))
|
||||
#define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2))
|
||||
typedef struct {
|
||||
int we_wordc;
|
||||
char *we_wordv[1];
|
||||
int we_offs;
|
||||
char wordPos[1025];
|
||||
} wordexp_t;
|
||||
int wordexp(char *words, wordexp_t *pwordexp, int flags);
|
||||
void wordfree(wordexp_t *pwordexp);
|
||||
|
||||
#define openlog(a, b, c)
|
||||
#define closelog()
|
||||
#define LOG_ERR 0
|
||||
#define LOG_INFO 1
|
||||
void syslog(int unused, const char *format, ...);
|
||||
#endif // WINDOWS
|
||||
|
||||
#ifndef WINDOWS
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b)))
|
||||
#define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2))
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ASSERT(x) assert(x)
|
||||
|
@ -141,7 +140,7 @@ extern "C" {
|
|||
|
||||
#if defined(__GNUC__)
|
||||
#define UNUSED_PARAM(x) _UNUSED##x __attribute__((unused))
|
||||
#define UNUSED_FUNC __attribute__((unused))
|
||||
#define UNUSED_FUNC __attribute__((unused))
|
||||
#else
|
||||
#define UNUSED_PARAM(x) x
|
||||
#define UNUSED_FUNC
|
||||
|
@ -169,16 +168,22 @@ extern "C" {
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define DEFAULT_DOUBLE_COMP(x, y) \
|
||||
do { \
|
||||
if (isnan(x) && isnan(y)) { return 0; } \
|
||||
if (isnan(x)) { return -1; } \
|
||||
if (isnan(y)) { return 1; } \
|
||||
if ((x) == (y)) { \
|
||||
return 0; \
|
||||
} else { \
|
||||
return (x) < (y) ? -1 : 1; \
|
||||
} \
|
||||
#define DEFAULT_DOUBLE_COMP(x, y) \
|
||||
do { \
|
||||
if (isnan(x) && isnan(y)) { \
|
||||
return 0; \
|
||||
} \
|
||||
if (isnan(x)) { \
|
||||
return -1; \
|
||||
} \
|
||||
if (isnan(y)) { \
|
||||
return 1; \
|
||||
} \
|
||||
if ((x) == (y)) { \
|
||||
return 0; \
|
||||
} else { \
|
||||
return (x) < (y) ? -1 : 1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DEFAULT_FLOAT_COMP(x, y) DEFAULT_DOUBLE_COMP(x, y)
|
||||
|
@ -190,43 +195,49 @@ extern "C" {
|
|||
|
||||
#undef threadlocal
|
||||
#ifdef _ISOC11_SOURCE
|
||||
#define threadlocal _Thread_local
|
||||
#define threadlocal _Thread_local
|
||||
#elif defined(__APPLE__)
|
||||
#define threadlocal __thread
|
||||
#define threadlocal __thread
|
||||
#elif defined(__GNUC__) && !defined(threadlocal)
|
||||
#define threadlocal __thread
|
||||
#define threadlocal __thread
|
||||
#else
|
||||
#define threadlocal __declspec( thread )
|
||||
#define threadlocal __declspec(thread)
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
#define PRIzu "ld"
|
||||
#define PRIzu "ld"
|
||||
#else
|
||||
#define PRIzu "zu"
|
||||
#define PRIzu "zu"
|
||||
#endif
|
||||
|
||||
#if !defined(WINDOWS)
|
||||
#if defined(_TD_DARWIN_64)
|
||||
// MacOS
|
||||
#if !defined(_GNU_SOURCE)
|
||||
#define setThreadName(name) do { pthread_setname_np((name)); } while (0)
|
||||
#else
|
||||
// pthread_setname_np not defined
|
||||
#define setThreadName(name)
|
||||
#endif
|
||||
#else
|
||||
// Linux, length of name must <= 16 (the last '\0' included)
|
||||
#define setThreadName(name) do { prctl(PR_SET_NAME, (name)); } while (0)
|
||||
#endif
|
||||
#if defined(_TD_DARWIN_64)
|
||||
// MacOS
|
||||
#if !defined(_GNU_SOURCE)
|
||||
#define setThreadName(name) \
|
||||
do { \
|
||||
pthread_setname_np((name)); \
|
||||
} while (0)
|
||||
#else
|
||||
// Windows
|
||||
#define setThreadName(name)
|
||||
// pthread_setname_np not defined
|
||||
#define setThreadName(name)
|
||||
#endif
|
||||
#else
|
||||
// Linux, length of name must <= 16 (the last '\0' included)
|
||||
#define setThreadName(name) \
|
||||
do { \
|
||||
prctl(PR_SET_NAME, (name)); \
|
||||
} while (0)
|
||||
#endif
|
||||
#else
|
||||
// Windows
|
||||
#define setThreadName(name)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define TD_DIRSEP "\\"
|
||||
#define TD_DIRSEP "\\"
|
||||
#else
|
||||
#define TD_DIRSEP "/"
|
||||
#define TD_DIRSEP "/"
|
||||
#endif
|
||||
|
||||
#define TD_LOCALE_LEN 64
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define opendir OPENDIR_FUNC_TAOS_FORBID
|
||||
#define readdir READDIR_FUNC_TAOS_FORBID
|
||||
#define closedir CLOSEDIR_FUNC_TAOS_FORBID
|
||||
#define dirname DIRNAME_FUNC_TAOS_FORBID
|
||||
#undef basename
|
||||
#define basename BASENAME_FUNC_TAOS_FORBID
|
||||
#define opendir OPENDIR_FUNC_TAOS_FORBID
|
||||
#define readdir READDIR_FUNC_TAOS_FORBID
|
||||
#define closedir CLOSEDIR_FUNC_TAOS_FORBID
|
||||
#define dirname DIRNAME_FUNC_TAOS_FORBID
|
||||
#undef basename
|
||||
#define basename BASENAME_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -32,26 +32,25 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
#define TD_TMP_DIR_PATH "C:\\Windows\\Temp\\"
|
||||
#define TD_CFG_DIR_PATH "C:\\TDengine\\cfg\\"
|
||||
#define TD_TMP_DIR_PATH "C:\\Windows\\Temp\\"
|
||||
#define TD_CFG_DIR_PATH "C:\\TDengine\\cfg\\"
|
||||
#define TD_DATA_DIR_PATH "C:\\TDengine\\data\\"
|
||||
#define TD_LOG_DIR_PATH "C:\\TDengine\\log\\"
|
||||
#define TD_LOG_DIR_PATH "C:\\TDengine\\log\\"
|
||||
#elif defined(_TD_DARWIN_64)
|
||||
#define TD_TMP_DIR_PATH "/tmp/taosd/"
|
||||
#define TD_CFG_DIR_PATH "/etc/taos/"
|
||||
#define TD_TMP_DIR_PATH "/tmp/taosd/"
|
||||
#define TD_CFG_DIR_PATH "/etc/taos/"
|
||||
#define TD_DATA_DIR_PATH "/var/lib/taos/"
|
||||
#define TD_LOG_DIR_PATH "/var/log/taos/"
|
||||
#define TD_LOG_DIR_PATH "/var/log/taos/"
|
||||
#else
|
||||
#define TD_TMP_DIR_PATH "/tmp/"
|
||||
#define TD_CFG_DIR_PATH "/etc/taos/"
|
||||
#define TD_TMP_DIR_PATH "/tmp/"
|
||||
#define TD_CFG_DIR_PATH "/etc/taos/"
|
||||
#define TD_DATA_DIR_PATH "/var/lib/taos/"
|
||||
#define TD_LOG_DIR_PATH "/var/log/taos/"
|
||||
#define TD_LOG_DIR_PATH "/var/log/taos/"
|
||||
#endif
|
||||
|
||||
typedef struct TdDir *TdDirPtr;
|
||||
typedef struct TdDir *TdDirPtr;
|
||||
typedef struct TdDirEntry *TdDirEntryPtr;
|
||||
|
||||
|
||||
void taosRemoveDir(const char *dirname);
|
||||
bool taosDirExist(const char *dirname);
|
||||
int32_t taosMkDir(const char *dirname);
|
||||
|
@ -61,13 +60,13 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays);
|
|||
int32_t taosExpandDir(const char *dirname, char *outname, int32_t maxlen);
|
||||
int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen);
|
||||
bool taosIsDir(const char *dirname);
|
||||
char* taosDirName(char *dirname);
|
||||
char* taosDirEntryBaseName(char *dirname);
|
||||
char *taosDirName(char *dirname);
|
||||
char *taosDirEntryBaseName(char *dirname);
|
||||
|
||||
TdDirPtr taosOpenDir(const char *dirname);
|
||||
TdDirEntryPtr taosReadDir(TdDirPtr pDir);
|
||||
bool taosDirEntryIsDir(TdDirEntryPtr pDirEntry);
|
||||
char* taosGetDirEntryName(TdDirEntryPtr pDirEntry);
|
||||
char *taosGetDirEntryName(TdDirEntryPtr pDirEntry);
|
||||
int32_t taosCloseDir(TdDirPtr *ppDir);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -24,7 +24,7 @@ typedef enum { TD_LITTLE_ENDIAN = 0, TD_BIG_ENDIAN } td_endian_t;
|
|||
|
||||
static const int32_t endian_test_var = 1;
|
||||
#define IS_LITTLE_ENDIAN() (*(uint8_t *)(&endian_test_var) != 0)
|
||||
#define TD_RT_ENDIAN() (IS_LITTLE_ENDIAN() ? TD_LITTLE_ENDIAN : TD_BIG_ENDIAN)
|
||||
#define TD_RT_ENDIAN() (IS_LITTLE_ENDIAN() ? TD_LITTLE_ENDIAN : TD_BIG_ENDIAN)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#define _TD_OS_ENV_H_
|
||||
|
||||
#include "osSysinfo.h"
|
||||
#include "osTimezone.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -34,7 +35,7 @@ extern int64_t tsOpenMax;
|
|||
extern int64_t tsStreamMax;
|
||||
extern float tsNumOfCores;
|
||||
extern int64_t tsTotalMemoryKB;
|
||||
extern char* tsProcPath;
|
||||
extern char *tsProcPath;
|
||||
|
||||
extern char configDir[];
|
||||
extern char tsDataDir[];
|
||||
|
|
|
@ -24,58 +24,54 @@ extern "C" {
|
|||
|
||||
#ifdef __APPLE__
|
||||
|
||||
enum EPOLL_EVENTS
|
||||
{
|
||||
EPOLLIN = 0x001,
|
||||
enum EPOLL_EVENTS {
|
||||
EPOLLIN = 0x001,
|
||||
#define EPOLLIN EPOLLIN
|
||||
EPOLLPRI = 0x002,
|
||||
EPOLLPRI = 0x002,
|
||||
#define EPOLLPRI EPOLLPRI
|
||||
EPOLLOUT = 0x004,
|
||||
EPOLLOUT = 0x004,
|
||||
#define EPOLLOUT EPOLLOUT
|
||||
EPOLLRDNORM = 0x040,
|
||||
EPOLLRDNORM = 0x040,
|
||||
#define EPOLLRDNORM EPOLLRDNORM
|
||||
EPOLLRDBAND = 0x080,
|
||||
EPOLLRDBAND = 0x080,
|
||||
#define EPOLLRDBAND EPOLLRDBAND
|
||||
EPOLLWRNORM = 0x100,
|
||||
EPOLLWRNORM = 0x100,
|
||||
#define EPOLLWRNORM EPOLLWRNORM
|
||||
EPOLLWRBAND = 0x200,
|
||||
EPOLLWRBAND = 0x200,
|
||||
#define EPOLLWRBAND EPOLLWRBAND
|
||||
EPOLLMSG = 0x400,
|
||||
EPOLLMSG = 0x400,
|
||||
#define EPOLLMSG EPOLLMSG
|
||||
EPOLLERR = 0x008,
|
||||
EPOLLERR = 0x008,
|
||||
#define EPOLLERR EPOLLERR
|
||||
EPOLLHUP = 0x010,
|
||||
EPOLLHUP = 0x010,
|
||||
#define EPOLLHUP EPOLLHUP
|
||||
EPOLLRDHUP = 0x2000,
|
||||
EPOLLRDHUP = 0x2000,
|
||||
#define EPOLLRDHUP EPOLLRDHUP
|
||||
EPOLLEXCLUSIVE = 1u << 28,
|
||||
EPOLLEXCLUSIVE = 1u << 28,
|
||||
#define EPOLLEXCLUSIVE EPOLLEXCLUSIVE
|
||||
EPOLLWAKEUP = 1u << 29,
|
||||
EPOLLWAKEUP = 1u << 29,
|
||||
#define EPOLLWAKEUP EPOLLWAKEUP
|
||||
EPOLLONESHOT = 1u << 30,
|
||||
EPOLLONESHOT = 1u << 30,
|
||||
#define EPOLLONESHOT EPOLLONESHOT
|
||||
EPOLLET = 1u << 31
|
||||
EPOLLET = 1u << 31
|
||||
#define EPOLLET EPOLLET
|
||||
};
|
||||
};
|
||||
|
||||
/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */
|
||||
#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */
|
||||
#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */
|
||||
#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */
|
||||
|
||||
|
||||
typedef union epoll_data
|
||||
{
|
||||
void *ptr;
|
||||
int fd;
|
||||
typedef union epoll_data {
|
||||
void *ptr;
|
||||
int fd;
|
||||
uint32_t u32;
|
||||
uint64_t u64;
|
||||
} epoll_data_t;
|
||||
|
||||
struct epoll_event
|
||||
{
|
||||
uint32_t events; /* Epoll events */
|
||||
epoll_data_t data; /* User data variable */
|
||||
struct epoll_event {
|
||||
uint32_t events; /* Epoll events */
|
||||
epoll_data_t data; /* User data variable */
|
||||
};
|
||||
|
||||
int epoll_create(int size);
|
||||
|
@ -83,11 +79,10 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
|
|||
int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);
|
||||
int epoll_close(int epfd);
|
||||
|
||||
#endif // __APPLE__
|
||||
#endif // __APPLE__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _eok_h_fd274616_996c_400e_9023_ae70be881fa3_
|
||||
|
||||
#endif // _eok_h_fd274616_996c_400e_9023_ae70be881fa3_
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define setlocale SETLOCALE_FUNC_TAOS_FORBID
|
||||
#define setlocale SETLOCALE_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
char *taosCharsetReplace(char *charsetstr);
|
||||
|
|
|
@ -21,25 +21,25 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
int32_t BUILDIN_CLZL(uint64_t val);
|
||||
int32_t BUILDIN_CLZ(uint32_t val);
|
||||
int32_t BUILDIN_CTZL(uint64_t val);
|
||||
int32_t BUILDIN_CTZ(uint32_t val);
|
||||
#elif defined (_TD_LINUX_32)
|
||||
#define BUILDIN_CLZL(val) __builtin_clzll(val)
|
||||
#define BUILDIN_CTZL(val) __builtin_ctzll(val)
|
||||
#define BUILDIN_CLZ(val) __builtin_clz(val)
|
||||
#define BUILDIN_CTZ(val) __builtin_ctz(val)
|
||||
#elif defined (_TD_ARM_32)
|
||||
#define BUILDIN_CLZL(val) __builtin_clzll(val)
|
||||
#define BUILDIN_CTZL(val) __builtin_ctzll(val)
|
||||
#define BUILDIN_CLZ(val) __builtin_clz(val)
|
||||
#define BUILDIN_CTZ(val) __builtin_ctz(val)
|
||||
int32_t BUILDIN_CLZL(uint64_t val);
|
||||
int32_t BUILDIN_CLZ(uint32_t val);
|
||||
int32_t BUILDIN_CTZL(uint64_t val);
|
||||
int32_t BUILDIN_CTZ(uint32_t val);
|
||||
#elif defined(_TD_LINUX_32)
|
||||
#define BUILDIN_CLZL(val) __builtin_clzll(val)
|
||||
#define BUILDIN_CTZL(val) __builtin_ctzll(val)
|
||||
#define BUILDIN_CLZ(val) __builtin_clz(val)
|
||||
#define BUILDIN_CTZ(val) __builtin_ctz(val)
|
||||
#elif defined(_TD_ARM_32)
|
||||
#define BUILDIN_CLZL(val) __builtin_clzll(val)
|
||||
#define BUILDIN_CTZL(val) __builtin_ctzll(val)
|
||||
#define BUILDIN_CLZ(val) __builtin_clz(val)
|
||||
#define BUILDIN_CTZ(val) __builtin_ctz(val)
|
||||
#else
|
||||
#define BUILDIN_CLZL(val) __builtin_clzl(val)
|
||||
#define BUILDIN_CTZL(val) __builtin_ctzl(val)
|
||||
#define BUILDIN_CLZ(val) __builtin_clz(val)
|
||||
#define BUILDIN_CTZ(val) __builtin_ctz(val)
|
||||
#define BUILDIN_CLZL(val) __builtin_clzl(val)
|
||||
#define BUILDIN_CTZL(val) __builtin_ctzl(val)
|
||||
#define BUILDIN_CLZ(val) __builtin_clz(val)
|
||||
#define BUILDIN_CTZ(val) __builtin_ctz(val)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -23,40 +23,40 @@ extern "C" {
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following sectio
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define qsort QSORT_FUNC_TAOS_FORBID
|
||||
#define qsort QSORT_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
#define TPOW2(x) ((x) * (x))
|
||||
#define TABS(x) ((x) > 0 ? (x) : -(x))
|
||||
#define TABS(x) ((x) > 0 ? (x) : -(x))
|
||||
|
||||
#define TSWAP(a, b) \
|
||||
do { \
|
||||
char *__tmp = alloca(sizeof(a)); \
|
||||
memcpy(__tmp, &(a), sizeof(a)); \
|
||||
memcpy(&(a), &(b), sizeof(a)); \
|
||||
memcpy(&(b), __tmp, sizeof(a)); \
|
||||
#define TSWAP(a, b) \
|
||||
do { \
|
||||
char *__tmp = alloca(sizeof(a)); \
|
||||
memcpy(__tmp, &(a), sizeof(a)); \
|
||||
memcpy(&(a), &(b), sizeof(a)); \
|
||||
memcpy(&(b), __tmp, sizeof(a)); \
|
||||
} while (0)
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
||||
#define TMAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define TMIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define TRANGE(aa, bb, cc) ((aa) = TMAX((aa), (bb)),(aa) = TMIN((aa), (cc)))
|
||||
#define TMAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define TMIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define TRANGE(aa, bb, cc) ((aa) = TMAX((aa), (bb)), (aa) = TMIN((aa), (cc)))
|
||||
|
||||
#else
|
||||
|
||||
#define TMAX(a, b) \
|
||||
({ \
|
||||
__typeof(a) __a = (a); \
|
||||
__typeof(b) __b = (b); \
|
||||
(__a > __b) ? __a : __b; \
|
||||
})
|
||||
#define TMAX(a, b) \
|
||||
({ \
|
||||
__typeof(a) __a = (a); \
|
||||
__typeof(b) __b = (b); \
|
||||
(__a > __b) ? __a : __b; \
|
||||
})
|
||||
|
||||
#define TMIN(a, b) \
|
||||
({ \
|
||||
__typeof(a) __a = (a); \
|
||||
__typeof(b) __b = (b); \
|
||||
(__a < __b) ? __a : __b; \
|
||||
#define TMIN(a, b) \
|
||||
({ \
|
||||
__typeof(a) __a = (a); \
|
||||
__typeof(b) __b = (b); \
|
||||
(__a < __b) ? __a : __b; \
|
||||
})
|
||||
|
||||
#define TRANGE(a, b, c) \
|
||||
|
@ -71,7 +71,7 @@ extern "C" {
|
|||
typedef int32_t (*__compar_fn_t)(const void *, const void *);
|
||||
#endif
|
||||
|
||||
void taosSort(void* arr, int64_t sz, int64_t width, __compar_fn_t compar);
|
||||
void taosSort(void *arr, int64_t sz, int64_t width, __compar_fn_t compar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -23,19 +23,19 @@ extern "C" {
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following sectio
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define malloc MALLOC_FUNC_TAOS_FORBID
|
||||
#define calloc CALLOC_FUNC_TAOS_FORBID
|
||||
#define realloc REALLOC_FUNC_TAOS_FORBID
|
||||
#define free FREE_FUNC_TAOS_FORBID
|
||||
#define malloc MALLOC_FUNC_TAOS_FORBID
|
||||
#define calloc CALLOC_FUNC_TAOS_FORBID
|
||||
#define realloc REALLOC_FUNC_TAOS_FORBID
|
||||
#define free FREE_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
void *taosMemoryMalloc(int32_t size);
|
||||
void *taosMemoryCalloc(int32_t num, int32_t size);
|
||||
void *taosMemoryRealloc(void *ptr, int32_t size);
|
||||
void *taosMemoryStrDup(const char *ptr);
|
||||
void taosMemoryFree(void *ptr);
|
||||
void *taosMemoryMalloc(int32_t size);
|
||||
void *taosMemoryCalloc(int32_t num, int32_t size);
|
||||
void *taosMemoryRealloc(void *ptr, int32_t size);
|
||||
void *taosMemoryStrDup(const char *ptr);
|
||||
void taosMemoryFree(void *ptr);
|
||||
int32_t taosMemorySize(void *ptr);
|
||||
void taosPrintBackTrace();
|
||||
void taosPrintBackTrace();
|
||||
|
||||
#define taosMemoryFreeClear(ptr) \
|
||||
do { \
|
||||
|
|
|
@ -23,14 +23,14 @@ extern "C" {
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define rand RAND_FUNC_TAOS_FORBID
|
||||
#define srand SRAND_FUNC_TAOS_FORBID
|
||||
#define rand_r RANDR_FUNC_TAOS_FORBID
|
||||
#define rand RAND_FUNC_TAOS_FORBID
|
||||
#define srand SRAND_FUNC_TAOS_FORBID
|
||||
#define rand_r RANDR_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
void taosSeedRand(uint32_t seed);
|
||||
void taosSeedRand(uint32_t seed);
|
||||
uint32_t taosRand(void);
|
||||
uint32_t taosRandR(uint32_t *pSeed);
|
||||
uint32_t taosRandR(uint32_t* pSeed);
|
||||
void taosRandStr(char* str, int32_t size);
|
||||
uint32_t taosSafeRand(void);
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ extern "C" {
|
|||
typedef struct {
|
||||
int32_t id;
|
||||
int32_t size;
|
||||
void* ptr;
|
||||
void *ptr;
|
||||
} SShm;
|
||||
|
||||
int32_t taosCreateShm(SShm *pShm, int32_t key, int32_t shmsize) ;
|
||||
int32_t taosCreateShm(SShm *pShm, int32_t key, int32_t shmsize);
|
||||
void taosDropShm(SShm *pShm);
|
||||
int32_t taosAttachShm(SShm *pShm);
|
||||
|
||||
|
|
|
@ -21,27 +21,27 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#ifndef SIGALRM
|
||||
#define SIGALRM 1234
|
||||
#define SIGALRM 1234
|
||||
#endif
|
||||
|
||||
#ifndef SIGHUP
|
||||
#define SIGHUP 1230
|
||||
#define SIGHUP 1230
|
||||
#endif
|
||||
|
||||
#ifndef SIGCHLD
|
||||
#define SIGCHLD 1234
|
||||
#define SIGCHLD 1234
|
||||
#endif
|
||||
|
||||
#ifndef SIGUSR1
|
||||
#define SIGUSR1 1234
|
||||
#define SIGUSR1 1234
|
||||
#endif
|
||||
|
||||
#ifndef SIGUSR2
|
||||
#define SIGUSR2 1234
|
||||
#define SIGUSR2 1234
|
||||
#endif
|
||||
|
||||
#ifndef SIGBREAK
|
||||
#define SIGBREAK 1234
|
||||
#define SIGBREAK 1234
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
@ -59,4 +59,4 @@ void taosKillChildOnParentStopped();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_OS_SIGNAL_H_*/
|
||||
#endif /*_TD_OS_SIGNAL_H_*/
|
||||
|
|
|
@ -23,10 +23,10 @@ extern "C" {
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define Sleep SLEEP_FUNC_TAOS_FORBID
|
||||
#define sleep SLEEP_FUNC_TAOS_FORBID
|
||||
#define usleep USLEEP_FUNC_TAOS_FORBID
|
||||
#define nanosleep NANOSLEEP_FUNC_TAOS_FORBID
|
||||
#define Sleep SLEEP_FUNC_TAOS_FORBID
|
||||
#define sleep SLEEP_FUNC_TAOS_FORBID
|
||||
#define usleep USLEEP_FUNC_TAOS_FORBID
|
||||
#define nanosleep NANOSLEEP_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
void taosSsleep(int32_t s);
|
||||
|
|
|
@ -75,7 +75,7 @@ extern "C" {
|
|||
typedef int socklen_t;
|
||||
#define TAOS_EPOLL_WAIT_TIME 100
|
||||
typedef SOCKET eventfd_t;
|
||||
#define eventfd(a, b) -1
|
||||
#define eventfd(a, b) -1
|
||||
#ifndef EPOLLWAKEUP
|
||||
#define EPOLLWAKEUP (1u << 29)
|
||||
#endif
|
||||
|
@ -119,8 +119,8 @@ typedef int32_t SocketFd;
|
|||
typedef SocketFd EpollFd;
|
||||
|
||||
typedef struct TdSocketServer *TdSocketServerPtr;
|
||||
typedef struct TdSocket * TdSocketPtr;
|
||||
typedef struct TdEpoll * TdEpollPtr;
|
||||
typedef struct TdSocket *TdSocketPtr;
|
||||
typedef struct TdEpoll *TdEpollPtr;
|
||||
|
||||
int32_t taosSendto(TdSocketPtr pSocket, void *msg, int len, unsigned int flags, const struct sockaddr *to, int tolen);
|
||||
int32_t taosWriteSocket(TdSocketPtr pSocket, void *msg, int len);
|
||||
|
|
|
@ -26,37 +26,37 @@ typedef int32_t TdUcs4;
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define iconv_open ICONV_OPEN_FUNC_TAOS_FORBID
|
||||
#define iconv_close ICONV_CLOSE_FUNC_TAOS_FORBID
|
||||
#define iconv ICONV_FUNC_TAOS_FORBID
|
||||
#define wcwidth WCWIDTH_FUNC_TAOS_FORBID
|
||||
#define wcswidth WCSWIDTH_FUNC_TAOS_FORBID
|
||||
#define mbtowc MBTOWC_FUNC_TAOS_FORBID
|
||||
#define mbstowcs MBSTOWCS_FUNC_TAOS_FORBID
|
||||
#define wctomb WCTOMB_FUNC_TAOS_FORBID
|
||||
#define wcstombs WCSTOMBS_FUNC_TAOS_FORBID
|
||||
#define wcsncpy WCSNCPY_FUNC_TAOS_FORBID
|
||||
#define wchar_t WCHAR_T_TYPE_TAOS_FORBID
|
||||
#define strcasestr STR_CASE_STR_FORBID
|
||||
#define strtoll STR_TO_LL_FUNC_TAOS_FORBID
|
||||
#define strtoull STR_TO_ULL_FUNC_TAOS_FORBID
|
||||
#define strtol STR_TO_L_FUNC_TAOS_FORBID
|
||||
#define strtoul STR_TO_UL_FUNC_TAOS_FORBID
|
||||
#define strtod STR_TO_LD_FUNC_TAOS_FORBID
|
||||
#define strtold STR_TO_D_FUNC_TAOS_FORBID
|
||||
#define strtof STR_TO_F_FUNC_TAOS_FORBID
|
||||
#define iconv_open ICONV_OPEN_FUNC_TAOS_FORBID
|
||||
#define iconv_close ICONV_CLOSE_FUNC_TAOS_FORBID
|
||||
#define iconv ICONV_FUNC_TAOS_FORBID
|
||||
#define wcwidth WCWIDTH_FUNC_TAOS_FORBID
|
||||
#define wcswidth WCSWIDTH_FUNC_TAOS_FORBID
|
||||
#define mbtowc MBTOWC_FUNC_TAOS_FORBID
|
||||
#define mbstowcs MBSTOWCS_FUNC_TAOS_FORBID
|
||||
#define wctomb WCTOMB_FUNC_TAOS_FORBID
|
||||
#define wcstombs WCSTOMBS_FUNC_TAOS_FORBID
|
||||
#define wcsncpy WCSNCPY_FUNC_TAOS_FORBID
|
||||
#define wchar_t WCHAR_T_TYPE_TAOS_FORBID
|
||||
#define strcasestr STR_CASE_STR_FORBID
|
||||
#define strtoll STR_TO_LL_FUNC_TAOS_FORBID
|
||||
#define strtoull STR_TO_ULL_FUNC_TAOS_FORBID
|
||||
#define strtol STR_TO_L_FUNC_TAOS_FORBID
|
||||
#define strtoul STR_TO_UL_FUNC_TAOS_FORBID
|
||||
#define strtod STR_TO_LD_FUNC_TAOS_FORBID
|
||||
#define strtold STR_TO_D_FUNC_TAOS_FORBID
|
||||
#define strtof STR_TO_F_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
#define tstrdup(str) _strdup(str)
|
||||
#define tstrdup(str) _strdup(str)
|
||||
#else
|
||||
#define tstrdup(str) strdup(str)
|
||||
#define tstrdup(str) strdup(str)
|
||||
#endif
|
||||
|
||||
#define tstrncpy(dst, src, size) \
|
||||
do { \
|
||||
strncpy((dst), (src), (size)); \
|
||||
(dst)[(size)-1] = 0; \
|
||||
#define tstrncpy(dst, src, size) \
|
||||
do { \
|
||||
strncpy((dst), (src), (size)); \
|
||||
(dst)[(size)-1] = 0; \
|
||||
} while (0)
|
||||
|
||||
int32_t taosUcs4len(TdUcs4 *ucs4);
|
||||
|
@ -67,7 +67,7 @@ void taosConvDestroy();
|
|||
int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs);
|
||||
bool taosMbsToUcs4(const char *mbs, size_t mbs_len, TdUcs4 *ucs4, int32_t ucs4_max_len, int32_t *len);
|
||||
int32_t tasoUcs4Compare(TdUcs4 *f1_ucs4, TdUcs4 *f2_ucs4, int32_t bytes);
|
||||
TdUcs4* tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4);
|
||||
TdUcs4 *tasoUcs4Copy(TdUcs4 *target_ucs4, TdUcs4 *source_ucs4, int32_t len_ucs4);
|
||||
bool taosValidateEncodec(const char *encodec);
|
||||
int32_t taosHexEncode(const unsigned char *src, char *dst, int32_t len);
|
||||
int32_t taosHexDecode(const char *src, char *dst, int32_t len);
|
||||
|
@ -80,16 +80,16 @@ int32_t taosWcharToMb(char *pStr, TdWchar wchar);
|
|||
|
||||
char *taosStrCaseStr(const char *str, const char *pattern);
|
||||
|
||||
int64_t taosStr2Int64(const char *str, char** pEnd, int32_t radix);
|
||||
uint64_t taosStr2UInt64(const char *str, char** pEnd, int32_t radix);
|
||||
int32_t taosStr2Int32(const char *str, char** pEnd, int32_t radix);
|
||||
uint32_t taosStr2UInt32(const char *str, char** pEnd, int32_t radix);
|
||||
int16_t taosStr2Int16(const char *str, char** pEnd, int32_t radix);
|
||||
uint16_t taosStr2UInt16(const char *str, char** pEnd, int32_t radix);
|
||||
int8_t taosStr2Int8(const char *str, char** pEnd, int32_t radix);
|
||||
uint8_t taosStr2UInt8(const char *str, char** pEnd, int32_t radix);
|
||||
double taosStr2Double(const char *str, char** pEnd);
|
||||
float taosStr2Float(const char *str, char** pEnd);
|
||||
int64_t taosStr2Int64(const char *str, char **pEnd, int32_t radix);
|
||||
uint64_t taosStr2UInt64(const char *str, char **pEnd, int32_t radix);
|
||||
int32_t taosStr2Int32(const char *str, char **pEnd, int32_t radix);
|
||||
uint32_t taosStr2UInt32(const char *str, char **pEnd, int32_t radix);
|
||||
int16_t taosStr2Int16(const char *str, char **pEnd, int32_t radix);
|
||||
uint16_t taosStr2UInt16(const char *str, char **pEnd, int32_t radix);
|
||||
int8_t taosStr2Int8(const char *str, char **pEnd, int32_t radix);
|
||||
uint8_t taosStr2UInt8(const char *str, char **pEnd, int32_t radix);
|
||||
double taosStr2Double(const char *str, char **pEnd);
|
||||
float taosStr2Float(const char *str, char **pEnd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -54,10 +54,10 @@ void taosSetCoreDump(bool enable);
|
|||
|
||||
#if !defined(LINUX)
|
||||
|
||||
#define _UTSNAME_LENGTH 65
|
||||
#define _UTSNAME_LENGTH 65
|
||||
#define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
|
||||
|
||||
#endif // WINDOWS
|
||||
#endif // WINDOWS
|
||||
|
||||
typedef struct {
|
||||
char sysname[_UTSNAME_MACHINE_LENGTH];
|
||||
|
@ -68,7 +68,7 @@ typedef struct {
|
|||
} SysNameInfo;
|
||||
|
||||
SysNameInfo taosGetSysNameInfo();
|
||||
bool taosCheckCurrentInDll();
|
||||
bool taosCheckCurrentInDll();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -23,16 +23,16 @@ extern "C" {
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define popen POPEN_FUNC_TAOS_FORBID
|
||||
#define pclose PCLOSE_FUNC_TAOS_FORBID
|
||||
#define tcsetattr TCSETATTR_FUNC_TAOS_FORBID
|
||||
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
|
||||
#define popen POPEN_FUNC_TAOS_FORBID
|
||||
#define pclose PCLOSE_FUNC_TAOS_FORBID
|
||||
#define tcsetattr TCSETATTR_FUNC_TAOS_FORBID
|
||||
#define tcgetattr TCGETATTR_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
typedef struct TdCmd *TdCmdPtr;
|
||||
typedef struct TdCmd* TdCmdPtr;
|
||||
|
||||
TdCmdPtr taosOpenCmd(const char* cmd);
|
||||
int64_t taosGetsCmd(TdCmdPtr pCmd, int32_t maxSize, char *__restrict buf);
|
||||
int64_t taosGetsCmd(TdCmdPtr pCmd, int32_t maxSize, char* __restrict buf);
|
||||
int64_t taosGetLineCmd(TdCmdPtr pCmd, char** __restrict ptrBuf);
|
||||
int32_t taosEOFCmd(TdCmdPtr pCmd);
|
||||
int64_t taosCloseCmd(TdCmdPtr* ppCmd);
|
||||
|
|
|
@ -29,21 +29,20 @@ typedef pthread_mutex_t pthread_spinlock_t;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
typedef pthread_t TdThread;
|
||||
typedef pthread_spinlock_t TdThreadSpinlock;
|
||||
typedef pthread_mutex_t TdThreadMutex;
|
||||
typedef pthread_mutexattr_t TdThreadMutexAttr;
|
||||
typedef pthread_rwlock_t TdThreadRwlock;
|
||||
typedef pthread_attr_t TdThreadAttr;
|
||||
typedef pthread_once_t TdThreadOnce;
|
||||
typedef pthread_t TdThread;
|
||||
typedef pthread_spinlock_t TdThreadSpinlock;
|
||||
typedef pthread_mutex_t TdThreadMutex;
|
||||
typedef pthread_mutexattr_t TdThreadMutexAttr;
|
||||
typedef pthread_rwlock_t TdThreadRwlock;
|
||||
typedef pthread_attr_t TdThreadAttr;
|
||||
typedef pthread_once_t TdThreadOnce;
|
||||
typedef pthread_rwlockattr_t TdThreadRwlockAttr;
|
||||
typedef pthread_cond_t TdThreadCond;
|
||||
typedef pthread_condattr_t TdThreadCondAttr;
|
||||
typedef pthread_key_t TdThreadKey;
|
||||
typedef pthread_cond_t TdThreadCond;
|
||||
typedef pthread_condattr_t TdThreadCondAttr;
|
||||
typedef pthread_key_t TdThreadKey;
|
||||
|
||||
#define taosThreadCleanupPush pthread_cleanup_push
|
||||
#define taosThreadCleanupPop pthread_cleanup_pop
|
||||
|
||||
#define taosThreadCleanupPop pthread_cleanup_pop
|
||||
|
||||
#ifdef WINDOWS
|
||||
#define TD_PTHREAD_MUTEX_INITIALIZER (TdThreadMutex)(-1)
|
||||
|
@ -54,181 +53,181 @@ typedef pthread_key_t TdThreadKey;
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define pthread_t PTHREAD_T_TYPE_TAOS_FORBID
|
||||
#define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID
|
||||
#define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID
|
||||
#define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID
|
||||
#define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID
|
||||
#define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID
|
||||
#define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_key_t PTHREAD_KEY_T_TYPE_TAOS_FORBID
|
||||
#define pthread_barrier_t PTHREAD_BARRIER_T_TYPE_TAOS_FORBID
|
||||
#define pthread_barrierattr_t PTHREAD_BARRIERATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getdetachstate PTHREAD_ATTR_GETDETACHSTATE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getscope PTHREAD_ATTR_GETSCOPE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE_FUNC_TAOS_FORBID
|
||||
#define pthread_barrier_destroy PTHREAD_BARRIER_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_barrier_init PTHREAD_BARRIER_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_barrier_wait PTHREAD_BARRIER_WAIT_FUNC_TAOS_FORBID
|
||||
#define pthread_barrierattr_destroy PTHREAD_BARRIERATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_barrierattr_getpshared PTHREAD_BARRIERATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_barrierattr_init PTHREAD_BARRIERATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_barrierattr_setpshared PTHREAD_BARRIERATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_getpshared PTHREAD_CONDATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID
|
||||
#define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID
|
||||
#define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID
|
||||
#define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID
|
||||
#define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID
|
||||
#define pthread_key_create PTHREAD_KEY_CREATE_FUNC_TAOS_FORBID
|
||||
#define pthread_key_delete PTHREAD_KEY_DELETE_FUNC_TAOS_FORBID
|
||||
#define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_consistent PTHREAD_MUTEX_CONSISTENT_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_timedlock PTHREAD_MUTEX_TIMEDLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_getpshared PTHREAD_MUTEXATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_getrobust PTHREAD_MUTEXATTR_GETROBUST_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_gettype PTHREAD_MUTEXATTR_GETTYPE_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_setpshared PTHREAD_MUTEXATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_setrobust PTHREAD_MUTEXATTR_SETROBUST_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_settype PTHREAD_MUTEXATTR_SETTYPE_FUNC_TAOS_FORBID
|
||||
#define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_timedrdlock PTHREAD_RWLOCK_TIMEDRDLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_timedwrlock PTHREAD_RWLOCK_TIMEDWRLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_tryrdlock PTHREAD_RWLOCK_TRYRDLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_trywrlock PTHREAD_RWLOCK_TRYWRLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlockattr_destroy PTHREAD_RWLOCKATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlockattr_getpshared PTHREAD_RWLOCKATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlockattr_init PTHREAD_RWLOCKATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlockattr_setpshared PTHREAD_RWLOCKATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID
|
||||
#define pthread_setcancelstate PTHREAD_SETCANCELSTATE_FUNC_TAOS_FORBID
|
||||
#define pthread_setcanceltype PTHREAD_SETCANCELTYPE_FUNC_TAOS_FORBID
|
||||
#define pthread_setschedparam PTHREAD_SETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_setspecific PTHREAD_SETSPECIFIC_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_trylock PTHREAD_SPIN_TRYLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID
|
||||
#define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID
|
||||
#define sigwait SIGWAIT_FUNC_TAOS_FORBID
|
||||
#define pthread_t PTHREAD_T_TYPE_TAOS_FORBID
|
||||
#define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID
|
||||
#define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID
|
||||
#define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID
|
||||
#define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID
|
||||
#define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID
|
||||
#define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_key_t PTHREAD_KEY_T_TYPE_TAOS_FORBID
|
||||
#define pthread_barrier_t PTHREAD_BARRIER_T_TYPE_TAOS_FORBID
|
||||
#define pthread_barrierattr_t PTHREAD_BARRIERATTR_T_TYPE_TAOS_FORBID
|
||||
#define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getdetachstate PTHREAD_ATTR_GETDETACHSTATE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getscope PTHREAD_ATTR_GETSCOPE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE_FUNC_TAOS_FORBID
|
||||
#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE_FUNC_TAOS_FORBID
|
||||
#define pthread_barrier_destroy PTHREAD_BARRIER_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_barrier_init PTHREAD_BARRIER_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_barrier_wait PTHREAD_BARRIER_WAIT_FUNC_TAOS_FORBID
|
||||
#define pthread_barrierattr_destroy PTHREAD_BARRIERATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_barrierattr_getpshared PTHREAD_BARRIERATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_barrierattr_init PTHREAD_BARRIERATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_barrierattr_setpshared PTHREAD_BARRIERATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID
|
||||
#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_getpshared PTHREAD_CONDATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID
|
||||
#define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID
|
||||
#define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID
|
||||
#define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID
|
||||
#define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID
|
||||
#define pthread_key_create PTHREAD_KEY_CREATE_FUNC_TAOS_FORBID
|
||||
#define pthread_key_delete PTHREAD_KEY_DELETE_FUNC_TAOS_FORBID
|
||||
#define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_consistent PTHREAD_MUTEX_CONSISTENT_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_timedlock PTHREAD_MUTEX_TIMEDLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_getpshared PTHREAD_MUTEXATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_getrobust PTHREAD_MUTEXATTR_GETROBUST_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_gettype PTHREAD_MUTEXATTR_GETTYPE_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_setpshared PTHREAD_MUTEXATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_setrobust PTHREAD_MUTEXATTR_SETROBUST_FUNC_TAOS_FORBID
|
||||
#define pthread_mutexattr_settype PTHREAD_MUTEXATTR_SETTYPE_FUNC_TAOS_FORBID
|
||||
#define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_timedrdlock PTHREAD_RWLOCK_TIMEDRDLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_timedwrlock PTHREAD_RWLOCK_TIMEDWRLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_tryrdlock PTHREAD_RWLOCK_TRYRDLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_trywrlock PTHREAD_RWLOCK_TRYWRLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlockattr_destroy PTHREAD_RWLOCKATTR_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlockattr_getpshared PTHREAD_RWLOCKATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlockattr_init PTHREAD_RWLOCKATTR_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_rwlockattr_setpshared PTHREAD_RWLOCKATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||
#define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID
|
||||
#define pthread_setcancelstate PTHREAD_SETCANCELSTATE_FUNC_TAOS_FORBID
|
||||
#define pthread_setcanceltype PTHREAD_SETCANCELTYPE_FUNC_TAOS_FORBID
|
||||
#define pthread_setschedparam PTHREAD_SETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||
#define pthread_setspecific PTHREAD_SETSPECIFIC_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_trylock PTHREAD_SPIN_TRYLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID
|
||||
#define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID
|
||||
#define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID
|
||||
#define sigwait SIGWAIT_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
int32_t taosThreadCreate(TdThread * tid, const TdThreadAttr * attr, void *(*start)(void *), void *arg);
|
||||
int32_t taosThreadAttrDestroy(TdThreadAttr * attr);
|
||||
int32_t taosThreadAttrGetDetachState(const TdThreadAttr * attr, int32_t *detachstate);
|
||||
int32_t taosThreadAttrGetInheritSched(const TdThreadAttr * attr, int32_t *inheritsched);
|
||||
int32_t taosThreadAttrGetSchedParam(const TdThreadAttr * attr, struct sched_param *param);
|
||||
int32_t taosThreadAttrGetSchedPolicy(const TdThreadAttr * attr, int32_t *policy);
|
||||
int32_t taosThreadAttrGetScope(const TdThreadAttr * attr, int32_t *contentionscope);
|
||||
int32_t taosThreadAttrGetStackSize(const TdThreadAttr * attr, size_t * stacksize);
|
||||
int32_t taosThreadAttrInit(TdThreadAttr * attr);
|
||||
int32_t taosThreadAttrSetDetachState(TdThreadAttr * attr, int32_t detachstate);
|
||||
int32_t taosThreadAttrSetInheritSched(TdThreadAttr * attr, int32_t inheritsched);
|
||||
int32_t taosThreadAttrSetSchedParam(TdThreadAttr * attr, const struct sched_param *param);
|
||||
int32_t taosThreadAttrSetSchedPolicy(TdThreadAttr * attr, int32_t policy);
|
||||
int32_t taosThreadAttrSetScope(TdThreadAttr * attr, int32_t contentionscope);
|
||||
int32_t taosThreadAttrSetStackSize(TdThreadAttr * attr, size_t stacksize);
|
||||
int32_t taosThreadCreate(TdThread *tid, const TdThreadAttr *attr, void *(*start)(void *), void *arg);
|
||||
int32_t taosThreadAttrDestroy(TdThreadAttr *attr);
|
||||
int32_t taosThreadAttrGetDetachState(const TdThreadAttr *attr, int32_t *detachstate);
|
||||
int32_t taosThreadAttrGetInheritSched(const TdThreadAttr *attr, int32_t *inheritsched);
|
||||
int32_t taosThreadAttrGetSchedParam(const TdThreadAttr *attr, struct sched_param *param);
|
||||
int32_t taosThreadAttrGetSchedPolicy(const TdThreadAttr *attr, int32_t *policy);
|
||||
int32_t taosThreadAttrGetScope(const TdThreadAttr *attr, int32_t *contentionscope);
|
||||
int32_t taosThreadAttrGetStackSize(const TdThreadAttr *attr, size_t *stacksize);
|
||||
int32_t taosThreadAttrInit(TdThreadAttr *attr);
|
||||
int32_t taosThreadAttrSetDetachState(TdThreadAttr *attr, int32_t detachstate);
|
||||
int32_t taosThreadAttrSetInheritSched(TdThreadAttr *attr, int32_t inheritsched);
|
||||
int32_t taosThreadAttrSetSchedParam(TdThreadAttr *attr, const struct sched_param *param);
|
||||
int32_t taosThreadAttrSetSchedPolicy(TdThreadAttr *attr, int32_t policy);
|
||||
int32_t taosThreadAttrSetScope(TdThreadAttr *attr, int32_t contentionscope);
|
||||
int32_t taosThreadAttrSetStackSize(TdThreadAttr *attr, size_t stacksize);
|
||||
int32_t taosThreadCancel(TdThread thread);
|
||||
int32_t taosThreadCondDestroy(TdThreadCond * cond);
|
||||
int32_t taosThreadCondInit(TdThreadCond * cond, const TdThreadCondAttr * attr);
|
||||
int32_t taosThreadCondSignal(TdThreadCond * cond);
|
||||
int32_t taosThreadCondBroadcast(TdThreadCond * cond);
|
||||
int32_t taosThreadCondWait(TdThreadCond * cond, TdThreadMutex * mutex);
|
||||
int32_t taosThreadCondTimedWait(TdThreadCond * cond, TdThreadMutex * mutex, const struct timespec *abstime);
|
||||
int32_t taosThreadCondAttrDestroy(TdThreadCondAttr * attr);
|
||||
int32_t taosThreadCondAttrGetPshared(const TdThreadCondAttr * attr, int32_t *pshared);
|
||||
int32_t taosThreadCondAttrInit(TdThreadCondAttr * attr);
|
||||
int32_t taosThreadCondAttrSetPshared(TdThreadCondAttr * attr, int32_t pshared);
|
||||
int32_t taosThreadCondDestroy(TdThreadCond *cond);
|
||||
int32_t taosThreadCondInit(TdThreadCond *cond, const TdThreadCondAttr *attr);
|
||||
int32_t taosThreadCondSignal(TdThreadCond *cond);
|
||||
int32_t taosThreadCondBroadcast(TdThreadCond *cond);
|
||||
int32_t taosThreadCondWait(TdThreadCond *cond, TdThreadMutex *mutex);
|
||||
int32_t taosThreadCondTimedWait(TdThreadCond *cond, TdThreadMutex *mutex, const struct timespec *abstime);
|
||||
int32_t taosThreadCondAttrDestroy(TdThreadCondAttr *attr);
|
||||
int32_t taosThreadCondAttrGetPshared(const TdThreadCondAttr *attr, int32_t *pshared);
|
||||
int32_t taosThreadCondAttrInit(TdThreadCondAttr *attr);
|
||||
int32_t taosThreadCondAttrSetPshared(TdThreadCondAttr *attr, int32_t pshared);
|
||||
int32_t taosThreadDetach(TdThread thread);
|
||||
int32_t taosThreadEqual(TdThread t1, TdThread t2);
|
||||
void taosThreadExit(void *valuePtr);
|
||||
void taosThreadExit(void *valuePtr);
|
||||
int32_t taosThreadGetSchedParam(TdThread thread, int32_t *policy, struct sched_param *param);
|
||||
void *taosThreadGetSpecific(TdThreadKey key);
|
||||
void *taosThreadGetSpecific(TdThreadKey key);
|
||||
int32_t taosThreadJoin(TdThread thread, void **valuePtr);
|
||||
int32_t taosThreadKeyCreate(TdThreadKey * key, void(*destructor)(void *));
|
||||
int32_t taosThreadKeyCreate(TdThreadKey *key, void (*destructor)(void *));
|
||||
int32_t taosThreadKeyDelete(TdThreadKey key);
|
||||
int32_t taosThreadKill(TdThread thread, int32_t sig);
|
||||
// int32_t taosThreadMutexConsistent(TdThreadMutex* mutex);
|
||||
int32_t taosThreadMutexDestroy(TdThreadMutex * mutex);
|
||||
int32_t taosThreadMutexInit(TdThreadMutex * mutex, const TdThreadMutexAttr * attr);
|
||||
int32_t taosThreadMutexLock(TdThreadMutex * mutex);
|
||||
int32_t taosThreadMutexDestroy(TdThreadMutex *mutex);
|
||||
int32_t taosThreadMutexInit(TdThreadMutex *mutex, const TdThreadMutexAttr *attr);
|
||||
int32_t taosThreadMutexLock(TdThreadMutex *mutex);
|
||||
// int32_t taosThreadMutexTimedLock(TdThreadMutex * mutex, const struct timespec *abstime);
|
||||
int32_t taosThreadMutexTryLock(TdThreadMutex * mutex);
|
||||
int32_t taosThreadMutexUnlock(TdThreadMutex * mutex);
|
||||
int32_t taosThreadMutexAttrDestroy(TdThreadMutexAttr * attr);
|
||||
int32_t taosThreadMutexAttrGetPshared(const TdThreadMutexAttr * attr, int32_t *pshared);
|
||||
int32_t taosThreadMutexTryLock(TdThreadMutex *mutex);
|
||||
int32_t taosThreadMutexUnlock(TdThreadMutex *mutex);
|
||||
int32_t taosThreadMutexAttrDestroy(TdThreadMutexAttr *attr);
|
||||
int32_t taosThreadMutexAttrGetPshared(const TdThreadMutexAttr *attr, int32_t *pshared);
|
||||
// int32_t taosThreadMutexAttrGetRobust(const TdThreadMutexAttr * attr, int32_t * robust);
|
||||
int32_t taosThreadMutexAttrGetType(const TdThreadMutexAttr * attr, int32_t *kind);
|
||||
int32_t taosThreadMutexAttrInit(TdThreadMutexAttr * attr);
|
||||
int32_t taosThreadMutexAttrSetPshared(TdThreadMutexAttr * attr, int32_t pshared);
|
||||
int32_t taosThreadMutexAttrGetType(const TdThreadMutexAttr *attr, int32_t *kind);
|
||||
int32_t taosThreadMutexAttrInit(TdThreadMutexAttr *attr);
|
||||
int32_t taosThreadMutexAttrSetPshared(TdThreadMutexAttr *attr, int32_t pshared);
|
||||
// int32_t taosThreadMutexAttrSetRobust(TdThreadMutexAttr * attr, int32_t robust);
|
||||
int32_t taosThreadMutexAttrSetType(TdThreadMutexAttr * attr, int32_t kind);
|
||||
int32_t taosThreadOnce(TdThreadOnce * onceControl, void(*initRoutine)(void));
|
||||
int32_t taosThreadRwlockDestroy(TdThreadRwlock * rwlock);
|
||||
int32_t taosThreadRwlockInit(TdThreadRwlock * rwlock, const TdThreadRwlockAttr * attr);
|
||||
int32_t taosThreadRwlockRdlock(TdThreadRwlock * rwlock);
|
||||
int32_t taosThreadMutexAttrSetType(TdThreadMutexAttr *attr, int32_t kind);
|
||||
int32_t taosThreadOnce(TdThreadOnce *onceControl, void (*initRoutine)(void));
|
||||
int32_t taosThreadRwlockDestroy(TdThreadRwlock *rwlock);
|
||||
int32_t taosThreadRwlockInit(TdThreadRwlock *rwlock, const TdThreadRwlockAttr *attr);
|
||||
int32_t taosThreadRwlockRdlock(TdThreadRwlock *rwlock);
|
||||
// int32_t taosThreadRwlockTimedRdlock(TdThreadRwlock * rwlock, const struct timespec *abstime);
|
||||
// int32_t taosThreadRwlockTimedWrlock(TdThreadRwlock * rwlock, const struct timespec *abstime);
|
||||
int32_t taosThreadRwlockTryRdlock(TdThreadRwlock * rwlock);
|
||||
int32_t taosThreadRwlockTryWrlock(TdThreadRwlock * rwlock);
|
||||
int32_t taosThreadRwlockUnlock(TdThreadRwlock * rwlock);
|
||||
int32_t taosThreadRwlockWrlock(TdThreadRwlock * rwlock);
|
||||
int32_t taosThreadRwlockAttrDestroy(TdThreadRwlockAttr * attr);
|
||||
int32_t taosThreadRwlockAttrGetPshared(const TdThreadRwlockAttr * attr, int32_t *pshared);
|
||||
int32_t taosThreadRwlockAttrInit(TdThreadRwlockAttr * attr);
|
||||
int32_t taosThreadRwlockAttrSetPshared(TdThreadRwlockAttr * attr, int32_t pshared);
|
||||
int32_t taosThreadRwlockTryRdlock(TdThreadRwlock *rwlock);
|
||||
int32_t taosThreadRwlockTryWrlock(TdThreadRwlock *rwlock);
|
||||
int32_t taosThreadRwlockUnlock(TdThreadRwlock *rwlock);
|
||||
int32_t taosThreadRwlockWrlock(TdThreadRwlock *rwlock);
|
||||
int32_t taosThreadRwlockAttrDestroy(TdThreadRwlockAttr *attr);
|
||||
int32_t taosThreadRwlockAttrGetPshared(const TdThreadRwlockAttr *attr, int32_t *pshared);
|
||||
int32_t taosThreadRwlockAttrInit(TdThreadRwlockAttr *attr);
|
||||
int32_t taosThreadRwlockAttrSetPshared(TdThreadRwlockAttr *attr, int32_t pshared);
|
||||
TdThread taosThreadSelf(void);
|
||||
int32_t taosThreadSetCancelState(int32_t state, int32_t *oldstate);
|
||||
int32_t taosThreadSetCancelType(int32_t type, int32_t *oldtype);
|
||||
int32_t taosThreadSetSchedParam(TdThread thread, int32_t policy, const struct sched_param *param);
|
||||
int32_t taosThreadSetSpecific(TdThreadKey key, const void *value);
|
||||
int32_t taosThreadSpinDestroy(TdThreadSpinlock * lock);
|
||||
int32_t taosThreadSpinInit(TdThreadSpinlock * lock, int32_t pshared);
|
||||
int32_t taosThreadSpinLock(TdThreadSpinlock * lock);
|
||||
int32_t taosThreadSpinTrylock(TdThreadSpinlock * lock);
|
||||
int32_t taosThreadSpinUnlock(TdThreadSpinlock * lock);
|
||||
void taosThreadTestCancel(void);
|
||||
void taosThreadClear(TdThread *thread);
|
||||
int32_t taosThreadSetCancelState(int32_t state, int32_t *oldstate);
|
||||
int32_t taosThreadSetCancelType(int32_t type, int32_t *oldtype);
|
||||
int32_t taosThreadSetSchedParam(TdThread thread, int32_t policy, const struct sched_param *param);
|
||||
int32_t taosThreadSetSpecific(TdThreadKey key, const void *value);
|
||||
int32_t taosThreadSpinDestroy(TdThreadSpinlock *lock);
|
||||
int32_t taosThreadSpinInit(TdThreadSpinlock *lock, int32_t pshared);
|
||||
int32_t taosThreadSpinLock(TdThreadSpinlock *lock);
|
||||
int32_t taosThreadSpinTrylock(TdThreadSpinlock *lock);
|
||||
int32_t taosThreadSpinUnlock(TdThreadSpinlock *lock);
|
||||
void taosThreadTestCancel(void);
|
||||
void taosThreadClear(TdThread *thread);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -23,22 +23,22 @@ extern "C" {
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define timer_create TIMER_CREATE_FUNC_TAOS_FORBID
|
||||
#define timer_settime TIMER_SETTIME_FUNC_TAOS_FORBID
|
||||
#define timer_delete TIMER_DELETE_FUNC_TAOS_FORBID
|
||||
#define timeSetEvent TIMESETEVENT_SETTIME_FUNC_TAOS_FORBID
|
||||
#define timeKillEvent TIMEKILLEVENT_SETTIME_FUNC_TAOS_FORBID
|
||||
#define timer_create TIMER_CREATE_FUNC_TAOS_FORBID
|
||||
#define timer_settime TIMER_SETTIME_FUNC_TAOS_FORBID
|
||||
#define timer_delete TIMER_DELETE_FUNC_TAOS_FORBID
|
||||
#define timeSetEvent TIMESETEVENT_SETTIME_FUNC_TAOS_FORBID
|
||||
#define timeKillEvent TIMEKILLEVENT_SETTIME_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
#define MSECONDS_PER_TICK 5
|
||||
|
||||
int32_t taosInitTimer(void (*callback)(int32_t), int32_t ms);
|
||||
void taosUninitTimer();
|
||||
int64_t taosGetMonotonicMs();
|
||||
int32_t taosInitTimer(void (*callback)(int32_t), int32_t ms);
|
||||
void taosUninitTimer();
|
||||
int64_t taosGetMonotonicMs();
|
||||
const char *taosMonotonicInit();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_OS_TIMER_H_*/
|
||||
#endif /*_TD_OS_TIMER_H_*/
|
||||
|
|
|
@ -23,36 +23,35 @@ extern "C" {
|
|||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||
// When you want to use this feature, you should find or add the same function in the following section.
|
||||
#ifndef ALLOW_FORBID_FUNC
|
||||
#define tzset TZSET_FUNC_TAOS_FORBID
|
||||
#define tzset TZSET_FUNC_TAOS_FORBID
|
||||
#endif
|
||||
|
||||
enum TdTimezone
|
||||
{
|
||||
TdWestZone12=-12,
|
||||
TdWestZone11,
|
||||
TdWestZone10,
|
||||
TdWestZone9,
|
||||
TdWestZone8,
|
||||
TdWestZone7,
|
||||
TdWestZone6,
|
||||
TdWestZone5,
|
||||
TdWestZone4,
|
||||
TdWestZone3,
|
||||
TdWestZone2,
|
||||
TdWestZone1,
|
||||
TdZeroZone,
|
||||
TdEastZone1,
|
||||
TdEastZone2,
|
||||
TdEastZone3,
|
||||
TdEastZone4,
|
||||
TdEastZone5,
|
||||
TdEastZone6,
|
||||
TdEastZone7,
|
||||
TdEastZone8,
|
||||
TdEastZone9,
|
||||
TdEastZone10,
|
||||
TdEastZone11,
|
||||
TdEastZone12
|
||||
enum TdTimezone {
|
||||
TdWestZone12 = -12,
|
||||
TdWestZone11,
|
||||
TdWestZone10,
|
||||
TdWestZone9,
|
||||
TdWestZone8,
|
||||
TdWestZone7,
|
||||
TdWestZone6,
|
||||
TdWestZone5,
|
||||
TdWestZone4,
|
||||
TdWestZone3,
|
||||
TdWestZone2,
|
||||
TdWestZone1,
|
||||
TdZeroZone,
|
||||
TdEastZone1,
|
||||
TdEastZone2,
|
||||
TdEastZone3,
|
||||
TdEastZone4,
|
||||
TdEastZone5,
|
||||
TdEastZone6,
|
||||
TdEastZone7,
|
||||
TdEastZone8,
|
||||
TdEastZone9,
|
||||
TdEastZone10,
|
||||
TdEastZone11,
|
||||
TdEastZone12
|
||||
};
|
||||
|
||||
void taosGetSystemTimezone(char *outTimezone, enum TdTimezone *tsTimezone);
|
||||
|
|
|
@ -25,26 +25,25 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef struct SBloomFilter {
|
||||
uint32_t hashFunctions;
|
||||
uint64_t expectedEntries;
|
||||
uint64_t numUnits;
|
||||
uint64_t numBits;
|
||||
uint64_t size;
|
||||
uint32_t hashFunctions;
|
||||
uint64_t expectedEntries;
|
||||
uint64_t numUnits;
|
||||
uint64_t numBits;
|
||||
uint64_t size;
|
||||
_hash_fn_t hashFn1;
|
||||
_hash_fn_t hashFn2;
|
||||
void *buffer;
|
||||
double errorRate;
|
||||
void *buffer;
|
||||
double errorRate;
|
||||
} SBloomFilter;
|
||||
|
||||
SBloomFilter *tBloomFilterInit(uint64_t expectedEntries, double errorRate);
|
||||
int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len);
|
||||
int32_t tBloomFilterNoContain(const SBloomFilter *pBF, const void *keyBuf,
|
||||
uint32_t len);
|
||||
void tBloomFilterDestroy(SBloomFilter *pBF);
|
||||
void tBloomFilterDump(const SBloomFilter *pBF);
|
||||
bool tBloomFilterIsFull(const SBloomFilter *pBF);
|
||||
int32_t tBloomFilterEncode(const SBloomFilter *pBF, SEncoder* pEncoder);
|
||||
SBloomFilter* tBloomFilterDecode(SDecoder* pDecoder);
|
||||
int32_t tBloomFilterPut(SBloomFilter *pBF, const void *keyBuf, uint32_t len);
|
||||
int32_t tBloomFilterNoContain(const SBloomFilter *pBF, const void *keyBuf, uint32_t len);
|
||||
void tBloomFilterDestroy(SBloomFilter *pBF);
|
||||
void tBloomFilterDump(const SBloomFilter *pBF);
|
||||
bool tBloomFilterIsFull(const SBloomFilter *pBF);
|
||||
int32_t tBloomFilterEncode(const SBloomFilter *pBF, SEncoder *pEncoder);
|
||||
SBloomFilter *tBloomFilterDecode(SDecoder *pDecoder);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -105,11 +105,11 @@ int32_t cfgAddTimezone(SConfig *pCfg, const char *name, const char *defaultVal);
|
|||
const char *cfgStypeStr(ECfgSrcType type);
|
||||
const char *cfgDtypeStr(ECfgDataType type);
|
||||
|
||||
void cfgDumpItemValue(SConfigItem *pItem, char* buf, int32_t bufSize, int32_t* pLen);
|
||||
void cfgDumpItemValue(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t *pLen);
|
||||
|
||||
void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump);
|
||||
|
||||
int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl);
|
||||
int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char *apolloUrl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
/*
|
||||
Copyright (c) 2013 - 2014, 2016 Mark Adler, Robert Vazan, Max Vysokikh
|
||||
Copyright (c) 2013 - 2014, 2016 Mark Adler, Robert Vazan, Max Vysokikh
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the author be held liable for any damages
|
||||
arising from the use of this software.
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the author be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef _TD_UTIL_CRC32_H_
|
||||
#define _TD_UTIL_CRC32_H_
|
||||
|
@ -41,4 +41,4 @@ void taosResolveCRC();
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /*_TD_UTIL_CRC32_H_*/
|
||||
#endif /*_TD_UTIL_CRC32_H_*/
|
||||
|
|
|
@ -22,50 +22,53 @@
|
|||
#ifndef TDIGEST_H
|
||||
#define TDIGEST_H
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846264338327950288 /* pi */
|
||||
#define M_PI 3.14159265358979323846264338327950288 /* pi */
|
||||
#endif
|
||||
|
||||
#define DOUBLE_MAX 1.79e+308
|
||||
|
||||
#define ADDITION_CENTROID_NUM 2
|
||||
#define COMPRESSION 300
|
||||
#define ADDITION_CENTROID_NUM 2
|
||||
#define COMPRESSION 300
|
||||
#define GET_CENTROID(compression) (ceil(compression * M_PI / 2) + 1 + ADDITION_CENTROID_NUM)
|
||||
#define GET_THRESHOLD(compression) (7.5 + 0.37 * compression - 2e-4 * pow(compression, 2))
|
||||
#define TDIGEST_SIZE(compression) (sizeof(TDigest) + sizeof(SCentroid)*GET_CENTROID(compression) + sizeof(SPt)*GET_THRESHOLD(compression))
|
||||
#define TDIGEST_SIZE(compression) \
|
||||
(sizeof(TDigest) + sizeof(SCentroid) * GET_CENTROID(compression) + sizeof(SPt) * GET_THRESHOLD(compression))
|
||||
|
||||
typedef struct SCentroid {
|
||||
double mean;
|
||||
int64_t weight;
|
||||
}SCentroid;
|
||||
double mean;
|
||||
int64_t weight;
|
||||
} SCentroid;
|
||||
|
||||
typedef struct SPt {
|
||||
double value;
|
||||
int64_t weight;
|
||||
}SPt;
|
||||
double value;
|
||||
int64_t weight;
|
||||
} SPt;
|
||||
|
||||
typedef struct TDigest {
|
||||
double compression;
|
||||
int32_t threshold;
|
||||
int64_t size;
|
||||
double compression;
|
||||
int32_t threshold;
|
||||
int64_t size;
|
||||
|
||||
int64_t total_weight;
|
||||
double min;
|
||||
double max;
|
||||
int64_t total_weight;
|
||||
double min;
|
||||
double max;
|
||||
|
||||
int32_t num_buffered_pts;
|
||||
SPt *buffered_pts;
|
||||
int32_t num_buffered_pts;
|
||||
SPt *buffered_pts;
|
||||
|
||||
int32_t num_centroids;
|
||||
SCentroid *centroids;
|
||||
}TDigest;
|
||||
int32_t num_centroids;
|
||||
SCentroid *centroids;
|
||||
} TDigest;
|
||||
|
||||
TDigest *tdigestNewFrom(void* pBuf, int32_t compression);
|
||||
void tdigestAdd(TDigest *t, double x, int64_t w);
|
||||
void tdigestMerge(TDigest *t1, TDigest *t2);
|
||||
double tdigestQuantile(TDigest *t, double q);
|
||||
void tdigestCompress(TDigest *t);
|
||||
void tdigestFreeFrom(TDigest *t);
|
||||
void tdigestAutoFill(TDigest* t, int32_t compression);
|
||||
TDigest *tdigestNewFrom(void *pBuf, int32_t compression);
|
||||
void tdigestAdd(TDigest *t, double x, int64_t w);
|
||||
void tdigestMerge(TDigest *t1, TDigest *t2);
|
||||
double tdigestQuantile(TDigest *t, double q);
|
||||
void tdigestCompress(TDigest *t);
|
||||
void tdigestFreeFrom(TDigest *t);
|
||||
void tdigestAutoFill(TDigest *t, int32_t compression);
|
||||
|
||||
#endif /* TDIGEST_H */
|
||||
|
|
|
@ -29,7 +29,7 @@ typedef void (*_hash_before_fn_t)(void *);
|
|||
typedef void (*_hash_free_fn_t)(void *);
|
||||
|
||||
#define HASH_KEY_ALREADY_EXISTS (-2)
|
||||
#define HASH_NODE_EXIST(code) (code == HASH_KEY_ALREADY_EXISTS)
|
||||
#define HASH_NODE_EXIST(code) (code == HASH_KEY_ALREADY_EXISTS)
|
||||
|
||||
/**
|
||||
* murmur hash algorithm
|
||||
|
@ -50,7 +50,7 @@ uint64_t MurmurHash3_64(const char *key, uint32_t len);
|
|||
uint32_t taosIntHash_32(const char *key, uint32_t len);
|
||||
uint32_t taosIntHash_64(const char *key, uint32_t len);
|
||||
|
||||
_hash_fn_t taosGetDefaultHashFunction(int32_t type);
|
||||
_hash_fn_t taosGetDefaultHashFunction(int32_t type);
|
||||
_equal_fn_t taosGetDefaultEqualFunction(int32_t type);
|
||||
|
||||
typedef enum SHashLockTypeE {
|
||||
|
@ -59,7 +59,7 @@ typedef enum SHashLockTypeE {
|
|||
} SHashLockTypeE;
|
||||
|
||||
typedef struct SHashNode SHashNode;
|
||||
typedef struct SHashObj SHashObj;
|
||||
typedef struct SHashObj SHashObj;
|
||||
|
||||
/**
|
||||
* init the hash table
|
||||
|
@ -118,7 +118,7 @@ int32_t taosHashGetDup(SHashObj *pHashObj, const void *key, size_t keyLen, void
|
|||
* @param size
|
||||
* @return
|
||||
*/
|
||||
int32_t taosHashGetDup_m(SHashObj* pHashObj, const void* key, size_t keyLen, void** destBuf, int32_t* size);
|
||||
int32_t taosHashGetDup_m(SHashObj *pHashObj, const void *key, size_t keyLen, void **destBuf, int32_t *size);
|
||||
|
||||
/**
|
||||
* remove item with the specified key
|
||||
|
@ -169,13 +169,13 @@ void *taosHashIterate(SHashObj *pHashObj, void *p);
|
|||
*/
|
||||
void taosHashCancelIterate(SHashObj *pHashObj, void *p);
|
||||
|
||||
/**
|
||||
* Get the corresponding key information for a given data in hash table
|
||||
* @param data
|
||||
* @param keyLen
|
||||
* @return
|
||||
*/
|
||||
void *taosHashGetKey(void *data, size_t* keyLen);
|
||||
/**
|
||||
* Get the corresponding key information for a given data in hash table
|
||||
* @param data
|
||||
* @param keyLen
|
||||
* @return
|
||||
*/
|
||||
void *taosHashGetKey(void *data, size_t *keyLen);
|
||||
|
||||
/**
|
||||
* return the payload data with the specified key(reference number added)
|
||||
|
|
|
@ -23,10 +23,10 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef struct {
|
||||
int32_t maxId;
|
||||
int32_t numOfFree;
|
||||
int32_t freeSlot;
|
||||
bool *freeList;
|
||||
int32_t maxId;
|
||||
int32_t numOfFree;
|
||||
int32_t freeSlot;
|
||||
bool *freeList;
|
||||
TdThreadMutex mutex;
|
||||
} id_pool_t;
|
||||
|
||||
|
|
|
@ -28,37 +28,34 @@ typedef void (*_taos_lru_deleter_t)(const void *key, size_t keyLen, void *value)
|
|||
|
||||
typedef struct LRUHandle LRUHandle;
|
||||
|
||||
typedef enum {
|
||||
TAOS_LRU_PRIORITY_HIGH,
|
||||
TAOS_LRU_PRIORITY_LOW
|
||||
} LRUPriority;
|
||||
|
||||
typedef enum { TAOS_LRU_PRIORITY_HIGH, TAOS_LRU_PRIORITY_LOW } LRUPriority;
|
||||
|
||||
typedef enum {
|
||||
TAOS_LRU_STATUS_OK,
|
||||
TAOS_LRU_STATUS_FAIL,
|
||||
TAOS_LRU_STATUS_INCOMPLETE,
|
||||
TAOS_LRU_STATUS_OK_OVERWRITTEN
|
||||
} LRUStatus;
|
||||
|
||||
SLRUCache *taosLRUCacheInit(size_t capacity, int numShardBits, double highPriPoolRatio);
|
||||
void taosLRUCacheCleanup(SLRUCache *cache);
|
||||
|
||||
LRUStatus taosLRUCacheInsert(SLRUCache *cache, const void *key, size_t keyLen, void *value, size_t charge,
|
||||
_taos_lru_deleter_t deleter, LRUHandle **handle, LRUPriority priority);
|
||||
LRUHandle *taosLRUCacheLookup(SLRUCache * cache, const void *key, size_t keyLen);
|
||||
void taosLRUCacheErase(SLRUCache * cache, const void *key, size_t keyLen);
|
||||
SLRUCache *taosLRUCacheInit(size_t capacity, int numShardBits, double highPriPoolRatio);
|
||||
void taosLRUCacheCleanup(SLRUCache *cache);
|
||||
|
||||
LRUStatus taosLRUCacheInsert(SLRUCache *cache, const void *key, size_t keyLen, void *value, size_t charge,
|
||||
_taos_lru_deleter_t deleter, LRUHandle **handle, LRUPriority priority);
|
||||
LRUHandle *taosLRUCacheLookup(SLRUCache *cache, const void *key, size_t keyLen);
|
||||
void taosLRUCacheErase(SLRUCache *cache, const void *key, size_t keyLen);
|
||||
|
||||
void taosLRUCacheEraseUnrefEntries(SLRUCache *cache);
|
||||
|
||||
bool taosLRUCacheRef(SLRUCache *cache, LRUHandle *handle);
|
||||
bool taosLRUCacheRelease(SLRUCache *cache, LRUHandle *handle, bool eraseIfLastRef);
|
||||
|
||||
void* taosLRUCacheValue(SLRUCache *cache, LRUHandle *handle);
|
||||
void *taosLRUCacheValue(SLRUCache *cache, LRUHandle *handle);
|
||||
|
||||
size_t taosLRUCacheGetUsage(SLRUCache *cache);
|
||||
size_t taosLRUCacheGetPinnedUsage(SLRUCache *cache);
|
||||
|
||||
void taosLRUCacheSetCapacity(SLRUCache *cache, size_t capacity);
|
||||
void taosLRUCacheSetCapacity(SLRUCache *cache, size_t capacity);
|
||||
size_t taosLRUCacheGetCapacity(SLRUCache *cache);
|
||||
|
||||
void taosLRUCacheSetStrictCapacity(SLRUCache *cache, bool strict);
|
||||
|
|
|
@ -53,7 +53,8 @@ typedef struct SDiskbasedBufStatis {
|
|||
* @param handle
|
||||
* @return
|
||||
*/
|
||||
int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMemBufSize, const char* id, const char* dir);
|
||||
int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMemBufSize, const char* id,
|
||||
const char* dir);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -158,7 +159,7 @@ void setBufPageCompressOnDisk(SDiskbasedBuf* pBuf, bool comp);
|
|||
* @param pBuf
|
||||
* @param pageId
|
||||
*/
|
||||
void dBufSetBufPageRecycled(SDiskbasedBuf *pBuf, void* pPage);
|
||||
void dBufSetBufPageRecycled(SDiskbasedBuf* pBuf, void* pPage);
|
||||
|
||||
/**
|
||||
* Print the statistics when closing this buffer
|
||||
|
|
|
@ -23,18 +23,17 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef struct SScalableBf {
|
||||
SArray *bfArray; // array of bloom filters
|
||||
SArray *bfArray; // array of bloom filters
|
||||
uint32_t growth;
|
||||
uint64_t numBits;
|
||||
} SScalableBf;
|
||||
|
||||
SScalableBf *tScalableBfInit(uint64_t expectedEntries, double errorRate);
|
||||
int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len);
|
||||
int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf,
|
||||
uint32_t len);
|
||||
void tScalableBfDestroy(SScalableBf *pSBf);
|
||||
int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder* pEncoder);
|
||||
SScalableBf* tScalableBfDecode(SDecoder* pDecoder);
|
||||
int32_t tScalableBfPut(SScalableBf *pSBf, const void *keyBuf, uint32_t len);
|
||||
int32_t tScalableBfNoContain(const SScalableBf *pSBf, const void *keyBuf, uint32_t len);
|
||||
void tScalableBfDestroy(SScalableBf *pSBf);
|
||||
int32_t tScalableBfEncode(const SScalableBf *pSBf, SEncoder *pEncoder);
|
||||
SScalableBf *tScalableBfDecode(SDecoder *pDecoder);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
TdThread* taosCreateThread(void* (*__start_routine)(void*), void* param);
|
||||
bool taosDestroyThread(TdThread* pthread);
|
||||
bool taosThreadRunning(TdThread* pthread);
|
||||
bool taosDestroyThread(TdThread* pthread);
|
||||
bool taosThreadRunning(TdThread* pthread);
|
||||
|
||||
typedef void *(*ThreadFp)(void *param);
|
||||
typedef void* (*ThreadFp)(void* param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include "os.h"
|
||||
#include "tcrc32c.h"
|
||||
#include "tdef.h"
|
||||
#include "tmd5.h"
|
||||
#include "thash.h"
|
||||
#include "tmd5.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -71,7 +71,7 @@ static FORCE_INLINE void taosEncryptPass_c(uint8_t *inBuf, size_t len, char *tar
|
|||
}
|
||||
|
||||
static FORCE_INLINE int32_t taosGetTbHashVal(const char *tbname, int32_t tblen, int32_t method, int32_t prefix,
|
||||
int32_t suffix) {
|
||||
int32_t suffix) {
|
||||
if (prefix == 0 && suffix == 0) {
|
||||
return MurmurHash3_32(tbname, tblen);
|
||||
} else {
|
||||
|
|
|
@ -61,17 +61,15 @@ bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) {
|
|||
|
||||
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet) {
|
||||
taosCorBeginWrite(&pEpSet->version);
|
||||
pEpSet->epSet = *pNewEpSet;
|
||||
pEpSet->epSet = *pNewEpSet;
|
||||
taosCorEndWrite(&pEpSet->version);
|
||||
}
|
||||
|
||||
SEpSet getEpSet_s(SCorEpSet* pEpSet) {
|
||||
SEpSet ep = {0};
|
||||
taosCorBeginRead(&pEpSet->version);
|
||||
ep = pEpSet->epSet;
|
||||
ep = pEpSet->epSet;
|
||||
taosCorEndRead(&pEpSet->version);
|
||||
|
||||
return ep;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -67,11 +67,11 @@ static int64_t user_mktime64(const uint32_t year0, const uint32_t mon0, const ui
|
|||
// ==== mktime() kernel code =================//
|
||||
static int64_t m_deltaUtc = 0;
|
||||
void deltaToUtcInitOnce() {
|
||||
struct tm tm = {0};
|
||||
struct tm tm = {0};
|
||||
|
||||
(void)taosStrpTime("1970-01-01 00:00:00", (const char*)("%Y-%m-%d %H:%M:%S"), &tm);
|
||||
m_deltaUtc = (int64_t)taosMktime(&tm);
|
||||
// printf("====delta:%lld\n\n", seconds);
|
||||
(void)taosStrpTime("1970-01-01 00:00:00", (const char*)("%Y-%m-%d %H:%M:%S"), &tm);
|
||||
m_deltaUtc = (int64_t)taosMktime(&tm);
|
||||
// printf("====delta:%lld\n\n", seconds);
|
||||
}
|
||||
|
||||
static int64_t parseFraction(char* str, char** end, int32_t timePrec);
|
||||
|
@ -81,8 +81,8 @@ static int32_t parseLocaltimeDst(char* timestr, int32_t len, int64_t* utime, int
|
|||
static char* forwardToTimeStringEnd(char* str);
|
||||
static bool checkTzPresent(const char* str, int32_t len);
|
||||
|
||||
static int32_t (*parseLocaltimeFp[])(char* timestr, int32_t len, int64_t* utime, int32_t timePrec, char delim) = {parseLocaltime,
|
||||
parseLocaltimeDst};
|
||||
static int32_t (*parseLocaltimeFp[])(char* timestr, int32_t len, int64_t* utime, int32_t timePrec, char delim) = {
|
||||
parseLocaltime, parseLocaltimeDst};
|
||||
|
||||
int32_t taosParseTime(const char* timestr, int64_t* utime, int32_t len, int32_t timePrec, int8_t day_light) {
|
||||
/* parse datatime string in with tz */
|
||||
|
@ -324,7 +324,7 @@ static FORCE_INLINE bool validateTm(struct tm* pTm) {
|
|||
|
||||
int32_t leapYearMonthDay = 29;
|
||||
int32_t year = pTm->tm_year + 1900;
|
||||
bool isLeapYear = ((year % 100) == 0)? ((year % 400) == 0):((year % 4) == 0);
|
||||
bool isLeapYear = ((year % 100) == 0) ? ((year % 400) == 0) : ((year % 4) == 0);
|
||||
|
||||
if (isLeapYear && (pTm->tm_mon == 1)) {
|
||||
if (pTm->tm_mday > leapYearMonthDay) {
|
||||
|
@ -336,14 +336,14 @@ static FORCE_INLINE bool validateTm(struct tm* pTm) {
|
|||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t parseLocaltime(char* timestr, int32_t len, int64_t* time, int32_t timePrec, char delim) {
|
||||
*time = 0;
|
||||
struct tm tm = {0};
|
||||
|
||||
char *str;
|
||||
char* str;
|
||||
if (delim == 'T') {
|
||||
str = taosStrpTime(timestr, "%Y-%m-%dT%H:%M:%S", &tm);
|
||||
} else if (delim == 0) {
|
||||
|
@ -353,7 +353,7 @@ int32_t parseLocaltime(char* timestr, int32_t len, int64_t* time, int32_t timePr
|
|||
}
|
||||
|
||||
if (str == NULL || (((str - timestr) < len) && (*str != '.')) || !validateTm(&tm)) {
|
||||
//if parse failed, try "%Y-%m-%d" format
|
||||
// if parse failed, try "%Y-%m-%d" format
|
||||
str = taosStrpTime(timestr, "%Y-%m-%d", &tm);
|
||||
if (str == NULL || (((str - timestr) < len) && (*str != '.')) || !validateTm(&tm)) {
|
||||
return -1;
|
||||
|
@ -390,7 +390,7 @@ int32_t parseLocaltimeDst(char* timestr, int32_t len, int64_t* time, int32_t tim
|
|||
struct tm tm = {0};
|
||||
tm.tm_isdst = -1;
|
||||
|
||||
char *str;
|
||||
char* str;
|
||||
if (delim == 'T') {
|
||||
str = taosStrpTime(timestr, "%Y-%m-%dT%H:%M:%S", &tm);
|
||||
} else if (delim == 0) {
|
||||
|
@ -400,7 +400,7 @@ int32_t parseLocaltimeDst(char* timestr, int32_t len, int64_t* time, int32_t tim
|
|||
}
|
||||
|
||||
if (str == NULL || (((str - timestr) < len) && (*str != '.')) || !validateTm(&tm)) {
|
||||
//if parse failed, try "%Y-%m-%d" format
|
||||
// if parse failed, try "%Y-%m-%d" format
|
||||
str = taosStrpTime(timestr, "%Y-%m-%d", &tm);
|
||||
if (str == NULL || (((str - timestr) < len) && (*str != '.')) || !validateTm(&tm)) {
|
||||
return -1;
|
||||
|
@ -438,14 +438,12 @@ char getPrecisionUnit(int32_t precision) {
|
|||
}
|
||||
|
||||
int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision) {
|
||||
assert(fromPrecision == TSDB_TIME_PRECISION_MILLI ||
|
||||
fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||
assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||
fromPrecision == TSDB_TIME_PRECISION_NANO);
|
||||
assert(toPrecision == TSDB_TIME_PRECISION_MILLI ||
|
||||
toPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||
assert(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||
toPrecision == TSDB_TIME_PRECISION_NANO);
|
||||
double tempResult = (double)time;
|
||||
switch(fromPrecision) {
|
||||
switch (fromPrecision) {
|
||||
case TSDB_TIME_PRECISION_MILLI: {
|
||||
switch (toPrecision) {
|
||||
case TSDB_TIME_PRECISION_MILLI:
|
||||
|
@ -459,7 +457,7 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec
|
|||
time *= 1000000;
|
||||
goto end_;
|
||||
}
|
||||
} // end from milli
|
||||
} // end from milli
|
||||
case TSDB_TIME_PRECISION_MICRO: {
|
||||
switch (toPrecision) {
|
||||
case TSDB_TIME_PRECISION_MILLI:
|
||||
|
@ -471,7 +469,7 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec
|
|||
time *= 1000;
|
||||
goto end_;
|
||||
}
|
||||
} //end from micro
|
||||
} // end from micro
|
||||
case TSDB_TIME_PRECISION_NANO: {
|
||||
switch (toPrecision) {
|
||||
case TSDB_TIME_PRECISION_MILLI:
|
||||
|
@ -481,20 +479,21 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec
|
|||
case TSDB_TIME_PRECISION_NANO:
|
||||
return time;
|
||||
}
|
||||
} //end from nano
|
||||
} // end from nano
|
||||
default: {
|
||||
assert(0);
|
||||
return time; // only to pass windows compilation
|
||||
}
|
||||
} //end switch fromPrecision
|
||||
} // end switch fromPrecision
|
||||
end_:
|
||||
if (tempResult >= (double)INT64_MAX) return INT64_MAX;
|
||||
if (tempResult <= (double)INT64_MIN) return INT64_MIN; // INT64_MIN means NULL
|
||||
return time;
|
||||
}
|
||||
|
||||
// !!!!notice:there are precision problems, double lose precison if time is too large, for example: 1626006833631000000*1.0 = double = 1626006833631000064
|
||||
//int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision) {
|
||||
// !!!!notice:there are precision problems, double lose precison if time is too large, for example:
|
||||
// 1626006833631000000*1.0 = double = 1626006833631000064
|
||||
// int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrecision) {
|
||||
// assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||
// fromPrecision == TSDB_TIME_PRECISION_NANO);
|
||||
// assert(toPrecision == TSDB_TIME_PRECISION_MILLI || toPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||
|
@ -503,53 +502,53 @@ end_:
|
|||
// ((double)time * factors[fromPrecision][toPrecision]);
|
||||
//}
|
||||
|
||||
|
||||
// !!!!notice: double lose precison if time is too large, for example: 1626006833631000000*1.0 = double = 1626006833631000064
|
||||
// !!!!notice: double lose precison if time is too large, for example: 1626006833631000000*1.0 = double =
|
||||
// 1626006833631000064
|
||||
int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char toUnit) {
|
||||
assert(fromPrecision == TSDB_TIME_PRECISION_MILLI || fromPrecision == TSDB_TIME_PRECISION_MICRO ||
|
||||
fromPrecision == TSDB_TIME_PRECISION_NANO);
|
||||
int64_t factors[3] = {NANOSECOND_PER_MSEC, NANOSECOND_PER_USEC, 1};
|
||||
double tmp = time;
|
||||
double tmp = time;
|
||||
switch (toUnit) {
|
||||
case 's':{
|
||||
tmp /= (NANOSECOND_PER_SEC/factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_SEC/factors[fromPrecision]);
|
||||
case 's': {
|
||||
tmp /= (NANOSECOND_PER_SEC / factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_SEC / factors[fromPrecision]);
|
||||
break;
|
||||
}
|
||||
case 'm':
|
||||
tmp /= (NANOSECOND_PER_MINUTE/factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_MINUTE/factors[fromPrecision]);
|
||||
tmp /= (NANOSECOND_PER_MINUTE / factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_MINUTE / factors[fromPrecision]);
|
||||
break;
|
||||
case 'h':
|
||||
tmp /= (NANOSECOND_PER_HOUR/factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_HOUR/factors[fromPrecision]);
|
||||
tmp /= (NANOSECOND_PER_HOUR / factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_HOUR / factors[fromPrecision]);
|
||||
break;
|
||||
case 'd':
|
||||
tmp /= (NANOSECOND_PER_DAY/factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_DAY/factors[fromPrecision]);
|
||||
tmp /= (NANOSECOND_PER_DAY / factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_DAY / factors[fromPrecision]);
|
||||
break;
|
||||
case 'w':
|
||||
tmp /= (NANOSECOND_PER_WEEK/factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_WEEK/factors[fromPrecision]);
|
||||
tmp /= (NANOSECOND_PER_WEEK / factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_WEEK / factors[fromPrecision]);
|
||||
break;
|
||||
case 'a':
|
||||
tmp /= (NANOSECOND_PER_MSEC/factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_MSEC/factors[fromPrecision]);
|
||||
tmp /= (NANOSECOND_PER_MSEC / factors[fromPrecision]); // the result of division is an integer
|
||||
time /= (NANOSECOND_PER_MSEC / factors[fromPrecision]);
|
||||
break;
|
||||
case 'u':
|
||||
// the result of (NANOSECOND_PER_USEC/(double)factors[fromPrecision]) maybe a double
|
||||
switch (fromPrecision) {
|
||||
case TSDB_TIME_PRECISION_MILLI:{
|
||||
case TSDB_TIME_PRECISION_MILLI: {
|
||||
tmp *= 1000;
|
||||
time *= 1000;
|
||||
break;
|
||||
}
|
||||
case TSDB_TIME_PRECISION_MICRO:{
|
||||
case TSDB_TIME_PRECISION_MICRO: {
|
||||
tmp /= 1;
|
||||
time /= 1;
|
||||
break;
|
||||
}
|
||||
case TSDB_TIME_PRECISION_NANO:{
|
||||
case TSDB_TIME_PRECISION_NANO: {
|
||||
tmp /= 1000;
|
||||
time /= 1000;
|
||||
break;
|
||||
|
@ -569,11 +568,11 @@ int64_t convertTimeFromPrecisionToUnit(int64_t time, int32_t fromPrecision, char
|
|||
return time;
|
||||
}
|
||||
|
||||
int32_t convertStringToTimestamp(int16_t type, char *inputData, int64_t timePrec, int64_t *timeVal) {
|
||||
int32_t convertStringToTimestamp(int16_t type, char* inputData, int64_t timePrec, int64_t* timeVal) {
|
||||
int32_t charLen = varDataLen(inputData);
|
||||
char *newColData;
|
||||
char* newColData;
|
||||
if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY) {
|
||||
newColData = taosMemoryCalloc(1, charLen + 1);
|
||||
newColData = taosMemoryCalloc(1, charLen + 1);
|
||||
memcpy(newColData, varDataVal(inputData), charLen);
|
||||
int32_t ret = taosParseTime(newColData, timeVal, charLen, (int32_t)timePrec, tsDaylight);
|
||||
if (ret != TSDB_CODE_SUCCESS) {
|
||||
|
@ -582,9 +581,9 @@ int32_t convertStringToTimestamp(int16_t type, char *inputData, int64_t timePrec
|
|||
}
|
||||
taosMemoryFree(newColData);
|
||||
} else if (type == TSDB_DATA_TYPE_NCHAR) {
|
||||
newColData = taosMemoryCalloc(1, charLen + TSDB_NCHAR_SIZE);
|
||||
int len = taosUcs4ToMbs((TdUcs4 *)varDataVal(inputData), charLen, newColData);
|
||||
if (len < 0){
|
||||
newColData = taosMemoryCalloc(1, charLen + TSDB_NCHAR_SIZE);
|
||||
int len = taosUcs4ToMbs((TdUcs4*)varDataVal(inputData), charLen, newColData);
|
||||
if (len < 0) {
|
||||
taosMemoryFree(newColData);
|
||||
return TSDB_CODE_FAILED;
|
||||
}
|
||||
|
@ -877,8 +876,8 @@ const char* fmtts(int64_t ts) {
|
|||
}
|
||||
|
||||
void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision) {
|
||||
char ts[40] = {0};
|
||||
struct tm ptm;
|
||||
char ts[40] = {0};
|
||||
struct tm ptm;
|
||||
|
||||
int32_t fractionLen;
|
||||
char* format = NULL;
|
||||
|
|
|
@ -209,7 +209,8 @@ static STSGroupBlockInfoEx* addOneGroupInfo(STSBuf* pTSBuf, int32_t id) {
|
|||
uint32_t newSize = (uint32_t)(pTSBuf->numOfAlloc * 1.5);
|
||||
assert((int32_t)newSize > pTSBuf->numOfAlloc);
|
||||
|
||||
STSGroupBlockInfoEx* tmp = (STSGroupBlockInfoEx*)taosMemoryRealloc(pTSBuf->pData, sizeof(STSGroupBlockInfoEx) * newSize);
|
||||
STSGroupBlockInfoEx* tmp =
|
||||
(STSGroupBlockInfoEx*)taosMemoryRealloc(pTSBuf->pData, sizeof(STSGroupBlockInfoEx) * newSize);
|
||||
if (tmp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "dmMgmt.h"
|
||||
#include "tconfig.h"
|
||||
#include "mnode.h"
|
||||
#include "tconfig.h"
|
||||
|
||||
// clang-format off
|
||||
#define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'."
|
||||
#define DM_CFG_DIR "Configuration directory."
|
||||
#define DM_DMP_CFG "Dump configuration."
|
||||
|
@ -28,9 +29,10 @@
|
|||
#define DM_MACHINE_CODE "Get machine code."
|
||||
#define DM_VERSION "Print program version."
|
||||
#define DM_EMAIL "<support@taosdata.com>"
|
||||
// clang-format on
|
||||
static struct {
|
||||
#ifdef WINDOWS
|
||||
bool winServiceMode;
|
||||
bool winServiceMode;
|
||||
#endif
|
||||
bool dumpConfig;
|
||||
bool dumpSdb;
|
||||
|
@ -101,10 +103,10 @@ static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
|
|||
global.dumpConfig = true;
|
||||
} else if (strcmp(argv[i], "-V") == 0) {
|
||||
global.printVersion = true;
|
||||
#ifdef WINDOWS
|
||||
#ifdef WINDOWS
|
||||
} else if (strcmp(argv[i], "--win_service") == 0) {
|
||||
global.winServiceMode = true;
|
||||
#endif
|
||||
#endif
|
||||
} else if (strcmp(argv[i], "-e") == 0) {
|
||||
global.envCmd[cmdEnvIndex] = argv[++i];
|
||||
cmdEnvIndex++;
|
||||
|
@ -183,7 +185,7 @@ int main(int argc, char const *argv[]) {
|
|||
}
|
||||
|
||||
#ifdef WINDOWS
|
||||
int mainWindows(int argc,char** argv);
|
||||
int mainWindows(int argc, char **argv);
|
||||
if (global.winServiceMode) {
|
||||
stratWindowsService(mainWindows);
|
||||
} else {
|
||||
|
@ -191,7 +193,7 @@ int main(int argc, char const *argv[]) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
int mainWindows(int argc,char** argv) {
|
||||
int mainWindows(int argc, char **argv) {
|
||||
#endif
|
||||
|
||||
if (global.generateGrant) {
|
||||
|
@ -224,7 +226,7 @@ int mainWindows(int argc,char** argv) {
|
|||
taosCleanupArgs();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
taosConvInit();
|
||||
|
||||
if (global.dumpConfig) {
|
||||
|
|
|
@ -101,7 +101,7 @@ void dmStopMonitorThread(SDnodeMgmt *pMgmt) {
|
|||
static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
|
||||
SDnodeMgmt *pMgmt = pInfo->ahandle;
|
||||
int32_t code = -1;
|
||||
STraceId * trace = &pMsg->info.traceId;
|
||||
STraceId *trace = &pMsg->info.traceId;
|
||||
dGTrace("msg:%p, will be processed in dnode queue, type:%s", pMsg, TMSG_INFO(pMsg->msgType));
|
||||
|
||||
switch (pMsg->msgType) {
|
||||
|
|
|
@ -51,7 +51,7 @@ int32_t qmPutNodeMsgToQueryQueue(SQnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
|||
int32_t qmPutNodeMsgToFetchQueue(SQnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
||||
int32_t qmPutNodeMsgToMonitorQueue(SQnodeMgmt *pMgmt, SRpcMsg *pMsg);
|
||||
|
||||
int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg * pMsg);
|
||||
int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg *pMsg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ void qmGetMonitorInfo(SQnodeMgmt *pMgmt, SMonQmInfo *qmInfo) {
|
|||
qndGetLoad(pMgmt->pQnode, &qload);
|
||||
|
||||
qload.dnodeId = pMgmt->pData->dnodeId;
|
||||
|
||||
}
|
||||
|
||||
void qmGetQnodeLoads(SQnodeMgmt *pMgmt, SQnodeLoad *pInfo) {
|
||||
|
|
|
@ -52,17 +52,23 @@ static int32_t dmInitMonitor() {
|
|||
static bool dmCheckDiskSpace() {
|
||||
osUpdate();
|
||||
if (!osDataSpaceAvailable()) {
|
||||
dError("free disk size: %f GB, too little, require %f GB at least at least , quit", (double)tsDataSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsDataSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||
dError("free disk size: %f GB, too little, require %f GB at least at least , quit",
|
||||
(double)tsDataSpace.size.avail / 1024.0 / 1024.0 / 1024.0,
|
||||
(double)tsDataSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
||||
return false;
|
||||
}
|
||||
if (!osLogSpaceAvailable()) {
|
||||
dError("free disk size: %f GB, too little, require %f GB at least at least, quit", (double)tsLogSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsLogSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||
dError("free disk size: %f GB, too little, require %f GB at least at least, quit",
|
||||
(double)tsLogSpace.size.avail / 1024.0 / 1024.0 / 1024.0,
|
||||
(double)tsLogSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
||||
return false;
|
||||
}
|
||||
if (!osTempSpaceAvailable()) {
|
||||
dError("free disk size: %f GB, too little, require %f GB at least at least, quit", (double)tsTempSpace.size.avail / 1024.0 / 1024.0 / 1024.0, (double)tsTempSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||
dError("free disk size: %f GB, too little, require %f GB at least at least, quit",
|
||||
(double)tsTempSpace.size.avail / 1024.0 / 1024.0 / 1024.0,
|
||||
(double)tsTempSpace.reserved / 1024.0 / 1024.0 / 1024.0);
|
||||
terrno = TSDB_CODE_NO_AVAIL_DISK;
|
||||
return false;
|
||||
}
|
||||
|
@ -73,7 +79,8 @@ static bool dmCheckDataDirVersion() {
|
|||
char checkDataDirJsonFileName[PATH_MAX];
|
||||
snprintf(checkDataDirJsonFileName, PATH_MAX, "%s/dnode/dnodeCfg.json", tsDataDir);
|
||||
if (taosCheckExistFile(checkDataDirJsonFileName)) {
|
||||
dError("The default data directory %s contains old data of tdengine 2.x, please clear it before running!", tsDataDir);
|
||||
dError("The default data directory %s contains old data of tdengine 2.x, please clear it before running!",
|
||||
tsDataDir);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -183,4 +183,3 @@ void dmGetQnodeLoads(SQnodeLoad *pInfo) {
|
|||
dmReleaseWrapper(pWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ static SProcQueue *dmInitProcQueue(SProc *proc, char *ptr, int32_t size) {
|
|||
static void dmCleanupProcQueue(SProcQueue *queue) {}
|
||||
|
||||
static inline int32_t dmPushToProcQueue(SProc *proc, SProcQueue *queue, SRpcMsg *pMsg, EProcFuncType ftype) {
|
||||
const void * pHead = pMsg;
|
||||
const void * pBody = pMsg->pCont;
|
||||
const void *pHead = pMsg;
|
||||
const void *pBody = pMsg->pCont;
|
||||
const int16_t rawHeadLen = sizeof(SRpcMsg);
|
||||
const int32_t rawBodyLen = pMsg->contLen;
|
||||
const int16_t headLen = CEIL8(rawHeadLen);
|
||||
|
@ -261,7 +261,7 @@ int32_t dmInitProc(struct SMgmtWrapper *pWrapper) {
|
|||
proc->wrapper = pWrapper;
|
||||
proc->name = pWrapper->name;
|
||||
|
||||
SShm * shm = &proc->shm;
|
||||
SShm *shm = &proc->shm;
|
||||
int32_t cstart = 0;
|
||||
int32_t csize = CEIL8(shm->size / 2);
|
||||
int32_t pstart = csize;
|
||||
|
@ -285,13 +285,13 @@ int32_t dmInitProc(struct SMgmtWrapper *pWrapper) {
|
|||
}
|
||||
|
||||
static void *dmConsumChildQueue(void *param) {
|
||||
SProc * proc = param;
|
||||
SProc *proc = param;
|
||||
SMgmtWrapper *pWrapper = proc->wrapper;
|
||||
SProcQueue * queue = proc->cqueue;
|
||||
SProcQueue *queue = proc->cqueue;
|
||||
int32_t numOfMsgs = 0;
|
||||
int32_t code = 0;
|
||||
EProcFuncType ftype = DND_FUNC_REQ;
|
||||
SRpcMsg * pMsg = NULL;
|
||||
SRpcMsg *pMsg = NULL;
|
||||
|
||||
dDebug("node:%s, start to consume from cqueue", proc->name);
|
||||
do {
|
||||
|
@ -328,13 +328,13 @@ static void *dmConsumChildQueue(void *param) {
|
|||
}
|
||||
|
||||
static void *dmConsumParentQueue(void *param) {
|
||||
SProc * proc = param;
|
||||
SProc *proc = param;
|
||||
SMgmtWrapper *pWrapper = proc->wrapper;
|
||||
SProcQueue * queue = proc->pqueue;
|
||||
SProcQueue *queue = proc->pqueue;
|
||||
int32_t numOfMsgs = 0;
|
||||
int32_t code = 0;
|
||||
EProcFuncType ftype = DND_FUNC_REQ;
|
||||
SRpcMsg * pMsg = NULL;
|
||||
SRpcMsg *pMsg = NULL;
|
||||
|
||||
dDebug("node:%s, start to consume from pqueue", proc->name);
|
||||
do {
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// clang-format off
|
||||
|
||||
#define dFatal(...) { if (dDebugFlag & DEBUG_FATAL) { taosPrintLog("DND FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }}
|
||||
|
|
|
@ -17,7 +17,7 @@ class DndTestBnode : public ::testing::Test {
|
|||
test.Init(TD_TMP_DIR_PATH "dbnodeTest", 9112);
|
||||
taosMsleep(1100);
|
||||
}
|
||||
static void TearDownTestSuite() { test.Cleanup(); }
|
||||
static void TearDownTestSuite() { test.Cleanup(); }
|
||||
static Testbase test;
|
||||
|
||||
public:
|
||||
|
|
|
@ -47,7 +47,7 @@ class Testbase {
|
|||
int32_t connId;
|
||||
|
||||
public:
|
||||
int32_t SendShowReq(int8_t showType, const char *tb, const char* db);
|
||||
int32_t SendShowReq(int8_t showType, const char* tb, const char* db);
|
||||
int32_t GetShowRows();
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -30,14 +30,14 @@ void Testbase::InitLog(const char* path) {
|
|||
tsdbDebugFlag = 0;
|
||||
tsLogEmbedded = 1;
|
||||
tsAsyncLog = 0;
|
||||
|
||||
|
||||
taosRemoveDir(path);
|
||||
taosMkDir(path);
|
||||
tstrncpy(tsLogDir, path, PATH_MAX);
|
||||
|
||||
taosGetSystemInfo();
|
||||
tsRpcQueueMemoryAllowed = tsTotalMemoryKB * 0.1;
|
||||
if (taosInitLog("taosdlog", 1) != 0) {
|
||||
if (taosInitLog("taosdlog", 1) != 0) {
|
||||
printf("failed to init log file\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
|
||||
#include "mndInt.h"
|
||||
|
||||
int32_t mndInitGrant(SMnode *pMnode);
|
||||
void mndCleanupGrant();
|
||||
void grantParseParameter();
|
||||
void grantReset(SMnode *pMnode, EGrantType grant, uint64_t value);
|
||||
void grantAdd(EGrantType grant, uint64_t value);
|
||||
void grantRestore(EGrantType grant, uint64_t value);
|
||||
int32_t mndInitGrant(SMnode * pMnode);
|
||||
void mndCleanupGrant();
|
||||
void grantParseParameter();
|
||||
void grantReset(SMnode * pMnode, EGrantType grant, uint64_t value);
|
||||
void grantAdd(EGrantType grant, uint64_t value);
|
||||
void grantRestore(EGrantType grant, uint64_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ extern "C" {
|
|||
// clang-format on
|
||||
|
||||
#define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
|
||||
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
|
||||
#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
|
||||
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
|
||||
#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
|
||||
|
||||
typedef int32_t (*MndMsgFp)(SRpcMsg *pMsg);
|
||||
typedef int32_t (*MndInitFp)(SMnode *pMnode);
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
int32_t mndBuildPerfsTableSchema(SMnode *pMnode, const char *dbFName, const char *tbName, STableMetaRsp *pRsp);
|
||||
int32_t mndBuildPerfsTableCfg(SMnode *pMnode, const char *dbFName, const char *tbName, STableCfgRsp *pRsp);
|
||||
int32_t mndInitPerfs(SMnode *pMnode);
|
||||
void mndCleanupPerfs(SMnode *pMnode);
|
||||
void mndCleanupPerfs(SMnode *pMnode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t mndInitQuery(SMnode *pMnode);
|
||||
void mndCleanupQuery(SMnode *pMnode);
|
||||
|
||||
int32_t mndInitQuery(SMnode *pMnode);
|
||||
void mndCleanupQuery(SMnode *pMnode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ SDbObj *mndAcquireDbByStb(SMnode *pMnode, const char *stbName);
|
|||
int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreate, SDbObj *pDb);
|
||||
int32_t mndAddStbToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb);
|
||||
void mndFreeStb(SStbObj *pStb);
|
||||
int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char* dbFName, char* stbFName, void **pCont, int32_t *pLen);
|
||||
int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char *dbFName, char *stbFName, void **pCont, int32_t *pLen);
|
||||
|
||||
void mndExtractDbNameFromStbFullName(const char *stbFullName, char *dst);
|
||||
void mndExtractTbNameFromStbFullName(const char *stbFullName, char *dst, int32_t dstSize);
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "mndBnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndDnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndShow.h"
|
||||
#include "mndTrans.h"
|
||||
#include "mndUser.h"
|
||||
|
|
|
@ -440,7 +440,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
|
|||
statusReq.memAvail, statusReq.memTotal, statusReq.numOfCores);
|
||||
} else {
|
||||
mInfo("dnode:%d, send dnode epset, online:%d dnodeVer:%" PRId64 ":%" PRId64 " reboot:%d", pDnode->id, online,
|
||||
statusReq.dnodeVer, dnodeVer, reboot);
|
||||
statusReq.dnodeVer, dnodeVer, reboot);
|
||||
}
|
||||
|
||||
pDnode->rebootTime = statusReq.rebootTime;
|
||||
|
|
|
@ -102,21 +102,21 @@ void dumpDb(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "compression", i642str(pObj->cfg.compression));
|
||||
tjsonAddStringToObject(item, "replications", i642str(pObj->cfg.replications));
|
||||
tjsonAddStringToObject(item, "strict", i642str(pObj->cfg.strict));
|
||||
tjsonAddStringToObject(item, "cacheLast",i642str( pObj->cfg.cacheLast));
|
||||
tjsonAddStringToObject(item, "cacheLast", i642str(pObj->cfg.cacheLast));
|
||||
tjsonAddStringToObject(item, "hashMethod", i642str(pObj->cfg.hashMethod));
|
||||
tjsonAddStringToObject(item, "hashPrefix", i642str(pObj->cfg.hashPrefix));
|
||||
tjsonAddStringToObject(item, "hashSuffix", i642str(pObj->cfg.hashSuffix));
|
||||
tjsonAddStringToObject(item, "sstTrigger", i642str(pObj->cfg.sstTrigger));
|
||||
tjsonAddStringToObject(item, "tsdbPageSize",i642str( pObj->cfg.tsdbPageSize));
|
||||
tjsonAddStringToObject(item, "tsdbPageSize", i642str(pObj->cfg.tsdbPageSize));
|
||||
tjsonAddStringToObject(item, "schemaless", i642str(pObj->cfg.schemaless));
|
||||
tjsonAddStringToObject(item, "walLevel",i642str( pObj->cfg.walLevel));
|
||||
tjsonAddStringToObject(item, "walLevel", i642str(pObj->cfg.walLevel));
|
||||
tjsonAddStringToObject(item, "walFsyncPeriod", i642str(pObj->cfg.walFsyncPeriod));
|
||||
tjsonAddStringToObject(item, "walRetentionPeriod", i642str(pObj->cfg.walRetentionPeriod));
|
||||
tjsonAddStringToObject(item, "walRetentionSize",i642str( pObj->cfg.walRetentionSize));
|
||||
tjsonAddStringToObject(item, "walRetentionSize", i642str(pObj->cfg.walRetentionSize));
|
||||
tjsonAddStringToObject(item, "walRollPeriod", i642str(pObj->cfg.walRollPeriod));
|
||||
tjsonAddStringToObject(item, "walSegmentSize", i642str(pObj->cfg.walSegmentSize));
|
||||
|
||||
tjsonAddStringToObject(item, "numOfRetensions",i642str( pObj->cfg.numOfRetensions));
|
||||
tjsonAddStringToObject(item, "numOfRetensions", i642str(pObj->cfg.numOfRetensions));
|
||||
for (int32_t i = 0; i < pObj->cfg.numOfRetensions; ++i) {
|
||||
SJson *rentensions = tjsonAddArrayToObject(item, "rentensions");
|
||||
SJson *rentension = tjsonCreateObject();
|
||||
|
@ -126,7 +126,7 @@ void dumpDb(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "freq", i642str(pRetension->freq));
|
||||
tjsonAddStringToObject(item, "freqUnit", i642str(pRetension->freqUnit));
|
||||
tjsonAddStringToObject(item, "keep", i642str(pRetension->keep));
|
||||
tjsonAddStringToObject(item, "keepUnit",i642str( pRetension->keepUnit));
|
||||
tjsonAddStringToObject(item, "keepUnit", i642str(pRetension->keepUnit));
|
||||
}
|
||||
|
||||
sdbRelease(pSdb, pObj);
|
||||
|
@ -150,21 +150,21 @@ void dumpStb(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
tjsonAddStringToObject(item, "uid", i642str(pObj->uid));
|
||||
tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
tjsonAddStringToObject(item, "tagVer",i642str( pObj->tagVer));
|
||||
tjsonAddStringToObject(item, "tagVer", i642str(pObj->tagVer));
|
||||
tjsonAddStringToObject(item, "colVer", i642str(pObj->colVer));
|
||||
tjsonAddStringToObject(item, "smaVer", i642str(pObj->smaVer));
|
||||
tjsonAddStringToObject(item, "nextColId", i642str(pObj->nextColId));
|
||||
tjsonAddStringToObject(item, "watermark1", i642str(pObj->watermark[0]));
|
||||
tjsonAddStringToObject(item, "watermark2", i642str(pObj->watermark[1]));
|
||||
tjsonAddStringToObject(item, "maxdelay0",i642str( pObj->maxdelay[0]));
|
||||
tjsonAddStringToObject(item, "maxdelay1",i642str( pObj->maxdelay[1]));
|
||||
tjsonAddStringToObject(item, "ttl",i642str( pObj->ttl));
|
||||
tjsonAddStringToObject(item, "numOfFuncs",i642str( pObj->numOfFuncs));
|
||||
tjsonAddStringToObject(item, "maxdelay0", i642str(pObj->maxdelay[0]));
|
||||
tjsonAddStringToObject(item, "maxdelay1", i642str(pObj->maxdelay[1]));
|
||||
tjsonAddStringToObject(item, "ttl", i642str(pObj->ttl));
|
||||
tjsonAddStringToObject(item, "numOfFuncs", i642str(pObj->numOfFuncs));
|
||||
tjsonAddStringToObject(item, "commentLen", i642str(pObj->commentLen));
|
||||
tjsonAddStringToObject(item, "ast1Len", i642str(pObj->ast1Len));
|
||||
tjsonAddStringToObject(item, "ast2Len",i642str( pObj->ast2Len));
|
||||
tjsonAddStringToObject(item, "ast2Len", i642str(pObj->ast2Len));
|
||||
|
||||
tjsonAddStringToObject(item, "numOfColumns",i642str( pObj->numOfColumns));
|
||||
tjsonAddStringToObject(item, "numOfColumns", i642str(pObj->numOfColumns));
|
||||
SJson *columns = tjsonAddArrayToObject(item, "columns");
|
||||
for (int32_t i = 0; i < pObj->numOfColumns; ++i) {
|
||||
SJson *column = tjsonCreateObject();
|
||||
|
@ -188,7 +188,7 @@ void dumpStb(SSdb *pSdb, SJson *json) {
|
|||
SSchema *pTag = &pObj->pTags[i];
|
||||
tjsonAddStringToObject(tag, "type", i642str(pTag->type));
|
||||
tjsonAddStringToObject(tag, "typestr", tDataTypes[pTag->type].name);
|
||||
tjsonAddStringToObject(tag, "flags",i642str( pTag->flags));
|
||||
tjsonAddStringToObject(tag, "flags", i642str(pTag->flags));
|
||||
tjsonAddStringToObject(tag, "colId", i642str(pTag->colId));
|
||||
tjsonAddStringToObject(tag, "bytes", i642str(pTag->bytes));
|
||||
tjsonAddStringToObject(tag, "name", pTag->name);
|
||||
|
@ -219,16 +219,16 @@ void dumpSma(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
tjsonAddStringToObject(item, "dstTbUid", i642str(pObj->dstTbUid));
|
||||
tjsonAddStringToObject(item, "intervalUnit", i642str(pObj->intervalUnit));
|
||||
tjsonAddStringToObject(item, "slidingUnit",i642str( pObj->slidingUnit));
|
||||
tjsonAddStringToObject(item, "slidingUnit", i642str(pObj->slidingUnit));
|
||||
tjsonAddStringToObject(item, "timezone", i642str(pObj->timezone));
|
||||
tjsonAddStringToObject(item, "dstVgId",i642str( pObj->dstVgId));
|
||||
tjsonAddStringToObject(item, "dstVgId", i642str(pObj->dstVgId));
|
||||
tjsonAddStringToObject(item, "interval", i642str(pObj->interval));
|
||||
tjsonAddStringToObject(item, "offset", i642str(pObj->offset));
|
||||
tjsonAddStringToObject(item, "sliding", i642str(pObj->sliding));
|
||||
tjsonAddStringToObject(item, "exprLen",i642str( pObj->exprLen));
|
||||
tjsonAddStringToObject(item, "exprLen", i642str(pObj->exprLen));
|
||||
tjsonAddStringToObject(item, "tagsFilterLen", i642str(pObj->tagsFilterLen));
|
||||
tjsonAddStringToObject(item, "sqlLen",i642str( pObj->sqlLen));
|
||||
tjsonAddStringToObject(item, "astLen",i642str( pObj->astLen));
|
||||
tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen));
|
||||
tjsonAddStringToObject(item, "astLen", i642str(pObj->astLen));
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
}
|
||||
|
@ -247,13 +247,13 @@ void dumpVgroup(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "vgId", i642str(pObj->vgId));
|
||||
tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
tjsonAddStringToObject(item, "version",i642str(pObj->version));
|
||||
tjsonAddStringToObject(item, "version", i642str(pObj->version));
|
||||
tjsonAddStringToObject(item, "hashBegin", i642str(pObj->hashBegin));
|
||||
tjsonAddStringToObject(item, "hashEnd", i642str(pObj->hashEnd));
|
||||
tjsonAddStringToObject(item, "db", mndGetDbStr(pObj->dbName));
|
||||
tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
tjsonAddStringToObject(item, "isTsma", i642str(pObj->isTsma));
|
||||
tjsonAddStringToObject(item, "replica",i642str( pObj->replica));
|
||||
tjsonAddStringToObject(item, "replica", i642str(pObj->replica));
|
||||
for (int32_t i = 0; i < pObj->replica; ++i) {
|
||||
SJson *replicas = tjsonAddArrayToObject(item, "replicas");
|
||||
SJson *replica = tjsonCreateObject();
|
||||
|
@ -281,13 +281,13 @@ void dumpTopic(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
tjsonAddStringToObject(item, "uid", i642str(pObj->uid));
|
||||
tjsonAddStringToObject(item, "dbUid", i642str(pObj->dbUid));
|
||||
tjsonAddStringToObject(item, "version",i642str( pObj->version));
|
||||
tjsonAddStringToObject(item, "subType",i642str( pObj->subType));
|
||||
tjsonAddStringToObject(item, "version", i642str(pObj->version));
|
||||
tjsonAddStringToObject(item, "subType", i642str(pObj->subType));
|
||||
tjsonAddStringToObject(item, "withMeta", i642str(pObj->withMeta));
|
||||
tjsonAddStringToObject(item, "stbUid", i642str(pObj->stbUid));
|
||||
tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen));
|
||||
tjsonAddStringToObject(item, "astLen",i642str( pObj->astLen));
|
||||
tjsonAddStringToObject(item, "sqlLen",i642str( pObj->sqlLen));
|
||||
tjsonAddStringToObject(item, "astLen", i642str(pObj->astLen));
|
||||
tjsonAddStringToObject(item, "sqlLen", i642str(pObj->sqlLen));
|
||||
tjsonAddStringToObject(item, "ntbUid", i642str(pObj->ntbUid));
|
||||
tjsonAddStringToObject(item, "ctbStbUid", i642str(pObj->ctbStbUid));
|
||||
sdbRelease(pSdb, pObj);
|
||||
|
@ -365,9 +365,9 @@ void dumpStream(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "totalLevel", i642str(pObj->totalLevel));
|
||||
tjsonAddStringToObject(item, "smaId", i642str(pObj->smaId));
|
||||
tjsonAddStringToObject(item, "uid", i642str(pObj->uid));
|
||||
tjsonAddStringToObject(item, "status",i642str( pObj->status));
|
||||
tjsonAddStringToObject(item, "igExpired",i642str( pObj->igExpired));
|
||||
tjsonAddStringToObject(item, "trigger",i642str( pObj->trigger));
|
||||
tjsonAddStringToObject(item, "status", i642str(pObj->status));
|
||||
tjsonAddStringToObject(item, "igExpired", i642str(pObj->igExpired));
|
||||
tjsonAddStringToObject(item, "trigger", i642str(pObj->trigger));
|
||||
tjsonAddStringToObject(item, "triggerParam", i642str(pObj->triggerParam));
|
||||
tjsonAddStringToObject(item, "watermark", i642str(pObj->watermark));
|
||||
tjsonAddStringToObject(item, "sourceDbUid", i642str(pObj->sourceDbUid));
|
||||
|
@ -419,9 +419,9 @@ void dumpUser(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "acct", pObj->acct);
|
||||
tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
tjsonAddStringToObject(item, "superUser",i642str( pObj->superUser));
|
||||
tjsonAddStringToObject(item, "superUser", i642str(pObj->superUser));
|
||||
tjsonAddStringToObject(item, "authVersion", i642str(pObj->authVersion));
|
||||
tjsonAddStringToObject(item, "numOfReadDbs",i642str( taosHashGetSize(pObj->readDbs)));
|
||||
tjsonAddStringToObject(item, "numOfReadDbs", i642str(taosHashGetSize(pObj->readDbs)));
|
||||
tjsonAddStringToObject(item, "numOfWriteDbs", i642str(taosHashGetSize(pObj->writeDbs)));
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
@ -438,10 +438,10 @@ void dumpDnode(SSdb *pSdb, SJson *json) {
|
|||
|
||||
SJson *item = tjsonCreateObject();
|
||||
tjsonAddItemToArray(items, item);
|
||||
tjsonAddStringToObject(item, "id",i642str( pObj->id));
|
||||
tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
tjsonAddStringToObject(item, "port",i642str( pObj->port));
|
||||
tjsonAddStringToObject(item, "port", i642str(pObj->port));
|
||||
tjsonAddStringToObject(item, "fqdn", pObj->fqdn);
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ void dumpSnode(SSdb *pSdb, SJson *json) {
|
|||
|
||||
SJson *item = tjsonCreateObject();
|
||||
tjsonAddItemToArray(items, item);
|
||||
tjsonAddStringToObject(item, "id",i642str( pObj->id));
|
||||
tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
tjsonAddStringToObject(item, "updateTime", i642str(pObj->updateTime));
|
||||
sdbRelease(pSdb, pObj);
|
||||
|
@ -538,15 +538,15 @@ void dumpTrans(SSdb *pSdb, SJson *json) {
|
|||
tjsonAddStringToObject(item, "id", i642str(pObj->id));
|
||||
tjsonAddStringToObject(item, "stage", i642str(pObj->stage));
|
||||
tjsonAddStringToObject(item, "policy", i642str(pObj->policy));
|
||||
tjsonAddStringToObject(item, "conflict",i642str( pObj->conflict));
|
||||
tjsonAddStringToObject(item, "conflict", i642str(pObj->conflict));
|
||||
tjsonAddStringToObject(item, "exec", i642str(pObj->exec));
|
||||
tjsonAddStringToObject(item, "oper", i642str(pObj->oper));
|
||||
tjsonAddStringToObject(item, "createdTime", i642str(pObj->createdTime));
|
||||
tjsonAddStringToObject(item, "dbname", pObj->dbname);
|
||||
tjsonAddStringToObject(item, "stbname", pObj->stbname);
|
||||
tjsonAddStringToObject(item, "opername", pObj->opername);
|
||||
tjsonAddStringToObject(item, "commitLogNum",i642str( taosArrayGetSize(pObj->commitActions)));
|
||||
tjsonAddStringToObject(item, "redoActionNum",i642str(taosArrayGetSize(pObj->redoActions)));
|
||||
tjsonAddStringToObject(item, "commitLogNum", i642str(taosArrayGetSize(pObj->commitActions)));
|
||||
tjsonAddStringToObject(item, "redoActionNum", i642str(taosArrayGetSize(pObj->redoActions)));
|
||||
tjsonAddStringToObject(item, "undoActionNum", i642str(taosArrayGetSize(pObj->undoActions)));
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "mndMnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndDnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndShow.h"
|
||||
#include "mndSync.h"
|
||||
#include "mndTrans.h"
|
||||
|
|
|
@ -45,8 +45,8 @@ int32_t mndPerfsInitMeta(SHashObj *hash) {
|
|||
meta.sversion = 1;
|
||||
meta.tversion = 1;
|
||||
|
||||
size_t size = 0;
|
||||
const SSysTableMeta* pSysDbTableMeta = NULL;
|
||||
size_t size = 0;
|
||||
const SSysTableMeta *pSysDbTableMeta = NULL;
|
||||
getPerfDbMeta(&pSysDbTableMeta, &size);
|
||||
|
||||
for (int32_t i = 0; i < size; ++i) {
|
||||
|
@ -150,4 +150,3 @@ void mndCleanupPerfs(SMnode *pMnode) {
|
|||
taosHashCleanup(pMnode->perfsMeta);
|
||||
pMnode->perfsMeta = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "mndQnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndDnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndShow.h"
|
||||
#include "mndTrans.h"
|
||||
#include "mndUser.h"
|
||||
|
|
|
@ -64,36 +64,36 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg) {
|
|||
}
|
||||
|
||||
int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
|
||||
int32_t code = 0;
|
||||
int32_t offset = 0;
|
||||
int32_t rspSize = 0;
|
||||
SBatchReq *batchReq = (SBatchReq*)pMsg->pCont;
|
||||
int32_t msgNum = ntohl(batchReq->msgNum);
|
||||
int32_t code = 0;
|
||||
int32_t offset = 0;
|
||||
int32_t rspSize = 0;
|
||||
SBatchReq *batchReq = (SBatchReq *)pMsg->pCont;
|
||||
int32_t msgNum = ntohl(batchReq->msgNum);
|
||||
offset += sizeof(SBatchReq);
|
||||
SBatchMsg req = {0};
|
||||
SBatchRsp rsp = {0};
|
||||
SRpcMsg reqMsg = *pMsg;
|
||||
SRpcMsg rspMsg = {0};
|
||||
void* pRsp = NULL;
|
||||
SMnode *pMnode = pMsg->info.node;
|
||||
SRpcMsg reqMsg = *pMsg;
|
||||
SRpcMsg rspMsg = {0};
|
||||
void *pRsp = NULL;
|
||||
SMnode *pMnode = pMsg->info.node;
|
||||
|
||||
SArray* batchRsp = taosArrayInit(msgNum, sizeof(SBatchRsp));
|
||||
SArray *batchRsp = taosArrayInit(msgNum, sizeof(SBatchRsp));
|
||||
if (NULL == batchRsp) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
|
||||
for (int32_t i = 0; i < msgNum; ++i) {
|
||||
req.msgIdx = ntohl(*(int32_t*)((char*)pMsg->pCont + offset));
|
||||
req.msgIdx = ntohl(*(int32_t *)((char *)pMsg->pCont + offset));
|
||||
offset += sizeof(req.msgIdx);
|
||||
|
||||
req.msgType = ntohl(*(int32_t*)((char*)pMsg->pCont + offset));
|
||||
req.msgType = ntohl(*(int32_t *)((char *)pMsg->pCont + offset));
|
||||
offset += sizeof(req.msgType);
|
||||
|
||||
req.msgLen = ntohl(*(int32_t*)((char*)pMsg->pCont + offset));
|
||||
req.msgLen = ntohl(*(int32_t *)((char *)pMsg->pCont + offset));
|
||||
offset += sizeof(req.msgLen);
|
||||
|
||||
req.msg = (char*)pMsg->pCont + offset;
|
||||
req.msg = (char *)pMsg->pCont + offset;
|
||||
offset += req.msgLen;
|
||||
|
||||
reqMsg.msgType = req.msgType;
|
||||
|
@ -118,7 +118,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
|
|||
rsp.reqType = reqMsg.msgType;
|
||||
rsp.msgLen = reqMsg.info.rspLen;
|
||||
rsp.msg = reqMsg.info.rsp;
|
||||
|
||||
|
||||
taosArrayPush(batchRsp, &rsp);
|
||||
|
||||
rspSize += sizeof(rsp) + rsp.msgLen - POINTER_BYTES;
|
||||
|
@ -126,27 +126,27 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
|
|||
|
||||
rspSize += sizeof(int32_t);
|
||||
offset = 0;
|
||||
|
||||
|
||||
pRsp = rpcMallocCont(rspSize);
|
||||
if (pRsp == NULL) {
|
||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
*(int32_t*)((char*)pRsp + offset) = htonl(msgNum);
|
||||
*(int32_t *)((char *)pRsp + offset) = htonl(msgNum);
|
||||
offset += sizeof(msgNum);
|
||||
for (int32_t i = 0; i < msgNum; ++i) {
|
||||
SBatchRsp *p = taosArrayGet(batchRsp, i);
|
||||
|
||||
*(int32_t*)((char*)pRsp + offset) = htonl(p->reqType);
|
||||
|
||||
*(int32_t *)((char *)pRsp + offset) = htonl(p->reqType);
|
||||
offset += sizeof(p->reqType);
|
||||
*(int32_t*)((char*)pRsp + offset) = htonl(p->msgIdx);
|
||||
*(int32_t *)((char *)pRsp + offset) = htonl(p->msgIdx);
|
||||
offset += sizeof(p->msgIdx);
|
||||
*(int32_t*)((char*)pRsp + offset) = htonl(p->msgLen);
|
||||
*(int32_t *)((char *)pRsp + offset) = htonl(p->msgLen);
|
||||
offset += sizeof(p->msgLen);
|
||||
*(int32_t*)((char*)pRsp + offset) = htonl(p->rspCode);
|
||||
*(int32_t *)((char *)pRsp + offset) = htonl(p->rspCode);
|
||||
offset += sizeof(p->rspCode);
|
||||
memcpy((char*)pRsp + offset, p->msg, p->msgLen);
|
||||
memcpy((char *)pRsp + offset, p->msg, p->msgLen);
|
||||
offset += p->msgLen;
|
||||
|
||||
rpcFreeCont(p->msg);
|
||||
|
|
|
@ -604,7 +604,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
|||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
mInfo("sma:%s, uid:%" PRIi64 " create on stb:%" PRIi64 ", dstSuid:%" PRIi64 " dstTb:%s dstVg:%d", pCreate->name,
|
||||
smaObj.uid, smaObj.stbUid, smaObj.dstTbUid, smaObj.dstTbName, smaObj.dstVgId);
|
||||
smaObj.uid, smaObj.stbUid, smaObj.dstTbUid, smaObj.dstTbName, smaObj.dstVgId);
|
||||
|
||||
code = 0;
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "mndSnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndDnode.h"
|
||||
#include "mndPrivilege.h"
|
||||
#include "mndShow.h"
|
||||
#include "mndTrans.h"
|
||||
#include "mndUser.h"
|
||||
|
|
|
@ -1162,7 +1162,7 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
|
|||
if (pIter == NULL) break;
|
||||
|
||||
mInfo("topic:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, subType:%d sql:%s",
|
||||
pTopic->name, stbFullName, suid, colId, pTopic->subType, pTopic->sql);
|
||||
pTopic->name, stbFullName, suid, colId, pTopic->subType, pTopic->sql);
|
||||
if (pTopic->subType != TOPIC_SUB_TYPE__COLUMN) {
|
||||
sdbRelease(pSdb, pTopic);
|
||||
continue;
|
||||
|
@ -1179,8 +1179,8 @@ static int32_t mndCheckAlterColForTopic(SMnode *pMnode, const char *stbFullName,
|
|||
SNode *pNode = NULL;
|
||||
FOREACH(pNode, pNodeList) {
|
||||
SColumnNode *pCol = (SColumnNode *)pNode;
|
||||
mInfo("topic:%s, check colId:%d tableId:%" PRId64 " ctbStbUid:%" PRId64, pTopic->name, pCol->colId,
|
||||
pCol->tableId, pTopic->ctbStbUid);
|
||||
mInfo("topic:%s, check colId:%d tableId:%" PRId64 " ctbStbUid:%" PRId64, pTopic->name, pCol->colId, pCol->tableId,
|
||||
pTopic->ctbStbUid);
|
||||
|
||||
if (pCol->tableId != suid && pTopic->ctbStbUid != suid) {
|
||||
mInfo("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
|
||||
|
@ -1256,8 +1256,8 @@ static int32_t mndCheckAlterColForTSma(SMnode *pMnode, const char *stbFullName,
|
|||
pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pSma);
|
||||
if (pIter == NULL) break;
|
||||
|
||||
mInfo("tsma:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, sql:%s", pSma->name,
|
||||
stbFullName, suid, colId, pSma->sql);
|
||||
mInfo("tsma:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, sql:%s", pSma->name, stbFullName,
|
||||
suid, colId, pSma->sql);
|
||||
|
||||
SNode *pAst = NULL;
|
||||
if (nodesStringToNode(pSma->ast, &pAst) != 0) {
|
||||
|
|
|
@ -51,9 +51,9 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
|
|||
int32_t transId = sdbGetIdFromRaw(pMnode->pSdb, pRaw);
|
||||
pMgmt->errCode = cbMeta.code;
|
||||
mInfo("trans:%d, is proposed, saved:%d code:0x%x, apply index:%" PRId64 " term:%" PRIu64 " config:%" PRId64
|
||||
" role:%s raw:%p",
|
||||
transId, pMgmt->transId, cbMeta.code, cbMeta.index, cbMeta.term, cbMeta.lastConfigIndex, syncStr(cbMeta.state),
|
||||
pRaw);
|
||||
" role:%s raw:%p",
|
||||
transId, pMgmt->transId, cbMeta.code, cbMeta.index, cbMeta.term, cbMeta.lastConfigIndex, syncStr(cbMeta.state),
|
||||
pRaw);
|
||||
|
||||
if (pMgmt->errCode == 0) {
|
||||
sdbWriteWithoutFree(pMnode->pSdb, pRaw);
|
||||
|
|
|
@ -1555,8 +1555,8 @@ static int32_t mndCheckDnodeMemory(SMnode *pMnode, SDbObj *pOldDb, SDbObj *pNewD
|
|||
terrno = TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE;
|
||||
return -1;
|
||||
} else if (inVgroup) {
|
||||
mInfo("db:%s, vgId:%d, memory in dnode:%d, avail:%" PRId64 " used:%" PRId64, pNewVgroup->dbName,
|
||||
pNewVgroup->vgId, pDnode->id, pDnode->memAvail, pDnode->memUsed);
|
||||
mInfo("db:%s, vgId:%d, memory in dnode:%d, avail:%" PRId64 " used:%" PRId64, pNewVgroup->dbName, pNewVgroup->vgId,
|
||||
pDnode->id, pDnode->memAvail, pDnode->memUsed);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class MndTestFunc : public ::testing::Test {
|
|||
|
||||
Testbase MndTestFunc::test;
|
||||
|
||||
void MndTestFunc::SetCode(SCreateFuncReq *pReq, const char *pCode, int32_t size) {
|
||||
void MndTestFunc::SetCode(SCreateFuncReq* pReq, const char* pCode, int32_t size) {
|
||||
pReq->pCode = (char*)taosMemoryMalloc(size);
|
||||
memcpy(pReq->pCode, pCode, size);
|
||||
pReq->codeLen = size;
|
||||
|
@ -41,9 +41,7 @@ void MndTestFunc::SetComment(SCreateFuncReq* pReq, const char* pComment) {
|
|||
strcpy(pReq->pComment, pComment);
|
||||
}
|
||||
|
||||
void MndTestFunc::SetBufSize(SCreateFuncReq* pReq, int32_t size) {
|
||||
pReq->bufSize = size;
|
||||
}
|
||||
void MndTestFunc::SetBufSize(SCreateFuncReq* pReq, int32_t size) { pReq->bufSize = size; }
|
||||
|
||||
TEST_F(MndTestFunc, 01_Show_Func) {
|
||||
test.SendShowReq(TSDB_MGMT_TABLE_FUNC, "ins_functions", "");
|
||||
|
@ -505,9 +503,8 @@ TEST_F(MndTestFunc, 05_Actual_code) {
|
|||
EXPECT_EQ(pFuncInfo->signature, 5);
|
||||
EXPECT_STREQ("comment1", pFuncInfo->pComment);
|
||||
for (int32_t i = 0; i < 300; ++i) {
|
||||
EXPECT_EQ(pFuncInfo->pCode[i], (i) % 20);
|
||||
EXPECT_EQ(pFuncInfo->pCode[i], (i) % 20);
|
||||
}
|
||||
tFreeSRetrieveFuncRsp(&retrieveRsp);
|
||||
}
|
||||
|
||||
}
|
|
@ -32,7 +32,8 @@ class MndTestStb : public ::testing::Test {
|
|||
void* BuildAlterStbUpdateTagBytesReq(const char* stbname, const char* tagname, int32_t bytes, int32_t* pContLen);
|
||||
void* BuildAlterStbAddColumnReq(const char* stbname, const char* colname, int32_t* pContLen);
|
||||
void* BuildAlterStbDropColumnReq(const char* stbname, const char* colname, int32_t* pContLen);
|
||||
void* BuildAlterStbUpdateColumnBytesReq(const char* stbname, const char* colname, int32_t bytes, int32_t* pContLen, int32_t verInBlock);
|
||||
void* BuildAlterStbUpdateColumnBytesReq(const char* stbname, const char* colname, int32_t bytes, int32_t* pContLen,
|
||||
int32_t verInBlock);
|
||||
};
|
||||
|
||||
Testbase MndTestStb::test;
|
||||
|
|
|
@ -306,8 +306,8 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
|||
pSdb->commitTerm = pSdb->applyTerm;
|
||||
pSdb->commitConfig = pSdb->applyConfig;
|
||||
memcpy(pSdb->tableVer, tableVer, sizeof(tableVer));
|
||||
mInfo("read sdb file:%s success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64, file,
|
||||
pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig);
|
||||
mInfo("read sdb file:%s success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64, file, pSdb->commitIndex,
|
||||
pSdb->commitTerm, pSdb->commitConfig);
|
||||
|
||||
_OVER:
|
||||
taosCloseFile(&pFile);
|
||||
|
@ -340,9 +340,9 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
|
|||
snprintf(curfile, sizeof(curfile), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
|
||||
|
||||
mInfo("start to write sdb file, apply index:%" PRId64 " term:%" PRId64 " config:%" PRId64 ", commit index:%" PRId64
|
||||
" term:%" PRId64 " config:%" PRId64 ", file:%s",
|
||||
pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig, pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig,
|
||||
curfile);
|
||||
" term:%" PRId64 " config:%" PRId64 ", file:%s",
|
||||
pSdb->applyIndex, pSdb->applyTerm, pSdb->applyConfig, pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig,
|
||||
curfile);
|
||||
|
||||
TdFilePtr pFile = taosOpenFile(tmpfile, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC);
|
||||
if (pFile == NULL) {
|
||||
|
@ -438,7 +438,7 @@ static int32_t sdbWriteFileImp(SSdb *pSdb) {
|
|||
pSdb->commitTerm = pSdb->applyTerm;
|
||||
pSdb->commitConfig = pSdb->applyConfig;
|
||||
mInfo("write sdb file success, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " file:%s",
|
||||
pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig, curfile);
|
||||
pSdb->commitIndex, pSdb->commitTerm, pSdb->commitConfig, curfile);
|
||||
}
|
||||
|
||||
terrno = code;
|
||||
|
@ -556,9 +556,8 @@ int32_t sdbStartRead(SSdb *pSdb, SSdbIter **ppIter, int64_t *index, int64_t *ter
|
|||
if (term != NULL) *term = commitTerm;
|
||||
if (config != NULL) *config = commitConfig;
|
||||
|
||||
mInfo("sdbiter:%p, is created to read snapshot, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64
|
||||
" file:%s",
|
||||
pIter, commitIndex, commitTerm, commitConfig, pIter->name);
|
||||
mInfo("sdbiter:%p, is created to read snapshot, commit index:%" PRId64 " term:%" PRId64 " config:%" PRId64 " file:%s",
|
||||
pIter, commitIndex, commitTerm, commitConfig, pIter->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include "tlog.h"
|
||||
#include "tmsg.h"
|
||||
#include "trpc.h"
|
||||
#include "tmsgcb.h"
|
||||
#include "trpc.h"
|
||||
|
||||
#include "qnode.h"
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
*/
|
||||
|
||||
#include "executor.h"
|
||||
#include "libs/function/function.h"
|
||||
#include "qndInt.h"
|
||||
#include "query.h"
|
||||
#include "qworker.h"
|
||||
#include "libs/function/function.h"
|
||||
|
||||
SQnode *qndOpen(const SQnodeOpt *pOption) {
|
||||
SQnode *pQnode = taosMemoryCalloc(1, sizeof(SQnode));
|
||||
|
@ -40,8 +40,8 @@ void qndClose(SQnode *pQnode) {
|
|||
taosMemoryFree(pQnode);
|
||||
}
|
||||
|
||||
int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) {
|
||||
SReadHandle handle = {.pMsgCb = &pQnode->msgCb};
|
||||
int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) {
|
||||
SReadHandle handle = {.pMsgCb = &pQnode->msgCb};
|
||||
SQWorkerStat stat = {0};
|
||||
|
||||
int32_t code = qWorkerGetStat(&handle, pQnode->pQuery, &stat);
|
||||
|
@ -60,11 +60,11 @@ int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) {
|
|||
pLoad->numOfProcessedDrop = stat.dropProcessed;
|
||||
pLoad->numOfProcessedHb = stat.hbProcessed;
|
||||
pLoad->numOfProcessedDelete = stat.deleteProcessed;
|
||||
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg * pMsg) {
|
||||
int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg *pMsg) {
|
||||
if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
|
|||
if (tEncodeI64(pCoder, pME->ctbEntry.ctime) < 0) return -1;
|
||||
if (tEncodeI32(pCoder, pME->ctbEntry.ttlDays) < 0) return -1;
|
||||
if (tEncodeI32v(pCoder, pME->ctbEntry.commentLen) < 0) return -1;
|
||||
if (pME->ctbEntry.commentLen > 0){
|
||||
if (pME->ctbEntry.commentLen > 0) {
|
||||
if (tEncodeCStr(pCoder, pME->ctbEntry.comment) < 0) return -1;
|
||||
}
|
||||
if (tEncodeI64(pCoder, pME->ctbEntry.suid) < 0) return -1;
|
||||
|
@ -43,7 +43,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
|
|||
if (tEncodeI64(pCoder, pME->ntbEntry.ctime) < 0) return -1;
|
||||
if (tEncodeI32(pCoder, pME->ntbEntry.ttlDays) < 0) return -1;
|
||||
if (tEncodeI32v(pCoder, pME->ntbEntry.commentLen) < 0) return -1;
|
||||
if (pME->ntbEntry.commentLen > 0){
|
||||
if (pME->ntbEntry.commentLen > 0) {
|
||||
if (tEncodeCStr(pCoder, pME->ntbEntry.comment) < 0) return -1;
|
||||
}
|
||||
if (tEncodeI32v(pCoder, pME->ntbEntry.ncid) < 0) return -1;
|
||||
|
@ -77,9 +77,8 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
|
|||
if (tDecodeI64(pCoder, &pME->ctbEntry.ctime) < 0) return -1;
|
||||
if (tDecodeI32(pCoder, &pME->ctbEntry.ttlDays) < 0) return -1;
|
||||
if (tDecodeI32v(pCoder, &pME->ctbEntry.commentLen) < 0) return -1;
|
||||
if (pME->ctbEntry.commentLen > 0){
|
||||
if (tDecodeCStr(pCoder, &pME->ctbEntry.comment) < 0)
|
||||
return -1;
|
||||
if (pME->ctbEntry.commentLen > 0) {
|
||||
if (tDecodeCStr(pCoder, &pME->ctbEntry.comment) < 0) return -1;
|
||||
}
|
||||
if (tDecodeI64(pCoder, &pME->ctbEntry.suid) < 0) return -1;
|
||||
if (tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags) < 0) return -1; // (TODO)
|
||||
|
@ -87,7 +86,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
|
|||
if (tDecodeI64(pCoder, &pME->ntbEntry.ctime) < 0) return -1;
|
||||
if (tDecodeI32(pCoder, &pME->ntbEntry.ttlDays) < 0) return -1;
|
||||
if (tDecodeI32v(pCoder, &pME->ntbEntry.commentLen) < 0) return -1;
|
||||
if (pME->ntbEntry.commentLen > 0){
|
||||
if (pME->ntbEntry.commentLen > 0) {
|
||||
if (tDecodeCStr(pCoder, &pME->ntbEntry.comment) < 0) return -1;
|
||||
}
|
||||
if (tDecodeI32v(pCoder, &pME->ntbEntry.ncid) < 0) return -1;
|
||||
|
|
|
@ -33,7 +33,7 @@ int32_t tdRSmaFSOpen(SSma *pSma, int64_t version) {
|
|||
SSmaEnv *pEnv = SMA_RSMA_ENV(pSma);
|
||||
SRSmaStat *pStat = NULL;
|
||||
SArray *output = NULL;
|
||||
|
||||
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
|
||||
if (!pEnv) {
|
||||
|
|
|
@ -73,7 +73,7 @@ static int32_t smaEvalDays(SVnode *pVnode, SRetention *r, int8_t level, int8_t p
|
|||
}
|
||||
|
||||
ASSERT(level >= TSDB_RETENTION_L1 && level <= TSDB_RETENTION_L2);
|
||||
|
||||
|
||||
freqDuration = convertTimeFromPrecisionToUnit((r + level)->freq, precision, TIME_UNIT_MINUTE);
|
||||
keepDuration = convertTimeFromPrecisionToUnit((r + level)->keep, precision, TIME_UNIT_MINUTE);
|
||||
|
||||
|
@ -92,7 +92,8 @@ static int32_t smaEvalDays(SVnode *pVnode, SRetention *r, int8_t level, int8_t p
|
|||
days = freqDuration;
|
||||
}
|
||||
end:
|
||||
smaInfo("vgId:%d, evaluated duration for level %" PRIi8 " is %d, raw val:%d", TD_VID(pVnode), level + 1, days, duration);
|
||||
smaInfo("vgId:%d, evaluated duration for level %" PRIi8 " is %d, raw val:%d", TD_VID(pVnode), level + 1, days,
|
||||
duration);
|
||||
return days;
|
||||
}
|
||||
|
||||
|
|
|
@ -328,4 +328,3 @@ int32_t tqMetaRestoreHandle(STQ* pTq) {
|
|||
tdbTbcClose(pCur);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,28 +17,28 @@
|
|||
|
||||
// SLDataIter =================================================
|
||||
struct SLDataIter {
|
||||
SRBTreeNode node;
|
||||
SSttBlk *pSttBlk;
|
||||
SDataFReader *pReader;
|
||||
int32_t iStt;
|
||||
int8_t backward;
|
||||
int32_t iSttBlk;
|
||||
int32_t iRow;
|
||||
SRowInfo rInfo;
|
||||
uint64_t uid;
|
||||
STimeWindow timeWindow;
|
||||
SVersionRange verRange;
|
||||
SSttBlockLoadInfo* pBlockLoadInfo;
|
||||
SRBTreeNode node;
|
||||
SSttBlk *pSttBlk;
|
||||
SDataFReader *pReader;
|
||||
int32_t iStt;
|
||||
int8_t backward;
|
||||
int32_t iSttBlk;
|
||||
int32_t iRow;
|
||||
SRowInfo rInfo;
|
||||
uint64_t uid;
|
||||
STimeWindow timeWindow;
|
||||
SVersionRange verRange;
|
||||
SSttBlockLoadInfo *pBlockLoadInfo;
|
||||
};
|
||||
|
||||
SSttBlockLoadInfo* tCreateLastBlockLoadInfo(STSchema* pSchema, int16_t* colList, int32_t numOfCols) {
|
||||
SSttBlockLoadInfo* pLoadInfo = taosMemoryCalloc(TSDB_DEFAULT_STT_FILE, sizeof(SSttBlockLoadInfo));
|
||||
SSttBlockLoadInfo *tCreateLastBlockLoadInfo(STSchema *pSchema, int16_t *colList, int32_t numOfCols) {
|
||||
SSttBlockLoadInfo *pLoadInfo = taosMemoryCalloc(TSDB_DEFAULT_STT_FILE, sizeof(SSttBlockLoadInfo));
|
||||
if (pLoadInfo == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for(int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
|
||||
for (int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
|
||||
pLoadInfo[i].blockIndex[0] = -1;
|
||||
pLoadInfo[i].blockIndex[1] = -1;
|
||||
pLoadInfo[i].currentLoadBlockIndex = 1;
|
||||
|
@ -62,8 +62,8 @@ SSttBlockLoadInfo* tCreateLastBlockLoadInfo(STSchema* pSchema, int16_t* colList,
|
|||
return pLoadInfo;
|
||||
}
|
||||
|
||||
void resetLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo) {
|
||||
for(int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
|
||||
void resetLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
|
||||
for (int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
|
||||
pLoadInfo[i].currentLoadBlockIndex = 1;
|
||||
pLoadInfo[i].blockIndex[0] = -1;
|
||||
pLoadInfo[i].blockIndex[1] = -1;
|
||||
|
@ -75,15 +75,15 @@ void resetLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo) {
|
|||
}
|
||||
}
|
||||
|
||||
void getLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo, int64_t* blocks, double* el) {
|
||||
for(int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
|
||||
void getLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo, int64_t *blocks, double *el) {
|
||||
for (int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
|
||||
*el += pLoadInfo[i].elapsedTime;
|
||||
*blocks += pLoadInfo[i].loadBlocks;
|
||||
}
|
||||
}
|
||||
|
||||
void* destroyLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo) {
|
||||
for(int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
|
||||
void *destroyLastBlockLoadInfo(SSttBlockLoadInfo *pLoadInfo) {
|
||||
for (int32_t i = 0; i < TSDB_DEFAULT_STT_FILE; ++i) {
|
||||
pLoadInfo[i].currentLoadBlockIndex = 1;
|
||||
pLoadInfo[i].blockIndex[0] = -1;
|
||||
pLoadInfo[i].blockIndex[1] = -1;
|
||||
|
@ -98,11 +98,11 @@ void* destroyLastBlockLoadInfo(SSttBlockLoadInfo* pLoadInfo) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
|
||||
static SBlockData *loadLastBlock(SLDataIter *pIter, const char *idStr) {
|
||||
int32_t code = 0;
|
||||
|
||||
SSttBlockLoadInfo* pInfo = pIter->pBlockLoadInfo;
|
||||
if (pInfo->blockIndex[0] == pIter->iSttBlk) {
|
||||
SSttBlockLoadInfo *pInfo = pIter->pBlockLoadInfo;
|
||||
if (pInfo->blockIndex[0] == pIter->iSttBlk) {
|
||||
return &pInfo->blockData[0];
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
|
|||
if (pIter->pSttBlk != NULL) { // current block not loaded yet
|
||||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
SBlockData* pBlock = &pInfo->blockData[pInfo->currentLoadBlockIndex];
|
||||
SBlockData *pBlock = &pInfo->blockData[pInfo->currentLoadBlockIndex];
|
||||
|
||||
TABLEID id = {0};
|
||||
if (pIter->pSttBlk->suid != 0) {
|
||||
|
@ -126,11 +126,12 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
|
|||
tBlockDataInit(pBlock, &id, pInfo->pSchema, pInfo->colIds, pInfo->numOfCols);
|
||||
code = tsdbReadSttBlock(pIter->pReader, pIter->iStt, pIter->pSttBlk, pBlock);
|
||||
|
||||
double el = (taosGetTimestampUs() - st)/ 1000.0;
|
||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||
pInfo->elapsedTime += el;
|
||||
pInfo->loadBlocks += 1;
|
||||
|
||||
tsdbDebug("read last block, index:%d, last file index:%d, elapsed time:%.2f ms, %s", pIter->iSttBlk, pIter->iStt, el, idStr);
|
||||
tsdbDebug("read last block, index:%d, last file index:%d, elapsed time:%.2f ms, %s", pIter->iSttBlk, pIter->iStt,
|
||||
el, idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _exit;
|
||||
}
|
||||
|
@ -141,7 +142,7 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
|
|||
|
||||
return &pInfo->blockData[pInfo->currentLoadBlockIndex];
|
||||
|
||||
_exit:
|
||||
_exit:
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
terrno = code;
|
||||
}
|
||||
|
@ -150,16 +151,17 @@ static SBlockData* loadLastBlock(SLDataIter *pIter, const char* idStr) {
|
|||
}
|
||||
|
||||
// find the earliest block that contains the required records
|
||||
static FORCE_INLINE int32_t findEarliestIndex(int32_t index, uint64_t uid, const SSttBlk* pBlockList, int32_t num, int32_t backward) {
|
||||
static FORCE_INLINE int32_t findEarliestIndex(int32_t index, uint64_t uid, const SSttBlk *pBlockList, int32_t num,
|
||||
int32_t backward) {
|
||||
int32_t i = index;
|
||||
int32_t step = backward? 1:-1;
|
||||
int32_t step = backward ? 1 : -1;
|
||||
while (i >= 0 && i < num && uid >= pBlockList[i].minUid && uid <= pBlockList[i].maxUid) {
|
||||
i += step;
|
||||
}
|
||||
return i - step;
|
||||
}
|
||||
|
||||
static int32_t binarySearchForStartBlock(SSttBlk*pBlockList, int32_t num, uint64_t uid, int32_t backward) {
|
||||
static int32_t binarySearchForStartBlock(SSttBlk *pBlockList, int32_t num, uint64_t uid, int32_t backward) {
|
||||
int32_t midPos = -1;
|
||||
if (num <= 0) {
|
||||
return -1;
|
||||
|
@ -195,16 +197,17 @@ static int32_t binarySearchForStartBlock(SSttBlk*pBlockList, int32_t num, uint64
|
|||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t findEarliestRow(int32_t index, uint64_t uid, const uint64_t* uidList, int32_t num, int32_t backward) {
|
||||
static FORCE_INLINE int32_t findEarliestRow(int32_t index, uint64_t uid, const uint64_t *uidList, int32_t num,
|
||||
int32_t backward) {
|
||||
int32_t i = index;
|
||||
int32_t step = backward? 1:-1;
|
||||
int32_t step = backward ? 1 : -1;
|
||||
while (i >= 0 && i < num && uid == uidList[i]) {
|
||||
i += step;
|
||||
}
|
||||
return i - step;
|
||||
}
|
||||
|
||||
static int32_t binarySearchForStartRowIndex(uint64_t* uidList, int32_t num, uint64_t uid, int32_t backward) {
|
||||
static int32_t binarySearchForStartRowIndex(uint64_t *uidList, int32_t num, uint64_t uid, int32_t backward) {
|
||||
int32_t firstPos = 0;
|
||||
int32_t lastPos = num - 1;
|
||||
|
||||
|
@ -236,8 +239,8 @@ static int32_t binarySearchForStartRowIndex(uint64_t* uidList, int32_t num, uint
|
|||
}
|
||||
|
||||
int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t iStt, int8_t backward, uint64_t suid,
|
||||
uint64_t uid, STimeWindow *pTimeWindow, SVersionRange *pRange, SSttBlockLoadInfo* pBlockLoadInfo,
|
||||
const char* idStr) {
|
||||
uint64_t uid, STimeWindow *pTimeWindow, SVersionRange *pRange, SSttBlockLoadInfo *pBlockLoadInfo,
|
||||
const char *idStr) {
|
||||
int32_t code = 0;
|
||||
*pIter = taosMemoryCalloc(1, sizeof(SLDataIter));
|
||||
if (*pIter == NULL) {
|
||||
|
@ -277,7 +280,7 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
|
|||
} else if (pStart->suid != suid) {
|
||||
// no qualified stt block existed
|
||||
(*pIter)->iSttBlk = -1;
|
||||
double el = (taosGetTimestampUs() - st)/1000.0;
|
||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||
tsdbDebug("load the last file info completed, elapsed time:%.2fms, %s", el, idStr);
|
||||
return code;
|
||||
}
|
||||
|
@ -302,7 +305,7 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
|
|||
}
|
||||
}
|
||||
|
||||
double el = (taosGetTimestampUs() - st)/1000.0;
|
||||
double el = (taosGetTimestampUs() - st) / 1000.0;
|
||||
tsdbDebug("load the last file info completed, elapsed time:%.2fms, %s", el, idStr);
|
||||
}
|
||||
|
||||
|
@ -319,9 +322,7 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
|
||||
void tLDataIterClose(SLDataIter *pIter) {
|
||||
taosMemoryFree(pIter);
|
||||
}
|
||||
void tLDataIterClose(SLDataIter *pIter) { taosMemoryFree(pIter); }
|
||||
|
||||
void tLDataIterNextBlock(SLDataIter *pIter) {
|
||||
int32_t step = pIter->backward ? -1 : 1;
|
||||
|
@ -374,17 +375,18 @@ void tLDataIterNextBlock(SLDataIter *pIter) {
|
|||
}
|
||||
}
|
||||
|
||||
static void findNextValidRow(SLDataIter *pIter, const char* idStr) {
|
||||
static void findNextValidRow(SLDataIter *pIter, const char *idStr) {
|
||||
int32_t step = pIter->backward ? -1 : 1;
|
||||
|
||||
bool hasVal = false;
|
||||
int32_t i = pIter->iRow;
|
||||
bool hasVal = false;
|
||||
int32_t i = pIter->iRow;
|
||||
|
||||
SBlockData *pBlockData = loadLastBlock(pIter, idStr);
|
||||
|
||||
// mostly we only need to find the start position for a given table
|
||||
if ((((i == 0) && (!pIter->backward)) || (i == pBlockData->nRow - 1 && pIter->backward)) && pBlockData->aUid != NULL) {
|
||||
i = binarySearchForStartRowIndex((uint64_t*)pBlockData->aUid, pBlockData->nRow, pIter->uid, pIter->backward);
|
||||
if ((((i == 0) && (!pIter->backward)) || (i == pBlockData->nRow - 1 && pIter->backward)) &&
|
||||
pBlockData->aUid != NULL) {
|
||||
i = binarySearchForStartRowIndex((uint64_t *)pBlockData->aUid, pBlockData->nRow, pIter->uid, pIter->backward);
|
||||
if (i == -1) {
|
||||
pIter->iRow = -1;
|
||||
return;
|
||||
|
@ -396,13 +398,15 @@ static void findNextValidRow(SLDataIter *pIter, const char* idStr) {
|
|||
if (!pIter->backward) {
|
||||
/*if (pBlockData->aUid[i] < pIter->uid) {
|
||||
continue;
|
||||
} else */if (pBlockData->aUid[i] > pIter->uid) {
|
||||
} else */
|
||||
if (pBlockData->aUid[i] > pIter->uid) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/*if (pBlockData->aUid[i] > pIter->uid) {
|
||||
continue;
|
||||
} else */if (pBlockData->aUid[i] < pIter->uid) {
|
||||
} else */
|
||||
if (pBlockData->aUid[i] < pIter->uid) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -440,7 +444,7 @@ static void findNextValidRow(SLDataIter *pIter, const char* idStr) {
|
|||
pIter->iRow = (hasVal) ? i : -1;
|
||||
}
|
||||
|
||||
bool tLDataIterNextRow(SLDataIter *pIter, const char* idStr) {
|
||||
bool tLDataIterNextRow(SLDataIter *pIter, const char *idStr) {
|
||||
int32_t code = 0;
|
||||
int32_t step = pIter->backward ? -1 : 1;
|
||||
|
||||
|
@ -449,7 +453,7 @@ bool tLDataIterNextRow(SLDataIter *pIter, const char* idStr) {
|
|||
return false;
|
||||
}
|
||||
|
||||
int32_t iBlockL = pIter->iSttBlk;
|
||||
int32_t iBlockL = pIter->iSttBlk;
|
||||
SBlockData *pBlockData = loadLastBlock(pIter, idStr);
|
||||
pIter->iRow += step;
|
||||
|
||||
|
@ -527,8 +531,9 @@ int32_t tMergeTreeOpen(SMergeTree *pMTree, int8_t backward, SDataFReader *pFRead
|
|||
pMTree->destroyLoadInfo = destroyLoadInfo;
|
||||
|
||||
for (int32_t i = 0; i < pFReader->pSet->nSttF; ++i) { // open all last file
|
||||
struct SLDataIter* pIter = NULL;
|
||||
code = tLDataIterOpen(&pIter, pFReader, i, pMTree->backward, suid, uid, pTimeWindow, pVerRange, &pMTree->pLoadInfo[i], pMTree->idStr);
|
||||
struct SLDataIter *pIter = NULL;
|
||||
code = tLDataIterOpen(&pIter, pFReader, i, pMTree->backward, suid, uid, pTimeWindow, pVerRange,
|
||||
&pMTree->pLoadInfo[i], pMTree->idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _end;
|
||||
}
|
||||
|
|
|
@ -799,4 +799,3 @@ bool vnodeIsLeader(SVnode *pVnode) {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include <tglobal.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <vnodeInt.h>
|
||||
#include <tmsg.h>
|
||||
#include <vnodeInt.h>
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wwrite-strings"
|
||||
|
@ -424,7 +424,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
|
|||
TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_VARCHAR, TSDB_DATA_TYPE_NCHAR};
|
||||
// last 2 columns for group by tags
|
||||
// int32_t tSmaTypeArray[tSmaNumOfCols] = {TSDB_DATA_TYPE_TIMESTAMP, TSDB_DATA_TYPE_BOOL};
|
||||
const char *tSmaGroupbyTags[tSmaGroupSize * tSmaNumOfTags] = {"BeiJing", "HaiDian", "BeiJing", "ChaoYang",
|
||||
const char *tSmaGroupbyTags[tSmaGroupSize * tSmaNumOfTags] = {"BeiJing", "HaiDian", "BeiJing", "ChaoYang",
|
||||
"ShangHai", "PuDong", "ShangHai", "MinHang"};
|
||||
TSKEY tSmaSKeyMs = (int64_t)1648535332 * 1000;
|
||||
int64_t tSmaIntervalMs = tSma.interval * 60 * 1000;
|
||||
|
@ -441,7 +441,6 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
|
|||
pDataBlock->pDataBlock = taosArrayInit(tSmaNumOfCols, sizeof(SColumnInfoData *));
|
||||
EXPECT_NE(pDataBlock->pDataBlock, nullptr);
|
||||
for (int32_t c = 0; c < tSmaNumOfCols; ++c) {
|
||||
|
||||
SColumnInfoData *pColInfoData = (SColumnInfoData *)taosMemoryCalloc(1, sizeof(SColumnInfoData));
|
||||
EXPECT_NE(pColInfoData, nullptr);
|
||||
|
||||
|
|
|
@ -193,11 +193,11 @@ void* interlocked_sub_fetch_ptr(void* volatile* ptr, void* val) {
|
|||
}
|
||||
int32_t interlocked_fetch_sub_32(int32_t volatile* ptr, int32_t val) { return _InterlockedExchangeAdd(ptr, -val); }
|
||||
|
||||
int64_t interlocked_fetch_sub_64(int64_t volatile* ptr, int64_t val) {
|
||||
int64_t interlocked_fetch_sub_64(int64_t volatile* ptr, int64_t val) {
|
||||
#ifdef _TD_WINDOWS_32
|
||||
return _InterlockedExchangeAdd((int32_t volatile*)ptr, -(int32_t)val);
|
||||
return _InterlockedExchangeAdd((int32_t volatile*)ptr, -(int32_t)val);
|
||||
#else
|
||||
return _InterlockedExchangeAdd64(ptr, -val);
|
||||
return _InterlockedExchangeAdd64(ptr, -val);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -31,14 +31,13 @@ typedef struct TdDir {
|
|||
HANDLE hFind;
|
||||
} TdDir;
|
||||
|
||||
enum
|
||||
{
|
||||
WRDE_NOSPACE = 1, /* Ran out of memory. */
|
||||
WRDE_BADCHAR, /* A metachar appears in the wrong place. */
|
||||
WRDE_BADVAL, /* Undefined var reference with WRDE_UNDEF. */
|
||||
WRDE_CMDSUB, /* Command substitution with WRDE_NOCMD. */
|
||||
WRDE_SYNTAX /* Shell syntax error. */
|
||||
};
|
||||
enum {
|
||||
WRDE_NOSPACE = 1, /* Ran out of memory. */
|
||||
WRDE_BADCHAR, /* A metachar appears in the wrong place. */
|
||||
WRDE_BADVAL, /* Undefined var reference with WRDE_UNDEF. */
|
||||
WRDE_CMDSUB, /* Command substitution with WRDE_NOCMD. */
|
||||
WRDE_SYNTAX /* Shell syntax error. */
|
||||
};
|
||||
|
||||
int wordexp(char *words, wordexp_t *pwordexp, int flags) {
|
||||
pwordexp->we_offs = 0;
|
||||
|
@ -175,7 +174,7 @@ int32_t taosMulMkDir(const char *dirname) {
|
|||
#ifdef WINDOWS
|
||||
code = _mkdir(temp, 0755);
|
||||
#elif defined(DARWIN)
|
||||
code = mkdir(dirname, 0777);
|
||||
code = mkdir(dirname, 0777);
|
||||
#else
|
||||
code = mkdir(temp, 0755);
|
||||
#endif
|
||||
|
@ -237,7 +236,7 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) {
|
|||
#ifdef WINDOWS
|
||||
code = _mkdir(temp, mode);
|
||||
#elif defined(DARWIN)
|
||||
code = mkdir(dirname, 0777);
|
||||
code = mkdir(dirname, 0777);
|
||||
#else
|
||||
code = mkdir(temp, mode);
|
||||
#endif
|
||||
|
@ -301,22 +300,24 @@ void taosRemoveOldFiles(const char *dirname, int32_t keepDays) {
|
|||
|
||||
int32_t taosExpandDir(const char *dirname, char *outname, int32_t maxlen) {
|
||||
wordexp_t full_path;
|
||||
switch (wordexp (dirname, &full_path, 0)) {
|
||||
case 0:
|
||||
break;
|
||||
case WRDE_NOSPACE:
|
||||
wordfree (&full_path);
|
||||
// printf("failed to expand path:%s since Out of memory\n", dirname);
|
||||
return -1;
|
||||
case WRDE_BADCHAR:
|
||||
// printf("failed to expand path:%s since illegal occurrence of newline or one of |, &, ;, <, >, (, ), {, }\n", dirname);
|
||||
return -1;
|
||||
case WRDE_SYNTAX:
|
||||
// printf("failed to expand path:%s since Shell syntax error, such as unbalanced parentheses or unmatched quotes\n", dirname);
|
||||
return -1;
|
||||
default:
|
||||
// printf("failed to expand path:%s since %s\n", dirname, strerror(errno));
|
||||
return -1;
|
||||
switch (wordexp(dirname, &full_path, 0)) {
|
||||
case 0:
|
||||
break;
|
||||
case WRDE_NOSPACE:
|
||||
wordfree(&full_path);
|
||||
// printf("failed to expand path:%s since Out of memory\n", dirname);
|
||||
return -1;
|
||||
case WRDE_BADCHAR:
|
||||
// printf("failed to expand path:%s since illegal occurrence of newline or one of |, &, ;, <, >, (, ), {, }\n",
|
||||
// dirname);
|
||||
return -1;
|
||||
case WRDE_SYNTAX:
|
||||
// printf("failed to expand path:%s since Shell syntax error, such as unbalanced parentheses or unmatched
|
||||
// quotes\n", dirname);
|
||||
return -1;
|
||||
default:
|
||||
// printf("failed to expand path:%s since %s\n", dirname, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (full_path.we_wordv != NULL && full_path.we_wordv[0] != NULL) {
|
||||
|
@ -417,7 +418,7 @@ TdDirPtr taosOpenDir(const char *dirname) {
|
|||
DIR *pDir = opendir(dirname);
|
||||
if (pDir == NULL) return NULL;
|
||||
TdDirPtr dirPtr = (TdDirPtr)taosMemoryMalloc(sizeof(TdDir));
|
||||
dirPtr->dirEntryPtr = (TdDirEntryPtr)&(dirPtr->dirEntry1);
|
||||
dirPtr->dirEntryPtr = (TdDirEntryPtr) & (dirPtr->dirEntry1);
|
||||
dirPtr->pDir = pDir;
|
||||
return dirPtr;
|
||||
#else
|
||||
|
@ -435,7 +436,7 @@ TdDirEntryPtr taosReadDir(TdDirPtr pDir) {
|
|||
}
|
||||
return (TdDirEntryPtr) & (pDir->dirEntry.findFileData);
|
||||
#elif defined(DARWIN)
|
||||
if (readdir_r(pDir->pDir, (dirent*)&(pDir->dirEntry), (dirent**)&(pDir->dirEntryPtr)) == 0) {
|
||||
if (readdir_r(pDir->pDir, (dirent *)&(pDir->dirEntry), (dirent **)&(pDir->dirEntryPtr)) == 0) {
|
||||
return pDir->dirEntryPtr;
|
||||
} else {
|
||||
return NULL;
|
||||
|
|
|
@ -35,7 +35,7 @@ int64_t tsOpenMax = 0;
|
|||
int64_t tsStreamMax = 0;
|
||||
float tsNumOfCores = 0;
|
||||
int64_t tsTotalMemoryKB = 0;
|
||||
char* tsProcPath = NULL;
|
||||
char *tsProcPath = NULL;
|
||||
|
||||
void osDefaultInit() {
|
||||
taosSeedRand(taosSafeRand());
|
||||
|
|
|
@ -58,14 +58,14 @@ typedef struct TdFile {
|
|||
|
||||
#define FILE_WITH_LOCK 1
|
||||
|
||||
typedef struct AutoDelFile * AutoDelFilePtr;
|
||||
typedef struct AutoDelFile *AutoDelFilePtr;
|
||||
typedef struct AutoDelFile {
|
||||
char *name;
|
||||
AutoDelFilePtr lastAutoDelFilePtr;
|
||||
char *name;
|
||||
AutoDelFilePtr lastAutoDelFilePtr;
|
||||
} AutoDelFile;
|
||||
static TdThreadMutex autoDelFileLock;
|
||||
static TdThreadMutex autoDelFileLock;
|
||||
static AutoDelFilePtr nowAutoDelFilePtr = NULL;
|
||||
static TdThreadOnce autoDelFileInit = PTHREAD_ONCE_INIT;
|
||||
static TdThreadOnce autoDelFileInit = PTHREAD_ONCE_INIT;
|
||||
|
||||
void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, char *dstPath) {
|
||||
#ifdef WINDOWS
|
||||
|
@ -205,10 +205,10 @@ int32_t taosRenameFile(const char *oldName, const char *newName) {
|
|||
int32_t taosStatFile(const char *path, int64_t *size, int32_t *mtime) {
|
||||
#ifdef WINDOWS
|
||||
struct _stati64 fileStat;
|
||||
int32_t code = _stati64(path, &fileStat);
|
||||
int32_t code = _stati64(path, &fileStat);
|
||||
#else
|
||||
struct stat fileStat;
|
||||
int32_t code = stat(path, &fileStat);
|
||||
int32_t code = stat(path, &fileStat);
|
||||
#endif
|
||||
if (code < 0) {
|
||||
return code;
|
||||
|
@ -706,11 +706,11 @@ int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, in
|
|||
int64_t sentbytes;
|
||||
|
||||
while (leftbytes > 0) {
|
||||
#ifdef _TD_ARM_32
|
||||
sentbytes = sendfile(pFileOut->fd, pFileIn->fd, (long int*)offset, leftbytes);
|
||||
#else
|
||||
#ifdef _TD_ARM_32
|
||||
sentbytes = sendfile(pFileOut->fd, pFileIn->fd, (long int *)offset, leftbytes);
|
||||
#else
|
||||
sentbytes = sendfile(pFileOut->fd, pFileIn->fd, offset, leftbytes);
|
||||
#endif
|
||||
#endif
|
||||
if (sentbytes == -1) {
|
||||
if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
continue;
|
||||
|
|
|
@ -77,7 +77,7 @@ void taosSetSystemLocale(const char *inLocale, const char *inCharSet) {
|
|||
|
||||
// default locale or user specified locale is not valid, abort launch
|
||||
if (inLocale == NULL || strlen(inLocale) == 0) {
|
||||
//printf("Invalid locale:%s, please set the valid locale in config file\n", inLocale);
|
||||
// printf("Invalid locale:%s, please set the valid locale in config file\n", inLocale);
|
||||
}
|
||||
|
||||
if (!taosValidateEncodec(inCharSet)) {
|
||||
|
|
|
@ -52,36 +52,38 @@ int32_t taosBackTrace(void **buffer, int32_t size) {
|
|||
#pragma comment(lib, "dbghelp.lib")
|
||||
|
||||
void taosPrintBackTrace() {
|
||||
#define MAX_STACK_FRAMES 20
|
||||
|
||||
void *pStack[MAX_STACK_FRAMES];
|
||||
|
||||
HANDLE process = GetCurrentProcess();
|
||||
SymInitialize(process, NULL, TRUE);
|
||||
WORD frames = CaptureStackBackTrace(1, MAX_STACK_FRAMES, pStack, NULL);
|
||||
|
||||
#define MAX_STACK_FRAMES 20
|
||||
|
||||
void *pStack[MAX_STACK_FRAMES];
|
||||
|
||||
HANDLE process = GetCurrentProcess();
|
||||
SymInitialize(process, NULL, TRUE);
|
||||
WORD frames = CaptureStackBackTrace(1, MAX_STACK_FRAMES, pStack, NULL);
|
||||
|
||||
char buf_tmp[1024];
|
||||
for (WORD i = 0; i < frames; ++i) {
|
||||
DWORD64 address = (DWORD64)(pStack[i]);
|
||||
|
||||
DWORD64 displacementSym = 0;
|
||||
char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
|
||||
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
|
||||
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
|
||||
pSymbol->MaxNameLen = MAX_SYM_NAME;
|
||||
|
||||
DWORD displacementLine = 0;
|
||||
IMAGEHLP_LINE64 line;
|
||||
//SymSetOptions(SYMOPT_LOAD_LINES);
|
||||
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||
|
||||
if (SymFromAddr(process, address, &displacementSym, pSymbol) && SymGetLineFromAddr64(process, address, &displacementLine, &line)) {
|
||||
snprintf(buf_tmp,sizeof(buf_tmp),"BackTrace %08" PRId64 " %s:%d %s\n", taosGetSelfPthreadId(), line.FileName, line.LineNumber, pSymbol->Name);
|
||||
} else {
|
||||
snprintf(buf_tmp,sizeof(buf_tmp),"BackTrace error: %d\n",GetLastError());
|
||||
}
|
||||
write(1,buf_tmp,strlen(buf_tmp));
|
||||
}
|
||||
for (WORD i = 0; i < frames; ++i) {
|
||||
DWORD64 address = (DWORD64)(pStack[i]);
|
||||
|
||||
DWORD64 displacementSym = 0;
|
||||
char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
|
||||
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
|
||||
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
|
||||
pSymbol->MaxNameLen = MAX_SYM_NAME;
|
||||
|
||||
DWORD displacementLine = 0;
|
||||
IMAGEHLP_LINE64 line;
|
||||
// SymSetOptions(SYMOPT_LOAD_LINES);
|
||||
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||
|
||||
if (SymFromAddr(process, address, &displacementSym, pSymbol) &&
|
||||
SymGetLineFromAddr64(process, address, &displacementLine, &line)) {
|
||||
snprintf(buf_tmp, sizeof(buf_tmp), "BackTrace %08" PRId64 " %s:%d %s\n", taosGetSelfPthreadId(), line.FileName,
|
||||
line.LineNumber, pSymbol->Name);
|
||||
} else {
|
||||
snprintf(buf_tmp, sizeof(buf_tmp), "BackTrace error: %d\n", GetLastError());
|
||||
}
|
||||
write(1, buf_tmp, strlen(buf_tmp));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
|
@ -126,27 +128,26 @@ int32_t taosBackTrace(void **buffer, int32_t size) {
|
|||
|
||||
#ifdef USE_ADDR2LINE
|
||||
|
||||
#include "osThread.h"
|
||||
#include "libdwarf.h"
|
||||
#include "dwarf.h"
|
||||
#include "libdwarf.h"
|
||||
#include "osThread.h"
|
||||
|
||||
#define DW_PR_DUu "llu"
|
||||
|
||||
typedef struct lookup_table
|
||||
{
|
||||
Dwarf_Line *table;
|
||||
Dwarf_Line_Context *ctxts;
|
||||
int cnt;
|
||||
Dwarf_Addr low;
|
||||
Dwarf_Addr high;
|
||||
typedef struct lookup_table {
|
||||
Dwarf_Line *table;
|
||||
Dwarf_Line_Context *ctxts;
|
||||
int cnt;
|
||||
Dwarf_Addr low;
|
||||
Dwarf_Addr high;
|
||||
} lookup_tableT;
|
||||
|
||||
extern int create_lookup_table(Dwarf_Debug dbg, lookup_tableT *lookup_table);
|
||||
extern int create_lookup_table(Dwarf_Debug dbg, lookup_tableT *lookup_table);
|
||||
extern void delete_lookup_table(lookup_tableT *lookup_table);
|
||||
|
||||
size_t addr = 0;
|
||||
lookup_tableT lookup_table;
|
||||
Dwarf_Debug tDbg;
|
||||
size_t addr = 0;
|
||||
lookup_tableT lookup_table;
|
||||
Dwarf_Debug tDbg;
|
||||
static TdThreadOnce traceThreadInit = PTHREAD_ONCE_INIT;
|
||||
|
||||
void endTrace() {
|
||||
|
@ -157,7 +158,7 @@ void endTrace() {
|
|||
}
|
||||
}
|
||||
void startTrace() {
|
||||
int ret;
|
||||
int ret;
|
||||
Dwarf_Ptr errarg = 0;
|
||||
|
||||
FILE *fp = fopen("/proc/self/maps", "r");
|
||||
|
@ -178,7 +179,7 @@ void startTrace() {
|
|||
atexit(endTrace);
|
||||
}
|
||||
static void print_line(Dwarf_Debug dbg, Dwarf_Line line, Dwarf_Addr pc) {
|
||||
char *linesrc = "??";
|
||||
char *linesrc = "??";
|
||||
Dwarf_Unsigned lineno = 0;
|
||||
|
||||
if (line) {
|
||||
|
@ -189,18 +190,18 @@ static void print_line(Dwarf_Debug dbg, Dwarf_Line line, Dwarf_Addr pc) {
|
|||
if (line) dwarf_dealloc(dbg, linesrc, DW_DLA_STRING);
|
||||
}
|
||||
void taosPrintBackTrace() {
|
||||
int size = 20;
|
||||
void **buffer[20];
|
||||
int size = 20;
|
||||
void **buffer[20];
|
||||
Dwarf_Addr pc;
|
||||
int32_t frame = 0;
|
||||
void **ebp;
|
||||
void **ret = NULL;
|
||||
size_t func_frame_distance = 0;
|
||||
int32_t frame = 0;
|
||||
void **ebp;
|
||||
void **ret = NULL;
|
||||
size_t func_frame_distance = 0;
|
||||
|
||||
taosThreadOnce(&traceThreadInit, startTrace);
|
||||
|
||||
if (buffer != NULL && size > 0) {
|
||||
ebp = taosGetEbp();
|
||||
ebp = taosGetEbp();
|
||||
func_frame_distance = (size_t)*ebp - (size_t)ebp;
|
||||
while (ebp && frame < size && (func_frame_distance < (1ULL << 24)) && (func_frame_distance > 0)) {
|
||||
ret = ebp + 1;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue