Use assert in code locations that can cause file corruption and set global configuration items
This commit is contained in:
parent
391f2de001
commit
0bb41e5bca
|
@ -36,7 +36,6 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
SET(TD_LINUX TRUE)
|
SET(TD_LINUX TRUE)
|
||||||
ADD_DEFINITIONS(-DLINUX)
|
ADD_DEFINITIONS(-DLINUX)
|
||||||
|
|
||||||
|
|
||||||
IF (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
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")
|
SET(COMMON_FLAGS "-std=gnu99 -Wall -fPIC -malign-double -g -Wno-char-subscripts -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
|
||||||
ELSE ()
|
ELSE ()
|
||||||
|
|
|
@ -72,9 +72,10 @@ extern float tsNumOfThreadsPerCore;
|
||||||
extern float tsRatioOfQueryThreads;
|
extern float tsRatioOfQueryThreads;
|
||||||
extern char tsInternalIp[];
|
extern char tsInternalIp[];
|
||||||
extern char tsServerIpStr[];
|
extern char tsServerIpStr[];
|
||||||
extern int tsNumOfVnodesPerCore;
|
extern short tsNumOfVnodesPerCore;
|
||||||
extern int tsNumOfTotalVnodes;
|
extern short tsNumOfTotalVnodes;
|
||||||
extern int tsShellsPerVnode;
|
extern int tsShellsPerVnode;
|
||||||
|
extern short tsCheckHeaderFile;
|
||||||
|
|
||||||
extern int tsSessionsPerVnode;
|
extern int tsSessionsPerVnode;
|
||||||
extern int tsAverageCacheBlocks;
|
extern int tsAverageCacheBlocks;
|
||||||
|
@ -84,11 +85,11 @@ extern int tsRowsInFileBlock;
|
||||||
extern float tsFileBlockMinPercent;
|
extern float tsFileBlockMinPercent;
|
||||||
|
|
||||||
extern short tsNumOfBlocksPerMeter;
|
extern short tsNumOfBlocksPerMeter;
|
||||||
extern int tsCommitTime; // seconds
|
extern short tsCommitTime; // seconds
|
||||||
extern int tsCommitLog;
|
extern short tsCommitLog;
|
||||||
extern int tsAsyncLog;
|
extern short tsAsyncLog;
|
||||||
extern int tsCompression;
|
extern short tsCompression;
|
||||||
extern int tsDaysPerFile;
|
extern short tsDaysPerFile;
|
||||||
extern int tsDaysToKeep;
|
extern int tsDaysToKeep;
|
||||||
extern int tsReplications;
|
extern int tsReplications;
|
||||||
|
|
||||||
|
|
|
@ -390,9 +390,9 @@ void vnodeCloseCommitFiles(SVnodeObj *pVnode) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
// Check new if new header file is correct
|
// Check new if new header file is correct
|
||||||
#ifdef _CHECK_HEADER_FILE_
|
if (tsCheckHeaderFile != 0) {
|
||||||
assert(vnodeCheckNewHeaderFile(pVnode->nfd, pVnode) == 0);
|
assert(vnodeCheckNewHeaderFile(pVnode->nfd, pVnode) == 0);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
close(pVnode->nfd);
|
close(pVnode->nfd);
|
||||||
pVnode->nfd = 0;
|
pVnode->nfd = 0;
|
||||||
|
|
|
@ -70,8 +70,9 @@ float tsNumOfThreadsPerCore = 1.0;
|
||||||
float tsRatioOfQueryThreads = 0.5;
|
float tsRatioOfQueryThreads = 0.5;
|
||||||
char tsInternalIp[TSDB_IPv4ADDR_LEN] = {0};
|
char tsInternalIp[TSDB_IPv4ADDR_LEN] = {0};
|
||||||
char tsServerIpStr[TSDB_IPv4ADDR_LEN] = "0.0.0.0";
|
char tsServerIpStr[TSDB_IPv4ADDR_LEN] = "0.0.0.0";
|
||||||
int tsNumOfVnodesPerCore = 8;
|
short tsNumOfVnodesPerCore = 8;
|
||||||
int tsNumOfTotalVnodes = 0;
|
short tsNumOfTotalVnodes = 0;
|
||||||
|
short tsCheckHeaderFile = 0;
|
||||||
|
|
||||||
int tsSessionsPerVnode = 1000;
|
int tsSessionsPerVnode = 1000;
|
||||||
int tsCacheBlockSize = 16384; // 256 columns
|
int tsCacheBlockSize = 16384; // 256 columns
|
||||||
|
@ -81,10 +82,10 @@ int tsRowsInFileBlock = 4096;
|
||||||
float tsFileBlockMinPercent = 0.05;
|
float tsFileBlockMinPercent = 0.05;
|
||||||
|
|
||||||
short tsNumOfBlocksPerMeter = 100;
|
short tsNumOfBlocksPerMeter = 100;
|
||||||
int tsCommitTime = 3600; // seconds
|
short tsCommitTime = 3600; // seconds
|
||||||
int tsCommitLog = 1;
|
short tsCommitLog = 1;
|
||||||
int tsCompression = 2;
|
short tsCompression = 2;
|
||||||
int tsDaysPerFile = 10;
|
short tsDaysPerFile = 10;
|
||||||
int tsDaysToKeep = 3650;
|
int tsDaysToKeep = 3650;
|
||||||
|
|
||||||
int tsMaxShellConns = 2000;
|
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);
|
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,
|
tsInitConfigOption(cfg++, "ratioOfQueryThreads", &tsRatioOfQueryThreads, TSDB_CFG_VTYPE_FLOAT,
|
||||||
TSDB_CFG_CTYPE_B_CONFIG, 0.1, 0.9, 0, TSDB_CFG_UTYPE_NONE);
|
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);
|
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);
|
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,
|
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);
|
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,
|
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);
|
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,
|
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);
|
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);
|
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,
|
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);
|
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,
|
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);
|
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);
|
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);
|
TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW, 0, 2, 0, TSDB_CFG_UTYPE_NONE);
|
||||||
|
|
||||||
// database configs
|
// 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);
|
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,
|
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);
|
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,
|
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_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT, 10000, 2000000000, 0,
|
||||||
TSDB_CFG_UTYPE_NONE);
|
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_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG | TSDB_CFG_CTYPE_B_CLIENT, 0, 1, 0,
|
||||||
TSDB_CFG_UTYPE_NONE);
|
TSDB_CFG_UTYPE_NONE);
|
||||||
tsInitConfigOption(cfg++, "debugFlag", &debugFlag, TSDB_CFG_VTYPE_INT,
|
tsInitConfigOption(cfg++, "debugFlag", &debugFlag, TSDB_CFG_VTYPE_INT,
|
||||||
|
|
|
@ -53,7 +53,7 @@ typedef struct {
|
||||||
} SLogBuff;
|
} SLogBuff;
|
||||||
|
|
||||||
int uDebugFlag = 131; // all the messages
|
int uDebugFlag = 131; // all the messages
|
||||||
int tsAsyncLog = 1;
|
short tsAsyncLog = 1;
|
||||||
|
|
||||||
static SLogBuff *logHandle;
|
static SLogBuff *logHandle;
|
||||||
static int taosLogFileNum = 1;
|
static int taosLogFileNum = 1;
|
||||||
|
|
Loading…
Reference in New Issue