Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
bc602464
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bc602464
编写于
10月 27, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1815]
上级
2e8048c1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
16 deletion
+30
-16
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+24
-12
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+5
-3
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
bc602464
...
...
@@ -225,7 +225,7 @@ void tscInitQueryInfo(SQueryInfo* pQueryInfo);
void
tscClearSubqueryInfo
(
SSqlCmd
*
pCmd
);
void
tscFreeVgroupTableInfo
(
SArray
*
pVgroupTables
);
SArray
*
tsc
CloneVgroupTableInfo
(
SArray
*
pVgroupTables
);
SArray
*
tsc
VgroupTableInfoClone
(
SArray
*
pVgroupTables
);
void
tscRemoveVgroupTableGroup
(
SArray
*
pVgroupTable
,
int32_t
index
);
int
tscGetSTableVgroupInfo
(
SSqlObj
*
pSql
,
int32_t
clauseIndex
);
...
...
src/client/src/tscSystem.c
浏览文件 @
bc602464
...
...
@@ -79,7 +79,7 @@ int32_t tscInitRpc(const char *user, const char *secretEncrypt, void **pDnodeCon
void
taos_init_imp
(
void
)
{
char
temp
[
128
];
char
temp
[
128
]
=
{
0
}
;
errno
=
TSDB_CODE_SUCCESS
;
srand
(
taosGetTimestampSec
());
...
...
@@ -146,29 +146,41 @@ void taos_init_imp(void) {
tscObjCache
=
taosCacheInit
(
TSDB_CACHE_PTR_KEY
,
refreshTime
/
2
,
false
,
tscFreeRegisteredSqlObj
,
"sqlObj"
);
}
// in other language APIs, taos_cleanup is not available yet.
// So, to make sure taos_cleanup will be invoked to clean up the allocated
// resource to suppress the valgrind warning.
atexit
(
taos_cleanup
);
tscDebug
(
"client is initialized successfully"
);
}
void
taos_init
()
{
pthread_once
(
&
tscinit
,
taos_init_imp
);
}
// this function may be called by user or system, or by both simultaneously.
void
taos_cleanup
()
{
if
(
tscMetaCache
!=
NULL
)
{
taosCacheCleanup
(
tscMetaCache
);
tscMetaCache
=
NULL
;
tscDebug
(
"start to cleanup client environment"
);
taosCacheCleanup
(
tscObjCache
);
tscObjCache
=
NULL
;
void
*
m
=
tscMetaCache
;
if
(
m
!=
NULL
&&
atomic_val_compare_exchange_ptr
(
&
tscMetaCache
,
m
,
0
)
==
m
)
{
taosCacheCleanup
(
m
);
}
if
(
tscQhandle
!=
NULL
)
{
taosCleanUpScheduler
(
tscQhandle
);
tscQhandle
=
NULL
;
m
=
tscObjCache
;
if
(
m
!=
NULL
&&
atomic_val_compare_exchange_ptr
(
&
tscObjCache
,
m
,
0
)
==
m
)
{
taosCacheCleanup
(
m
);
}
m
=
tscQhandle
;
if
(
m
!=
NULL
&&
atomic_val_compare_exchange_ptr
(
&
tscQhandle
,
m
,
0
)
==
m
)
{
taosCleanUpScheduler
(
m
);
}
taosCleanupKeywordsTable
();
taosCloseLog
();
taosTmrCleanUp
(
tscTmr
);
m
=
tscTmr
;
if
(
m
!=
NULL
&&
atomic_val_compare_exchange_ptr
(
&
tscTmr
,
m
,
0
)
==
m
)
{
taosTmrCleanUp
(
m
);
}
}
static
int
taos_options_imp
(
TSDB_OPTION
option
,
const
char
*
pStr
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
bc602464
...
...
@@ -1713,7 +1713,7 @@ void tscRemoveVgroupTableGroup(SArray* pVgroupTable, int32_t index) {
taosArrayRemove
(
pVgroupTable
,
index
);
}
SArray
*
tsc
CloneVgroupTableInfo
(
SArray
*
pVgroupTables
)
{
SArray
*
tsc
VgroupTableInfoClone
(
SArray
*
pVgroupTables
)
{
if
(
pVgroupTables
==
NULL
)
{
return
NULL
;
}
...
...
@@ -1739,7 +1739,7 @@ SArray* tscCloneVgroupTableInfo(SArray* pVgroupTables) {
}
void
clearAllTableMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
address
,
bool
removeFromCache
)
{
tscDebug
(
"%p
deref the table meta in cache, numOfTables:%d
"
,
address
,
pQueryInfo
->
numOfTables
);
tscDebug
(
"%p
unref %d tables in the tableMeta cache
"
,
address
,
pQueryInfo
->
numOfTables
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
...
...
@@ -1779,6 +1779,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST
pTableMetaInfo
->
vgroupList
=
tscVgroupInfoClone
(
vgroupList
);
}
// TODO handle malloc failure
pTableMetaInfo
->
tagColList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
if
(
pTableMetaInfo
->
tagColList
==
NULL
)
{
return
NULL
;
...
...
@@ -1788,7 +1789,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST
tscColumnListCopy
(
pTableMetaInfo
->
tagColList
,
pTagCols
,
-
1
);
}
pTableMetaInfo
->
pVgroupTables
=
tsc
CloneVgroupTableInfo
(
pVgroupTables
);
pTableMetaInfo
->
pVgroupTables
=
tsc
VgroupTableInfoClone
(
pVgroupTables
);
pQueryInfo
->
numOfTables
+=
1
;
return
pTableMetaInfo
;
...
...
@@ -2469,6 +2470,7 @@ void tscSCMVgroupInfoCopy(SCMVgroupInfo* dst, const SCMVgroupInfo* src) {
dst
->
vgId
=
src
->
vgId
;
dst
->
numOfEps
=
src
->
numOfEps
;
for
(
int32_t
i
=
0
;
i
<
dst
->
numOfEps
;
++
i
)
{
taosTFree
(
dst
->
epAddr
[
i
].
fqdn
);
dst
->
epAddr
[
i
].
port
=
src
->
epAddr
[
i
].
port
;
dst
->
epAddr
[
i
].
fqdn
=
strdup
(
src
->
epAddr
[
i
].
fqdn
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录