提交 0bb41e5b 编写于 作者: S slguan

Use assert in code locations that can cause file corruption and set global configuration items

上级 391f2de0
......@@ -36,7 +36,6 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET(TD_LINUX TRUE)
ADD_DEFINITIONS(-DLINUX)
IF (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(COMMON_FLAGS "-std=gnu99 -Wall -fPIC -malign-double -g -Wno-char-subscripts -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
ELSE ()
......
......@@ -72,9 +72,10 @@ extern float tsNumOfThreadsPerCore;
extern float tsRatioOfQueryThreads;
extern char tsInternalIp[];
extern char tsServerIpStr[];
extern int tsNumOfVnodesPerCore;
extern int tsNumOfTotalVnodes;
extern short tsNumOfVnodesPerCore;
extern short tsNumOfTotalVnodes;
extern int tsShellsPerVnode;
extern short tsCheckHeaderFile;
extern int tsSessionsPerVnode;
extern int tsAverageCacheBlocks;
......@@ -84,11 +85,11 @@ extern int tsRowsInFileBlock;
extern float tsFileBlockMinPercent;
extern short tsNumOfBlocksPerMeter;
extern int tsCommitTime; // seconds
extern int tsCommitLog;
extern int tsAsyncLog;
extern int tsCompression;
extern int tsDaysPerFile;
extern short tsCommitTime; // seconds
extern short tsCommitLog;
extern short tsAsyncLog;
extern short tsCompression;
extern short tsDaysPerFile;
extern int tsDaysToKeep;
extern int tsReplications;
......
......@@ -390,10 +390,10 @@ void vnodeCloseCommitFiles(SVnodeObj *pVnode) {
int ret;
// Check new if new header file is correct
#ifdef _CHECK_HEADER_FILE_
assert(vnodeCheckNewHeaderFile(pVnode->nfd, pVnode) == 0);
#endif
if (tsCheckHeaderFile != 0) {
assert(vnodeCheckNewHeaderFile(pVnode->nfd, pVnode) == 0);
}
close(pVnode->nfd);
pVnode->nfd = 0;
......
......@@ -70,8 +70,9 @@ float tsNumOfThreadsPerCore = 1.0;
float tsRatioOfQueryThreads = 0.5;
char tsInternalIp[TSDB_IPv4ADDR_LEN] = {0};
char tsServerIpStr[TSDB_IPv4ADDR_LEN] = "0.0.0.0";
int tsNumOfVnodesPerCore = 8;
int tsNumOfTotalVnodes = 0;
short tsNumOfVnodesPerCore = 8;
short tsNumOfTotalVnodes = 0;
short tsCheckHeaderFile = 0;
int tsSessionsPerVnode = 1000;
int tsCacheBlockSize = 16384; // 256 columns
......@@ -81,10 +82,10 @@ int tsRowsInFileBlock = 4096;
float tsFileBlockMinPercent = 0.05;
short tsNumOfBlocksPerMeter = 100;
int tsCommitTime = 3600; // seconds
int tsCommitLog = 1;
int tsCompression = 2;
int tsDaysPerFile = 10;
short tsCommitTime = 3600; // seconds
short tsCommitLog = 1;
short tsCompression = 2;
short tsDaysPerFile = 10;
int tsDaysToKeep = 3650;
int tsMaxShellConns = 2000;
......@@ -418,10 +419,12 @@ void tsInitGlobalConfig() {
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT, 0, 10, 0, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "ratioOfQueryThreads", &tsRatioOfQueryThreads, TSDB_CFG_VTYPE_FLOAT,
TSDB_CFG_CTYPE_B_CONFIG, 0.1, 0.9, 0, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "numOfVnodesPerCore", &tsNumOfVnodesPerCore, TSDB_CFG_VTYPE_INT,
tsInitConfigOption(cfg++, "numOfVnodesPerCore", &tsNumOfVnodesPerCore, TSDB_CFG_VTYPE_SHORT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 1, 64, 0, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "numOfTotalVnodes", &tsNumOfTotalVnodes, TSDB_CFG_VTYPE_INT, TSDB_CFG_CTYPE_B_CONFIG, 0,
tsInitConfigOption(cfg++, "numOfTotalVnodes", &tsNumOfTotalVnodes, TSDB_CFG_VTYPE_SHORT, TSDB_CFG_CTYPE_B_CONFIG, 0,
TSDB_MAX_VNODES, 0, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "checkHeaderFile", &tsCheckHeaderFile, TSDB_CFG_VTYPE_SHORT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 0, 1, 0, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "tables", &tsSessionsPerVnode, TSDB_CFG_VTYPE_INT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 4, 220000, 0, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "cache", &tsCacheBlockSize, TSDB_CFG_VTYPE_INT,
......@@ -442,7 +445,7 @@ void tsInitGlobalConfig() {
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT, 100, 3000, 0, TSDB_CFG_UTYPE_MS);
tsInitConfigOption(cfg++, "rpcMaxTime", &tsRpcMaxTime, TSDB_CFG_VTYPE_INT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT, 100, 7200, 0, TSDB_CFG_UTYPE_SECOND);
tsInitConfigOption(cfg++, "ctime", &tsCommitTime, TSDB_CFG_VTYPE_INT,
tsInitConfigOption(cfg++, "ctime", &tsCommitTime, TSDB_CFG_VTYPE_SHORT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 30, 40960, 0, TSDB_CFG_UTYPE_SECOND);
tsInitConfigOption(cfg++, "statusInterval", &tsStatusInterval, TSDB_CFG_VTYPE_INT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 1, 10, 0, TSDB_CFG_UTYPE_SECOND);
......@@ -474,13 +477,13 @@ void tsInitGlobalConfig() {
tsInitConfigOption(cfg++, "retryStreamCompDelay", &tsStreamCompRetryDelay, TSDB_CFG_VTYPE_INT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 10, 1000000000, 0, TSDB_CFG_UTYPE_MS);
tsInitConfigOption(cfg++, "clog", &tsCommitLog, TSDB_CFG_VTYPE_INT,
tsInitConfigOption(cfg++, "clog", &tsCommitLog, TSDB_CFG_VTYPE_SHORT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 0, 1, 0, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "comp", &tsCompression, TSDB_CFG_VTYPE_INT,
tsInitConfigOption(cfg++, "comp", &tsCompression, TSDB_CFG_VTYPE_SHORT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 0, 2, 0, TSDB_CFG_UTYPE_NONE);
// database configs
tsInitConfigOption(cfg++, "days", &tsDaysPerFile, TSDB_CFG_VTYPE_INT,
tsInitConfigOption(cfg++, "days", &tsDaysPerFile, TSDB_CFG_VTYPE_SHORT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 1, 365, 0, TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "keep", &tsDaysToKeep, TSDB_CFG_VTYPE_INT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 1, 365000, 0, TSDB_CFG_UTYPE_NONE);
......@@ -539,7 +542,7 @@ void tsInitGlobalConfig() {
tsInitConfigOption(cfg++, "numOfLogLines", &tsNumOfLogLines, TSDB_CFG_VTYPE_INT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT, 10000, 2000000000, 0,
TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "asyncLog", &tsAsyncLog, TSDB_CFG_VTYPE_INT,
tsInitConfigOption(cfg++, "asyncLog", &tsAsyncLog, TSDB_CFG_VTYPE_SHORT,
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT, 0, 1, 0,
TSDB_CFG_UTYPE_NONE);
tsInitConfigOption(cfg++, "debugFlag", &debugFlag, TSDB_CFG_VTYPE_INT,
......
......@@ -53,7 +53,7 @@ typedef struct {
} SLogBuff;
int uDebugFlag = 131; // all the messages
int tsAsyncLog = 1;
short tsAsyncLog = 1;
static SLogBuff *logHandle;
static int taosLogFileNum = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册