TDengine/include/common/tglobal.h

286 lines
8.4 KiB
C
Raw Normal View History

2019-07-11 08:36:16 +00:00
/*
* 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/>.
*/
2021-10-04 12:42:53 +00:00
#ifndef _TD_COMMON_GLOBAL_H_
#define _TD_COMMON_GLOBAL_H_
2021-01-18 02:34:06 +00:00
2022-02-28 09:39:07 +00:00
#include "tarray.h"
#include "tconfig.h"
#include "tdef.h"
2022-02-28 09:39:07 +00:00
2019-07-11 08:36:16 +00:00
#ifdef __cplusplus
extern "C" {
#endif
2024-06-19 10:54:26 +00:00
#define SLOW_LOG_TYPE_NULL 0x0
2023-04-23 07:54:15 +00:00
#define SLOW_LOG_TYPE_QUERY 0x1
#define SLOW_LOG_TYPE_INSERT 0x2
#define SLOW_LOG_TYPE_OTHERS 0x4
2024-06-22 07:38:24 +00:00
#define SLOW_LOG_TYPE_ALL 0x7
2023-04-23 07:54:15 +00:00
2024-03-29 02:48:49 +00:00
typedef enum {
DND_CA_SM4 = 1,
} EEncryptAlgor;
typedef enum {
DND_CS_TSDB = 1,
DND_CS_VNODE_WAL = 2,
DND_CS_SDB = 4,
DND_CS_MNODE_WAL = 8,
} EEncryptScope;
2022-02-24 10:13:57 +00:00
// cluster
2022-02-24 10:35:25 +00:00
extern char tsFirst[];
extern char tsSecond[];
extern char tsLocalFqdn[];
extern char tsLocalEp[];
2023-07-17 01:19:24 +00:00
extern char tsVersionName[];
2022-02-24 10:35:25 +00:00
extern uint16_t tsServerPort;
extern int32_t tsVersion;
extern int32_t tsStatusInterval;
2022-05-16 13:03:20 +00:00
extern int32_t tsNumOfSupportVnodes;
2024-03-29 02:48:49 +00:00
extern char tsEncryptAlgorithm[];
extern char tsEncryptScope[];
extern EEncryptAlgor tsiEncryptAlgorithm;
extern EEncryptScope tsiEncryptScope;
//extern char tsAuthCode[];
extern char tsEncryptKey[];
2022-02-24 10:13:57 +00:00
2020-06-23 03:22:35 +00:00
// common
2022-02-24 10:13:57 +00:00
extern int32_t tsMaxShellConns;
extern int32_t tsShellActivityTimer;
extern int32_t tsCompressMsgSize;
extern int64_t tsTickPerMin[3];
extern int64_t tsTickPerHour[3];
extern int32_t tsCountAlwaysReturnValue;
2022-11-16 06:23:12 +00:00
extern float tsSelectivityRatio;
extern int32_t tsTagFilterResCacheSize;
2022-04-07 06:48:13 +00:00
// queue & threads
extern int32_t tsNumOfRpcThreads;
2023-02-19 10:10:42 +00:00
extern int32_t tsNumOfRpcSessions;
2023-02-24 13:20:15 +00:00
extern int32_t tsTimeToGetAvailableConn;
2023-08-01 06:38:30 +00:00
extern int32_t tsKeepAliveIdle;
2022-04-07 06:48:13 +00:00
extern int32_t tsNumOfCommitThreads;
extern int32_t tsNumOfTaskQueueThreads;
2022-04-07 07:43:47 +00:00
extern int32_t tsNumOfMnodeQueryThreads;
2022-06-15 12:59:33 +00:00
extern int32_t tsNumOfMnodeFetchThreads;
2022-04-07 07:43:47 +00:00
extern int32_t tsNumOfMnodeReadThreads;
extern int32_t tsNumOfVnodeQueryThreads;
extern float tsRatioOfVnodeStreamThreads;
2022-04-07 07:43:47 +00:00
extern int32_t tsNumOfVnodeFetchThreads;
2022-08-24 02:57:06 +00:00
extern int32_t tsNumOfVnodeRsmaThreads;
2022-04-07 07:51:24 +00:00
extern int32_t tsNumOfQnodeQueryThreads;
extern int32_t tsNumOfQnodeFetchThreads;
2022-10-28 09:03:17 +00:00
extern int32_t tsNumOfSnodeStreamThreads;
extern int32_t tsNumOfSnodeWriteThreads;
extern int64_t tsRpcQueueMemoryAllowed;
2024-06-12 09:23:57 +00:00
extern int32_t tsRetentionSpeedLimitMB;
2022-04-07 06:48:13 +00:00
// sync raft
extern int32_t tsElectInterval;
extern int32_t tsHeartbeatInterval;
extern int32_t tsHeartbeatTimeout;
extern int32_t tsSnapReplMaxWaitN;
// arbitrator
extern int32_t tsArbHeartBeatIntervalSec;
extern int32_t tsArbCheckSyncIntervalSec;
extern int32_t tsArbSetAssignedTimeoutSec;
// vnode
extern int64_t tsVndCommitMaxIntervalMs;
2023-11-02 12:13:29 +00:00
// snode
2023-11-07 10:49:12 +00:00
extern int32_t tsRsyncPort;
extern char tsCheckpointBackupDir[];
2023-11-02 12:13:29 +00:00
2023-11-07 10:55:46 +00:00
// vnode checkpoint
extern char tsSnodeAddress[]; // 127.0.0.1:873
2023-11-07 10:55:46 +00:00
// mnode
extern int64_t tsMndSdbWriteDelta;
extern int64_t tsMndLogRetention;
2023-06-15 05:29:41 +00:00
extern bool tsMndSkipGrant;
2023-09-01 07:11:25 +00:00
extern bool tsEnableWhiteList;
2023-07-19 07:30:14 +00:00
// dnode
extern int64_t tsDndStart;
2023-07-23 15:25:58 +00:00
extern int64_t tsDndStartOsUptime;
2023-07-19 07:30:14 +00:00
extern int64_t tsDndUpTime;
2024-03-27 12:03:38 +00:00
// dnode misc
2024-03-28 08:17:35 +00:00
extern uint32_t tsEncryptionKeyChksum;
extern int8_t tsEncryptionKeyStat;
extern int8_t tsGrant;
2024-03-27 12:03:38 +00:00
2022-03-02 06:44:04 +00:00
// monitor
extern bool tsEnableMonitor;
extern int32_t tsMonitorInterval;
extern char tsMonitorFqdn[];
extern uint16_t tsMonitorPort;
2022-03-02 07:41:19 +00:00
extern int32_t tsMonitorMaxLogs;
2022-03-07 05:52:49 +00:00
extern bool tsMonitorComp;
2024-01-24 09:44:44 +00:00
extern bool tsMonitorLogProtocol;
extern bool tsMonitorForceV2;
2022-03-02 06:44:04 +00:00
2023-08-28 01:15:51 +00:00
// audit
2024-04-08 02:33:02 +00:00
extern bool tsEnableAudit;
extern bool tsEnableAuditCreateTable;
extern int32_t tsAuditInterval;
2023-08-28 01:15:51 +00:00
2022-04-20 09:14:19 +00:00
// telem
extern bool tsEnableTelem;
extern int32_t tsTelemInterval;
extern char tsTelemServer[];
extern uint16_t tsTelemPort;
2022-12-30 05:30:54 +00:00
extern bool tsEnableCrashReport;
2024-04-08 02:33:02 +00:00
extern char *tsTelemUri;
extern char *tsClientCrashReportUri;
extern char *tsSvrCrashReportUri;
2022-04-20 09:14:19 +00:00
2021-12-30 03:35:46 +00:00
// query buffer management
extern int32_t tsQueryBufferSize; // maximum allowed usage buffer size in MB for each data node during query processing
extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in byte for each data node
extern int32_t tsCacheLazyLoadThreshold; // cost threshold for last/last_row loading cache as much as possible
2020-10-24 15:07:12 +00:00
2022-04-22 10:23:37 +00:00
// query client
extern int32_t tsQueryPolicy;
2022-10-14 01:31:18 +00:00
extern int32_t tsQueryRspPolicy;
extern int64_t tsQueryMaxConcurrentTables;
2022-06-11 10:21:47 +00:00
extern int32_t tsQuerySmaOptimize;
extern int32_t tsQueryRsmaTolerance;
extern bool tsQueryPlannerTrace;
extern int32_t tsQueryNodeChunkSize;
extern bool tsQueryUseNodeAllocator;
extern bool tsKeepColumnName;
extern bool tsEnableQueryHb;
2023-04-13 08:40:38 +00:00
extern bool tsEnableScience;
extern bool tsTtlChangeOnWrite;
extern int32_t tsTtlFlushThreshold;
extern int32_t tsRedirectPeriod;
extern int32_t tsRedirectFactor;
extern int32_t tsRedirectMaxPeriod;
extern int32_t tsMaxRetryWaitTime;
extern bool tsUseAdapter;
2023-05-10 09:44:53 +00:00
extern int32_t tsMetaCacheMaxSize;
2023-04-23 07:54:15 +00:00
extern int32_t tsSlowLogThreshold;
2024-06-19 10:54:26 +00:00
extern int32_t tsSlowLogThresholdTest;
extern char tsSlowLogExceptDb[];
2023-04-23 07:54:15 +00:00
extern int32_t tsSlowLogScope;
2024-06-19 10:54:26 +00:00
extern int32_t tsSlowLogMaxLen;
extern int32_t tsTimeSeriesThreshold;
2024-04-11 08:48:58 +00:00
extern bool tsMultiResultFunctionStarReturnTags;
2022-04-22 10:23:37 +00:00
2020-06-23 03:22:35 +00:00
// client
extern int32_t tsMinSlidingTime;
extern int32_t tsMinIntervalTime;
extern int32_t tsMaxInsertBatchRows;
2019-07-11 08:36:16 +00:00
2022-02-24 10:13:57 +00:00
// build info
extern char version[];
extern char compatible_version[];
extern char gitinfo[];
extern char buildinfo[];
// lossy
extern char tsLossyColumns[];
2023-09-23 04:04:41 +00:00
extern float tsFPrecision;
2022-02-24 10:13:57 +00:00
extern double tsDPrecision;
extern uint32_t tsMaxRange;
extern uint32_t tsCurRange;
2023-09-15 06:30:23 +00:00
extern bool tsIfAdtFse;
2022-02-24 10:13:57 +00:00
extern char tsCompressor[];
// tfs
extern int32_t tsDiskCfgNum;
extern SDiskCfg tsDiskCfg[];
2023-08-23 08:41:29 +00:00
extern int64_t tsMinDiskFreeSize;
2022-02-24 10:13:57 +00:00
// udf
extern bool tsStartUdfd;
2022-09-19 09:28:13 +00:00
extern char tsUdfdResFuncs[];
extern char tsUdfdLdLibPath[];
// schemaless
extern char tsSmlChildTableName[];
extern char tsSmlAutoChildTableNameDelimiter[];
extern char tsSmlTagName[];
extern bool tsSmlDot2Underline;
extern char tsSmlTsDefaultName[];
// extern bool tsSmlDataFormat;
// extern int32_t tsSmlBatchSize;
2023-06-27 09:44:51 +00:00
extern int32_t tmqMaxTopicNum;
2024-04-12 01:49:08 +00:00
extern int32_t tmqRowSize;
2024-03-19 04:04:27 +00:00
extern int32_t tsMaxTsmaNum;
extern int32_t tsMaxTsmaCalcDelay;
2024-04-28 09:42:24 +00:00
extern int64_t tsmaDataDeleteMark;
2023-06-27 09:44:51 +00:00
// wal
extern int64_t tsWalFsyncDataSizeLimit;
// internal
extern int32_t tsTransPullupInterval;
2023-11-23 04:43:28 +00:00
extern int32_t tsCompactPullupInterval;
extern int32_t tsMqRebalanceInterval;
extern int32_t tsStreamCheckpointInterval;
extern float tsSinkDataRate;
extern int32_t tsStreamNodeCheckInterval;
extern int32_t tsMaxConcurrentCheckpoint;
2022-06-21 10:37:47 +00:00
extern int32_t tsTtlUnit;
extern int32_t tsTtlPushIntervalSec;
extern int32_t tsTtlBatchDropNum;
extern int32_t tsTrimVDbIntervalSec;
2024-04-08 02:33:02 +00:00
extern int32_t tsS3MigrateIntervalSec;
extern bool tsS3MigrateEnabled;
2022-07-06 12:46:41 +00:00
extern int32_t tsGrantHBInterval;
2022-08-23 09:29:31 +00:00
extern int32_t tsUptimeInterval;
2022-05-04 14:00:04 +00:00
2023-04-03 06:31:37 +00:00
extern bool tsDisableStream;
extern int64_t tsStreamBufferSize;
2023-12-08 11:00:10 +00:00
extern int tsStreamAggCnt;
extern bool tsFilterScalarMode;
2023-05-31 03:15:25 +00:00
extern int32_t tsMaxStreamBackendCache;
extern int32_t tsPQSortMemThreshold;
2023-08-01 06:24:28 +00:00
extern int32_t tsResolveFQDNRetryTime;
2023-02-15 10:39:05 +00:00
2023-12-15 02:40:54 +00:00
extern bool tsExperimental;
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
2019-11-26 06:30:36 +00:00
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc);
2024-05-21 01:57:33 +00:00
int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd,
const char *envFile, char *apolloUrl, SArray *pArgs);
int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl, SArray *pArgs,
2024-05-21 01:57:33 +00:00
bool tsc);
2022-02-24 10:13:57 +00:00
void taosCleanupCfg();
2023-11-13 06:49:50 +00:00
2024-04-25 05:58:02 +00:00
int32_t taosCfgDynamicOptions(SConfig *pCfg, const char *name, bool forServer);
2020-10-22 06:28:44 +00:00
2022-02-24 11:06:39 +00:00
struct SConfig *taosGetCfg();
2024-07-24 08:36:57 +00:00
int32_t taosSetGlobalDebugFlag(int32_t flag);
int32_t taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal);
void taosLocalCfgForbiddenToChange(char *name, bool *forbidden);
int8_t taosGranted(int8_t type);
int32_t taosSetSlowLogScope(char *pScopeStr, int32_t *pScope);
2022-02-24 11:06:39 +00:00
2019-07-11 08:36:16 +00:00
#ifdef __cplusplus
}
#endif
2021-10-04 12:42:53 +00:00
#endif /*_TD_COMMON_GLOBAL_H_*/