Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
65b358d4
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看板
提交
65b358d4
编写于
8月 24, 2021
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/TD-5992' of github.com:taosdata/TDengine into feature/TD-5992
上级
1e7c84f9
a133bfbe
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
35 deletion
+46
-35
src/client/CMakeLists.txt
src/client/CMakeLists.txt
+8
-8
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+7
-11
src/util/inc/tconfig.h
src/util/inc/tconfig.h
+1
-1
src/util/src/tconfig.c
src/util/src/tconfig.c
+30
-15
未找到文件。
src/client/CMakeLists.txt
浏览文件 @
65b358d4
...
...
@@ -18,9 +18,9 @@ IF (TD_LINUX)
# generate dynamic library (*.so)
ADD_LIBRARY
(
taos SHARED
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
taos common query trpc tutil pthread m rt
)
TARGET_LINK_LIBRARIES
(
taos common query trpc
cJson
tutil pthread m rt
)
IF
(
TD_LINUX_64
)
TARGET_LINK_LIBRARIES
(
taos lua
)
TARGET_LINK_LIBRARIES
(
taos lua
cJson
)
ENDIF
()
SET_TARGET_PROPERTIES
(
taos PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
...
...
@@ -39,13 +39,13 @@ ELSEIF (TD_DARWIN)
# set the static lib name
ADD_LIBRARY
(
taos_static STATIC
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
taos_static common query trpc tutil pthread m lua cJson
)
TARGET_LINK_LIBRARIES
(
taos_static common query trpc
cJson
tutil pthread m lua cJson
)
SET_TARGET_PROPERTIES
(
taos_static PROPERTIES OUTPUT_NAME
"taos_static"
)
SET_TARGET_PROPERTIES
(
taos_static PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
# generate dynamic library (*.dylib)
ADD_LIBRARY
(
taos SHARED
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
taos common query trpc tutil pthread m lua
)
TARGET_LINK_LIBRARIES
(
taos common query
cJson
trpc tutil pthread m lua
)
SET_TARGET_PROPERTIES
(
taos PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
#set version of .dylib
...
...
@@ -64,14 +64,14 @@ ELSEIF (TD_WINDOWS)
CONFIGURE_FILE
(
"
${
TD_COMMUNITY_DIR
}
/src/client/src/taos.rc.in"
"
${
TD_COMMUNITY_DIR
}
/src/client/src/taos.rc"
)
ADD_LIBRARY
(
taos_static STATIC
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
taos_static trpc tutil cJson query
)
TARGET_LINK_LIBRARIES
(
taos_static trpc
cJson
tutil cJson query
)
# generate dynamic library (*.dll)
ADD_LIBRARY
(
taos SHARED
${
SRC
}
${
TD_COMMUNITY_DIR
}
/src/client/src/taos.rc
)
IF
(
NOT TD_GODLL
)
SET_TARGET_PROPERTIES
(
taos PROPERTIES LINK_FLAGS /DEF:
${
TD_COMMUNITY_DIR
}
/src/client/src/taos.def
)
ENDIF
()
TARGET_LINK_LIBRARIES
(
taos trpc tutil query lua
)
TARGET_LINK_LIBRARIES
(
taos trpc
cJson
tutil query lua
)
ELSEIF
(
TD_DARWIN
)
SET
(
CMAKE_MACOSX_RPATH 1
)
...
...
@@ -79,12 +79,12 @@ ELSEIF (TD_DARWIN)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/cJson/inc
)
ADD_LIBRARY
(
taos_static STATIC
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
taos_static query trpc tutil pthread cJson m lua
)
TARGET_LINK_LIBRARIES
(
taos_static query trpc
cJson
tutil pthread cJson m lua
)
SET_TARGET_PROPERTIES
(
taos_static PROPERTIES OUTPUT_NAME
"taos_static"
)
# generate dynamic library (*.dylib)
ADD_LIBRARY
(
taos SHARED
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
taos query trpc tutil pthread m lua
)
TARGET_LINK_LIBRARIES
(
taos query trpc
cJson
tutil pthread m lua
)
SET_TARGET_PROPERTIES
(
taos PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
...
...
src/client/src/tscSystem.c
浏览文件 @
65b358d4
...
...
@@ -442,12 +442,13 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
static
int
taos_set_config_imp
(
const
char
*
config
){
static
bool
setConfFlag
=
false
;
if
(
setConfFlag
)
{
tscError
(
"already set config"
);
printf
(
"already set config"
);
return
0
;
}
taosInitGlobalCfg
();
cJSON
*
root
=
cJSON_Parse
(
config
);
if
(
root
==
NULL
)
{
tscError
(
"failed to set config, invalid json format: %s"
,
config
);
printf
(
"failed to set config, invalid json format: %s"
,
config
);
return
-
1
;
}
...
...
@@ -456,30 +457,25 @@ static int taos_set_config_imp(const char *config){
for
(
int
i
=
0
;
i
<
size
;
i
++
){
cJSON
*
item
=
cJSON_GetArrayItem
(
root
,
i
);
if
(
!
item
)
{
tscError
(
"failed to read index:%d"
,
i
);
printf
(
"failed to read index:%d"
,
i
);
ret
=
-
2
;
continue
;
}
if
(
!
taosReadConfigOption
(
item
->
string
,
item
->
valuestring
,
NULL
,
NULL
)){
if
(
!
taosReadConfigOption
(
item
->
string
,
item
->
valuestring
,
NULL
,
NULL
,
TAOS_CFG_CSTATUS_OPTION
)){
printf
(
"set failed:%s->%s"
,
item
->
string
,
item
->
valuestring
);
ret
=
-
2
;
}
}
taosPrintGlobalCfg
();
setConfFlag
=
true
;
return
ret
;
}
int
taos_set_config
(
const
char
*
config
){
if
(
taos_init
()){
tscError
(
"failed to call taos_init"
);
return
-
1
;
}
static
int32_t
lock
=
0
;
for
(
int
i
=
1
;
atomic_val_compare_exchange_32
(
&
lock
,
0
,
1
)
!=
0
;
++
i
)
{
if
(
i
%
1000
==
0
)
{
tscInfo
(
"haven't acquire lock after spin %d times."
,
i
);
printf
(
"haven't acquire lock after spin %d times."
,
i
);
sched_yield
();
}
}
...
...
src/util/inc/tconfig.h
浏览文件 @
65b358d4
...
...
@@ -89,7 +89,7 @@ void taosDumpGlobalCfg();
void
taosInitConfigOption
(
SGlobalCfg
cfg
);
SGlobalCfg
*
taosGetConfigOption
(
const
char
*
option
);
bool
taosReadConfigOption
(
const
char
*
option
,
char
*
value
,
char
*
value2
,
char
*
value3
);
bool
taosReadConfigOption
(
const
char
*
option
,
char
*
value
,
char
*
value2
,
char
*
value3
,
int8_t
cfgStatus
);
#ifdef __cplusplus
}
...
...
src/util/src/tconfig.c
浏览文件 @
65b358d4
...
...
@@ -293,7 +293,9 @@ SGlobalCfg *taosGetConfigOption(const char *option) {
return
NULL
;
}
bool
taosReadConfigOption
(
const
char
*
option
,
char
*
value
,
char
*
value2
,
char
*
value3
)
{
bool
taosReadConfigOption
(
const
char
*
option
,
char
*
value
,
char
*
value2
,
char
*
value3
,
int8_t
cfgStatus
)
{
bool
ret
=
false
;
for
(
int
i
=
0
;
i
<
tsGlobalConfigNum
;
++
i
)
{
SGlobalCfg
*
cfg
=
tsGlobalConfig
+
i
;
if
(
!
(
cfg
->
cfgType
&
TSDB_CFG_CTYPE_B_CONFIG
))
continue
;
...
...
@@ -301,35 +303,48 @@ bool taosReadConfigOption(const char *option, char *value, char *value2, char *v
switch
(
cfg
->
valType
)
{
case
TAOS_CFG_VTYPE_INT8
:
return
taosReadInt8Config
(
cfg
,
value
);
ret
=
taosReadInt8Config
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_INT16
:
return
taosReadInt16Config
(
cfg
,
value
);
ret
=
taosReadInt16Config
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_INT32
:
return
taosReadInt32Config
(
cfg
,
value
);
ret
=
taosReadInt32Config
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_UINT16
:
return
taosReadUInt16Config
(
cfg
,
value
);
ret
=
taosReadUInt16Config
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_FLOAT
:
return
taosReadFloatConfig
(
cfg
,
value
);
ret
=
taosReadFloatConfig
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_DOUBLE
:
return
taosReadDoubleConfig
(
cfg
,
value
);
ret
=
taosReadDoubleConfig
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_STRING
:
return
taosReadStringConfig
(
cfg
,
value
);
ret
=
taosReadStringConfig
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_IPSTR
:
return
taosReadIpStrConfig
(
cfg
,
value
);
ret
=
taosReadIpStrConfig
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_DIRECTORY
:
return
taosReadDirectoryConfig
(
cfg
,
value
);
ret
=
taosReadDirectoryConfig
(
cfg
,
value
);
break
;
case
TAOS_CFG_VTYPE_DATA_DIRCTORY
:
if
(
taosReadDirectoryConfig
(
cfg
,
value
))
{
taosReadDataDirCfg
(
value
,
value2
,
value3
);
ret
urn
true
;
ret
=
true
;
}
return
false
;
ret
=
false
;
break
;
default:
uError
(
"config option:%s, input value:%s, can't be recognized"
,
option
,
value
);
return
false
;
ret
=
false
;
}
if
(
ret
&&
cfgStatus
==
TAOS_CFG_CSTATUS_OPTION
){
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_OPTION
;
}
}
return
false
;
return
ret
;
}
void
taosInitConfigOption
(
SGlobalCfg
cfg
)
{
...
...
@@ -464,7 +479,7 @@ bool taosReadGlobalCfg() {
if
(
vlen3
!=
0
)
value3
[
vlen3
]
=
0
;
}
taosReadConfigOption
(
option
,
value
,
value2
,
value3
);
taosReadConfigOption
(
option
,
value
,
value2
,
value3
,
TAOS_CFG_CSTATUS_FILE
);
}
fclose
(
fp
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录