tglobal.h 6.6 KB
Newer Older
H
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * 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/>.
 */

16 17
#ifndef _TD_COMMON_GLOBAL_H_
#define _TD_COMMON_GLOBAL_H_
H
Hongze Cheng 已提交
18

S
Shengliang Guan 已提交
19
#include "tarray.h"
20
#include "tconfig.h"
21
#include "tdef.h"
S
Shengliang Guan 已提交
22

H
hzcheng 已提交
23 24 25 26
#ifdef __cplusplus
extern "C" {
#endif

D
dapan1121 已提交
27 28 29 30 31
#define SLOW_LOG_TYPE_QUERY  0x1
#define SLOW_LOG_TYPE_INSERT 0x2
#define SLOW_LOG_TYPE_OTHERS 0x4
#define SLOW_LOG_TYPE_ALL    0xFFFFFFFF

S
Shengliang Guan 已提交
32
// cluster
S
Shengliang Guan 已提交
33 34 35 36
extern char     tsFirst[];
extern char     tsSecond[];
extern char     tsLocalFqdn[];
extern char     tsLocalEp[];
K
kailixu 已提交
37
extern char     tsVersionName[];
S
Shengliang Guan 已提交
38 39 40
extern uint16_t tsServerPort;
extern int32_t  tsVersion;
extern int32_t  tsStatusInterval;
41
extern int32_t  tsNumOfSupportVnodes;
S
Shengliang Guan 已提交
42

S
Shengliang Guan 已提交
43
// common
S
Shengliang Guan 已提交
44 45 46 47 48 49 50
extern int32_t tsMaxShellConns;
extern int32_t tsShellActivityTimer;
extern int32_t tsCompressMsgSize;
extern int32_t tsCompressColData;
extern int32_t tsMaxNumOfDistinctResults;
extern int32_t tsCompatibleModel;
extern bool    tsPrintAuth;
51
extern int64_t tsTickPerMin[3];
52
extern int64_t tsTickPerHour[3];
53
extern int32_t tsCountAlwaysReturnValue;
H
Haojun Liao 已提交
54 55
extern float   tsSelectivityRatio;
extern int32_t tsTagFilterResCacheSize;
56

S
Shengliang Guan 已提交
57 58
// queue & threads
extern int32_t tsNumOfRpcThreads;
dengyihao's avatar
dengyihao 已提交
59
extern int32_t tsNumOfRpcSessions;
dengyihao's avatar
dengyihao 已提交
60
extern int32_t tsTimeToGetAvailableConn;
S
Shengliang Guan 已提交
61 62
extern int32_t tsNumOfCommitThreads;
extern int32_t tsNumOfTaskQueueThreads;
S
Shengliang Guan 已提交
63
extern int32_t tsNumOfMnodeQueryThreads;
D
dapan1121 已提交
64
extern int32_t tsNumOfMnodeFetchThreads;
S
Shengliang Guan 已提交
65 66
extern int32_t tsNumOfMnodeReadThreads;
extern int32_t tsNumOfVnodeQueryThreads;
67
extern float   tsRatioOfVnodeStreamThreads;
S
Shengliang Guan 已提交
68
extern int32_t tsNumOfVnodeFetchThreads;
C
Cary Xu 已提交
69
extern int32_t tsNumOfVnodeRsmaThreads;
S
Shengliang Guan 已提交
70 71
extern int32_t tsNumOfQnodeQueryThreads;
extern int32_t tsNumOfQnodeFetchThreads;
L
Liu Jicong 已提交
72 73
extern int32_t tsNumOfSnodeStreamThreads;
extern int32_t tsNumOfSnodeWriteThreads;
74
extern int64_t tsRpcQueueMemoryAllowed;
S
Shengliang Guan 已提交
75

76 77 78 79 80
// sync raft
extern int32_t tsElectInterval;
extern int32_t tsHeartbeatInterval;
extern int32_t tsHeartbeatTimeout;

81 82 83
// vnode
extern int64_t tsVndCommitMaxIntervalMs;

84 85
// mnode
extern int64_t tsMndSdbWriteDelta;
86
extern int64_t tsMndLogRetention;
K
kailixu 已提交
87
extern int8_t  tsGrant;
K
kailixu 已提交
88
extern int32_t tsMndGrantMode;
H
Haojun Liao 已提交
89
extern bool    tsMndSkipGrant;
90

K
kailixu 已提交
91 92
// dnode
extern int64_t tsDndStart;
K
kailixu 已提交
93
extern int64_t tsDndStartOsUptime;
K
kailixu 已提交
94 95
extern int64_t tsDndUpTime;

S
monitor  
Shengliang Guan 已提交
96 97 98 99 100
// monitor
extern bool     tsEnableMonitor;
extern int32_t  tsMonitorInterval;
extern char     tsMonitorFqdn[];
extern uint16_t tsMonitorPort;
S
monitor  
Shengliang Guan 已提交
101
extern int32_t  tsMonitorMaxLogs;
S
Shengliang Guan 已提交
102
extern bool     tsMonitorComp;
S
monitor  
Shengliang Guan 已提交
103

S
Shengliang Guan 已提交
104 105 106 107 108
// telem
extern bool     tsEnableTelem;
extern int32_t  tsTelemInterval;
extern char     tsTelemServer[];
extern uint16_t tsTelemPort;
D
dapan1121 已提交
109
extern bool     tsEnableCrashReport;
dengyihao's avatar
dengyihao 已提交
110 111 112
extern char    *tsTelemUri;
extern char    *tsClientCrashReportUri;
extern char    *tsSvrCrashReportUri;
S
Shengliang Guan 已提交
113

S
Shengliang Guan 已提交
114 115
// query buffer management
extern int32_t tsQueryBufferSize;  // maximum allowed usage buffer size in MB for each data node during query processing
116 117
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
H
Haojun Liao 已提交
118

X
Xiaoyu Wang 已提交
119 120
// query client
extern int32_t tsQueryPolicy;
D
dapan1121 已提交
121
extern int32_t tsQueryRspPolicy;
122
extern int64_t tsQueryMaxConcurrentTables;
X
Xiaoyu Wang 已提交
123
extern int32_t tsQuerySmaOptimize;
124
extern int32_t tsQueryRsmaTolerance;
125
extern bool    tsQueryPlannerTrace;
126 127
extern int32_t tsQueryNodeChunkSize;
extern bool    tsQueryUseNodeAllocator;
128
extern bool    tsKeepColumnName;
129
extern bool    tsEnableQueryHb;
130
extern bool    tsEnableScience;
131
extern bool    tsTtlChangeOnWrite;
132 133 134 135
extern int32_t tsRedirectPeriod;
extern int32_t tsRedirectFactor;
extern int32_t tsRedirectMaxPeriod;
extern int32_t tsMaxRetryWaitTime;
136
extern bool    tsUseAdapter;
D
dapan1121 已提交
137
extern int32_t tsMetaCacheMaxSize;
D
dapan1121 已提交
138 139
extern int32_t tsSlowLogThreshold;
extern int32_t tsSlowLogScope;
X
Xiaoyu Wang 已提交
140

S
Shengliang Guan 已提交
141 142 143
// client
extern int32_t tsMinSlidingTime;
extern int32_t tsMinIntervalTime;
144
extern int32_t tsMaxInsertBatchRows;
H
hzcheng 已提交
145

S
Shengliang Guan 已提交
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
// build info
extern char version[];
extern char compatible_version[];
extern char gitinfo[];
extern char buildinfo[];

// lossy
extern char     tsLossyColumns[];
extern double   tsFPrecision;
extern double   tsDPrecision;
extern uint32_t tsMaxRange;
extern uint32_t tsCurRange;
extern char     tsCompressor[];

// tfs
extern int32_t  tsDiskCfgNum;
extern SDiskCfg tsDiskCfg[];

S
slzhou 已提交
164
// udf
165
extern bool tsStartUdfd;
S
slzhou 已提交
166
extern char tsUdfdResFuncs[];
167
extern char tsUdfdLdLibPath[];
S
slzhou 已提交
168

169
// schemaless
170 171
extern char tsSmlChildTableName[];
extern char tsSmlTagName[];
172 173
extern bool tsSmlDot2Underline;
extern char tsSmlTsDefaultName[];
174 175
// extern bool    tsSmlDataFormat;
// extern int32_t tsSmlBatchSize;
176

wmmhello's avatar
wmmhello 已提交
177 178
extern int32_t tmqMaxTopicNum;

179
// wal
180
extern int64_t tsWalFsyncDataSizeLimit;
181

182 183 184
// internal
extern int32_t tsTransPullupInterval;
extern int32_t tsMqRebalanceInterval;
185
extern int32_t tsStreamCheckpointTickInterval;
wmmhello's avatar
wmmhello 已提交
186
extern int32_t tsTtlUnit;
wmmhello's avatar
wmmhello 已提交
187
extern int32_t tsTtlPushInterval;
C
Cary Xu 已提交
188
extern int32_t tsGrantHBInterval;
189
extern int32_t tsUptimeInterval;
190

dengyihao's avatar
dengyihao 已提交
191 192 193
extern int32_t tsRpcRetryLimit;
extern int32_t tsRpcRetryInterval;

5
54liuyao 已提交
194 195
extern bool    tsDisableStream;
extern int64_t tsStreamBufferSize;
5
54liuyao 已提交
196
extern int64_t tsCheckpointInterval;
197
extern bool    tsFilterScalarMode;
198
extern int32_t tsKeepTimeOffset;
dengyihao's avatar
dengyihao 已提交
199
extern int32_t tsMaxStreamBackendCache;
200
extern int32_t tsPQSortMemThreshold;
D
dmchen 已提交
201
extern int32_t tsResolveFQDNRetryTime;
5
54liuyao 已提交
202

203
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
H
hjxilinx 已提交
204

205 206 207 208
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
                      const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc);
int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl, SArray *pArgs,
                    bool tsc);
S
Shengliang Guan 已提交
209 210
void    taosCleanupCfg();
void    taosCfgDynamicOptions(const char *option, const char *value);
S
TD-1767  
Shengliang Guan 已提交
211

S
Shengliang Guan 已提交
212
struct SConfig *taosGetCfg();
213

wafwerar's avatar
wafwerar 已提交
214 215
void    taosSetAllDebugFlag(int32_t flag, bool rewrite);
void    taosSetDebugFlag(int32_t *pFlagPtr, const char *flagName, int32_t flagVal, bool rewrite);
D
dapan1121 已提交
216
int32_t taosApplyLocalCfg(SConfig *pCfg, char *name);
217
void    taosLocalCfgForbiddenToChange(char *name, bool *forbidden);
K
kailixu 已提交
218
int8_t  taosGranted();
S
Shengliang Guan 已提交
219

H
hzcheng 已提交
220 221 222 223
#ifdef __cplusplus
}
#endif

224
#endif /*_TD_COMMON_GLOBAL_H_*/