Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cd361f43
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
cd361f43
编写于
7月 30, 2022
作者:
D
dapan1121
提交者:
GitHub
7月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15572 from taosdata/fix/forbiddenLocalCfg
enh: add forbidden local config setting
上级
9d62c839
77837f6e
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
115 addition
and
9 deletion
+115
-9
include/common/tglobal.h
include/common/tglobal.h
+1
-0
include/os/osString.h
include/os/osString.h
+2
-0
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+2
-0
source/client/src/clientHb.c
source/client/src/clientHb.c
+1
-0
source/client/src/clientMain.c
source/client/src/clientMain.c
+2
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+18
-4
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+2
-0
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+1
-0
source/libs/command/src/command.c
source/libs/command/src/command.c
+7
-0
source/libs/scheduler/src/schJob.c
source/libs/scheduler/src/schJob.c
+1
-1
source/os/src/osString.c
source/os/src/osString.c
+78
-4
未找到文件。
include/common/tglobal.h
浏览文件 @
cd361f43
...
...
@@ -146,6 +146,7 @@ struct SConfig *taosGetCfg();
void
taosSetAllDebugFlag
(
int32_t
flag
);
void
taosSetDebugFlag
(
int32_t
*
pFlagPtr
,
const
char
*
flagName
,
int32_t
flagVal
);
int32_t
taosSetCfg
(
SConfig
*
pCfg
,
char
*
name
);
void
taosLocalCfgForbiddenToChange
(
char
*
name
,
bool
*
forbidden
);
#ifdef __cplusplus
}
...
...
include/os/osString.h
浏览文件 @
cd361f43
...
...
@@ -62,6 +62,8 @@ typedef int32_t TdUcs4;
int32_t
taosUcs4len
(
TdUcs4
*
ucs4
);
int64_t
taosStr2int64
(
const
char
*
str
);
void
taosConvInit
(
void
);
void
taosConvDestroy
();
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbs_len
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
);
int32_t
tasoUcs4Compare
(
TdUcs4
*
f1_ucs4
,
TdUcs4
*
f2_ucs4
,
int32_t
bytes
);
...
...
source/client/src/clientEnv.c
浏览文件 @
cd361f43
...
...
@@ -361,6 +361,8 @@ void taos_init_imp(void) {
initQueryModuleMsgHandle
();
taosConvInit
();
rpcInit
();
SCatalogCfg
cfg
=
{.
maxDBCacheNum
=
100
,
.
maxTblCacheNum
=
100
};
...
...
source/client/src/clientHb.c
浏览文件 @
cd361f43
...
...
@@ -353,6 +353,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
desc
.
subDesc
=
NULL
;
desc
.
subPlanNum
=
0
;
}
desc
.
subPlanNum
=
taosArrayGetSize
(
desc
.
subDesc
);
ASSERT
(
desc
.
subPlanNum
==
taosArrayGetSize
(
desc
.
subDesc
));
}
else
{
desc
.
subDesc
=
NULL
;
...
...
source/client/src/clientMain.c
浏览文件 @
cd361f43
...
...
@@ -75,6 +75,8 @@ void taos_cleanup(void) {
cleanupTaskQueue
();
taosConvDestroy
();
tscInfo
(
"all local resources released"
);
taosCleanupCfg
();
taosCloseLog
();
...
...
source/common/src/tglobal.c
浏览文件 @
cd361f43
...
...
@@ -49,7 +49,7 @@ int32_t tsNumOfShmThreads = 1;
// queue & threads
int32_t
tsNumOfRpcThreads
=
1
;
int32_t
tsNumOfCommitThreads
=
2
;
int32_t
tsNumOfTaskQueueThreads
=
1
;
int32_t
tsNumOfTaskQueueThreads
=
4
;
int32_t
tsNumOfMnodeQueryThreads
=
4
;
int32_t
tsNumOfMnodeFetchThreads
=
1
;
int32_t
tsNumOfMnodeReadThreads
=
1
;
...
...
@@ -317,9 +317,9 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
if
(
cfgAddString
(
pCfg
,
"smlTagName"
,
tsSmlTagName
,
1
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"smlDataFormat"
,
tsSmlDataFormat
,
1
)
!=
0
)
return
-
1
;
tsNumOfTaskQueueThreads
=
tsNumOfCores
/
4
;
tsNumOfTaskQueueThreads
=
T
RANGE
(
tsNumOfTaskQueueThreads
,
1
,
2
);
if
(
cfgAddInt32
(
pCfg
,
"numOfTaskQueueThreads"
,
tsNumOfTaskQueueThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfTaskQueueThreads
=
tsNumOfCores
/
2
;
tsNumOfTaskQueueThreads
=
T
MAX
(
tsNumOfTaskQueueThreads
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfTaskQueueThreads"
,
tsNumOfTaskQueueThreads
,
4
,
1024
,
0
)
!=
0
)
return
-
1
;
return
0
;
}
...
...
@@ -594,6 +594,20 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
return
0
;
}
void
taosLocalCfgForbiddenToChange
(
char
*
name
,
bool
*
forbidden
)
{
int32_t
len
=
strlen
(
name
);
char
lowcaseName
[
CFG_NAME_MAX_LEN
+
1
]
=
{
0
};
strntolower
(
lowcaseName
,
name
,
TMIN
(
CFG_NAME_MAX_LEN
,
len
));
if
(
strcasecmp
(
"charset"
,
name
)
==
0
)
{
*
forbidden
=
true
;
return
;
}
*
forbidden
=
false
;
}
int32_t
taosSetCfg
(
SConfig
*
pCfg
,
char
*
name
)
{
int32_t
len
=
strlen
(
name
);
char
lowcaseName
[
CFG_NAME_MAX_LEN
+
1
]
=
{
0
};
...
...
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
cd361f43
...
...
@@ -219,6 +219,8 @@ int mainWindows(int argc,char** argv) {
return
-
1
;
}
taosConvInit
();
if
(
global
.
dumpConfig
)
{
dmDumpCfg
();
taosCleanupCfg
();
...
...
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
cd361f43
...
...
@@ -215,6 +215,7 @@ void dmCleanupDnode(SDnode *pDnode) {
dmClearVars
(
pDnode
);
rpcCleanup
();
indexCleanup
();
taosConvDestroy
();
dDebug
(
"dnode is closed, ptr:%p"
,
pDnode
);
}
...
...
source/libs/command/src/command.c
浏览文件 @
cd361f43
...
...
@@ -517,6 +517,13 @@ static int32_t execAlterLocal(SAlterLocalStmt* pStmt) {
goto
_return
;
}
bool
forbidden
=
false
;
taosLocalCfgForbiddenToChange
(
pStmt
->
config
,
&
forbidden
);
if
(
forbidden
)
{
terrno
=
TSDB_CODE_OPS_NOT_SUPPORT
;
return
terrno
;
}
if
(
cfgSetItem
(
tsCfg
,
pStmt
->
config
,
pStmt
->
value
,
CFG_STYPE_ALTER_CMD
))
{
return
terrno
;
}
...
...
source/libs/scheduler/src/schJob.c
浏览文件 @
cd361f43
...
...
@@ -278,7 +278,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) {
}
SHashObj
*
planToTask
=
taosHashInit
(
SCHEDULE_DEFAULT_MAX_TASK_NUM
,
pDag
->
numOfSubplans
,
taosGetDefaultHashFunction
(
POINTER_BYTES
==
sizeof
(
int64_t
)
?
TSDB_DATA_TYPE_BIGINT
:
TSDB_DATA_TYPE_INT
),
false
,
HASH_NO_LOCK
);
if
(
NULL
==
planToTask
)
{
...
...
source/os/src/osString.c
浏览文件 @
cd361f43
...
...
@@ -134,21 +134,95 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
#endif
}
typedef
struct
{
iconv_t
conv
;
int8_t
inUse
;
}
SConv
;
SConv
*
gConv
=
NULL
;
int32_t
convUsed
=
0
;
int32_t
gConvMaxNum
=
0
;
void
taosConvInit
(
void
)
{
gConvMaxNum
=
512
;
gConv
=
taosMemoryCalloc
(
gConvMaxNum
,
sizeof
(
SConv
));
for
(
int32_t
i
=
0
;
i
<
gConvMaxNum
;
++
i
)
{
gConv
[
i
].
conv
=
iconv_open
(
DEFAULT_UNICODE_ENCODEC
,
tsCharset
);
if
((
iconv_t
)
-
1
==
gConv
[
i
].
conv
||
(
iconv_t
)
0
==
gConv
[
i
].
conv
)
{
ASSERT
(
0
);
}
}
}
void
taosConvDestroy
()
{
for
(
int32_t
i
=
0
;
i
<
gConvMaxNum
;
++
i
)
{
iconv_close
(
gConv
[
i
].
conv
);
}
taosMemoryFreeClear
(
gConv
);
gConvMaxNum
=
-
1
;
}
iconv_t
taosAcquireConv
(
int32_t
*
idx
)
{
if
(
gConvMaxNum
<=
0
)
{
*
idx
=
-
1
;
return
iconv_open
(
DEFAULT_UNICODE_ENCODEC
,
tsCharset
);
}
while
(
true
)
{
int32_t
used
=
atomic_add_fetch_32
(
&
convUsed
,
1
);
if
(
used
>
gConvMaxNum
)
{
used
=
atomic_sub_fetch_32
(
&
convUsed
,
1
);
sched_yield
();
continue
;
}
break
;
}
int32_t
startId
=
taosGetSelfPthreadId
()
%
gConvMaxNum
;
while
(
true
)
{
if
(
gConv
[
startId
].
inUse
)
{
startId
=
(
startId
+
1
)
%
gConvMaxNum
;
continue
;
}
int8_t
old
=
atomic_val_compare_exchange_8
(
&
gConv
[
startId
].
inUse
,
0
,
1
);
if
(
0
==
old
)
{
break
;
}
}
*
idx
=
startId
;
return
gConv
[
startId
].
conv
;
}
void
taosReleaseConv
(
int32_t
idx
,
iconv_t
conv
)
{
if
(
idx
<
0
)
{
iconv_close
(
conv
);
return
;
}
atomic_store_8
(
&
gConv
[
idx
].
inUse
,
0
);
atomic_sub_fetch_32
(
&
convUsed
,
1
);
}
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbsLength
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
)
{
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile TDengine.
\n
"
);
return
-
1
;
#else
memset
(
ucs4
,
0
,
ucs4_max_len
);
iconv_t
cd
=
iconv_open
(
DEFAULT_UNICODE_ENCODEC
,
tsCharset
);
int32_t
idx
=
-
1
;
iconv_t
conv
=
taosAcquireConv
(
&
idx
);
size_t
ucs4_input_len
=
mbsLength
;
size_t
outLeft
=
ucs4_max_len
;
if
(
iconv
(
c
d
,
(
char
**
)
&
mbs
,
&
ucs4_input_len
,
(
char
**
)
&
ucs4
,
&
outLeft
)
==
-
1
)
{
iconv_close
(
cd
);
if
(
iconv
(
c
onv
,
(
char
**
)
&
mbs
,
&
ucs4_input_len
,
(
char
**
)
&
ucs4
,
&
outLeft
)
==
-
1
)
{
taosReleaseConv
(
idx
,
conv
);
return
false
;
}
iconv_close
(
cd
);
taosReleaseConv
(
idx
,
conv
);
if
(
len
!=
NULL
)
{
*
len
=
(
int32_t
)(
ucs4_max_len
-
outLeft
);
if
(
*
len
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录