tglobal.h 4.1 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

H
hzcheng 已提交
19 20 21 22
#ifdef __cplusplus
extern "C" {
#endif

23 24
#include "tdef.h"

S
Shengliang Guan 已提交
25 26 27 28 29
// cluster
extern char     tsFirst[];
extern char     tsSecond[];
extern char     tsLocalFqdn[];
extern char     tsLocalEp[];
J
jtao1735 已提交
30
extern uint16_t tsServerPort;
S
Shengliang Guan 已提交
31
extern int32_t  tsStatusInterval;
S
Shengliang Guan 已提交
32
extern int8_t   tsEnableTelemetryReporting;
S
Shengliang Guan 已提交
33
extern int32_t  tsNumOfSupportVnodes;
S
Shengliang Guan 已提交
34 35 36 37

// common
extern int      tsRpcTimer;
extern int      tsRpcMaxTime;
S
Shengliang Guan 已提交
38
extern int      tsRpcForceTcp;  // all commands go to tcp protocol if this is enabled
S
Shengliang Guan 已提交
39 40 41 42 43
extern int32_t  tsMaxConnections;
extern int32_t  tsMaxShellConns;
extern int32_t  tsShellActivityTimer;
extern uint32_t tsMaxTmrCtrl;
extern float    tsNumOfThreadsPerCore;
S
TD-2067  
Shengliang Guan 已提交
44
extern int32_t  tsNumOfCommitThreads;
45
extern float    tsRatioOfQueryCores;
S
Shengliang Guan 已提交
46
extern int8_t   tsDaylight;
S
Shengliang Guan 已提交
47
extern int8_t   tsEnableCoreFile;
S
Shengliang Guan 已提交
48
extern int32_t  tsCompressMsgSize;
49
extern int32_t  tsCompressColData;
50
extern int32_t  tsMaxNumOfDistinctResults;
51
extern char     tsTempDir[];
S
Shengliang Guan 已提交
52 53 54 55 56 57 58 59 60 61 62 63
extern int      tsCompatibleModel;  // 2.0 compatible model
extern int8_t   tsEnableSlaveQuery;
extern int8_t   tsEnableAdjustMaster;
extern int8_t   tsPrintAuth;
extern int64_t  tsTickPerDay[3];

// 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 tsRetrieveBlockingModel;  // retrieve threads will be blocked
extern int8_t  tsKeepOriginalColumnName;
extern int8_t  tsDeadLockKillQuery;
H
Haojun Liao 已提交
64

S
Shengliang Guan 已提交
65 66
// client
extern int32_t tsMaxSQLStringLen;
67
extern int32_t tsMaxWildCardsLen;
68
extern int32_t tsMaxRegexStringLen;
S
Shengliang Guan 已提交
69
extern int8_t  tsTscEnableRecordSql;
S
Shengliang Guan 已提交
70 71 72 73 74
extern int32_t tsMaxNumOfOrderedResults;
extern int32_t tsMinSlidingTime;
extern int32_t tsMinIntervalTime;
extern int32_t tsMaxStreamComputDelay;
extern int32_t tsStreamCompStartDelay;
75
extern int32_t tsRetryStreamCompDelay;
S
Shengliang Guan 已提交
76 77 78
extern float   tsStreamComputDelayRatio;  // the delayed computing ration of the whole time window
extern int32_t tsProjectExecInterval;
extern int64_t tsMaxRetentWindow;
H
hzcheng 已提交
79

S
Shengliang Guan 已提交
80
// system info
S
Shengliang Guan 已提交
81 82 83 84 85 86 87 88 89 90
extern float    tsTotalLogDirGB;
extern float    tsTotalTmpDirGB;
extern float    tsTotalDataDirGB;
extern float    tsAvailLogDirGB;
extern float    tsAvailTmpDirectorySpace;
extern float    tsAvailDataDirGB;
extern float    tsUsedDataDirGB;
extern float    tsMinimalLogDirGB;
extern float    tsReservedTmpDirectorySpace;
extern float    tsMinimalDataDirGB;
91
extern uint32_t tsVersion;
S
slguan 已提交
92

S
Shengliang Guan 已提交
93 94 95 96 97 98
// build info
extern char version[];
extern char compatible_version[];
extern char gitinfo[];
extern char gitinfoOfInternal[];
extern char buildinfo[];
S
slguan 已提交
99

S
Shengliang Guan 已提交
100 101 102 103 104 105 106
// lossy
extern char     tsLossyColumns[];
extern double   tsFPrecision;
extern double   tsDPrecision;
extern uint32_t tsMaxRange;
extern uint32_t tsCurRange;
extern char     tsCompressor[];
T
tickduan 已提交
107

S
TD-1767  
Shengliang Guan 已提交
108
typedef struct {
109
  char dir[TSDB_FILENAME_LEN];
S
TD-1767  
Shengliang Guan 已提交
110 111 112 113 114 115
  int  level;
  int  primary;
} SDiskCfg;
extern int32_t  tsDiskCfgNum;
extern SDiskCfg tsDiskCfg[];

H
hjxilinx 已提交
116 117
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)

H
Hongze Cheng 已提交
118
void    taosInitGlobalCfg();
119
int32_t taosCheckAndPrintCfg();
S
Shengliang Guan 已提交
120
int32_t taosCfgDynamicOptions(char *msg);
H
Hongze Cheng 已提交
121 122 123 124
bool    taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *dnodeId);
void    taosAddDataDir(int index, char *v1, int level, int primary);
void    taosReadDataDirCfg(char *v1, char *v2, char *v3);
void    taosPrintDataDirCfg();
S
TD-1767  
Shengliang Guan 已提交
125

H
hzcheng 已提交
126 127 128 129
#ifdef __cplusplus
}
#endif

130
#endif /*_TD_COMMON_GLOBAL_H_*/