Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0d0841d1
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看板
提交
0d0841d1
编写于
2月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
config
上级
77788309
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
72 addition
and
68 deletion
+72
-68
include/os/osDir.h
include/os/osDir.h
+1
-1
include/os/osEnv.h
include/os/osEnv.h
+22
-27
source/client/src/clientCfg.c
source/client/src/clientCfg.c
+1
-1
source/dnode/mgmt/daemon/src/dmnCfg.c
source/dnode/mgmt/daemon/src/dmnCfg.c
+4
-5
source/dnode/mgmt/daemon/src/dmnLog.c
source/dnode/mgmt/daemon/src/dmnLog.c
+2
-3
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+1
-1
source/libs/index/test/fstUT.cc
source/libs/index/test/fstUT.cc
+1
-1
source/libs/transport/test/transUT.cc
source/libs/transport/test/transUT.cc
+1
-1
source/os/src/osDir.c
source/os/src/osDir.c
+1
-1
source/os/src/osEnv.c
source/os/src/osEnv.c
+38
-26
tools/shell/src/shellLinux.c
tools/shell/src/shellLinux.c
+0
-1
未找到文件。
include/os/osDir.h
浏览文件 @
0d0841d1
...
@@ -23,7 +23,7 @@ extern "C" {
...
@@ -23,7 +23,7 @@ extern "C" {
void
taosRemoveDir
(
const
char
*
dirname
);
void
taosRemoveDir
(
const
char
*
dirname
);
int32_t
taosDirExist
(
char
*
dirname
);
int32_t
taosDirExist
(
char
*
dirname
);
int32_t
taosMkDir
(
const
char
*
dirname
);
int32_t
taosMkDir
(
const
char
*
dirname
);
void
taosRemoveOldFiles
(
char
*
dirname
,
int32_t
keepDays
);
void
taosRemoveOldFiles
(
c
onst
c
har
*
dirname
,
int32_t
keepDays
);
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
int32_t
maxlen
);
...
...
include/os/osEnv.h
浏览文件 @
0d0841d1
...
@@ -22,36 +22,31 @@
...
@@ -22,36 +22,31 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
struct
SOsEnv
{
typedef
struct
SOsEnv
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
;
}
SOsEnv
;
extern
char
configDir
[];
extern
char
configDir
[];
void
osInit
();
void
osInit
();
SOsEnv
*
osEnv
();
void
osUpdate
();
void
osUpdate
();
bool
osLogSpaceAvailable
();
bool
osLogSpaceAvailable
();
char
*
osLogDir
();
int8_t
osDaylight
();
char
*
osTempDir
();
char
*
osDataDir
();
const
char
*
osLogDir
();
char
*
osName
();
const
char
*
osTempDir
();
char
*
osTimezone
();
const
char
*
osDataDir
();
int8_t
osDaylight
();
const
char
*
osName
();
char
*
osLocale
();
const
char
*
osTimezone
();
char
*
osCharset
();
const
char
*
osLocale
();
const
char
*
osCharset
();
void
osSetTimezone
(
const
char
*
timezone
);
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
);
void
osSetTimezone
(
const
char
*
timezone
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/client/src/clientCfg.c
浏览文件 @
0d0841d1
...
@@ -67,7 +67,7 @@ static int32_t tscAddLogCfg(SConfig *pCfg) {
...
@@ -67,7 +67,7 @@ static int32_t tscAddLogCfg(SConfig *pCfg) {
}
}
static
int32_t
tscSetLogCfg
(
SConfig
*
pCfg
)
{
static
int32_t
tscSetLogCfg
(
SConfig
*
pCfg
)
{
tstrncpy
(
osLogDir
(),
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
osSetLogDir
(
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
);
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
...
...
source/dnode/mgmt/daemon/src/dmnCfg.c
浏览文件 @
0d0841d1
...
@@ -46,11 +46,10 @@ static int32_t dmnAddDirCfg(SConfig *pCfg) {
...
@@ -46,11 +46,10 @@ static int32_t dmnAddDirCfg(SConfig *pCfg) {
}
}
static
int32_t
dmnCheckDirCfg
(
SConfig
*
pCfg
)
{
static
int32_t
dmnCheckDirCfg
(
SConfig
*
pCfg
)
{
SOsEnv
*
pEnv
=
osEnv
();
osSetDataDir
(
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
);
tstrncpy
(
pEnv
->
dataDir
,
cfgGetItem
(
pCfg
,
"dataDir"
)
->
str
,
PATH_MAX
);
osSetTempDir
(
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
);
tstrncpy
(
pEnv
->
tempDir
,
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
,
PATH_MAX
);
osSetTempReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
);
pEnv
->
dataSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
osSetDataReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
);
pEnv
->
tempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
;
return
0
;
return
0
;
}
}
...
...
source/dnode/mgmt/daemon/src/dmnLog.c
浏览文件 @
0d0841d1
...
@@ -41,9 +41,8 @@ int32_t dmnAddLogCfg(SConfig *pCfg) {
...
@@ -41,9 +41,8 @@ int32_t dmnAddLogCfg(SConfig *pCfg) {
}
}
int32_t
dmnSetLogCfg
(
SConfig
*
pCfg
)
{
int32_t
dmnSetLogCfg
(
SConfig
*
pCfg
)
{
SOsEnv
*
pEnv
=
osEnv
();
osSetLogDir
(
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
);
tstrncpy
(
pEnv
->
logDir
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
osSetLogReservedSpace
(
cfgGetItem
(
pCfg
,
"minimalLogDirGB"
)
->
fval
);
pEnv
->
logSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalLogDirGB"
)
->
fval
;
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
...
...
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
0d0841d1
...
@@ -33,7 +33,7 @@ void Testbase::InitLog(const char* path) {
...
@@ -33,7 +33,7 @@ void Testbase::InitLog(const char* path) {
taosRemoveDir
(
path
);
taosRemoveDir
(
path
);
taosMkDir
(
path
);
taosMkDir
(
path
);
tstrncpy
(
osLogDir
(),
path
,
PATH_MAX
);
osSetLogDir
(
path
);
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file
\n
"
);
printf
(
"failed to init log file
\n
"
);
}
}
...
...
source/libs/index/test/fstUT.cc
浏览文件 @
0d0841d1
...
@@ -30,7 +30,7 @@ static void EnvInit() {
...
@@ -30,7 +30,7 @@ static void EnvInit() {
taosRemoveDir
(
path
.
c_str
());
taosRemoveDir
(
path
.
c_str
());
taosMkDir
(
path
.
c_str
());
taosMkDir
(
path
.
c_str
());
// init log file
// init log file
tstrncpy
(
osLogDir
(),
path
.
c_str
(),
PATH_MAX
);
osSetLogDir
(
path
.
c_str
()
);
if
(
taosInitLog
(
"tindex.idx"
,
1
)
!=
0
)
{
if
(
taosInitLog
(
"tindex.idx"
,
1
)
!=
0
)
{
printf
(
"failed to init log"
);
printf
(
"failed to init log"
);
}
}
...
...
source/libs/transport/test/transUT.cc
浏览文件 @
0d0841d1
...
@@ -155,7 +155,7 @@ class TransObj {
...
@@ -155,7 +155,7 @@ class TransObj {
taosRemoveDir
(
path
.
c_str
());
taosRemoveDir
(
path
.
c_str
());
taosMkDir
(
path
.
c_str
());
taosMkDir
(
path
.
c_str
());
tstrncpy
(
osLogDir
(),
path
.
c_str
(),
PATH_MAX
);
osSetLogDir
(
path
.
c_str
()
);
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file
\n
"
);
printf
(
"failed to init log file
\n
"
);
}
}
...
...
source/os/src/osDir.c
浏览文件 @
0d0841d1
...
@@ -71,7 +71,7 @@ int32_t taosMkDir(const char *dirname) {
...
@@ -71,7 +71,7 @@ int32_t taosMkDir(const char *dirname) {
return
code
;
return
code
;
}
}
void
taosRemoveOldFiles
(
char
*
dirname
,
int32_t
keepDays
)
{
void
taosRemoveOldFiles
(
c
onst
c
har
*
dirname
,
int32_t
keepDays
)
{
DIR
*
dir
=
opendir
(
dirname
);
DIR
*
dir
=
opendir
(
dirname
);
if
(
dir
==
NULL
)
return
;
if
(
dir
==
NULL
)
return
;
...
...
source/os/src/osEnv.c
浏览文件 @
0d0841d1
...
@@ -16,8 +16,24 @@
...
@@ -16,8 +16,24 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "osEnv.h"
#include "osEnv.h"
SOsEnv
env
=
{
0
};
extern
void
taosWinSocketInit
();
char
configDir
[
PATH_MAX
]
=
{
0
};
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
;
}
SOsEnv
;
static
SOsEnv
env
=
{
0
};
SOsEnv
*
osEnv
()
{
return
&
env
;
}
SOsEnv
*
osEnv
()
{
return
&
env
;
}
...
@@ -39,26 +55,29 @@ void osUpdate() {
...
@@ -39,26 +55,29 @@ void osUpdate() {
}
}
}
}
bool
osLogSpaceAvailable
()
{
return
env
.
logSpace
.
reserved
<
env
.
logSpace
.
size
.
avail
;
}
bool
osLogSpaceAvailable
()
{
return
env
.
logSpace
.
reserved
<=
env
.
logSpace
.
size
.
avail
;
}
char
*
osLogDir
()
{
return
env
.
logDir
;
}
char
*
osTempDir
()
{
return
env
.
tempDir
;
}
char
*
osDataDir
()
{
return
env
.
dataDir
;
}
char
*
osName
()
{
return
env
.
osName
;
}
char
*
osTimezone
()
{
return
env
.
timezone
;
}
char
*
osLocale
()
{
return
env
.
locale
;
}
char
*
osCharset
()
{
return
env
.
charset
;
}
int8_t
osDaylight
()
{
return
env
.
daylight
;
}
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
osSetTimezone
(
const
char
*
timezone
)
{
taosSetSystemTimezone
(
timezone
,
env
.
timezone
,
&
env
.
daylight
);
}
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
extern
taosWinSocketInit
();
void
osInit
()
{
void
osInit
()
{
srand
(
taosSafeRand
());
srand
(
taosSafeRand
());
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
taosWinSocketInit
();
taosWinSocketInit
();
const
char
*
tmpDir
=
getenv
(
"tmp"
);
const
char
*
tmpDir
=
getenv
(
"tmp"
);
...
@@ -74,27 +93,20 @@ void osInit() {
...
@@ -74,27 +93,20 @@ void osInit() {
strcpy
(
env
.
logDir
,
"C:
\\
TDengine
\\
log"
);
strcpy
(
env
.
logDir
,
"C:
\\
TDengine
\\
log"
);
strcpy
(
env
.
tempDir
,
"C:
\\
Windows
\\
Temp"
);
strcpy
(
env
.
tempDir
,
"C:
\\
Windows
\\
Temp"
);
strcpy
(
env
.
osName
,
"Windows"
);
strcpy
(
env
.
osName
,
"Windows"
);
}
#elif defined(_TD_DARWIN_64)
#elif defined(_TD_DARWIN_64)
void
osInit
()
{
srand
(
taosSafeRand
());
strcpy
(
configDir
,
"/tmp/taosd"
);
strcpy
(
configDir
,
"/tmp/taosd"
);
strcpy
(
env
.
dataDir
,
"/usr/local/var/lib/taos"
);
strcpy
(
env
.
dataDir
,
"/usr/local/var/lib/taos"
);
strcpy
(
env
.
logDir
,
"/usr/local/var/log/taos"
);
strcpy
(
env
.
logDir
,
"/usr/local/var/log/taos"
);
strcpy
(
env
.
tempDir
,
"/usr/local/etc/taos"
);
strcpy
(
env
.
tempDir
,
"/usr/local/etc/taos"
);
strcpy
(
env
.
osName
,
"Darwin"
);
strcpy
(
env
.
osName
,
"Darwin"
);
}
#else
void
osInit
()
{
#else
srand
(
taosSafeRand
());
strcpy
(
configDir
,
"/etc/taos"
);
strcpy
(
configDir
,
"/etc/taos"
);
strcpy
(
env
.
dataDir
,
"/var/lib/taos"
);
strcpy
(
env
.
dataDir
,
"/var/lib/taos"
);
strcpy
(
env
.
logDir
,
"/var/log/taos"
);
strcpy
(
env
.
logDir
,
"/var/log/taos"
);
strcpy
(
env
.
tempDir
,
"/tmp"
);
strcpy
(
env
.
tempDir
,
"/tmp"
);
strcpy
(
env
.
osName
,
"Linux"
);
strcpy
(
env
.
osName
,
"Linux"
);
}
#endif
#endif
\ No newline at end of file
}
\ No newline at end of file
tools/shell/src/shellLinux.c
浏览文件 @
0d0841d1
...
@@ -184,7 +184,6 @@ static void parse_args(
...
@@ -184,7 +184,6 @@ static void parse_args(
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
((
strncmp
(
argv
[
i
],
"-p"
,
2
)
==
0
)
if
((
strncmp
(
argv
[
i
],
"-p"
,
2
)
==
0
)
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
strcpy
(
osName
(),
"Linux"
);
printf
(
LINUXCLIENT_VERSION
,
osName
(),
taos_get_client_info
());
printf
(
LINUXCLIENT_VERSION
,
osName
(),
taos_get_client_info
());
if
((
strlen
(
argv
[
i
])
==
2
)
if
((
strlen
(
argv
[
i
])
==
2
)
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
||
(
strncmp
(
argv
[
i
],
"--password"
,
10
)
==
0
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录