Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
612dd719
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
612dd719
编写于
2月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
os env
上级
1383e53d
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
122 addition
and
153 deletion
+122
-153
include/os/osEnv.h
include/os/osEnv.h
+19
-21
include/os/osSysinfo.h
include/os/osSysinfo.h
+0
-8
source/common/src/tglobal.c
source/common/src/tglobal.c
+17
-17
source/common/src/ttszip.c
source/common/src/ttszip.c
+1
-1
source/dnode/mgmt/impl/src/dndMgmt.c
source/dnode/mgmt/impl/src/dndMgmt.c
+3
-3
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+1
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+9
-9
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-1
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+1
-1
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+1
-1
source/libs/index/test/fstUT.cc
source/libs/index/test/fstUT.cc
+1
-1
source/libs/parser/src/insertParser.c
source/libs/parser/src/insertParser.c
+1
-1
source/libs/parser/src/parserImpl.c
source/libs/parser/src/parserImpl.c
+1
-1
source/libs/parser/src/parserUtil.c
source/libs/parser/src/parserUtil.c
+1
-1
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+1
-1
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+1
-1
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+1
-1
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+1
-1
source/libs/transport/test/transUT.cc
source/libs/transport/test/transUT.cc
+1
-1
source/os/src/osEnv.c
source/os/src/osEnv.c
+51
-72
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+2
-2
source/util/src/tlog.c
source/util/src/tlog.c
+2
-2
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+3
-3
tools/shell/src/shellLinux.c
tools/shell/src/shellLinux.c
+1
-1
未找到文件。
include/os/osEnv.h
浏览文件 @
612dd719
...
...
@@ -22,33 +22,31 @@
extern
"C"
{
#endif
typedef
struct
SOsEnv
SOsEnv
;
extern
char
tsOsName
[];
extern
char
tsTimezone
[];
extern
char
tsCharset
[];
extern
char
tsLocale
[];
extern
int8_t
tsDaylight
;
extern
bool
tsEnableCoreFile
;
extern
int64_t
tsPageSize
;
extern
int64_t
tsOpenMax
;
extern
int64_t
tsStreamMax
;
extern
int32_t
tsNumOfCores
;
extern
int32_t
tsTotalMemoryMB
;
extern
char
configDir
[];
extern
char
tsDataDir
[];
extern
char
tsLogDir
[];
extern
char
tsTempDir
[];
extern
SDiskSpace
tsDataSpace
;
extern
SDiskSpace
tsLogSpace
;
extern
SDiskSpace
tsTempSpace
;
void
osInit
();
void
osUpdate
();
bool
osLogSpaceAvailable
();
int8_t
osDaylight
();
const
char
*
osLogDir
();
const
char
*
osTempDir
();
const
char
*
osDataDir
();
const
char
*
osName
();
const
char
*
osTimezone
();
const
char
*
osLocale
();
const
char
*
osCharset
();
void
osSetLogDir
(
const
char
*
logDir
);
void
osSetTempDir
(
const
char
*
tempDir
);
void
osSetDataDir
(
const
char
*
dataDir
);
void
osSetLogReservedSpace
(
float
sizeInGB
);
void
osSetTempReservedSpace
(
float
sizeInGB
);
void
osSetDataReservedSpace
(
float
sizeInGB
);
bool
osLogSpaceAvailable
();
void
osSetTimezone
(
const
char
*
timezone
);
void
osSetLocale
(
const
char
*
locale
,
const
char
*
charset
);
bool
osSetEnableCore
(
bool
enable
);
#ifdef __cplusplus
}
...
...
include/os/osSysinfo.h
浏览文件 @
612dd719
...
...
@@ -37,14 +37,6 @@ typedef struct SDiskSpace {
SDiskSize
size
;
}
SDiskSpace
;
extern
int64_t
tsPageSize
;
extern
int64_t
tsOpenMax
;
extern
int64_t
tsStreamMax
;
extern
int32_t
tsNumOfCores
;
extern
int32_t
tsTotalMemoryMB
;
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SDiskSize
*
diskSize
);
int32_t
taosGetCpuCores
();
void
taosGetSystemInfo
();
...
...
source/common/src/tglobal.c
浏览文件 @
612dd719
...
...
@@ -207,7 +207,7 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char *inputCfgDir, const char *e
}
static
void
taosAddClientLogCfg
(
SConfig
*
pCfg
)
{
cfgAddDir
(
pCfg
,
"logDir"
,
osLogDir
()
,
1
);
cfgAddDir
(
pCfg
,
"logDir"
,
tsLogDir
,
1
);
cfgAddFloat
(
pCfg
,
"minimalLogDirGB"
,
1
.
0
f
,
0
.
001
f
,
10000000
,
1
);
cfgAddInt32
(
pCfg
,
"numOfLogLines"
,
tsNumOfLogLines
,
1000
,
2000000000
,
1
);
cfgAddBool
(
pCfg
,
"asyncLog"
,
tsAsyncLog
,
1
);
...
...
@@ -248,7 +248,7 @@ static void taosAddClientCfg(SConfig *pCfg) {
cfgAddString
(
pCfg
,
"secondEp"
,
defaultSecondEp
,
1
);
cfgAddString
(
pCfg
,
"fqdn"
,
defaultFqdn
,
1
);
cfgAddInt32
(
pCfg
,
"serverPort"
,
defaultServerPort
,
1
,
65056
,
1
);
cfgAddDir
(
pCfg
,
"tempDir"
,
osTempDir
()
,
1
);
cfgAddDir
(
pCfg
,
"tempDir"
,
tsTempDir
,
1
);
cfgAddFloat
(
pCfg
,
"minimalTempDirGB"
,
1
.
0
f
,
0
.
001
f
,
10000000
,
1
);
cfgAddFloat
(
pCfg
,
"numOfThreadsPerCore"
,
tsNumOfThreadsPerCore
,
0
,
10
,
1
);
cfgAddInt32
(
pCfg
,
"maxTmrCtrl"
,
tsMaxTmrCtrl
,
8
,
2048
,
1
);
...
...
@@ -263,11 +263,12 @@ static void taosAddClientCfg(SConfig *pCfg) {
cfgAddInt32
(
pCfg
,
"maxNumOfOrderedRes"
,
tsMaxNumOfOrderedResults
,
128
,
TSDB_MAX_ALLOWED_SQL_LEN
,
1
);
cfgAddBool
(
pCfg
,
"keepColumnName"
,
tsKeepOriginalColumnName
,
1
);
cfgAddInt32
(
pCfg
,
"maxBinaryDisplayWidth"
,
tsMaxBinaryDisplayWidth
,
1
,
65536
,
1
);
cfgAddTimezone
(
pCfg
,
"timezone"
,
osTimezone
()
);
cfgAddLocale
(
pCfg
,
"locale"
,
osLocale
()
);
cfgAddCharset
(
pCfg
,
"charset"
,
osCharset
()
);
cfgAddTimezone
(
pCfg
,
"timezone"
,
tsTimezone
);
cfgAddLocale
(
pCfg
,
"locale"
,
tsLocale
);
cfgAddCharset
(
pCfg
,
"charset"
,
tsCharset
);
cfgAddBool
(
pCfg
,
"enableCoreFile"
,
0
,
1
);
cfgAddInt32
(
pCfg
,
"numOfCores"
,
tsNumOfCores
,
1
,
100000
,
1
);
cfgAddString
(
pCfg
,
"version"
,
version
,
1
);
cfgAddString
(
pCfg
,
"compatible_version"
,
compatible_version
,
1
);
cfgAddString
(
pCfg
,
"gitinfo"
,
gitinfo
,
1
);
...
...
@@ -277,7 +278,7 @@ static void taosAddClientCfg(SConfig *pCfg) {
static
void
taosAddServerCfg
(
SConfig
*
pCfg
)
{
cfgAddInt32
(
pCfg
,
"supportVnodes"
,
256
,
0
,
65536
,
0
);
cfgAddDir
(
pCfg
,
"dataDir"
,
osDataDir
()
,
0
);
cfgAddDir
(
pCfg
,
"dataDir"
,
tsDataDir
,
0
);
cfgAddFloat
(
pCfg
,
"minimalDataDirGB"
,
2
.
0
f
,
0
.
001
f
,
10000000
,
0
);
cfgAddInt32
(
pCfg
,
"numOfCommitThreads"
,
tsNumOfCommitThreads
,
1
,
100
,
0
);
cfgAddFloat
(
pCfg
,
"ratioOfQueryCores"
,
tsRatioOfQueryCores
,
0
,
2
,
0
);
...
...
@@ -301,8 +302,8 @@ static void taosAddServerCfg(SConfig *pCfg) {
static
void
taosSetClientLogCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"logDir"
);
osSetLogDir
(
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
);
osSetDataReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalLogDirGB"
)
->
fval
)
;
tstrncpy
(
tsLogDir
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
tsLogSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalLogDirGB"
)
->
fval
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
...
...
@@ -331,8 +332,8 @@ static void taosSetClientCfg(SConfig *pCfg) {
tstrncpy
(
tsLocalFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
TSDB_EP_LEN
);
tsServerPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
snprintf
(
tsLocalEp
,
sizeof
(
tsLocalEp
),
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
osSetTempDir
(
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
);
osSetDataReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
)
;
tstrncpy
(
tsLogDir
,
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
,
PATH_MAX
);
tsTempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
;
tsNumOfThreadsPerCore
=
cfgGetItem
(
pCfg
,
"maxTmrCtrl"
)
->
fval
;
tsMaxTmrCtrl
=
cfgGetItem
(
pCfg
,
"maxTmrCtrl"
)
->
i32
;
...
...
@@ -350,28 +351,27 @@ static void taosSetClientCfg(SConfig *pCfg) {
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"timezone"
);
osSetTimezone
(
pItem
->
str
);
uDebug
(
"timezone format changed from %s to %s"
,
pItem
->
str
,
osTimezone
()
);
cfgSetItem
(
pCfg
,
"timezone"
,
osTimezone
()
,
pItem
->
stype
);
uDebug
(
"timezone format changed from %s to %s"
,
pItem
->
str
,
tsTimezone
);
cfgSetItem
(
pCfg
,
"timezone"
,
tsTimezone
,
pItem
->
stype
);
const
char
*
locale
=
cfgGetItem
(
pCfg
,
"locale"
)
->
str
;
const
char
*
charset
=
cfgGetItem
(
pCfg
,
"charset"
)
->
str
;
osSet
Locale
(
locale
,
charset
);
taosSetSystem
Locale
(
locale
,
charset
);
if
(
tsNumOfCores
<=
1
)
{
tsNumOfCores
=
2
;
}
bool
enableCore
=
cfgGetItem
(
pCfg
,
"enableCoreFile"
)
->
bval
;
taosSetCo
reDump
(
enableCore
);
taosSetCo
nsoleEcho
(
enableCore
);
// todo
tsVersion
=
30000000
;
}
static
void
taosSetServerCfg
(
SConfig
*
pCfg
)
{
osSetDataDir
(
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
);
osSetTempReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
);
tstrncpy
(
tsDataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
PATH_MAX
);
tsTempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
tsNumOfCommitThreads
=
cfgGetItem
(
pCfg
,
"numOfCommitThreads"
)
->
i32
;
tsRatioOfQueryCores
=
cfgGetItem
(
pCfg
,
"ratioOfQueryCores"
)
->
fval
;
tsMaxNumOfDistinctResults
=
cfgGetItem
(
pCfg
,
"maxNumOfDistinctRes"
)
->
i32
;
...
...
source/common/src/ttszip.c
浏览文件 @
612dd719
...
...
@@ -23,7 +23,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
pTSBuf
->
autoDelete
=
autoDelete
;
taosGetTmpfilePath
(
osTempDir
()
,
"join"
,
pTSBuf
->
path
);
taosGetTmpfilePath
(
tsTempDir
,
"join"
,
pTSBuf
->
path
);
pTSBuf
->
f
=
fopen
(
pTSBuf
->
path
,
"wb+"
);
if
(
pTSBuf
->
f
==
NULL
)
{
free
(
pTSBuf
);
...
...
source/dnode/mgmt/impl/src/dndMgmt.c
浏览文件 @
612dd719
...
...
@@ -371,9 +371,9 @@ void dndSendStatusReq(SDnode *pDnode) {
req
.
clusterCfg
.
checkTime
=
0
;
char
timestr
[
32
]
=
"1970-01-01 00:00:00.00"
;
(
void
)
taosParseTime
(
timestr
,
&
req
.
clusterCfg
.
checkTime
,
(
int32_t
)
strlen
(
timestr
),
TSDB_TIME_PRECISION_MILLI
,
0
);
memcpy
(
req
.
clusterCfg
.
timezone
,
osTimezone
()
,
TD_TIMEZONE_LEN
);
memcpy
(
req
.
clusterCfg
.
locale
,
osLocale
()
,
TD_LOCALE_LEN
);
memcpy
(
req
.
clusterCfg
.
charset
,
osCharset
()
,
TD_LOCALE_LEN
);
memcpy
(
req
.
clusterCfg
.
timezone
,
tsTimezone
,
TD_TIMEZONE_LEN
);
memcpy
(
req
.
clusterCfg
.
locale
,
tsLocale
,
TD_LOCALE_LEN
);
memcpy
(
req
.
clusterCfg
.
charset
,
tsCharset
,
TD_LOCALE_LEN
);
taosRUnLockLatch
(
&
pMgmt
->
latch
);
req
.
pVloads
=
taosArrayInit
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeLoad
));
...
...
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
612dd719
...
...
@@ -33,7 +33,7 @@ void Testbase::InitLog(const char* path) {
taosRemoveDir
(
path
);
taosMkDir
(
path
);
osSetLogDir
(
path
);
tstrncpy
(
tsLogDir
,
path
,
PATH_MAX
);
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file
\n
"
);
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
612dd719
...
...
@@ -277,19 +277,19 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, const SClusterCfg *pCfg) {
return
DND_REASON_STATUS_INTERVAL_NOT_MATCH
;
}
if
((
0
!=
strcasecmp
(
pCfg
->
timezone
,
osTimezone
()
))
&&
(
pMnode
->
checkTime
!=
pCfg
->
checkTime
))
{
mError
(
"timezone [%s - %s] [%"
PRId64
" - %"
PRId64
"] cfg inconsistent"
,
pCfg
->
timezone
,
osTimezone
()
,
if
((
0
!=
strcasecmp
(
pCfg
->
timezone
,
tsTimezone
))
&&
(
pMnode
->
checkTime
!=
pCfg
->
checkTime
))
{
mError
(
"timezone [%s - %s] [%"
PRId64
" - %"
PRId64
"] cfg inconsistent"
,
pCfg
->
timezone
,
tsTimezone
,
pCfg
->
checkTime
,
pMnode
->
checkTime
);
return
DND_REASON_TIME_ZONE_NOT_MATCH
;
}
if
(
0
!=
strcasecmp
(
pCfg
->
locale
,
osLocale
()
))
{
mError
(
"locale [%s - %s] cfg inconsistent"
,
pCfg
->
locale
,
osLocale
()
);
if
(
0
!=
strcasecmp
(
pCfg
->
locale
,
tsLocale
))
{
mError
(
"locale [%s - %s] cfg inconsistent"
,
pCfg
->
locale
,
tsLocale
);
return
DND_REASON_LOCALE_NOT_MATCH
;
}
if
(
0
!=
strcasecmp
(
pCfg
->
charset
,
osCharset
()
))
{
mError
(
"charset [%s - %s] cfg inconsistent."
,
pCfg
->
charset
,
osCharset
()
);
if
(
0
!=
strcasecmp
(
pCfg
->
charset
,
tsCharset
))
{
mError
(
"charset [%s - %s] cfg inconsistent."
,
pCfg
->
charset
,
tsCharset
);
return
DND_REASON_CHARSET_NOT_MATCH
;
}
...
...
@@ -669,15 +669,15 @@ static int32_t mndRetrieveConfigs(SMnodeMsg *pReq, SShowObj *pShow, char *data,
numOfRows
++
;
cfgOpts
[
numOfRows
]
=
"timezone"
;
snprintf
(
cfgVals
[
numOfRows
],
TSDB_CONIIG_VALUE_LEN
,
"%s"
,
osTimezone
()
);
snprintf
(
cfgVals
[
numOfRows
],
TSDB_CONIIG_VALUE_LEN
,
"%s"
,
tsTimezone
);
numOfRows
++
;
cfgOpts
[
numOfRows
]
=
"locale"
;
snprintf
(
cfgVals
[
numOfRows
],
TSDB_CONIIG_VALUE_LEN
,
"%s"
,
osLocale
()
);
snprintf
(
cfgVals
[
numOfRows
],
TSDB_CONIIG_VALUE_LEN
,
"%s"
,
tsLocale
);
numOfRows
++
;
cfgOpts
[
numOfRows
]
=
"charset"
;
snprintf
(
cfgVals
[
numOfRows
],
TSDB_CONIIG_VALUE_LEN
,
"%s"
,
osCharset
()
);
snprintf
(
cfgVals
[
numOfRows
],
TSDB_CONIIG_VALUE_LEN
,
"%s"
,
tsCharset
);
numOfRows
++
;
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
i
++
)
{
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
612dd719
...
...
@@ -132,7 +132,7 @@ void ctgTestInitLogFile() {
ctgDbgEnableDebug
(
"api"
);
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
612dd719
...
...
@@ -4628,7 +4628,7 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
getIntermediateBufInfo
(
pRuntimeEnv
,
&
ps
,
&
pQueryAttr
->
intermediateResultRowSize
);
int32_t
TENMB
=
1024
*
1024
*
10
;
int32_t
code
=
createDiskbasedBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
TENMB
,
pQInfo
->
qId
,
osTempDir
()
);
int32_t
code
=
createDiskbasedBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
TENMB
,
pQInfo
->
qId
,
tsTempDir
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
source/libs/function/src/tpercentile.c
浏览文件 @
612dd719
...
...
@@ -254,7 +254,7 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
resetSlotInfo
(
pBucket
);
int32_t
ret
=
createDiskbasedBuffer
(
&
pBucket
->
pBuffer
,
pBucket
->
bufPageSize
,
pBucket
->
bufPageSize
*
512
,
1
,
osTempDir
()
);
int32_t
ret
=
createDiskbasedBuffer
(
&
pBucket
->
pBuffer
,
pBucket
->
bufPageSize
,
pBucket
->
bufPageSize
*
512
,
1
,
tsTempDir
);
if
(
ret
!=
0
)
{
tMemBucketDestroy
(
pBucket
);
return
NULL
;
...
...
source/libs/function/src/tudf.c
浏览文件 @
612dd719
...
...
@@ -55,7 +55,7 @@ int32_t initUdfInfo(SUdfInfo* pUdfInfo) {
} else {
char path[PATH_MAX] = {0};
taosGetTmpfilePath("script", path,
osTempDir()
);
taosGetTmpfilePath("script", path,
tsTempDir
);
FILE* file = fopen(path, "w+");
...
...
source/libs/index/test/fstUT.cc
浏览文件 @
612dd719
...
...
@@ -30,7 +30,7 @@ static void EnvInit() {
taosRemoveDir
(
path
.
c_str
());
taosMkDir
(
path
.
c_str
());
// init log file
osSetLogDir
(
path
.
c_str
()
);
tstrncpy
(
tsLogDir
,
path
.
c_str
(),
PATH_MAX
);
if
(
taosInitLog
(
"tindex.idx"
,
1
)
!=
0
)
{
printf
(
"failed to init log"
);
}
...
...
source/libs/parser/src/insertParser.c
浏览文件 @
612dd719
...
...
@@ -204,7 +204,7 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
bool
isSigned
=
false
;
toInteger
(
pToken
->
z
,
pToken
->
n
,
10
,
&
ts
,
&
isSigned
);
}
else
{
// parse the RFC-3339/ISO-8601 timestamp format string
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
,
osDaylight
()
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid timestamp format"
,
pToken
->
z
);
}
...
...
source/libs/parser/src/parserImpl.c
浏览文件 @
612dd719
...
...
@@ -578,7 +578,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
return
DEAL_RES_ERROR
;
}
int32_t
len
=
trimStringCopy
(
pVal
->
literal
,
n
,
tmp
);
if
(
taosParseTime
(
tmp
,
&
pVal
->
datum
.
i
,
len
,
pVal
->
node
.
resType
.
precision
,
osDaylight
()
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
taosParseTime
(
tmp
,
&
pVal
->
datum
.
i
,
len
,
pVal
->
node
.
resType
.
precision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
tmp
);
generateSyntaxErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
return
DEAL_RES_ERROR
;
...
...
source/libs/parser/src/parserUtil.c
浏览文件 @
612dd719
...
...
@@ -1639,7 +1639,7 @@ static int parseTime(char **end, SToken *pToken, int16_t timePrec, int64_t *time
bool
isSigned
=
false
;
toInteger
(
pToken
->
z
,
pToken
->
n
,
10
,
&
ts
,
&
isSigned
);
}
else
{
// parse the RFC-3339/ISO-8601 timestamp format string
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
,
osDaylight
()
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
return
buildSyntaxErrMsg
(
pMsgBuf
,
"invalid timestamp format"
,
pToken
->
z
);
}
...
...
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
612dd719
...
...
@@ -102,7 +102,7 @@ void qwtInitLogFile() {
qDebugFlag
=
159
;
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
...
...
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
612dd719
...
...
@@ -53,7 +53,7 @@ void flttInitLogFile() {
qDebugFlag
=
159
;
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
...
...
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
612dd719
...
...
@@ -52,7 +52,7 @@ void scltInitLogFile() {
qDebugFlag
=
159
;
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
...
...
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
612dd719
...
...
@@ -67,7 +67,7 @@ void schtInitLogFile() {
qDebugFlag
=
159
;
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
osLogDir
()
);
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
...
...
source/libs/transport/test/transUT.cc
浏览文件 @
612dd719
...
...
@@ -155,7 +155,7 @@ class TransObj {
taosRemoveDir
(
path
.
c_str
());
taosMkDir
(
path
.
c_str
());
osSetLogDir
(
path
.
c_str
()
);
tstrncpy
(
tsLogDir
,
path
.
c_str
(),
PATH_MAX
);
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file
\n
"
);
}
...
...
source/os/src/osEnv.c
浏览文件 @
612dd719
...
...
@@ -17,68 +17,31 @@
#include "osEnv.h"
extern
void
taosWinSocketInit
();
char
configDir
[
PATH_MAX
]
=
{
0
};
typedef
struct
SOsEnv
{
char
dataDir
[
PATH_MAX
];
char
logDir
[
PATH_MAX
];
char
tempDir
[
PATH_MAX
];
SDiskSpace
dataSpace
;
SDiskSpace
logSpace
;
SDiskSpace
tempSpace
;
char
osName
[
16
];
char
timezone
[
TD_TIMEZONE_LEN
];
char
locale
[
TD_LOCALE_LEN
];
char
charset
[
TD_CHARSET_LEN
];
int8_t
daylight
;
bool
enableCoreFile
;
}
SOsEnv
;
static
SOsEnv
env
=
{
0
};
SOsEnv
*
osEnv
()
{
return
&
env
;
}
void
osInitImp
()
{
taosGetSystemLocale
(
env
.
locale
,
env
.
charset
);
taosGetSystemTimezone
(
env
.
timezone
);
osSetTimezone
(
env
.
timezone
);
}
void
osUpdate
()
{
if
(
env
.
logDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
env
.
logDir
,
&
env
.
logSpace
.
size
);
}
if
(
env
.
dataDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
env
.
dataDir
,
&
env
.
dataSpace
.
size
);
}
if
(
env
.
tempDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
env
.
tempDir
,
&
env
.
tempSpace
.
size
);
}
}
bool
osLogSpaceAvailable
()
{
return
env
.
logSpace
.
reserved
<=
env
.
logSpace
.
size
.
avail
;
}
int8_t
osDaylight
()
{
return
env
.
daylight
;
}
const
char
*
osLogDir
()
{
return
env
.
logDir
;
}
const
char
*
osTempDir
()
{
return
env
.
tempDir
;
}
const
char
*
osDataDir
()
{
return
env
.
dataDir
;
}
const
char
*
osName
()
{
return
env
.
osName
;
}
const
char
*
osTimezone
()
{
return
env
.
timezone
;
}
const
char
*
osLocale
()
{
return
env
.
locale
;
}
const
char
*
osCharset
()
{
return
env
.
charset
;
}
void
osSetLogDir
(
const
char
*
logDir
)
{
tstrncpy
(
env
.
logDir
,
logDir
,
PATH_MAX
);
}
void
osSetTempDir
(
const
char
*
tempDir
)
{
tstrncpy
(
env
.
tempDir
,
tempDir
,
PATH_MAX
);
}
void
osSetDataDir
(
const
char
*
dataDir
)
{
tstrncpy
(
env
.
dataDir
,
dataDir
,
PATH_MAX
);
}
void
osSetLogReservedSpace
(
float
sizeInGB
)
{
env
.
logSpace
.
reserved
=
sizeInGB
;
}
void
osSetTempReservedSpace
(
float
sizeInGB
)
{
env
.
tempSpace
.
reserved
=
sizeInGB
;
}
void
osSetDataReservedSpace
(
float
sizeInGB
)
{
env
.
dataSpace
.
reserved
=
sizeInGB
;
}
void
osSetTimezone
(
const
char
*
timezone
)
{
taosSetSystemTimezone
(
timezone
,
env
.
timezone
,
&
env
.
daylight
);
}
void
osSetLocale
(
const
char
*
locale
,
const
char
*
charset
)
{
taosSetSystemLocale
(
locale
,
charset
);
}
bool
osSetEnableCore
(
bool
enable
)
{
env
.
enableCoreFile
=
enable
;
}
char
configDir
[
PATH_MAX
]
=
{
0
};
char
tsDataDir
[
PATH_MAX
];
char
tsLogDir
[
PATH_MAX
];
char
tsTempDir
[
PATH_MAX
];
SDiskSpace
tsDataSpace
;
SDiskSpace
tsLogSpace
;
SDiskSpace
tsTempSpace
;
char
tsOsName
[
16
];
char
tsTimezone
[
TD_TIMEZONE_LEN
];
char
tsLocale
[
TD_LOCALE_LEN
];
char
tsCharset
[
TD_CHARSET_LEN
];
int8_t
tsDaylight
;
bool
tsEnableCoreFile
;
int64_t
tsPageSize
;
int64_t
tsOpenMax
;
int64_t
tsStreamMax
;
int32_t
tsNumOfCores
;
int32_t
tsTotalMemoryMB
;
void
osInit
()
{
srand
(
taosSafeRand
());
taosGetSystemLocale
(
tsLocale
,
tsCharset
);
taosGetSystemTimezone
(
tsTimezone
);
taosSetSystemTimezone
(
tsTimezone
,
tsTimezone
,
&
tsDaylight
);
taosGetSystemInfo
();
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
...
...
@@ -89,34 +52,50 @@ void osInit() {
tmpDir
=
getenv
(
"temp"
);
}
if
(
tmpDir
!=
NULL
)
{
strcpy
(
env
.
t
empDir
,
tmpDir
);
strcpy
(
tsT
empDir
,
tmpDir
);
}
if
(
configDir
[
0
]
==
0
)
{
strcpy
(
configDir
,
"C:
\\
TDengine
\\
cfg"
);
}
strcpy
(
env
.
d
ataDir
,
"C:
\\
TDengine
\\
data"
);
strcpy
(
env
.
l
ogDir
,
"C:
\\
TDengine
\\
log"
);
strcpy
(
env
.
t
empDir
,
"C:
\\
Windows
\\
Temp"
);
strcpy
(
env
.
o
sName
,
"Windows"
);
strcpy
(
tsD
ataDir
,
"C:
\\
TDengine
\\
data"
);
strcpy
(
tsL
ogDir
,
"C:
\\
TDengine
\\
log"
);
strcpy
(
tsT
empDir
,
"C:
\\
Windows
\\
Temp"
);
strcpy
(
tsO
sName
,
"Windows"
);
#elif defined(_TD_DARWIN_64)
if
(
configDir
[
0
]
==
0
)
{
strcpy
(
configDir
,
"/tmp/taosd"
);
}
strcpy
(
env
.
d
ataDir
,
"/usr/local/var/lib/taos"
);
strcpy
(
env
.
l
ogDir
,
"/usr/local/var/log/taos"
);
strcpy
(
env
.
t
empDir
,
"/usr/local/etc/taos"
);
strcpy
(
env
.
o
sName
,
"Darwin"
);
strcpy
(
tsD
ataDir
,
"/usr/local/var/lib/taos"
);
strcpy
(
tsL
ogDir
,
"/usr/local/var/log/taos"
);
strcpy
(
tsT
empDir
,
"/usr/local/etc/taos"
);
strcpy
(
tsO
sName
,
"Darwin"
);
#else
if
(
configDir
[
0
]
==
0
)
{
strcpy
(
configDir
,
"/etc/taos"
);
}
strcpy
(
env
.
d
ataDir
,
"/var/lib/taos"
);
strcpy
(
env
.
l
ogDir
,
"/var/log/taos"
);
strcpy
(
env
.
t
empDir
,
"/tmp"
);
strcpy
(
env
.
o
sName
,
"Linux"
);
strcpy
(
tsD
ataDir
,
"/var/lib/taos"
);
strcpy
(
tsL
ogDir
,
"/var/log/taos"
);
strcpy
(
tsT
empDir
,
"/tmp"
);
strcpy
(
tsO
sName
,
"Linux"
);
#endif
}
\ No newline at end of file
}
void
osUpdate
()
{
if
(
tsLogDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
tsLogDir
,
&
tsLogSpace
.
size
);
}
if
(
tsDataDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
tsDataDir
,
&
tsDataSpace
.
size
);
}
if
(
tsTempDir
[
0
]
!=
0
)
{
taosGetDiskSize
(
tsTempDir
,
&
tsTempSpace
.
size
);
}
}
bool
osLogSpaceAvailable
()
{
return
tsLogSpace
.
reserved
<=
tsLogSpace
.
size
.
avail
;
}
void
osSetTimezone
(
const
char
*
timezone
)
{
taosSetSystemTimezone
(
tsTimezone
,
tsTimezone
,
&
tsDaylight
);
}
source/os/src/osSysinfo.c
浏览文件 @
612dd719
...
...
@@ -111,7 +111,7 @@ int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize) {
diskSize
->
used
=
(
int64_t
)(
i64TotalBytes
-
i64FreeBytes
);
return
0
;
}
else
{
//printf("failed to get disk size, dataDir:%s errno:%s",
osDataDir()
, strerror(errno));
//printf("failed to get disk size, dataDir:%s errno:%s",
tsDataDir
, strerror(errno));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
...
...
@@ -316,7 +316,7 @@ void taosSetCoreDump() {}
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SDiskSize
*
diskSize
)
{
struct
statvfs
info
;
if
(
statvfs
(
dataDir
,
&
info
))
{
//printf("failed to get disk size, dataDir:%s errno:%s",
osDataDir()
, strerror(errno));
//printf("failed to get disk size, dataDir:%s errno:%s",
tsDataDir
, strerror(errno));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
else
{
...
...
source/util/src/tlog.c
浏览文件 @
612dd719
...
...
@@ -121,7 +121,7 @@ int32_t taosInitLog(const char *logName, int maxFiles) {
osUpdate
();
char
fullName
[
PATH_MAX
]
=
{
0
};
snprintf
(
fullName
,
PATH_MAX
,
"%s"
TD_DIRSEP
"%s"
,
osLogDir
()
,
logName
);
snprintf
(
fullName
,
PATH_MAX
,
"%s"
TD_DIRSEP
"%s"
,
tsLogDir
,
logName
);
tsLogObj
.
logHandle
=
taosLogBuffNew
(
TSDB_DEFAULT_LOG_BUF_SIZE
);
if
(
tsLogObj
.
logHandle
==
NULL
)
return
-
1
;
...
...
@@ -187,7 +187,7 @@ static void taosKeepOldLog(char *oldName) {
}
}
taosRemoveOldFiles
(
osLogDir
()
,
TABS
(
tsLogKeepDays
));
taosRemoveOldFiles
(
tsLogDir
,
TABS
(
tsLogKeepDays
));
}
static
void
*
taosThreadToOpenNewFile
(
void
*
param
)
{
...
...
tools/shell/src/shellEngine.c
浏览文件 @
612dd719
...
...
@@ -68,11 +68,11 @@ TAOS *shellInit(SShellArguments *_args) {
printf
(
"
\n
"
);
if
(
!
_args
->
is_use_passwd
)
{
#ifdef TD_WINDOWS
strcpy
(
osName
()
,
"Windows"
);
strcpy
(
tsOsName
,
"Windows"
);
#elif defined(TD_DARWIN)
strcpy
(
osName
()
,
"Darwin"
);
strcpy
(
tsOsName
,
"Darwin"
);
#endif
printf
(
CLIENT_VERSION
,
osName
()
,
taos_get_client_info
());
printf
(
CLIENT_VERSION
,
tsOsName
,
taos_get_client_info
());
}
fflush
(
stdout
);
...
...
tools/shell/src/shellLinux.c
浏览文件 @
612dd719
...
...
@@ -184,7 +184,7 @@ static void parse_args(
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
((
strncmp
(
argv
[
i
],
"-p"
,
2
)
==
0
)
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
printf
(
LINUXCLIENT_VERSION
,
osName
()
,
taos_get_client_info
());
printf
(
LINUXCLIENT_VERSION
,
tsOsName
,
taos_get_client_info
());
if
((
strlen
(
argv
[
i
])
==
2
)
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
printf
(
"Enter password: "
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录