Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4de8d28f
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,发现更多精彩内容 >>
提交
4de8d28f
编写于
7月 29, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix ucs4 convertion issue
上级
cc597c2f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
72 addition
and
5 deletion
+72
-5
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/libs/scheduler/src/schJob.c
source/libs/scheduler/src/schJob.c
+1
-1
source/os/src/osString.c
source/os/src/osString.c
+64
-4
未找到文件。
include/os/osString.h
浏览文件 @
4de8d28f
...
@@ -62,6 +62,8 @@ typedef int32_t TdUcs4;
...
@@ -62,6 +62,8 @@ typedef int32_t TdUcs4;
int32_t
taosUcs4len
(
TdUcs4
*
ucs4
);
int32_t
taosUcs4len
(
TdUcs4
*
ucs4
);
int64_t
taosStr2int64
(
const
char
*
str
);
int64_t
taosStr2int64
(
const
char
*
str
);
int32_t
taosConvInit
(
int32_t
maxNum
);
void
taosConvDestroy
();
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
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
);
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
);
int32_t
tasoUcs4Compare
(
TdUcs4
*
f1_ucs4
,
TdUcs4
*
f2_ucs4
,
int32_t
bytes
);
...
...
source/client/src/clientEnv.c
浏览文件 @
4de8d28f
...
@@ -361,6 +361,8 @@ void taos_init_imp(void) {
...
@@ -361,6 +361,8 @@ void taos_init_imp(void) {
initQueryModuleMsgHandle
();
initQueryModuleMsgHandle
();
taosConvInit
(
256
);
rpcInit
();
rpcInit
();
SCatalogCfg
cfg
=
{.
maxDBCacheNum
=
100
,
.
maxTblCacheNum
=
100
};
SCatalogCfg
cfg
=
{.
maxDBCacheNum
=
100
,
.
maxTblCacheNum
=
100
};
...
...
source/client/src/clientHb.c
浏览文件 @
4de8d28f
...
@@ -353,6 +353,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
...
@@ -353,6 +353,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
desc
.
subDesc
=
NULL
;
desc
.
subDesc
=
NULL
;
desc
.
subPlanNum
=
0
;
desc
.
subPlanNum
=
0
;
}
}
desc
.
subPlanNum
=
taosArrayGetSize
(
desc
.
subDesc
);
ASSERT
(
desc
.
subPlanNum
==
taosArrayGetSize
(
desc
.
subDesc
));
ASSERT
(
desc
.
subPlanNum
==
taosArrayGetSize
(
desc
.
subDesc
));
}
else
{
}
else
{
desc
.
subDesc
=
NULL
;
desc
.
subDesc
=
NULL
;
...
...
source/client/src/clientMain.c
浏览文件 @
4de8d28f
...
@@ -75,6 +75,8 @@ void taos_cleanup(void) {
...
@@ -75,6 +75,8 @@ void taos_cleanup(void) {
cleanupTaskQueue
();
cleanupTaskQueue
();
taosConvDestroy
();
tscInfo
(
"all local resources released"
);
tscInfo
(
"all local resources released"
);
taosCleanupCfg
();
taosCleanupCfg
();
taosCloseLog
();
taosCloseLog
();
...
...
source/libs/scheduler/src/schJob.c
浏览文件 @
4de8d28f
...
@@ -278,7 +278,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) {
...
@@ -278,7 +278,7 @@ int32_t schValidateAndBuildJob(SQueryPlan *pDag, SSchJob *pJob) {
}
}
SHashObj
*
planToTask
=
taosHashInit
(
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
,
taosGetDefaultHashFunction
(
POINTER_BYTES
==
sizeof
(
int64_t
)
?
TSDB_DATA_TYPE_BIGINT
:
TSDB_DATA_TYPE_INT
),
false
,
HASH_NO_LOCK
);
HASH_NO_LOCK
);
if
(
NULL
==
planToTask
)
{
if
(
NULL
==
planToTask
)
{
...
...
source/os/src/osString.c
浏览文件 @
4de8d28f
...
@@ -134,21 +134,81 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
...
@@ -134,21 +134,81 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
#endif
#endif
}
}
typedef
struct
{
iconv_t
conv
;
int8_t
inUse
;
}
SConv
;
SConv
*
gConv
=
NULL
;
int32_t
convUsed
=
0
;
int32_t
gConvMaxNum
=
0
;
int32_t
taosConvInit
(
int32_t
maxNum
)
{
gConvMaxNum
=
maxNum
*
2
;
gConv
=
taosMemoryCalloc
(
gConvMaxNum
,
sizeof
(
SConv
));
for
(
int32_t
i
=
0
;
i
<
gConvMaxNum
;
++
i
)
{
gConv
[
i
].
conv
=
iconv_open
(
DEFAULT_UNICODE_ENCODEC
,
tsCharset
);
}
return
0
;
}
void
taosConvDestroy
()
{
for
(
int32_t
i
=
0
;
i
<
gConvMaxNum
;
++
i
)
{
iconv_close
(
gConv
[
i
].
conv
);
}
taosMemoryFreeClear
(
gConv
);
}
void
taosAcquireConv
(
int32_t
*
idx
)
{
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
;
}
void
taosReleaseConv
(
int32_t
idx
)
{
atomic_store_8
(
&
gConv
[
idx
].
inUse
,
0
);
}
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbsLength
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
)
{
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbsLength
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
)
{
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile TDengine.
\n
"
);
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile TDengine.
\n
"
);
return
-
1
;
return
-
1
;
#else
#else
memset
(
ucs4
,
0
,
ucs4_max_len
);
memset
(
ucs4
,
0
,
ucs4_max_len
);
iconv_t
cd
=
iconv_open
(
DEFAULT_UNICODE_ENCODEC
,
tsCharset
);
int32_t
idx
=
0
;
taosAcquireConv
(
&
idx
);
size_t
ucs4_input_len
=
mbsLength
;
size_t
ucs4_input_len
=
mbsLength
;
size_t
outLeft
=
ucs4_max_len
;
size_t
outLeft
=
ucs4_max_len
;
if
(
iconv
(
cd
,
(
char
**
)
&
mbs
,
&
ucs4_input_len
,
(
char
**
)
&
ucs4
,
&
outLeft
)
==
-
1
)
{
if
(
iconv
(
gConv
[
idx
].
conv
,
(
char
**
)
&
mbs
,
&
ucs4_input_len
,
(
char
**
)
&
ucs4
,
&
outLeft
)
==
-
1
)
{
iconv_close
(
cd
);
taosReleaseConv
(
idx
);
return
false
;
return
false
;
}
}
iconv_close
(
cd
);
taosReleaseConv
(
idx
);
if
(
len
!=
NULL
)
{
if
(
len
!=
NULL
)
{
*
len
=
(
int32_t
)(
ucs4_max_len
-
outLeft
);
*
len
=
(
int32_t
)(
ucs4_max_len
-
outLeft
);
if
(
*
len
<
0
)
{
if
(
*
len
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录