Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0dddfb3d
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看板
未验证
提交
0dddfb3d
编写于
2月 19, 2021
作者:
H
haojun Liao
提交者:
GitHub
2月 19, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5204 from taosdata/hotfix/TD-2964
[TD-2964]add check for tmp directory
上级
78af4550
12dac486
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
85 addition
and
16 deletion
+85
-16
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-1
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+8
-2
src/common/src/tglobal.c
src/common/src/tglobal.c
+22
-0
src/inc/taos.h
src/inc/taos.h
+1
-1
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+5
-1
src/kit/shell/src/shellMain.c
src/kit/shell/src/shellMain.c
+4
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+5
-1
src/kit/taosdemox/taosdemox.c
src/kit/taosdemox/taosdemox.c
+15
-3
src/plugins/monitor/src/monMain.c
src/plugins/monitor/src/monMain.c
+3
-1
tests/examples/c/demo.c
tests/examples/c/demo.c
+4
-1
tests/examples/c/prepare.c
tests/examples/c/prepare.c
+4
-1
tests/examples/c/stream.c
tests/examples/c/stream.c
+4
-1
tests/examples/c/subscribe.c
tests/examples/c/subscribe.c
+4
-1
tests/tsim/src/simSystem.c
tests/tsim/src/simSystem.c
+3
-1
未找到文件。
src/client/src/tscSql.c
浏览文件 @
0dddfb3d
...
@@ -52,7 +52,9 @@ static bool validPassword(const char* passwd) {
...
@@ -52,7 +52,9 @@ static bool validPassword(const char* passwd) {
static
SSqlObj
*
taosConnectImpl
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
static
SSqlObj
*
taosConnectImpl
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
,
void
(
*
fp
)(
void
*
,
TAOS_RES
*
,
int
),
void
*
param
,
TAOS
**
taos
)
{
uint16_t
port
,
void
(
*
fp
)(
void
*
,
TAOS_RES
*
,
int
),
void
*
param
,
TAOS
**
taos
)
{
taos_init
();
if
(
taos_init
())
{
return
NULL
;
}
if
(
!
validUserName
(
user
))
{
if
(
!
validUserName
(
user
))
{
terrno
=
TSDB_CODE_TSC_INVALID_USER_LENGTH
;
terrno
=
TSDB_CODE_TSC_INVALID_USER_LENGTH
;
...
...
src/client/src/tscSystem.c
浏览文件 @
0dddfb3d
...
@@ -47,6 +47,7 @@ void *tscRpcCache; // cache to keep rpc obj
...
@@ -47,6 +47,7 @@ void *tscRpcCache; // cache to keep rpc obj
int32_t
tscNumOfThreads
=
1
;
// num of rpc threads
int32_t
tscNumOfThreads
=
1
;
// num of rpc threads
static
pthread_mutex_t
rpcObjMutex
;
// mutex to protect open the rpc obj concurrently
static
pthread_mutex_t
rpcObjMutex
;
// mutex to protect open the rpc obj concurrently
static
pthread_once_t
tscinit
=
PTHREAD_ONCE_INIT
;
static
pthread_once_t
tscinit
=
PTHREAD_ONCE_INIT
;
static
volatile
int
tscInitRes
=
0
;
void
tscCheckDiskUsage
(
void
*
UNUSED_PARAM
(
para
),
void
*
UNUSED_PARAM
(
param
))
{
void
tscCheckDiskUsage
(
void
*
UNUSED_PARAM
(
para
),
void
*
UNUSED_PARAM
(
param
))
{
taosGetDisk
();
taosGetDisk
();
...
@@ -137,7 +138,11 @@ void taos_init_imp(void) {
...
@@ -137,7 +138,11 @@ void taos_init_imp(void) {
}
}
taosReadGlobalCfg
();
taosReadGlobalCfg
();
taosCheckGlobalCfg
();
if
(
taosCheckGlobalCfg
())
{
tscInitRes
=
-
1
;
return
;
}
taosInitNotes
();
taosInitNotes
();
rpcInit
();
rpcInit
();
...
@@ -159,6 +164,7 @@ void taos_init_imp(void) {
...
@@ -159,6 +164,7 @@ void taos_init_imp(void) {
tscQhandle
=
taosInitScheduler
(
queueSize
,
tscNumOfThreads
,
"tsc"
);
tscQhandle
=
taosInitScheduler
(
queueSize
,
tscNumOfThreads
,
"tsc"
);
if
(
NULL
==
tscQhandle
)
{
if
(
NULL
==
tscQhandle
)
{
tscError
(
"failed to init scheduler"
);
tscError
(
"failed to init scheduler"
);
tscInitRes
=
-
1
;
return
;
return
;
}
}
...
@@ -187,7 +193,7 @@ void taos_init_imp(void) {
...
@@ -187,7 +193,7 @@ void taos_init_imp(void) {
tscDebug
(
"client is initialized successfully"
);
tscDebug
(
"client is initialized successfully"
);
}
}
void
taos_init
()
{
pthread_once
(
&
tscinit
,
taos_init_imp
);
}
int
taos_init
()
{
pthread_once
(
&
tscinit
,
taos_init_imp
);
return
tscInitRes
;
}
// this function may be called by user or system, or by both simultaneously.
// this function may be called by user or system, or by both simultaneously.
void
taos_cleanup
(
void
)
{
void
taos_cleanup
(
void
)
{
...
...
src/common/src/tglobal.c
浏览文件 @
0dddfb3d
...
@@ -373,6 +373,23 @@ static void taosCheckDataDirCfg() {
...
@@ -373,6 +373,23 @@ static void taosCheckDataDirCfg() {
}
}
}
}
static
int32_t
taosCheckTmpDir
(
void
)
{
if
(
strlen
(
tsTempDir
)
<=
0
){
uError
(
"tempDir is not set"
);
return
-
1
;
}
DIR
*
dir
=
opendir
(
tsTempDir
);
if
(
dir
==
NULL
)
{
uError
(
"can not open tempDir:%s, error:%s"
,
tsTempDir
,
strerror
(
errno
));
return
-
1
;
}
closedir
(
dir
);
return
0
;
}
static
void
doInitGlobalConfig
(
void
)
{
static
void
doInitGlobalConfig
(
void
)
{
osInit
();
osInit
();
srand
(
taosSafeRand
());
srand
(
taosSafeRand
());
...
@@ -1488,6 +1505,11 @@ int32_t taosCheckGlobalCfg() {
...
@@ -1488,6 +1505,11 @@ int32_t taosCheckGlobalCfg() {
}
}
taosCheckDataDirCfg
();
taosCheckDataDirCfg
();
if
(
taosCheckTmpDir
())
{
return
-
1
;
}
taosGetSystemInfo
();
taosGetSystemInfo
();
tsSetLocale
();
tsSetLocale
();
...
...
src/inc/taos.h
浏览文件 @
0dddfb3d
...
@@ -68,7 +68,7 @@ typedef struct taosField {
...
@@ -68,7 +68,7 @@ typedef struct taosField {
#define DLL_EXPORT
#define DLL_EXPORT
#endif
#endif
DLL_EXPORT
void
taos_init
();
DLL_EXPORT
int
taos_init
();
DLL_EXPORT
void
taos_cleanup
(
void
);
DLL_EXPORT
void
taos_cleanup
(
void
);
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
...
...
src/kit/shell/src/shellEngine.c
浏览文件 @
0dddfb3d
...
@@ -76,7 +76,11 @@ TAOS *shellInit(SShellArguments *args) {
...
@@ -76,7 +76,11 @@ TAOS *shellInit(SShellArguments *args) {
args
->
user
=
TSDB_DEFAULT_USER
;
args
->
user
=
TSDB_DEFAULT_USER
;
}
}
taos_init
();
if
(
taos_init
())
{
printf
(
"failed to init taos
\n
"
);
fflush
(
stdout
);
return
NULL
;
}
// Connect to the database.
// Connect to the database.
TAOS
*
con
=
NULL
;
TAOS
*
con
=
NULL
;
...
...
src/kit/shell/src/shellMain.c
浏览文件 @
0dddfb3d
...
@@ -110,7 +110,10 @@ int main(int argc, char* argv[]) {
...
@@ -110,7 +110,10 @@ int main(int argc, char* argv[]) {
}
}
if
(
args
.
netTestRole
&&
args
.
netTestRole
[
0
]
!=
0
)
{
if
(
args
.
netTestRole
&&
args
.
netTestRole
[
0
]
!=
0
)
{
taos_init
();
if
(
taos_init
())
{
printf
(
"Failed to init taos"
);
exit
(
EXIT_FAILURE
);
}
taosNetTest
(
args
.
netTestRole
,
args
.
host
,
args
.
port
,
args
.
pktLen
);
taosNetTest
(
args
.
netTestRole
,
args
.
host
,
args
.
port
,
args
.
pktLen
);
exit
(
0
);
exit
(
0
);
}
}
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
0dddfb3d
...
@@ -711,7 +711,11 @@ int main(int argc, char *argv[]) {
...
@@ -711,7 +711,11 @@ int main(int argc, char *argv[]) {
fprintf
(
fp
,
"###################################################################
\n\n
"
);
fprintf
(
fp
,
"###################################################################
\n\n
"
);
fprintf
(
fp
,
"| WRecords | Records/Second | Requests/Second | WLatency(ms) |
\n
"
);
fprintf
(
fp
,
"| WRecords | Records/Second | Requests/Second | WLatency(ms) |
\n
"
);
taos_init
();
if
(
taos_init
())
{
fprintf
(
stderr
,
"Failed to init taos
\n
"
);
return
1
;
}
TAOS
*
taos
=
taos_connect
(
ip_addr
,
user
,
pass
,
NULL
,
port
);
TAOS
*
taos
=
taos_connect
(
ip_addr
,
user
,
pass
,
NULL
,
port
);
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
...
...
src/kit/taosdemox/taosdemox.c
浏览文件 @
0dddfb3d
...
@@ -1971,7 +1971,11 @@ static int createSuperTable(TAOS * taos, char* dbName, SSuperTable* superTbls,
...
@@ -1971,7 +1971,11 @@ static int createSuperTable(TAOS * taos, char* dbName, SSuperTable* superTbls,
static
int
createDatabases
()
{
static
int
createDatabases
()
{
TAOS
*
taos
=
NULL
;
TAOS
*
taos
=
NULL
;
int
ret
=
0
;
int
ret
=
0
;
taos_init
();
if
(
taos_init
())
{
fprintf
(
stderr
,
"Failed to init taos
\n
"
);
exit
(
-
1
);
}
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
NULL
,
g_Dbs
.
port
);
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
NULL
,
g_Dbs
.
port
);
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
...
@@ -4496,7 +4500,11 @@ void *subQueryProcess(void *sarg) {
...
@@ -4496,7 +4500,11 @@ void *subQueryProcess(void *sarg) {
int
queryTestProcess
()
{
int
queryTestProcess
()
{
TAOS
*
taos
=
NULL
;
TAOS
*
taos
=
NULL
;
taos_init
();
if
(
taos_init
())
{
fprintf
(
stderr
,
"Failed to init taos
\n
"
);
exit
(
-
1
);
}
taos
=
taos_connect
(
g_queryInfo
.
host
,
g_queryInfo
.
user
,
g_queryInfo
.
password
,
NULL
,
g_queryInfo
.
port
);
taos
=
taos_connect
(
g_queryInfo
.
host
,
g_queryInfo
.
user
,
g_queryInfo
.
password
,
NULL
,
g_queryInfo
.
port
);
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
...
@@ -4772,7 +4780,11 @@ int subscribeTestProcess() {
...
@@ -4772,7 +4780,11 @@ int subscribeTestProcess() {
}
}
TAOS
*
taos
=
NULL
;
TAOS
*
taos
=
NULL
;
taos_init
();
if
(
taos_init
())
{
fprintf
(
stderr
,
"Failed to init taos
\n
"
);
exit
(
-
1
);
}
taos
=
taos_connect
(
g_queryInfo
.
host
,
g_queryInfo
.
user
,
g_queryInfo
.
password
,
g_queryInfo
.
dbName
,
g_queryInfo
.
port
);
taos
=
taos_connect
(
g_queryInfo
.
host
,
g_queryInfo
.
user
,
g_queryInfo
.
password
,
g_queryInfo
.
dbName
,
g_queryInfo
.
port
);
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
fprintf
(
stderr
,
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
...
...
src/plugins/monitor/src/monMain.c
浏览文件 @
0dddfb3d
...
@@ -103,7 +103,9 @@ int32_t monInitSystem() {
...
@@ -103,7 +103,9 @@ int32_t monInitSystem() {
}
}
int32_t
monStartSystem
()
{
int32_t
monStartSystem
()
{
taos_init
();
if
(
taos_init
())
{
return
-
1
;
}
tsMonitor
.
start
=
1
;
tsMonitor
.
start
=
1
;
monExecuteSQLFp
=
monExecuteSQL
;
monExecuteSQLFp
=
monExecuteSQL
;
monInfo
(
"monitor module start"
);
monInfo
(
"monitor module start"
);
...
...
tests/examples/c/demo.c
浏览文件 @
0dddfb3d
...
@@ -62,7 +62,10 @@ int main(int argc, char *argv[]) {
...
@@ -62,7 +62,10 @@ int main(int argc, char *argv[]) {
}
}
// init TAOS
// init TAOS
taos_init
();
if
(
taos_init
())
{
exit
(
1
);
}
TAOS
*
taos
=
taos_connect
(
argv
[
1
],
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
taos
=
taos_connect
(
argv
[
1
],
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
printf
(
"failed to connect to server, reason:%s
\n
"
,
"null taos"
/*taos_errstr(taos)*/
);
printf
(
"failed to connect to server, reason:%s
\n
"
,
"null taos"
/*taos_errstr(taos)*/
);
...
...
tests/examples/c/prepare.c
浏览文件 @
0dddfb3d
...
@@ -23,7 +23,10 @@ int main(int argc, char *argv[])
...
@@ -23,7 +23,10 @@ int main(int argc, char *argv[])
}
}
// init TAOS
// init TAOS
taos_init
();
if
(
taos_init
())
{
printf
(
"failed to init taos
\n
"
);
exit
(
1
);
}
taos
=
taos_connect
(
argv
[
1
],
"root"
,
"taosdata"
,
NULL
,
0
);
taos
=
taos_connect
(
argv
[
1
],
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
...
...
tests/examples/c/stream.c
浏览文件 @
0dddfb3d
...
@@ -55,7 +55,10 @@ int main(int argc, char *argv[])
...
@@ -55,7 +55,10 @@ int main(int argc, char *argv[])
}
}
// init TAOS
// init TAOS
taos_init
();
if
(
taos_init
())
{
printf
(
"failed to init taos
\n
"
);
exit
(
1
);
}
strcpy
(
db_name
,
argv
[
2
]);
strcpy
(
db_name
,
argv
[
2
]);
strcpy
(
tbl_name
,
argv
[
3
]);
strcpy
(
tbl_name
,
argv
[
3
]);
...
...
tests/examples/c/subscribe.c
浏览文件 @
0dddfb3d
...
@@ -217,7 +217,10 @@ int main(int argc, char *argv[]) {
...
@@ -217,7 +217,10 @@ int main(int argc, char *argv[]) {
}
}
// init TAOS
// init TAOS
taos_init
();
if
(
taos_init
())
{
printf
(
"failed to init taos
\n
"
);
exit
(
1
);
}
TAOS
*
taos
=
taos_connect
(
host
,
user
,
passwd
,
""
,
0
);
TAOS
*
taos
=
taos_connect
(
host
,
user
,
passwd
,
""
,
0
);
if
(
taos
==
NULL
)
{
if
(
taos
==
NULL
)
{
...
...
tests/tsim/src/simSystem.c
浏览文件 @
0dddfb3d
...
@@ -81,7 +81,9 @@ char *simParseHostName(char *varName) {
...
@@ -81,7 +81,9 @@ char *simParseHostName(char *varName) {
}
}
bool
simSystemInit
()
{
bool
simSystemInit
()
{
taos_init
();
if
(
taos_init
())
{
return
false
;
}
taosGetFqdn
(
simHostName
);
taosGetFqdn
(
simHostName
);
simInitsimCmdList
();
simInitsimCmdList
();
memset
(
simScriptList
,
0
,
sizeof
(
SScript
*
)
*
MAX_MAIN_SCRIPT_NUM
);
memset
(
simScriptList
,
0
,
sizeof
(
SScript
*
)
*
MAX_MAIN_SCRIPT_NUM
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录