Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
5ddc7b45
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看板
提交
5ddc7b45
编写于
1月 09, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix memory leaks and refactor some codes
上级
2c393a89
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
65 addition
and
36 deletion
+65
-36
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+16
-15
src/client/src/tscSecondaryMerge.c
src/client/src/tscSecondaryMerge.c
+5
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+44
-20
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
5ddc7b45
...
...
@@ -201,10 +201,10 @@ typedef struct SDataBlockList {
}
SDataBlockList
;
typedef
struct
SQueryInfo
{
int16_t
command
;
// the command may be different for each subclause, so keep it seperately.
uint16_t
type
;
// query/insert/import type
char
intervalTimeUnit
;
int16_t
command
;
// the command may be different for each subclause, so keep it seperately.
uint16_t
type
;
// query/insert/import type
char
intervalTimeUnit
;
int64_t
etime
,
stime
;
int64_t
nAggTimeInterval
;
// aggregation time interval
int64_t
nSlidingTime
;
// sliding window in mseconds
...
...
@@ -221,9 +221,9 @@ typedef struct SQueryInfo {
int16_t
numOfTables
;
SMeterMetaInfo
**
pMeterInfo
;
struct
STSBuf
*
tsBuf
;
int64_t
*
defaultVal
;
// default value for interpolation
char
*
msg
;
// pointer to the pCmd->payload to keep error message temporarily
int64_t
clauseLimit
;
// limit for this sub clause
int64_t
*
defaultVal
;
// default value for interpolation
char
*
msg
;
// pointer to the pCmd->payload to keep error message temporarily
int64_t
clauseLimit
;
// limit for this sub clause
}
SQueryInfo
;
// data source from sql string or from file
...
...
@@ -248,13 +248,13 @@ typedef struct {
int32_t
numOfTablesInSubmit
;
};
int32_t
clauseIndex
;
// index of multiple subclause query
int8_t
isParseFinish
;
short
numOfCols
;
uint32_t
allocSize
;
char
*
payload
;
int
payloadLen
;
int32_t
clauseIndex
;
// index of multiple subclause query
int8_t
isParseFinish
;
short
numOfCols
;
uint32_t
allocSize
;
char
*
payload
;
int
payloadLen
;
SQueryInfo
**
pQueryInfo
;
int32_t
numOfClause
;
...
...
@@ -413,6 +413,7 @@ int32_t tscCreateResPointerInfo(SQueryInfo *pQueryInfo, SSqlRes *pRes);
void
tscDestroyResPointerInfo
(
SSqlRes
*
pRes
);
void
tscFreeSqlCmdData
(
SSqlCmd
*
pCmd
);
void
tscFreeResData
(
SSqlObj
*
pSql
);
/**
* only free part of resources allocated during query.
...
...
@@ -435,7 +436,7 @@ void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql);
void
tscKillMetricQuery
(
SSqlObj
*
pSql
);
void
tscInitResObjForLocalQuery
(
SSqlObj
*
pObj
,
int32_t
numOfRes
,
int32_t
rowLen
);
bool
tscIsUpdateQuery
(
STscObj
*
pObj
);
bool
tscHasReachLimitation
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
);
bool
tscHasReachLimitation
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
);
char
*
tscGetErrorMsgPayload
(
SSqlCmd
*
pCmd
);
...
...
src/client/src/tscSecondaryMerge.c
浏览文件 @
5ddc7b45
...
...
@@ -453,8 +453,12 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
++
i
)
{
SQLFunctionCtx
*
pCtx
=
&
pLocalReducer
->
pCtx
[
i
];
tVariantDestroy
(
&
pCtx
->
tag
);
if
(
pCtx
->
tagInfo
.
pTagCtxList
!=
NULL
)
{
tfree
(
pCtx
->
tagInfo
.
pTagCtxList
);
}
}
tfree
(
pLocalReducer
->
pCtx
);
}
...
...
src/client/src/tscUtil.c
浏览文件 @
5ddc7b45
...
...
@@ -365,6 +365,39 @@ void tscFreeSqlCmdData(SSqlCmd* pCmd) {
tscFreeSubqueryInfo
(
pCmd
);
}
void
tscFreeResData
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
tfree
(
pRes
->
pRsp
);
pRes
->
row
=
0
;
pRes
->
rspType
=
0
;
pRes
->
rspLen
=
0
;
pRes
->
row
=
0
;
pRes
->
numOfRows
=
0
;
pRes
->
numOfTotal
=
0
;
pRes
->
numOfTotalInCurrentClause
=
0
;
pRes
->
numOfGroups
=
0
;
pRes
->
precision
=
0
;
pRes
->
numOfnchar
=
0
;
pRes
->
qhandle
=
0
;
pRes
->
offset
=
0
;
pRes
->
useconds
=
0
;
pRes
->
code
=
0
;
pRes
->
data
=
NULL
;
tfree
(
pRes
->
pGroupRec
);
tscDestroyLocalReducer
(
pSql
);
tscDestroyResPointerInfo
(
pRes
);
tfree
(
pRes
->
pColumnIndex
);
}
void
tscFreeSqlObjPartial
(
SSqlObj
*
pSql
)
{
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
return
;
...
...
@@ -387,22 +420,11 @@ void tscFreeSqlObjPartial(SSqlObj* pSql) {
pthread_mutex_lock
(
&
pObj
->
mutex
);
tfree
(
pSql
->
sqlstr
);
pthread_mutex_unlock
(
&
pObj
->
mutex
);
tfree
(
pRes
->
pRsp
);
pRes
->
row
=
0
;
pRes
->
numOfRows
=
0
;
pRes
->
numOfTotal
=
0
;
pRes
->
numOfTotalInCurrentClause
=
0
;
pRes
->
numOfGroups
=
0
;
tfree
(
pRes
->
pGroupRec
);
tscDestroyLocalReducer
(
pSql
);
tscFreeResData
(
pSql
);
tfree
(
pSql
->
pSubs
);
pSql
->
numOfSubs
=
0
;
tscDestroyResPointerInfo
(
pRes
);
tfree
(
pRes
->
pColumnIndex
);
tscFreeSqlCmdData
(
pCmd
);
}
...
...
@@ -2156,13 +2178,15 @@ void tscTryQueryNextClause(SSqlObj* pSql, void (*queryFp)()) {
pSql
->
cmd
.
command
=
pQueryInfo
->
command
;
pRes
->
numOfTotal
+=
pRes
->
numOfTotalInCurrentClause
;
pRes
->
numOfTotalInCurrentClause
=
0
;
pRes
->
rspType
=
0
;
pSql
->
numOfSubs
=
0
;
//backup the total number of result first
int64_t
num
=
pRes
->
numOfTotal
+
pRes
->
numOfTotalInCurrentClause
;
tscFreeResData
(
pSql
);
pRes
->
numOfTotal
=
num
;
tfree
(
pSql
->
pSubs
);
pSql
->
numOfSubs
=
0
;
if
(
pSql
->
fp
!=
NULL
)
{
pSql
->
fp
=
queryFp
;
assert
(
queryFp
!=
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录