Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bc65c92e
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看板
提交
bc65c92e
编写于
4月 22, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(tools): adjust client config parameters
上级
0970d1e4
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
96 addition
and
60 deletion
+96
-60
include/common/tglobal.h
include/common/tglobal.h
+0
-7
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-30
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+1
-1
source/libs/sync/src/syncIO.c
source/libs/sync/src/syncIO.c
+0
-1
source/util/src/tconfig.c
source/util/src/tconfig.c
+4
-2
source/util/src/ttimer.c
source/util/src/ttimer.c
+1
-1
tools/shell/src/shellArguments.c
tools/shell/src/shellArguments.c
+79
-14
tools/shell/src/shellMain.c
tools/shell/src/shellMain.c
+1
-2
tools/shell/src/shellUtil.c
tools/shell/src/shellUtil.c
+9
-2
未找到文件。
include/common/tglobal.h
浏览文件 @
bc65c92e
...
@@ -34,13 +34,9 @@ extern int32_t tsVersion;
...
@@ -34,13 +34,9 @@ extern int32_t tsVersion;
extern
int32_t
tsStatusInterval
;
extern
int32_t
tsStatusInterval
;
// common
// common
extern
int32_t
tsRpcTimer
;
extern
int32_t
tsRpcMaxTime
;
extern
bool
tsRpcForceTcp
;
// all commands go to tcp protocol if this is enabled
extern
int32_t
tsMaxConnections
;
extern
int32_t
tsMaxConnections
;
extern
int32_t
tsMaxShellConns
;
extern
int32_t
tsMaxShellConns
;
extern
int32_t
tsShellActivityTimer
;
extern
int32_t
tsShellActivityTimer
;
extern
int32_t
tsMaxTmrCtrl
;
extern
int32_t
tsCompressMsgSize
;
extern
int32_t
tsCompressMsgSize
;
extern
int32_t
tsCompressColData
;
extern
int32_t
tsCompressColData
;
extern
int32_t
tsMaxNumOfDistinctResults
;
extern
int32_t
tsMaxNumOfDistinctResults
;
...
@@ -95,9 +91,6 @@ extern bool tsKeepOriginalColumnName;
...
@@ -95,9 +91,6 @@ extern bool tsKeepOriginalColumnName;
extern
bool
tsDeadLockKillQuery
;
extern
bool
tsDeadLockKillQuery
;
// client
// client
extern
int32_t
tsMaxWildCardsLen
;
extern
int32_t
tsMaxRegexStringLen
;
extern
int32_t
tsMaxNumOfOrderedResults
;
extern
int32_t
tsMinSlidingTime
;
extern
int32_t
tsMinSlidingTime
;
extern
int32_t
tsMinIntervalTime
;
extern
int32_t
tsMinIntervalTime
;
extern
int32_t
tsMaxStreamComputDelay
;
extern
int32_t
tsMaxStreamComputDelay
;
...
...
source/common/src/tglobal.c
浏览文件 @
bc65c92e
...
@@ -32,13 +32,9 @@ int32_t tsVersion = 30000000;
...
@@ -32,13 +32,9 @@ int32_t tsVersion = 30000000;
int32_t
tsStatusInterval
=
1
;
// second
int32_t
tsStatusInterval
=
1
;
// second
// common
// common
int32_t
tsRpcTimer
=
300
;
int32_t
tsRpcMaxTime
=
600
;
// seconds;
bool
tsRpcForceTcp
=
true
;
// disable this, means query, show command use udp protocol as default
int32_t
tsMaxShellConns
=
50000
;
int32_t
tsMaxShellConns
=
50000
;
int32_t
tsMaxConnections
=
50000
;
int32_t
tsMaxConnections
=
50000
;
int32_t
tsShellActivityTimer
=
3
;
// second
int32_t
tsShellActivityTimer
=
3
;
// second
int32_t
tsMaxBinaryDisplayWidth
=
30
;
bool
tsEnableSlaveQuery
=
true
;
bool
tsEnableSlaveQuery
=
true
;
bool
tsPrintAuth
=
false
;
bool
tsPrintAuth
=
false
;
...
@@ -102,14 +98,6 @@ int32_t tsCompressColData = -1;
...
@@ -102,14 +98,6 @@ int32_t tsCompressColData = -1;
*/
*/
int32_t
tsCompatibleModel
=
1
;
int32_t
tsCompatibleModel
=
1
;
// client
int32_t
tsMaxWildCardsLen
=
TSDB_PATTERN_STRING_DEFAULT_LEN
;
int32_t
tsMaxRegexStringLen
=
TSDB_REGEX_STRING_DEFAULT_LEN
;
// the maximum number of results for projection query on super table that are returned from
// one virtual node, to order according to timestamp
int32_t
tsMaxNumOfOrderedResults
=
100000
;
// 10 ms for sliding time, the value will changed in case of time precision changed
// 10 ms for sliding time, the value will changed in case of time precision changed
int32_t
tsMinSlidingTime
=
10
;
int32_t
tsMinSlidingTime
=
10
;
...
@@ -308,19 +296,10 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
...
@@ -308,19 +296,10 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"serverPort"
,
defaultServerPort
,
1
,
65056
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"serverPort"
,
defaultServerPort
,
1
,
65056
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"tempDir"
,
tsTempDir
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddDir
(
pCfg
,
"tempDir"
,
tsTempDir
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalTempDirGB"
,
1
.
0
f
,
0
.
001
f
,
10000000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddFloat
(
pCfg
,
"minimalTempDirGB"
,
1
.
0
f
,
0
.
001
f
,
10000000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxTmrCtrl"
,
tsMaxTmrCtrl
,
8
,
2048
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcTimer"
,
tsRpcTimer
,
100
,
3000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"rpcMaxTime"
,
tsRpcMaxTime
,
100
,
7200
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"rpcForceTcp"
,
tsRpcForceTcp
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"shellActivityTimer"
,
tsShellActivityTimer
,
1
,
120
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"shellActivityTimer"
,
tsShellActivityTimer
,
1
,
120
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"compressMsgSize"
,
tsCompressMsgSize
,
-
1
,
100000000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"compressMsgSize"
,
tsCompressMsgSize
,
-
1
,
100000000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"compressColData"
,
tsCompressColData
,
-
1
,
100000000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"compressColData"
,
tsCompressColData
,
-
1
,
100000000
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxWildCardsLength"
,
tsMaxWildCardsLen
,
0
,
TSDB_MAX_FIELD_LEN
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxRegexStringLen"
,
tsMaxRegexStringLen
,
0
,
TSDB_MAX_FIELD_LEN
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxNumOfOrderedRes"
,
tsMaxNumOfOrderedResults
,
128
,
TSDB_MAX_ALLOWED_SQL_LEN
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"keepColumnName"
,
tsKeepOriginalColumnName
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"keepColumnName"
,
tsKeepOriginalColumnName
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"maxBinaryDisplayWidth"
,
tsMaxBinaryDisplayWidth
,
1
,
65536
,
1
)
!=
0
)
return
-
1
;
tsNumOfTaskQueueThreads
=
tsNumOfCores
/
4
;
tsNumOfTaskQueueThreads
=
tsNumOfCores
/
4
;
tsNumOfTaskQueueThreads
=
TRANGE
(
tsNumOfTaskQueueThreads
,
1
,
2
);
tsNumOfTaskQueueThreads
=
TRANGE
(
tsNumOfTaskQueueThreads
,
1
,
2
);
...
@@ -500,18 +479,10 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
...
@@ -500,18 +479,10 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
return
-
1
;
return
-
1
;
}
}
tsMaxTmrCtrl
=
cfgGetItem
(
pCfg
,
"maxTmrCtrl"
)
->
i32
;
tsRpcTimer
=
cfgGetItem
(
pCfg
,
"rpcTimer"
)
->
i32
;
tsRpcMaxTime
=
cfgGetItem
(
pCfg
,
"rpcMaxTime"
)
->
i32
;
tsRpcForceTcp
=
cfgGetItem
(
pCfg
,
"rpcForceTcp"
)
->
i32
;
tsShellActivityTimer
=
cfgGetItem
(
pCfg
,
"shellActivityTimer"
)
->
i32
;
tsShellActivityTimer
=
cfgGetItem
(
pCfg
,
"shellActivityTimer"
)
->
i32
;
tsCompressMsgSize
=
cfgGetItem
(
pCfg
,
"compressMsgSize"
)
->
i32
;
tsCompressMsgSize
=
cfgGetItem
(
pCfg
,
"compressMsgSize"
)
->
i32
;
tsCompressColData
=
cfgGetItem
(
pCfg
,
"compressColData"
)
->
i32
;
tsCompressColData
=
cfgGetItem
(
pCfg
,
"compressColData"
)
->
i32
;
tsMaxWildCardsLen
=
cfgGetItem
(
pCfg
,
"maxWildCardsLength"
)
->
i32
;
tsMaxRegexStringLen
=
cfgGetItem
(
pCfg
,
"maxRegexStringLen"
)
->
i32
;
tsMaxNumOfOrderedResults
=
cfgGetItem
(
pCfg
,
"maxNumOfOrderedRes"
)
->
i32
;
tsKeepOriginalColumnName
=
cfgGetItem
(
pCfg
,
"keepColumnName"
)
->
bval
;
tsKeepOriginalColumnName
=
cfgGetItem
(
pCfg
,
"keepColumnName"
)
->
bval
;
tsMaxBinaryDisplayWidth
=
cfgGetItem
(
pCfg
,
"maxBinaryDisplayWidth"
)
->
i32
;
tsNumOfTaskQueueThreads
=
cfgGetItem
(
pCfg
,
"numOfTaskQueueThreads"
)
->
i32
;
tsNumOfTaskQueueThreads
=
cfgGetItem
(
pCfg
,
"numOfTaskQueueThreads"
)
->
i32
;
return
0
;
return
0
;
}
}
...
@@ -701,6 +672,6 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
...
@@ -701,6 +672,6 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
if
(
strcasecmp
(
option
,
"resetlog"
)
==
0
)
{
if
(
strcasecmp
(
option
,
"resetlog"
)
==
0
)
{
taosResetLog
();
taosResetLog
();
cfgDumpCfg
(
tsCfg
,
1
,
false
);
cfgDumpCfg
(
tsCfg
,
0
,
false
);
}
}
}
}
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
bc65c92e
...
@@ -104,7 +104,7 @@ static void dmPrintVersion() {
...
@@ -104,7 +104,7 @@ static void dmPrintVersion() {
static
void
dmDumpCfg
()
{
static
void
dmDumpCfg
()
{
SConfig
*
pCfg
=
taosGetCfg
();
SConfig
*
pCfg
=
taosGetCfg
();
cfgDumpCfg
(
pCfg
,
0
,
1
);
cfgDumpCfg
(
pCfg
,
0
,
true
);
}
}
static
SDnodeOpt
dmGetOpt
()
{
static
SDnodeOpt
dmGetOpt
()
{
...
...
source/libs/sync/src/syncIO.c
浏览文件 @
bc65c92e
...
@@ -164,7 +164,6 @@ static int32_t syncIOStartInternal(SSyncIO *io) {
...
@@ -164,7 +164,6 @@ static int32_t syncIOStartInternal(SSyncIO *io) {
taosBlockSIGPIPE
();
taosBlockSIGPIPE
();
rpcInit
();
rpcInit
();
tsRpcForceTcp
=
1
;
// cient rpc init
// cient rpc init
{
{
...
...
source/util/src/tconfig.c
浏览文件 @
bc65c92e
...
@@ -524,6 +524,8 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
...
@@ -524,6 +524,8 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SConfigItem
*
pItem
=
taosArrayGet
(
pCfg
->
array
,
i
);
SConfigItem
*
pItem
=
taosArrayGet
(
pCfg
->
array
,
i
);
if
(
tsc
&&
!
pItem
->
tsc
)
continue
;
if
(
tsc
&&
!
pItem
->
tsc
)
continue
;
if
(
dump
&&
strcmp
(
pItem
->
name
,
"scriptDir"
)
==
0
)
continue
;
if
(
dump
&&
strcmp
(
pItem
->
name
,
"simDebugFlag"
)
==
0
)
continue
;
tstrncpy
(
src
,
cfgStypeStr
(
pItem
->
stype
),
CFG_SRC_PRINT_LEN
);
tstrncpy
(
src
,
cfgStypeStr
(
pItem
->
stype
),
CFG_SRC_PRINT_LEN
);
for
(
int32_t
i
=
0
;
i
<
CFG_SRC_PRINT_LEN
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
CFG_SRC_PRINT_LEN
;
++
i
)
{
if
(
src
[
i
]
==
0
)
src
[
i
]
=
' '
;
if
(
src
[
i
]
==
0
)
src
[
i
]
=
' '
;
...
@@ -562,10 +564,10 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
...
@@ -562,10 +564,10 @@ void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump) {
break
;
break
;
case
CFG_DTYPE_FLOAT
:
case
CFG_DTYPE_FLOAT
:
if
(
dump
)
{
if
(
dump
)
{
printf
(
"%s %s %f"
,
src
,
name
,
pItem
->
fval
);
printf
(
"%s %s %
.2
f"
,
src
,
name
,
pItem
->
fval
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
else
{
}
else
{
uInfo
(
"%s %s %f"
,
src
,
name
,
pItem
->
fval
);
uInfo
(
"%s %s %
.2
f"
,
src
,
name
,
pItem
->
fval
);
}
}
break
;
break
;
case
CFG_DTYPE_STRING
:
case
CFG_DTYPE_STRING
:
...
...
source/util/src/ttimer.c
浏览文件 @
bc65c92e
...
@@ -110,7 +110,7 @@ typedef struct time_wheel_t {
...
@@ -110,7 +110,7 @@ typedef struct time_wheel_t {
tmr_obj_t
**
slots
;
tmr_obj_t
**
slots
;
}
time_wheel_t
;
}
time_wheel_t
;
int32_t
tsMaxTmrCtrl
=
512
;
static
int32_t
tsMaxTmrCtrl
=
512
;
static
TdThreadOnce
tmrModuleInit
=
PTHREAD_ONCE_INIT
;
static
TdThreadOnce
tmrModuleInit
=
PTHREAD_ONCE_INIT
;
static
TdThreadMutex
tmrCtrlMutex
;
static
TdThreadMutex
tmrCtrlMutex
;
...
...
tools/shell/src/shellArguments.c
浏览文件 @
bc65c92e
...
@@ -59,7 +59,7 @@ void shellPrintHelp() {
...
@@ -59,7 +59,7 @@ void shellPrintHelp() {
printf
(
"%s%s%s
\n
"
,
indent
,
indent
,
"Print program version."
);
printf
(
"%s%s%s
\n
"
,
indent
,
indent
,
"Print program version."
);
}
}
void
shellParseArgs
InWindows
(
int
argc
,
char
*
argv
[])
{
void
shellParseArgs
WithoutArgp
(
int
argc
,
char
*
argv
[])
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
strcmp
(
argv
[
i
],
"-h"
)
==
0
)
{
if
(
strcmp
(
argv
[
i
],
"-h"
)
==
0
)
{
if
(
i
<
argc
-
1
)
{
if
(
i
<
argc
-
1
)
{
...
@@ -97,7 +97,7 @@ void shellParseArgsInWindows(int argc, char *argv[]) {
...
@@ -97,7 +97,7 @@ void shellParseArgsInWindows(int argc, char *argv[]) {
if
(
i
<
argc
-
1
)
{
if
(
i
<
argc
-
1
)
{
arguments
->
cfgdir
=
argv
[
++
i
];
arguments
->
cfgdir
=
argv
[
++
i
];
}
else
{
}
else
{
fprintf
(
stderr
,
"
O
ption -c requires an argument
\n
"
);
fprintf
(
stderr
,
"
o
ption -c requires an argument
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
else
if
(
strcmp
(
argv
[
i
],
"-C"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-C"
)
==
0
)
{
...
@@ -186,10 +186,10 @@ static struct argp_option shellOptions[] = {
...
@@ -186,10 +186,10 @@ static struct argp_option shellOptions[] = {
{
"host"
,
'h'
,
"HOST"
,
0
,
"TDengine server FQDN to connect. The default host is localhost."
},
{
"host"
,
'h'
,
"HOST"
,
0
,
"TDengine server FQDN to connect. The default host is localhost."
},
{
"port"
,
'P'
,
"PORT"
,
0
,
"The TCP/IP port number to use for the connection."
},
{
"port"
,
'P'
,
"PORT"
,
0
,
"The TCP/IP port number to use for the connection."
},
{
"user"
,
'u'
,
"USER"
,
0
,
"The user name to use when connecting to the server."
},
{
"user"
,
'u'
,
"USER"
,
0
,
"The user name to use when connecting to the server."
},
{
"password"
,
'p'
,
"PASSWORD"
,
0
,
"The password to use when connecting to the server."
},
{
"password"
,
'p'
,
0
,
0
,
"The password to use when connecting to the server."
},
{
"auth"
,
'a'
,
"AUTH"
,
0
,
"The auth string to use when connecting to the server."
},
{
"auth"
,
'a'
,
"AUTH"
,
0
,
"The auth string to use when connecting to the server."
},
{
"generate-auth"
,
'A'
,
0
,
0
,
"Generate auth string from password."
},
{
"generate-auth"
,
'A'
,
0
,
0
,
"Generate auth string from password."
},
{
"config-dir"
,
'c'
,
"
CONFIG_
DIR"
,
0
,
"Configuration directory."
},
{
"config-dir"
,
'c'
,
"DIR"
,
0
,
"Configuration directory."
},
{
"dump-config"
,
'C'
,
0
,
0
,
"Dump configuration."
},
{
"dump-config"
,
'C'
,
0
,
0
,
"Dump configuration."
},
{
"commands"
,
's'
,
"COMMANDS"
,
0
,
"Commands to run without enter the shell."
},
{
"commands"
,
's'
,
"COMMANDS"
,
0
,
"Commands to run without enter the shell."
},
{
"raw-time"
,
'r'
,
0
,
0
,
"Output time as uint64_t."
},
{
"raw-time"
,
'r'
,
0
,
0
,
"Output time as uint64_t."
},
...
@@ -197,13 +197,11 @@ static struct argp_option shellOptions[] = {
...
@@ -197,13 +197,11 @@ static struct argp_option shellOptions[] = {
{
"database"
,
'd'
,
"DATABASE"
,
0
,
"Database to use when connecting to the server."
},
{
"database"
,
'd'
,
"DATABASE"
,
0
,
"Database to use when connecting to the server."
},
{
"check"
,
'k'
,
0
,
0
,
"Check the service status."
},
{
"check"
,
'k'
,
0
,
0
,
"Check the service status."
},
{
"startup"
,
't'
,
0
,
0
,
"Check the details of the service status."
},
{
"startup"
,
't'
,
0
,
0
,
"Check the details of the service status."
},
{
"display-width"
,
'w'
,
0
,
0
,
"Set the default binary display width."
},
{
"display-width"
,
'w'
,
"WIDTH"
,
0
,
"Set the default binary display width."
},
{
"netrole"
,
'n'
,
"NETROLE"
,
0
,
"Net role when network connectivity test, options: client|server."
},
{
"netrole"
,
'n'
,
"NETROLE"
,
0
,
"Net role when network connectivity test, options: client|server."
},
{
"pktlen"
,
'l'
,
"PKTLEN"
,
0
,
"Packet length used for net test, default is 1000 bytes."
},
{
"pktlen"
,
'l'
,
"PKTLEN"
,
0
,
"Packet length used for net test, default is 1000 bytes."
},
{
"pktnum"
,
'N'
,
"PKTNUM"
,
0
,
"Packet numbers used for net test, default is 100."
},
{
"pktnum"
,
'N'
,
"PKTNUM"
,
0
,
"Packet numbers used for net test, default is 100."
},
{
"version"
,
'V'
,
0
,
0
,
"Print client version number."
},
{
0
}};
{
0
},
};
static
error_t
shellParseOpt
(
int32_t
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
static
error_t
shellParseOpt
(
int32_t
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
SShellArgs
*
arguments
=
&
shell
.
args
;
SShellArgs
*
arguments
=
&
shell
.
args
;
...
@@ -276,7 +274,7 @@ static error_t shellParseOpt(int32_t key, char *arg, struct argp_state *state) {
...
@@ -276,7 +274,7 @@ static error_t shellParseOpt(int32_t key, char *arg, struct argp_state *state) {
static
struct
argp
shellArgp
=
{
shellOptions
,
shellParseOpt
,
""
,
""
};
static
struct
argp
shellArgp
=
{
shellOptions
,
shellParseOpt
,
""
,
""
};
static
void
shellParseArgs
InLinux
(
int
argc
,
char
*
argv
[])
{
static
void
shellParseArgs
UseArgp
(
int
argc
,
char
*
argv
[])
{
argp_program_version
=
shell
.
info
.
programVersion
;
argp_program_version
=
shell
.
info
.
programVersion
;
argp_parse
(
&
shellArgp
,
argc
,
argv
,
0
,
0
,
&
shell
.
args
);
argp_parse
(
&
shellArgp
,
argc
,
argv
,
0
,
0
,
&
shell
.
args
);
}
}
...
@@ -313,7 +311,74 @@ static void shellInitArgs(int argc, char *argv[]) {
...
@@ -313,7 +311,74 @@ static void shellInitArgs(int argc, char *argv[]) {
shell
.
args
.
user
=
TSDB_DEFAULT_USER
;
shell
.
args
.
user
=
TSDB_DEFAULT_USER
;
}
}
static
int32_t
shellCheckArgs
()
{
return
0
;
}
static
int32_t
shellCheckArgs
()
{
SShellArgs
*
pArgs
=
&
shell
.
args
;
if
(
pArgs
->
host
!=
NULL
&&
(
strlen
(
pArgs
->
host
)
<=
0
||
strlen
(
pArgs
->
host
)
>
TSDB_FQDN_LEN
))
{
printf
(
"Invalid host:%s
\n
"
,
pArgs
->
host
);
return
-
1
;
}
if
(
pArgs
->
user
!=
NULL
&&
(
strlen
(
pArgs
->
user
)
<=
0
||
strlen
(
pArgs
->
user
)
>
TSDB_USER_LEN
))
{
printf
(
"Invalid user:%s
\n
"
,
pArgs
->
user
);
return
-
1
;
}
if
(
pArgs
->
auth
!=
NULL
&&
(
strlen
(
pArgs
->
auth
)
<=
0
||
strlen
(
pArgs
->
auth
)
>
TSDB_PASSWORD_LEN
))
{
printf
(
"Invalid auth:%s
\n
"
,
pArgs
->
auth
);
return
-
1
;
}
if
(
pArgs
->
database
!=
NULL
&&
(
strlen
(
pArgs
->
database
)
<=
0
||
strlen
(
pArgs
->
database
)
>
TSDB_DB_NAME_LEN
))
{
printf
(
"Invalid database:%s
\n
"
,
pArgs
->
database
);
return
-
1
;
}
if
(
pArgs
->
file
!=
NULL
&&
(
strlen
(
pArgs
->
file
)
<=
0
))
{
printf
(
"Invalid file:%s
\n
"
,
pArgs
->
file
);
return
-
1
;
}
if
(
pArgs
->
cfgdir
!=
NULL
)
{
if
(
strlen
(
pArgs
->
cfgdir
)
<=
0
||
strlen
(
pArgs
->
cfgdir
)
>=
PATH_MAX
)
{
printf
(
"Invalid cfgdir:%s
\n
"
,
pArgs
->
cfgdir
);
return
-
1
;
}
else
{
tstrncpy
(
configDir
,
pArgs
->
cfgdir
,
PATH_MAX
);
}
}
if
(
pArgs
->
commands
!=
NULL
&&
(
strlen
(
pArgs
->
commands
)
<=
0
))
{
printf
(
"Invalid commands:%s
\n
"
,
pArgs
->
commands
);
return
-
1
;
}
if
(
pArgs
->
netrole
!=
NULL
&&
!
(
strcmp
(
pArgs
->
netrole
,
"client"
)
==
0
||
strcmp
(
pArgs
->
netrole
,
"server"
)
==
0
))
{
printf
(
"Invalid netrole:%s
\n
"
,
pArgs
->
netrole
);
return
-
1
;
}
if
(
pArgs
->
password
!=
NULL
&&
(
strlen
(
pArgs
->
password
)
<=
0
))
{
printf
(
"Invalid password
\n
"
);
return
-
1
;
}
if
(
pArgs
->
pktLen
<=
0
||
pArgs
->
pktLen
>
20
*
1024
*
1024
)
{
printf
(
"Invalid pktLen:%d, range:[1, 20 * 1024 * 1024]
\n
"
,
pArgs
->
pktLen
);
return
-
1
;
}
if
(
pArgs
->
pktNum
<=
0
||
pArgs
->
pktNum
>
1024
*
1024
)
{
printf
(
"Invalid pktNum:%d, range:[1, 1024 * 1024]
\n
"
,
pArgs
->
pktNum
);
return
-
1
;
}
if
(
pArgs
->
displayWidth
<=
0
||
pArgs
->
displayWidth
>
10
*
1024
)
{
printf
(
"Invalid displayWidth:%d, range:[1, 10 * 1024]
\n
"
,
pArgs
->
displayWidth
);
return
-
1
;
}
return
0
;
}
int32_t
shellParseArgs
(
int32_t
argc
,
char
*
argv
[])
{
int32_t
shellParseArgs
(
int32_t
argc
,
char
*
argv
[])
{
shellInitArgs
(
argc
,
argv
);
shellInitArgs
(
argc
,
argv
);
...
@@ -323,20 +388,20 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
...
@@ -323,20 +388,20 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
shell
.
info
.
promptHeader
=
"taos> "
;
shell
.
info
.
promptHeader
=
"taos> "
;
shell
.
info
.
promptContinue
=
" -> "
;
shell
.
info
.
promptContinue
=
" -> "
;
shell
.
info
.
promptSize
=
6
;
shell
.
info
.
promptSize
=
6
;
snprintf
(
shell
.
info
.
programVersion
,
sizeof
(
shell
.
info
.
programVersion
),
"version: %s
\n
"
,
version
);
snprintf
(
shell
.
info
.
programVersion
,
sizeof
(
shell
.
info
.
programVersion
),
"version: %s"
,
version
);
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
shell
.
info
.
osname
=
"Windows"
;
shell
.
info
.
osname
=
"Windows"
;
snprintf
(
shell
.
history
.
file
,
TSDB_FILENAME_LEN
,
"C:/TDengine/%s"
,
SHELL_HISTORY_FILE
);
snprintf
(
shell
.
history
.
file
,
TSDB_FILENAME_LEN
,
"C:/TDengine/%s"
,
SHELL_HISTORY_FILE
);
shellParseArgs
InLinuxAndDarwin
();
shellParseArgs
WithoutArgp
();
#elif defined(_TD_DARWIN_64)
#elif defined(_TD_DARWIN_64)
shell
.
info
.
osname
=
"Darwin"
;
shell
.
info
.
osname
=
"Darwin"
;
snprintf
(
shell
.
history
.
file
,
TSDB_FILENAME_LEN
,
"%s/%s"
,
getpwuid
(
getuid
())
->
pw_dir
,
SHELL_HISTORY_FILE
);
snprintf
(
shell
.
history
.
file
,
TSDB_FILENAME_LEN
,
"%s/%s"
,
getpwuid
(
getuid
())
->
pw_dir
,
SHELL_HISTORY_FILE
);
shellParseArgs
InLinuxAndDarwin
();
shellParseArgs
WithoutArgp
();
#else
#else
shell
.
info
.
osname
=
"Linux"
;
shell
.
info
.
osname
=
"Linux"
;
snprintf
(
shell
.
history
.
file
,
TSDB_FILENAME_LEN
,
"%s/%s"
,
getenv
(
"HOME"
),
SHELL_HISTORY_FILE
);
snprintf
(
shell
.
history
.
file
,
TSDB_FILENAME_LEN
,
"%s/%s"
,
getenv
(
"HOME"
),
SHELL_HISTORY_FILE
);
shellParseArgs
InLinux
(
argc
,
argv
);
shellParseArgs
UseArgp
(
argc
,
argv
);
#endif
#endif
if
(
shell
.
args
.
abort
)
{
if
(
shell
.
args
.
abort
)
{
...
...
tools/shell/src/shellMain.c
浏览文件 @
bc65c92e
...
@@ -56,8 +56,7 @@ int main(int argc, char *argv[]) {
...
@@ -56,8 +56,7 @@ int main(int argc, char *argv[]) {
return
0
;
return
0
;
}
}
if
(
shell
.
args
.
netrole
!=
NULL
&&
if
(
shell
.
args
.
netrole
!=
NULL
)
{
(
strcmp
(
shell
.
args
.
netrole
,
"client"
)
==
0
||
strcmp
(
shell
.
args
.
netrole
,
"server"
))
==
0
)
{
shellTestNetWork
();
shellTestNetWork
();
taos_cleanup
();
taos_cleanup
();
return
0
;
return
0
;
...
...
tools/shell/src/shellUtil.c
浏览文件 @
bc65c92e
...
@@ -70,15 +70,21 @@ int32_t shellCheckIntSize() {
...
@@ -70,15 +70,21 @@ int32_t shellCheckIntSize() {
void
shellPrintVersion
()
{
printf
(
"version: %s
\n
"
,
version
);
}
void
shellPrintVersion
()
{
printf
(
"version: %s
\n
"
,
version
);
}
void
shellGenerateAuth
()
{}
void
shellGenerateAuth
()
{
char
secretEncrypt
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
shell
.
args
.
password
,
strlen
(
shell
.
args
.
password
),
secretEncrypt
);
printf
(
"%s
\n
"
,
secretEncrypt
);
fflush
(
stdout
);
}
void
shellDumpConfig
()
{
void
shellDumpConfig
()
{
SConfig
*
pCfg
=
taosGetCfg
();
SConfig
*
pCfg
=
taosGetCfg
();
if
(
pCfg
==
NULL
)
{
if
(
pCfg
==
NULL
)
{
printf
(
"TDengine read global config failed!
\n
"
);
printf
(
"TDengine read global config failed!
\n
"
);
}
else
{
}
else
{
cfgDumpCfg
(
pCfg
,
1
,
1
);
cfgDumpCfg
(
pCfg
,
1
,
true
);
}
}
fflush
(
stdout
);
}
}
void
shellCheckServerStatus
()
{
void
shellCheckServerStatus
()
{
...
@@ -107,6 +113,7 @@ void shellCheckServerStatus() {
...
@@ -107,6 +113,7 @@ void shellCheckServerStatus() {
if
(
strlen
(
details
)
!=
0
)
{
if
(
strlen
(
details
)
!=
0
)
{
printf
(
"%s
\n\n
"
,
details
);
printf
(
"%s
\n\n
"
,
details
);
}
}
fflush
(
stdout
);
if
(
code
==
TSDB_SRV_STATUS_NETWORK_OK
&&
shell
.
args
.
is_startup
)
{
if
(
code
==
TSDB_SRV_STATUS_NETWORK_OK
&&
shell
.
args
.
is_startup
)
{
taosMsleep
(
1000
);
taosMsleep
(
1000
);
}
else
{
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录