Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
7daaecba
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看板
提交
7daaecba
编写于
1月 05, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mem protect
上级
4b5152cf
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
453 addition
and
312 deletion
+453
-312
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+2
-2
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+1
-1
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+20
-20
src/client/src/tscLocalMerge.c
src/client/src/tscLocalMerge.c
+36
-36
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+10
-10
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+7
-7
src/client/src/tscProfile.c
src/client/src/tscProfile.c
+3
-3
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-3
src/client/src/tscServer.c
src/client/src/tscServer.c
+10
-10
src/client/src/tscSql.c
src/client/src/tscSql.c
+14
-14
src/client/src/tscStream.c
src/client/src/tscStream.c
+4
-4
src/client/src/tscSub.c
src/client/src/tscSub.c
+2
-2
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+15
-15
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+55
-55
src/os/inc/osMemory.h
src/os/inc/osMemory.h
+23
-0
src/os/src/detail/osMemory.c
src/os/src/detail/osMemory.c
+119
-1
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+3
-3
src/query/src/qAst.c
src/query/src/qAst.c
+7
-7
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+56
-56
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+9
-9
src/query/src/qFill.c
src/query/src/qFill.c
+8
-8
src/query/src/qHistogram.c
src/query/src/qHistogram.c
+2
-2
src/query/src/qParserImpl.c
src/query/src/qParserImpl.c
+15
-15
src/query/src/qPercentile.c
src/query/src/qPercentile.c
+6
-6
src/query/src/qResultbuf.c
src/query/src/qResultbuf.c
+6
-6
src/query/src/qTsbuf.c
src/query/src/qTsbuf.c
+8
-8
src/query/src/qUtil.c
src/query/src/qUtil.c
+5
-5
src/query/src/sql.c
src/query/src/sql.c
+1
-1
src/util/src/hash.c
src/util/src/hash.c
+2
-2
未找到文件。
src/client/src/TSDBJNIConnector.c
浏览文件 @
7daaecba
...
@@ -314,7 +314,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_executeQueryImp(
...
@@ -314,7 +314,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_executeQueryImp(
}
}
}
}
free
(
str
);
TDMFREE
(
str
);
return
(
jlong
)
pSql
;
return
(
jlong
)
pSql
;
}
}
...
@@ -660,7 +660,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab
...
@@ -660,7 +660,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab
int
code
=
taos_validate_sql
(
tscon
,
str
);
int
code
=
taos_validate_sql
(
tscon
,
str
);
jniDebug
(
"jobj:%p, conn:%p, code is %d"
,
jobj
,
tscon
,
code
);
jniDebug
(
"jobj:%p, conn:%p, code is %d"
,
jobj
,
tscon
,
code
);
free
(
str
);
TDMFREE
(
str
);
return
code
;
return
code
;
}
}
...
...
src/client/src/tscAsync.c
浏览文件 @
7daaecba
...
@@ -364,7 +364,7 @@ void tscProcessFetchRow(SSchedMsg *pMsg) {
...
@@ -364,7 +364,7 @@ void tscProcessFetchRow(SSchedMsg *pMsg) {
static
void
tscProcessAsyncError
(
SSchedMsg
*
pMsg
)
{
static
void
tscProcessAsyncError
(
SSchedMsg
*
pMsg
)
{
void
(
*
fp
)()
=
pMsg
->
ahandle
;
void
(
*
fp
)()
=
pMsg
->
ahandle
;
terrno
=
*
(
int32_t
*
)
pMsg
->
msg
;
terrno
=
*
(
int32_t
*
)
pMsg
->
msg
;
tfree
(
pMsg
->
msg
);
TDMFREE
(
pMsg
->
msg
);
(
*
fp
)(
pMsg
->
thandle
,
NULL
,
*
(
int32_t
*
)
pMsg
->
msg
);
(
*
fp
)(
pMsg
->
thandle
,
NULL
,
*
(
int32_t
*
)
pMsg
->
msg
);
}
}
...
...
src/client/src/tscLocal.c
浏览文件 @
7daaecba
...
@@ -271,7 +271,7 @@ void tscSCreateCallBack(void *param, TAOS_RES *tres, int code) {
...
@@ -271,7 +271,7 @@ void tscSCreateCallBack(void *param, TAOS_RES *tres, int code) {
pRes
->
code
=
taos_errno
(
pSql
);
pRes
->
code
=
taos_errno
(
pSql
);
if
(
pRes
->
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
pRes
->
code
!=
TSDB_CODE_SUCCESS
)
{
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
free
(
builder
);
TDMFREE
(
builder
);
tscAsyncResultOnError
(
pParentSql
);
tscAsyncResultOnError
(
pParentSql
);
return
;
return
;
}
}
...
@@ -284,8 +284,8 @@ void tscSCreateCallBack(void *param, TAOS_RES *tres, int code) {
...
@@ -284,8 +284,8 @@ void tscSCreateCallBack(void *param, TAOS_RES *tres, int code) {
pRes
->
code
=
builder
->
fp
(
builder
,
result
);
pRes
->
code
=
builder
->
fp
(
builder
,
result
);
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
free
(
builder
);
TDMFREE
(
builder
);
free
(
result
);
TDMFREE
(
result
);
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
)
{
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
)
{
(
*
pParentSql
->
fp
)(
pParentSql
->
param
,
pParentSql
,
code
);
(
*
pParentSql
->
fp
)(
pParentSql
->
param
,
pParentSql
,
code
);
...
@@ -464,7 +464,7 @@ int32_t tscRebuildCreateTableStatement(void *param,char *result) {
...
@@ -464,7 +464,7 @@ int32_t tscRebuildCreateTableStatement(void *param,char *result) {
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"CREATE TABLE %s USING %s TAGS %s"
,
builder
->
buf
,
builder
->
sTableName
,
buf
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"CREATE TABLE %s USING %s TAGS %s"
,
builder
->
buf
,
builder
->
sTableName
,
buf
);
code
=
tscSCreateBuildResult
(
builder
->
pParentSql
,
SCREATE_BUILD_TABLE
,
builder
->
buf
,
result
);
code
=
tscSCreateBuildResult
(
builder
->
pParentSql
,
SCREATE_BUILD_TABLE
,
builder
->
buf
,
result
);
}
}
free
(
buf
);
TDMFREE
(
buf
);
return
code
;
return
code
;
}
}
...
@@ -520,7 +520,7 @@ int32_t tscRebuildCreateDBStatement(void *param,char *result) {
...
@@ -520,7 +520,7 @@ int32_t tscRebuildCreateDBStatement(void *param,char *result) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
tscSCreateBuildResult
(
builder
->
pParentSql
,
SCREATE_BUILD_DB
,
builder
->
buf
,
buf
);
code
=
tscSCreateBuildResult
(
builder
->
pParentSql
,
SCREATE_BUILD_DB
,
builder
->
buf
,
buf
);
}
}
free
(
buf
);
TDMFREE
(
buf
);
return
code
;
return
code
;
}
}
...
@@ -534,7 +534,7 @@ static int32_t tscGetTableTagColumnName(SSqlObj *pSql, char **result) {
...
@@ -534,7 +534,7 @@ static int32_t tscGetTableTagColumnName(SSqlObj *pSql, char **result) {
STableMeta
*
pMeta
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
)
->
pTableMeta
;
STableMeta
*
pMeta
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
,
0
)
->
pTableMeta
;
if
(
pMeta
->
tableType
==
TSDB_SUPER_TABLE
||
pMeta
->
tableType
==
TSDB_NORMAL_TABLE
||
if
(
pMeta
->
tableType
==
TSDB_SUPER_TABLE
||
pMeta
->
tableType
==
TSDB_NORMAL_TABLE
||
pMeta
->
tableType
==
TSDB_STREAM_TABLE
)
{
pMeta
->
tableType
==
TSDB_STREAM_TABLE
)
{
free
(
buf
);
TDMFREE
(
buf
);
return
TSDB_CODE_TSC_INVALID_VALUE
;
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
}
...
@@ -564,7 +564,7 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch
...
@@ -564,7 +564,7 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch
SCreateBuilder
*
param
=
(
SCreateBuilder
*
)
malloc
(
sizeof
(
SCreateBuilder
));
SCreateBuilder
*
param
=
(
SCreateBuilder
*
)
malloc
(
sizeof
(
SCreateBuilder
));
if
(
param
==
NULL
)
{
if
(
param
==
NULL
)
{
free
(
pInterSql
);
TDMFREE
(
pInterSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -581,24 +581,24 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch
...
@@ -581,24 +581,24 @@ static int32_t tscRebuildDDLForSubTable(SSqlObj *pSql, const char *tableName, ch
char
*
query
=
(
char
*
)
calloc
(
1
,
TSDB_MAX_BINARY_LEN
);
char
*
query
=
(
char
*
)
calloc
(
1
,
TSDB_MAX_BINARY_LEN
);
if
(
query
==
NULL
)
{
if
(
query
==
NULL
)
{
free
(
param
);
TDMFREE
(
param
);
free
(
pInterSql
);
TDMFREE
(
pInterSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
char
*
columns
=
NULL
;
char
*
columns
=
NULL
;
int32_t
code
=
tscGetTableTagColumnName
(
pSql
,
&
columns
)
;
int32_t
code
=
tscGetTableTagColumnName
(
pSql
,
&
columns
)
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
free
(
param
);
TDMFREE
(
param
);
free
(
pInterSql
);
TDMFREE
(
pInterSql
);
free
(
query
);
TDMFREE
(
query
);
return
code
;
return
code
;
}
}
snprintf
(
query
+
strlen
(
query
),
TSDB_MAX_BINARY_LEN
-
strlen
(
query
),
"SELECT %s FROM %s WHERE TBNAME IN(
\'
%s
\'
)"
,
columns
,
fullName
,
param
->
buf
);
snprintf
(
query
+
strlen
(
query
),
TSDB_MAX_BINARY_LEN
-
strlen
(
query
),
"SELECT %s FROM %s WHERE TBNAME IN(
\'
%s
\'
)"
,
columns
,
fullName
,
param
->
buf
);
doAsyncQuery
(
pSql
->
pTscObj
,
pInterSql
,
tscSCreateCallBack
,
param
,
query
,
strlen
(
query
));
doAsyncQuery
(
pSql
->
pTscObj
,
pInterSql
,
tscSCreateCallBack
,
param
,
query
,
strlen
(
query
));
free
(
query
);
TDMFREE
(
query
);
free
(
columns
);
TDMFREE
(
columns
);
return
TSDB_CODE_TSC_ACTION_IN_PROGRESS
;
return
TSDB_CODE_TSC_ACTION_IN_PROGRESS
;
}
}
...
@@ -693,7 +693,7 @@ static int32_t tscProcessShowCreateTable(SSqlObj *pSql) {
...
@@ -693,7 +693,7 @@ static int32_t tscProcessShowCreateTable(SSqlObj *pSql) {
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
tscSCreateBuildResult
(
pSql
,
SCREATE_BUILD_TABLE
,
tableName
,
result
);
code
=
tscSCreateBuildResult
(
pSql
,
SCREATE_BUILD_TABLE
,
tableName
,
result
);
}
}
free
(
result
);
TDMFREE
(
result
);
return
code
;
return
code
;
}
}
...
@@ -709,7 +709,7 @@ static int32_t tscProcessShowCreateDatabase(SSqlObj *pSql) {
...
@@ -709,7 +709,7 @@ static int32_t tscProcessShowCreateDatabase(SSqlObj *pSql) {
SCreateBuilder
*
param
=
(
SCreateBuilder
*
)
malloc
(
sizeof
(
SCreateBuilder
));
SCreateBuilder
*
param
=
(
SCreateBuilder
*
)
malloc
(
sizeof
(
SCreateBuilder
));
if
(
param
==
NULL
)
{
if
(
param
==
NULL
)
{
free
(
pInterSql
);
TDMFREE
(
pInterSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
extractTableName
(
pTableMetaInfo
->
name
,
param
->
buf
);
extractTableName
(
pTableMetaInfo
->
name
,
param
->
buf
);
...
@@ -738,7 +738,7 @@ static int32_t tscProcessCurrentUser(SSqlObj *pSql) {
...
@@ -738,7 +738,7 @@ static int32_t tscProcessCurrentUser(SSqlObj *pSql) {
STR_WITH_MAXSIZE_TO_VARSTR
(
vx
,
pSql
->
pTscObj
->
user
,
size
);
STR_WITH_MAXSIZE_TO_VARSTR
(
vx
,
pSql
->
pTscObj
->
user
,
size
);
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
free
(
vx
);
TDMFREE
(
vx
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -767,7 +767,7 @@ static int32_t tscProcessCurrentDB(SSqlObj *pSql) {
...
@@ -767,7 +767,7 @@ static int32_t tscProcessCurrentDB(SSqlObj *pSql) {
}
}
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
free
(
vx
);
TDMFREE
(
vx
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -791,7 +791,7 @@ static int32_t tscProcessServerVer(SSqlObj *pSql) {
...
@@ -791,7 +791,7 @@ static int32_t tscProcessServerVer(SSqlObj *pSql) {
STR_WITH_SIZE_TO_VARSTR
(
vx
,
v
,
(
VarDataLenT
)
t
);
STR_WITH_SIZE_TO_VARSTR
(
vx
,
v
,
(
VarDataLenT
)
t
);
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
tscSetLocalQueryResult
(
pSql
,
vx
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
free
(
vx
);
TDMFREE
(
vx
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -814,7 +814,7 @@ static int32_t tscProcessClientVer(SSqlObj *pSql) {
...
@@ -814,7 +814,7 @@ static int32_t tscProcessClientVer(SSqlObj *pSql) {
STR_WITH_SIZE_TO_VARSTR
(
v
,
version
,
(
VarDataLenT
)
t
);
STR_WITH_SIZE_TO_VARSTR
(
v
,
version
,
(
VarDataLenT
)
t
);
tscSetLocalQueryResult
(
pSql
,
v
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
tscSetLocalQueryResult
(
pSql
,
v
,
pExpr
->
aliasName
,
pExpr
->
resType
,
pExpr
->
resBytes
);
free
(
v
);
TDMFREE
(
v
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
src/client/src/tscLocalMerge.c
浏览文件 @
7daaecba
...
@@ -124,7 +124,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalReducer *pReducer, tOrderDesc
...
@@ -124,7 +124,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalReducer *pReducer, tOrderDesc
}
}
if
(
n
==
0
||
pCtx
==
NULL
)
{
if
(
n
==
0
||
pCtx
==
NULL
)
{
free
(
pTagCtx
);
TDMFREE
(
pTagCtx
);
}
else
{
}
else
{
pCtx
->
tagInfo
.
pTagCtxList
=
pTagCtx
;
pCtx
->
tagInfo
.
pTagCtxList
=
pTagCtx
;
pCtx
->
tagInfo
.
numOfTagCols
=
n
;
pCtx
->
tagInfo
.
numOfTagCols
=
n
;
...
@@ -242,7 +242,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -242,7 +242,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
if
(
ds
==
NULL
)
{
if
(
ds
==
NULL
)
{
tscError
(
"%p failed to create merge structure"
,
pSql
);
tscError
(
"%p failed to create merge structure"
,
pSql
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tfree
(
pReducer
);
TDMFREE
(
pReducer
);
return
;
return
;
}
}
...
@@ -269,7 +269,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -269,7 +269,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
if
(
ds
->
filePage
.
num
==
0
)
{
// no data in this flush, the index does not increase
if
(
ds
->
filePage
.
num
==
0
)
{
// no data in this flush, the index does not increase
tscDebug
(
"%p flush data is empty, ignore %d flush record"
,
pSql
,
idx
);
tscDebug
(
"%p flush data is empty, ignore %d flush record"
,
pSql
,
idx
);
tfree
(
ds
);
TDMFREE
(
ds
);
continue
;
continue
;
}
}
...
@@ -279,7 +279,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -279,7 +279,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
// no data actually, no need to merge result.
// no data actually, no need to merge result.
if
(
idx
==
0
)
{
if
(
idx
==
0
)
{
tfree
(
pReducer
);
TDMFREE
(
pReducer
);
return
;
return
;
}
}
...
@@ -287,7 +287,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -287,7 +287,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
SCompareParam
*
param
=
malloc
(
sizeof
(
SCompareParam
));
SCompareParam
*
param
=
malloc
(
sizeof
(
SCompareParam
));
if
(
param
==
NULL
)
{
if
(
param
==
NULL
)
{
tfree
(
pReducer
);
TDMFREE
(
pReducer
);
return
;
return
;
}
}
...
@@ -301,8 +301,8 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -301,8 +301,8 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
pRes
->
code
=
tLoserTreeCreate
(
&
pReducer
->
pLoserTree
,
pReducer
->
numOfBuffer
,
param
,
treeComparator
);
pRes
->
code
=
tLoserTreeCreate
(
&
pReducer
->
pLoserTree
,
pReducer
->
numOfBuffer
,
param
,
treeComparator
);
if
(
pReducer
->
pLoserTree
==
NULL
||
pRes
->
code
!=
0
)
{
if
(
pReducer
->
pLoserTree
==
NULL
||
pRes
->
code
!=
0
)
{
tfree
(
param
);
TDMFREE
(
param
);
tfree
(
pReducer
);
TDMFREE
(
pReducer
);
return
;
return
;
}
}
...
@@ -344,14 +344,14 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -344,14 +344,14 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
if
(
pReducer
->
pTempBuffer
==
NULL
||
pReducer
->
discardData
==
NULL
||
pReducer
->
pResultBuf
==
NULL
||
if
(
pReducer
->
pTempBuffer
==
NULL
||
pReducer
->
discardData
==
NULL
||
pReducer
->
pResultBuf
==
NULL
||
pReducer
->
pFinalRes
==
NULL
||
pReducer
->
prevRowOfInput
==
NULL
)
{
pReducer
->
pFinalRes
==
NULL
||
pReducer
->
prevRowOfInput
==
NULL
)
{
tfree
(
pReducer
->
pTempBuffer
);
TDMFREE
(
pReducer
->
pTempBuffer
);
tfree
(
pReducer
->
discardData
);
TDMFREE
(
pReducer
->
discardData
);
tfree
(
pReducer
->
pResultBuf
);
TDMFREE
(
pReducer
->
pResultBuf
);
tfree
(
pReducer
->
pFinalRes
);
TDMFREE
(
pReducer
->
pFinalRes
);
tfree
(
pReducer
->
prevRowOfInput
);
TDMFREE
(
pReducer
->
prevRowOfInput
);
tfree
(
pReducer
->
pLoserTree
);
TDMFREE
(
pReducer
->
pLoserTree
);
tfree
(
param
);
TDMFREE
(
param
);
tfree
(
pReducer
);
TDMFREE
(
pReducer
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
;
return
;
}
}
...
@@ -501,38 +501,38 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
...
@@ -501,38 +501,38 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
SQLFunctionCtx
*
pCtx
=
&
pLocalReducer
->
pCtx
[
i
];
SQLFunctionCtx
*
pCtx
=
&
pLocalReducer
->
pCtx
[
i
];
tVariantDestroy
(
&
pCtx
->
tag
);
tVariantDestroy
(
&
pCtx
->
tag
);
tfree
(
pCtx
->
resultInfo
);
TDMFREE
(
pCtx
->
resultInfo
);
if
(
pCtx
->
tagInfo
.
pTagCtxList
!=
NULL
)
{
if
(
pCtx
->
tagInfo
.
pTagCtxList
!=
NULL
)
{
tfree
(
pCtx
->
tagInfo
.
pTagCtxList
);
TDMFREE
(
pCtx
->
tagInfo
.
pTagCtxList
);
}
}
}
}
tfree
(
pLocalReducer
->
pCtx
);
TDMFREE
(
pLocalReducer
->
pCtx
);
}
}
tfree
(
pLocalReducer
->
prevRowOfInput
);
TDMFREE
(
pLocalReducer
->
prevRowOfInput
);
tfree
(
pLocalReducer
->
pTempBuffer
);
TDMFREE
(
pLocalReducer
->
pTempBuffer
);
tfree
(
pLocalReducer
->
pResultBuf
);
TDMFREE
(
pLocalReducer
->
pResultBuf
);
if
(
pLocalReducer
->
pLoserTree
)
{
if
(
pLocalReducer
->
pLoserTree
)
{
tfree
(
pLocalReducer
->
pLoserTree
->
param
);
TDMFREE
(
pLocalReducer
->
pLoserTree
->
param
);
tfree
(
pLocalReducer
->
pLoserTree
);
TDMFREE
(
pLocalReducer
->
pLoserTree
);
}
}
tfree
(
pLocalReducer
->
pFinalRes
);
TDMFREE
(
pLocalReducer
->
pFinalRes
);
tfree
(
pLocalReducer
->
discardData
);
TDMFREE
(
pLocalReducer
->
discardData
);
tscLocalReducerEnvDestroy
(
pLocalReducer
->
pExtMemBuffer
,
pLocalReducer
->
pDesc
,
pLocalReducer
->
resColModel
,
pLocalReducer
->
finalModel
,
tscLocalReducerEnvDestroy
(
pLocalReducer
->
pExtMemBuffer
,
pLocalReducer
->
pDesc
,
pLocalReducer
->
resColModel
,
pLocalReducer
->
finalModel
,
pLocalReducer
->
numOfVnode
);
pLocalReducer
->
numOfVnode
);
for
(
int32_t
i
=
0
;
i
<
pLocalReducer
->
numOfBuffer
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pLocalReducer
->
numOfBuffer
;
++
i
)
{
tfree
(
pLocalReducer
->
pLocalDataSrc
[
i
]);
TDMFREE
(
pLocalReducer
->
pLocalDataSrc
[
i
]);
}
}
pLocalReducer
->
numOfBuffer
=
0
;
pLocalReducer
->
numOfBuffer
=
0
;
pLocalReducer
->
numOfCompleted
=
0
;
pLocalReducer
->
numOfCompleted
=
0
;
free
(
pLocalReducer
);
TDMFREE
(
pLocalReducer
);
}
else
{
}
else
{
tscDebug
(
"%p already freed or another free function is invoked"
,
pSql
);
tscDebug
(
"%p already freed or another free function is invoked"
,
pSql
);
}
}
...
@@ -595,7 +595,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCm
...
@@ -595,7 +595,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCm
}
}
*
pOrderDesc
=
tOrderDesCreate
(
orderColIndexList
,
numOfGroupByCols
,
pModel
,
pQueryInfo
->
order
.
order
);
*
pOrderDesc
=
tOrderDesCreate
(
orderColIndexList
,
numOfGroupByCols
,
pModel
,
pQueryInfo
->
order
.
order
);
tfree
(
orderColIndexList
);
TDMFREE
(
orderColIndexList
);
if
(
*
pOrderDesc
==
NULL
)
{
if
(
*
pOrderDesc
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
@@ -708,7 +708,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
...
@@ -708,7 +708,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
if
(
createOrderDescriptor
(
pOrderDesc
,
pCmd
,
pModel
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
createOrderDescriptor
(
pOrderDesc
,
pCmd
,
pModel
)
!=
TSDB_CODE_SUCCESS
)
{
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tfree
(
pSchema
);
TDMFREE
(
pSchema
);
return
pRes
->
code
;
return
pRes
->
code
;
}
}
...
@@ -769,7 +769,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
...
@@ -769,7 +769,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
*
pFFModel
=
createColumnModel
(
pSchema
,
(
int32_t
)
size
,
capacity
);
*
pFFModel
=
createColumnModel
(
pSchema
,
(
int32_t
)
size
,
capacity
);
tfree
(
pSchema
);
TDMFREE
(
pSchema
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -790,7 +790,7 @@ void tscLocalReducerEnvDestroy(tExtMemBuffer **pMemBuffer, tOrderDescriptor *pDe
...
@@ -790,7 +790,7 @@ void tscLocalReducerEnvDestroy(tExtMemBuffer **pMemBuffer, tOrderDescriptor *pDe
pMemBuffer
[
i
]
=
destoryExtMemBuffer
(
pMemBuffer
[
i
]);
pMemBuffer
[
i
]
=
destoryExtMemBuffer
(
pMemBuffer
[
i
]);
}
}
tfree
(
pMemBuffer
);
TDMFREE
(
pMemBuffer
);
}
}
/**
/**
...
@@ -1020,10 +1020,10 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
...
@@ -1020,10 +1020,10 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
pBeforeFillData
->
num
=
0
;
pBeforeFillData
->
num
=
0
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
tfree
(
pResPages
[
i
]);
TDMFREE
(
pResPages
[
i
]);
}
}
tfree
(
pResPages
);
TDMFREE
(
pResPages
);
}
}
static
void
savePreviousRow
(
SLocalReducer
*
pLocalReducer
,
tFilePage
*
tmpBuffer
)
{
static
void
savePreviousRow
(
SLocalReducer
*
pLocalReducer
,
tFilePage
*
tmpBuffer
)
{
...
@@ -1151,7 +1151,7 @@ static void fillMultiRowsOfTagsVal(SQueryInfo *pQueryInfo, int32_t numOfRes, SLo
...
@@ -1151,7 +1151,7 @@ static void fillMultiRowsOfTagsVal(SQueryInfo *pQueryInfo, int32_t numOfRes, SLo
}
}
}
}
free
(
buf
);
TDMFREE
(
buf
);
}
}
int32_t
finalizeRes
(
SQueryInfo
*
pQueryInfo
,
SLocalReducer
*
pLocalReducer
)
{
int32_t
finalizeRes
(
SQueryInfo
*
pQueryInfo
,
SLocalReducer
*
pLocalReducer
)
{
...
@@ -1658,8 +1658,8 @@ int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_
...
@@ -1658,8 +1658,8 @@ int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_
memcpy
(
pOutput
->
data
,
pbuf
,
(
size_t
)(
pOutput
->
num
*
offset
));
memcpy
(
pOutput
->
data
,
pbuf
,
(
size_t
)(
pOutput
->
num
*
offset
));
tfree
(
pbuf
);
TDMFREE
(
pbuf
);
tfree
(
arithSup
.
data
);
TDMFREE
(
arithSup
.
data
);
return
offset
;
return
offset
;
}
}
src/client/src/tscParseInsert.c
浏览文件 @
7daaecba
...
@@ -711,7 +711,7 @@ static int32_t doParseInsertStatement(SSqlCmd* pCmd, char **str, SParsedDataColI
...
@@ -711,7 +711,7 @@ static int32_t doParseInsertStatement(SSqlCmd* pCmd, char **str, SParsedDataColI
}
}
int32_t
numOfRows
=
tsParseValues
(
str
,
dataBuf
,
pTableMeta
,
maxNumOfRows
,
spd
,
pCmd
,
&
code
,
tmpTokenBuf
);
int32_t
numOfRows
=
tsParseValues
(
str
,
dataBuf
,
pTableMeta
,
maxNumOfRows
,
spd
,
pCmd
,
&
code
,
tmpTokenBuf
);
free
(
tmpTokenBuf
);
TDMFREE
(
tmpTokenBuf
);
if
(
numOfRows
<=
0
)
{
if
(
numOfRows
<=
0
)
{
return
code
;
return
code
;
}
}
...
@@ -946,7 +946,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
...
@@ -946,7 +946,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
}
}
kvRowCpy
(
pTag
,
row
);
kvRowCpy
(
pTag
,
row
);
free
(
row
);
TDMFREE
(
row
);
pCmd
->
tagData
.
data
=
pTag
;
pCmd
->
tagData
.
data
=
pTag
;
index
=
0
;
index
=
0
;
...
@@ -1337,10 +1337,10 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
...
@@ -1337,10 +1337,10 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
char
*
sqlstr
=
strdup
(
pSql
->
sqlstr
);
char
*
sqlstr
=
strdup
(
pSql
->
sqlstr
);
ret
=
tsParseInsertSql
(
pSql
);
ret
=
tsParseInsertSql
(
pSql
);
if
(
sqlstr
==
NULL
||
pSql
->
parseRetry
>=
1
||
ret
!=
TSDB_CODE_TSC_INVALID_SQL
)
{
if
(
sqlstr
==
NULL
||
pSql
->
parseRetry
>=
1
||
ret
!=
TSDB_CODE_TSC_INVALID_SQL
)
{
free
(
sqlstr
);
TDMFREE
(
sqlstr
);
}
else
{
}
else
{
tscResetSqlCmdObj
(
pCmd
);
tscResetSqlCmdObj
(
pCmd
);
free
(
pSql
->
sqlstr
);
TDMFREE
(
pSql
->
sqlstr
);
pSql
->
sqlstr
=
sqlstr
;
pSql
->
sqlstr
=
sqlstr
;
pSql
->
parseRetry
++
;
pSql
->
parseRetry
++
;
if
((
ret
=
tsInsertInitialCheck
(
pSql
))
==
TSDB_CODE_SUCCESS
)
{
if
((
ret
=
tsInsertInitialCheck
(
pSql
))
==
TSDB_CODE_SUCCESS
)
{
...
@@ -1425,7 +1425,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
...
@@ -1425,7 +1425,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
}
}
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
tfree
(
pSupporter
);
TDMFREE
(
pSupporter
);
fclose
(
fp
);
fclose
(
fp
);
pParentSql
->
res
.
code
=
code
;
pParentSql
->
res
.
code
=
code
;
...
@@ -1451,7 +1451,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
...
@@ -1451,7 +1451,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
int32_t
count
=
0
;
int32_t
count
=
0
;
int32_t
maxRows
=
0
;
int32_t
maxRows
=
0
;
tfree
(
pCmd
->
pTableNameList
);
TDMFREE
(
pCmd
->
pTableNameList
);
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
if
(
pCmd
->
pTableBlockHashList
==
NULL
)
{
if
(
pCmd
->
pTableBlockHashList
==
NULL
)
{
...
@@ -1493,8 +1493,8 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
...
@@ -1493,8 +1493,8 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
}
}
}
}
tfree
(
tokenBuf
);
TDMFREE
(
tokenBuf
);
free
(
line
);
TDMFREE
(
line
);
if
(
count
>
0
)
{
if
(
count
>
0
)
{
code
=
doPackSendDataBlock
(
pSql
,
count
,
pTableDataBlock
);
code
=
doPackSendDataBlock
(
pSql
,
count
,
pTableDataBlock
);
...
@@ -1506,7 +1506,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
...
@@ -1506,7 +1506,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
}
else
{
}
else
{
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
tfree
(
pSupporter
);
TDMFREE
(
pSupporter
);
fclose
(
fp
);
fclose
(
fp
);
pParentSql
->
fp
=
pParentSql
->
fetchFp
;
pParentSql
->
fp
=
pParentSql
->
fetchFp
;
...
@@ -1534,7 +1534,7 @@ void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql) {
...
@@ -1534,7 +1534,7 @@ void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql) {
pSql
->
res
.
code
=
TAOS_SYSTEM_ERROR
(
errno
);
pSql
->
res
.
code
=
TAOS_SYSTEM_ERROR
(
errno
);
tscError
(
"%p failed to open file %s to load data from file, code:%s"
,
pSql
,
pCmd
->
payload
,
tstrerror
(
pSql
->
res
.
code
));
tscError
(
"%p failed to open file %s to load data from file, code:%s"
,
pSql
,
pCmd
->
payload
,
tstrerror
(
pSql
->
res
.
code
));
tfree
(
pSupporter
);
TDMFREE
(
pSupporter
);
tscAsyncResultOnError
(
pSql
);
tscAsyncResultOnError
(
pSql
);
return
;
return
;
...
...
src/client/src/tscPrepare.c
浏览文件 @
7daaecba
...
@@ -860,7 +860,7 @@ TAOS_STMT* taos_stmt_init(TAOS* taos) {
...
@@ -860,7 +860,7 @@ TAOS_STMT* taos_stmt_init(TAOS* taos) {
SSqlObj
*
pSql
=
calloc
(
1
,
sizeof
(
SSqlObj
));
SSqlObj
*
pSql
=
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
pSql
==
NULL
)
{
if
(
pSql
==
NULL
)
{
free
(
pStmt
);
TDMFREE
(
pStmt
);
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscError
(
"failed to allocate memory for statement"
);
tscError
(
"failed to allocate memory for statement"
);
return
NULL
;
return
NULL
;
...
@@ -901,7 +901,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
...
@@ -901,7 +901,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
if
(
pSql
->
sqlstr
==
NULL
)
{
if
(
pSql
->
sqlstr
==
NULL
)
{
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
free
(
pCmd
->
payload
);
TDMFREE
(
pCmd
->
payload
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -941,14 +941,14 @@ int taos_stmt_close(TAOS_STMT* stmt) {
...
@@ -941,14 +941,14 @@ int taos_stmt_close(TAOS_STMT* stmt) {
for
(
uint16_t
i
=
0
;
i
<
normal
->
numParams
;
i
++
)
{
for
(
uint16_t
i
=
0
;
i
<
normal
->
numParams
;
i
++
)
{
tVariantDestroy
(
normal
->
params
+
i
);
tVariantDestroy
(
normal
->
params
+
i
);
}
}
free
(
normal
->
params
);
TDMFREE
(
normal
->
params
);
}
}
free
(
normal
->
parts
);
TDMFREE
(
normal
->
parts
);
free
(
normal
->
sql
);
TDMFREE
(
normal
->
sql
);
}
}
taos_free_result
(
pStmt
->
pSql
);
taos_free_result
(
pStmt
->
pSql
);
free
(
pStmt
);
TDMFREE
(
pStmt
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -992,7 +992,7 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
...
@@ -992,7 +992,7 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
}
}
pStmt
->
pSql
=
taos_query
((
TAOS
*
)
pStmt
->
taos
,
sql
);
pStmt
->
pSql
=
taos_query
((
TAOS
*
)
pStmt
->
taos
,
sql
);
ret
=
taos_errno
(
pStmt
->
pSql
);
ret
=
taos_errno
(
pStmt
->
pSql
);
free
(
sql
);
TDMFREE
(
sql
);
}
}
}
}
return
ret
;
return
ret
;
...
...
src/client/src/tscProfile.c
浏览文件 @
7daaecba
...
@@ -33,7 +33,7 @@ void tscInitConnCb(void *param, TAOS_RES *result, int code) {
...
@@ -33,7 +33,7 @@ void tscInitConnCb(void *param, TAOS_RES *result, int code) {
taos_close
(
tscSlowQueryConn
);
taos_close
(
tscSlowQueryConn
);
tscSlowQueryConn
=
NULL
;
tscSlowQueryConn
=
NULL
;
tscSlowQueryConnInitialized
=
false
;
tscSlowQueryConnInitialized
=
false
;
free
(
sql
);
TDMFREE
(
sql
);
}
else
{
}
else
{
tscDebug
(
"taos:%p, slow query connect success, code:%d"
,
tscSlowQueryConn
,
code
);
tscDebug
(
"taos:%p, slow query connect success, code:%d"
,
tscSlowQueryConn
,
code
);
tscSlowQueryConnInitialized
=
true
;
tscSlowQueryConnInitialized
=
true
;
...
@@ -82,12 +82,12 @@ void tscSaveSlowQueryFp(void *handle, void *tmrId) {
...
@@ -82,12 +82,12 @@ void tscSaveSlowQueryFp(void *handle, void *tmrId) {
taos_connect_a
(
NULL
,
"monitor"
,
tsInternalPass
,
""
,
0
,
tscInitConnCb
,
sql
,
&
tscSlowQueryConn
);
taos_connect_a
(
NULL
,
"monitor"
,
tsInternalPass
,
""
,
0
,
tscInitConnCb
,
sql
,
&
tscSlowQueryConn
);
}
else
{
}
else
{
tscError
(
"taos:%p, slow query connect is already initialized"
,
tscSlowQueryConn
);
tscError
(
"taos:%p, slow query connect is already initialized"
,
tscSlowQueryConn
);
free
(
sql
);
TDMFREE
(
sql
);
}
}
}
else
{
}
else
{
tscDebug
(
"taos:%p, save slow query:%s"
,
tscSlowQueryConn
,
sql
);
tscDebug
(
"taos:%p, save slow query:%s"
,
tscSlowQueryConn
,
sql
);
taos_query_a
(
tscSlowQueryConn
,
sql
,
tscSaveSlowQueryFpCb
,
NULL
);
taos_query_a
(
tscSlowQueryConn
,
sql
,
tscSaveSlowQueryFpCb
,
NULL
);
free
(
sql
);
TDMFREE
(
sql
);
}
}
}
}
...
...
src/client/src/tscSQLParser.c
浏览文件 @
7daaecba
...
@@ -4058,7 +4058,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
...
@@ -4058,7 +4058,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
int32_t
ret
=
setObjFullName
(
idBuf
,
account
,
&
dbToken
,
&
t
,
&
xlen
);
int32_t
ret
=
setObjFullName
(
idBuf
,
account
,
&
dbToken
,
&
t
,
&
xlen
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
taosStringBuilderDestroy
(
&
sb1
);
taosStringBuilderDestroy
(
&
sb1
);
tfree
(
segments
);
TDMFREE
(
segments
);
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
return
ret
;
return
ret
;
...
@@ -4072,7 +4072,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
...
@@ -4072,7 +4072,7 @@ static int32_t setTableCondForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo,
pQueryInfo
->
tagCond
.
tbnameCond
.
len
=
(
int32_t
)
strlen
(
str
);
pQueryInfo
->
tagCond
.
tbnameCond
.
len
=
(
int32_t
)
strlen
(
str
);
taosStringBuilderDestroy
(
&
sb1
);
taosStringBuilderDestroy
(
&
sb1
);
tfree
(
segments
);
TDMFREE
(
segments
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -6257,7 +6257,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
...
@@ -6257,7 +6257,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
}
}
kvRowCpy
(
pTag
->
data
,
row
);
kvRowCpy
(
pTag
->
data
,
row
);
free
(
row
);
TDMFREE
(
row
);
// table name
// table name
if
(
tscValidateName
(
&
(
pCreateTableInfo
->
name
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
tscValidateName
(
&
(
pCreateTableInfo
->
name
))
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscServer.c
浏览文件 @
7daaecba
...
@@ -391,7 +391,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
...
@@ -391,7 +391,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
memcpy
(
pRes
->
pRsp
,
rpcMsg
->
pCont
,
pRes
->
rspLen
);
memcpy
(
pRes
->
pRsp
,
rpcMsg
->
pCont
,
pRes
->
rspLen
);
}
}
}
else
{
}
else
{
tfree
(
pRes
->
pRsp
);
TDMFREE
(
pRes
->
pRsp
);
}
}
/*
/*
...
@@ -747,7 +747,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -747,7 +747,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg
->
queryType
=
htonl
(
pQueryInfo
->
type
);
pQueryMsg
->
queryType
=
htonl
(
pQueryInfo
->
type
);
pQueryMsg
->
vgroupLimit
=
htobe64
(
pQueryInfo
->
vgroupLimit
);
pQueryMsg
->
vgroupLimit
=
htobe64
(
pQueryInfo
->
vgroupLimit
);
pQueryMsg
->
sqlstrLen
=
htonl
(
sqlLen
);
pQueryMsg
->
sqlstrLen
=
htonl
(
sqlLen
);
if
(
pSql
->
sqlstr
&&
strlen
(
pSql
->
sqlstr
)
<
sizeof
(
(
pQueryMsg
->
sqlstr
))
{
if
(
pSql
->
sqlstr
&&
strlen
(
pSql
->
sqlstr
)
<
sizeof
(
pQueryMsg
->
sqlstr
))
{
strcpy
(
pQueryMsg
->
sqlstr
,
pSql
->
sqlstr
);
strcpy
(
pQueryMsg
->
sqlstr
,
pSql
->
sqlstr
);
}
}
...
@@ -1860,11 +1860,11 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
...
@@ -1860,11 +1860,11 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
int32_t
code
=
taosHashPut
(
tscTableMetaInfo
,
pTableMeta
->
sTableName
,
len
,
pSupTableMeta
,
size
);
int32_t
code
=
taosHashPut
(
tscTableMetaInfo
,
pTableMeta
->
sTableName
,
len
,
pSupTableMeta
,
size
);
assert
(
code
==
TSDB_CODE_SUCCESS
);
assert
(
code
==
TSDB_CODE_SUCCESS
);
tfree
(
pSupTableMeta
);
TDMFREE
(
pSupTableMeta
);
CChildTableMeta
*
cMeta
=
tscCreateChildMeta
(
pTableMeta
);
CChildTableMeta
*
cMeta
=
tscCreateChildMeta
(
pTableMeta
);
taosHashPut
(
tscTableMetaInfo
,
pTableMetaInfo
->
name
,
strlen
(
pTableMetaInfo
->
name
),
cMeta
,
sizeof
(
CChildTableMeta
));
taosHashPut
(
tscTableMetaInfo
,
pTableMetaInfo
->
name
,
strlen
(
pTableMetaInfo
->
name
),
cMeta
,
sizeof
(
CChildTableMeta
));
tfree
(
cMeta
);
TDMFREE
(
cMeta
);
}
else
{
}
else
{
uint32_t
s
=
tscGetTableMetaSize
(
pTableMeta
);
uint32_t
s
=
tscGetTableMetaSize
(
pTableMeta
);
taosHashPut
(
tscTableMetaInfo
,
pTableMetaInfo
->
name
,
strlen
(
pTableMetaInfo
->
name
),
pTableMeta
,
s
);
taosHashPut
(
tscTableMetaInfo
,
pTableMetaInfo
->
name
,
strlen
(
pTableMetaInfo
->
name
),
pTableMeta
,
s
);
...
@@ -1887,7 +1887,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
...
@@ -1887,7 +1887,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
}
}
tscDebug
(
"%p recv table meta, uid:%"
PRId64
", tid:%d, name:%s"
,
pSql
,
pTableMeta
->
id
.
uid
,
pTableMeta
->
id
.
tid
,
pTableMetaInfo
->
name
);
tscDebug
(
"%p recv table meta, uid:%"
PRId64
", tid:%d, name:%s"
,
pSql
,
pTableMeta
->
id
.
uid
,
pTableMeta
->
id
.
tid
,
pTableMetaInfo
->
name
);
free
(
pTableMeta
);
TDMFREE
(
pTableMeta
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -2079,7 +2079,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
...
@@ -2079,7 +2079,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
pSchema
++
;
pSchema
++
;
}
}
tfree
(
pTableMetaInfo
->
pTableMeta
);
TDMFREE
(
pTableMetaInfo
->
pTableMeta
);
pTableMetaInfo
->
pTableMeta
=
tscCreateTableMetaFromMsg
(
pMetaMsg
);
pTableMetaInfo
->
pTableMeta
=
tscCreateTableMetaFromMsg
(
pMetaMsg
);
SSchema
*
pTableSchema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
SSchema
*
pTableSchema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
...
@@ -2121,7 +2121,7 @@ static void createHBObj(STscObj* pObj) {
...
@@ -2121,7 +2121,7 @@ static void createHBObj(STscObj* pObj) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetailSafely
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetailSafely
(
&
pSql
->
cmd
,
0
);
if
(
pQueryInfo
==
NULL
)
{
if
(
pQueryInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tfree
(
pSql
);
TDMFREE
(
pSql
);
return
;
return
;
}
}
...
@@ -2130,7 +2130,7 @@ static void createHBObj(STscObj* pObj) {
...
@@ -2130,7 +2130,7 @@ static void createHBObj(STscObj* pObj) {
pSql
->
cmd
.
command
=
pQueryInfo
->
command
;
pSql
->
cmd
.
command
=
pQueryInfo
->
command
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
(
pSql
->
cmd
),
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
(
pSql
->
cmd
),
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tfree
(
pSql
);
TDMFREE
(
pSql
);
return
;
return
;
}
}
...
@@ -2213,7 +2213,7 @@ int tscProcessAlterTableMsgRsp(SSqlObj *pSql) {
...
@@ -2213,7 +2213,7 @@ int tscProcessAlterTableMsgRsp(SSqlObj *pSql) {
bool
isSuperTable
=
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
);
bool
isSuperTable
=
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
);
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
tfree
(
pTableMetaInfo
->
pTableMeta
);
TDMFREE
(
pTableMetaInfo
->
pTableMeta
);
if
(
isSuperTable
)
{
// if it is a super table, iterate the hashTable and remove all the childTableMeta
if
(
isSuperTable
)
{
// if it is a super table, iterate the hashTable and remove all the childTableMeta
taosHashEmpty
(
tscTableMetaInfo
);
taosHashEmpty
(
tscTableMetaInfo
);
...
@@ -2360,7 +2360,7 @@ static int32_t getTableMetaFromMnode(SSqlObj *pSql, STableMetaInfo *pTableMetaIn
...
@@ -2360,7 +2360,7 @@ static int32_t getTableMetaFromMnode(SSqlObj *pSql, STableMetaInfo *pTableMetaIn
int32_t
tscGetTableMeta
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
int32_t
tscGetTableMeta
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
assert
(
strlen
(
pTableMetaInfo
->
name
)
!=
0
);
assert
(
strlen
(
pTableMetaInfo
->
name
)
!=
0
);
tfree
(
pTableMetaInfo
->
pTableMeta
);
TDMFREE
(
pTableMetaInfo
->
pTableMeta
);
uint32_t
size
=
tscGetTableMetaMaxSize
();
uint32_t
size
=
tscGetTableMetaMaxSize
();
pTableMetaInfo
->
pTableMeta
=
calloc
(
1
,
size
);
pTableMetaInfo
->
pTableMeta
=
calloc
(
1
,
size
);
...
...
src/client/src/tscSql.c
浏览文件 @
7daaecba
...
@@ -74,12 +74,12 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
...
@@ -74,12 +74,12 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
char
*
base64
=
(
char
*
)
base64_decode
(
auth
,
len
,
&
outlen
);
char
*
base64
=
(
char
*
)
base64_decode
(
auth
,
len
,
&
outlen
);
if
(
base64
==
NULL
||
outlen
==
0
)
{
if
(
base64
==
NULL
||
outlen
==
0
)
{
tscError
(
"invalid auth info:%s"
,
auth
);
tscError
(
"invalid auth info:%s"
,
auth
);
free
(
base64
);
TDMFREE
(
base64
);
terrno
=
TSDB_CODE_TSC_INVALID_PASS_LENGTH
;
terrno
=
TSDB_CODE_TSC_INVALID_PASS_LENGTH
;
return
NULL
;
return
NULL
;
}
else
{
}
else
{
memcpy
(
secretEncrypt
,
base64
,
outlen
);
memcpy
(
secretEncrypt
,
base64
,
outlen
);
free
(
base64
);
TDMFREE
(
base64
);
}
}
secretEncryptLen
=
outlen
;
secretEncryptLen
=
outlen
;
}
}
...
@@ -108,8 +108,8 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
...
@@ -108,8 +108,8 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
if
(
NULL
==
pObj
->
tscCorMgmtEpSet
)
{
if
(
NULL
==
pObj
->
tscCorMgmtEpSet
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
rpcClose
(
pDnodeConn
);
free
(
pObj
->
tscCorMgmtEpSet
);
TDMFREE
(
pObj
->
tscCorMgmtEpSet
);
free
(
pObj
);
TDMFREE
(
pObj
);
}
}
memcpy
(
pObj
->
tscCorMgmtEpSet
,
&
corMgmtEpSet
,
sizeof
(
SRpcCorEpSet
));
memcpy
(
pObj
->
tscCorMgmtEpSet
,
&
corMgmtEpSet
,
sizeof
(
SRpcCorEpSet
));
...
@@ -126,8 +126,8 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
...
@@ -126,8 +126,8 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
if
(
len
>=
TSDB_DB_NAME_LEN
)
{
if
(
len
>=
TSDB_DB_NAME_LEN
)
{
terrno
=
TSDB_CODE_TSC_INVALID_DB_LENGTH
;
terrno
=
TSDB_CODE_TSC_INVALID_DB_LENGTH
;
rpcClose
(
pDnodeConn
);
rpcClose
(
pDnodeConn
);
free
(
pObj
->
tscCorMgmtEpSet
);
TDMFREE
(
pObj
->
tscCorMgmtEpSet
);
free
(
pObj
);
TDMFREE
(
pObj
);
return
NULL
;
return
NULL
;
}
}
...
@@ -144,8 +144,8 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
...
@@ -144,8 +144,8 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
if
(
NULL
==
pSql
)
{
if
(
NULL
==
pSql
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
rpcClose
(
pDnodeConn
);
free
(
pObj
->
tscCorMgmtEpSet
);
TDMFREE
(
pObj
->
tscCorMgmtEpSet
);
free
(
pObj
);
TDMFREE
(
pObj
);
return
NULL
;
return
NULL
;
}
}
...
@@ -161,9 +161,9 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
...
@@ -161,9 +161,9 @@ static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pa
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
pSql
->
cmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
pSql
->
cmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
rpcClose
(
pDnodeConn
);
free
(
pSql
);
TDMFREE
(
pSql
);
free
(
pObj
->
tscCorMgmtEpSet
);
TDMFREE
(
pObj
->
tscCorMgmtEpSet
);
free
(
pObj
);
TDMFREE
(
pObj
);
return
NULL
;
return
NULL
;
}
}
...
@@ -868,7 +868,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
...
@@ -868,7 +868,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
int32_t
sqlLen
=
(
int32_t
)
strlen
(
sql
);
int32_t
sqlLen
=
(
int32_t
)
strlen
(
sql
);
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
tscError
(
"%p sql too long"
,
pSql
);
tscError
(
"%p sql too long"
,
pSql
);
tfree
(
pSql
);
TDMFREE
(
pSql
);
return
TSDB_CODE_TSC_EXCEED_SQL_LIMIT
;
return
TSDB_CODE_TSC_EXCEED_SQL_LIMIT
;
}
}
...
@@ -876,7 +876,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
...
@@ -876,7 +876,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
if
(
pSql
->
sqlstr
==
NULL
)
{
if
(
pSql
->
sqlstr
==
NULL
)
{
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
tscDebug
(
"%p Valid SQL result:%d, %s pObj:%p"
,
pSql
,
pRes
->
code
,
taos_errstr
(
pSql
),
pObj
);
tscDebug
(
"%p Valid SQL result:%d, %s pObj:%p"
,
pSql
,
pRes
->
code
,
taos_errstr
(
pSql
),
pObj
);
tfree
(
pSql
);
TDMFREE
(
pSql
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -1035,7 +1035,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
...
@@ -1035,7 +1035,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
* to free connection, which may cause segment fault, when the parse phrase is not even successfully executed.
* to free connection, which may cause segment fault, when the parse phrase is not even successfully executed.
*/
*/
pRes
->
qhandle
=
0
;
pRes
->
qhandle
=
0
;
free
(
str
);
TDMFREE
(
str
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscFreeSqlObj
(
pSql
);
tscFreeSqlObj
(
pSql
);
...
...
src/client/src/tscStream.c
浏览文件 @
7daaecba
...
@@ -271,10 +271,10 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
...
@@ -271,10 +271,10 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
tscDebug
(
"%p stream:%p, query on:%s, fetch result completed, fetched rows:%"
PRId64
,
pSql
,
pStream
,
pTableMetaInfo
->
name
,
tscDebug
(
"%p stream:%p, query on:%s, fetch result completed, fetched rows:%"
PRId64
,
pSql
,
pStream
,
pTableMetaInfo
->
name
,
pStream
->
numOfRes
);
pStream
->
numOfRes
);
tfree
(
pTableMetaInfo
->
pTableMeta
);
TDMFREE
(
pTableMetaInfo
->
pTableMeta
);
tscFreeSqlResult
(
pSql
);
tscFreeSqlResult
(
pSql
);
tfree
(
pSql
->
pSubs
);
TDMFREE
(
pSql
->
pSubs
);
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
pTableMetaInfo
->
vgroupList
=
tscVgroupInfoClear
(
pTableMetaInfo
->
vgroupList
);
pTableMetaInfo
->
vgroupList
=
tscVgroupInfoClear
(
pTableMetaInfo
->
vgroupList
);
tscSetNextLaunchTimer
(
pStream
,
pSql
);
tscSetNextLaunchTimer
(
pStream
,
pSql
);
...
@@ -592,7 +592,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
...
@@ -592,7 +592,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
}
else
if
(
code
!=
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
}
else
if
(
code
!=
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
tscError
(
"%p open stream failed, sql:%s, code:%s"
,
pSql
,
sqlstr
,
tstrerror
(
pRes
->
code
));
tscError
(
"%p open stream failed, sql:%s, code:%s"
,
pSql
,
sqlstr
,
tstrerror
(
pRes
->
code
));
tscFreeSqlObj
(
pSql
);
tscFreeSqlObj
(
pSql
);
free
(
pStream
);
TDMFREE
(
pStream
);
return
NULL
;
return
NULL
;
}
}
...
@@ -622,6 +622,6 @@ void taos_close_stream(TAOS_STREAM *handle) {
...
@@ -622,6 +622,6 @@ void taos_close_stream(TAOS_STREAM *handle) {
pStream
->
pSql
=
NULL
;
pStream
->
pSql
=
NULL
;
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
tfree
(
pStream
);
TDMFREE
(
pStream
);
}
}
}
}
src/client/src/tscSub.c
浏览文件 @
7daaecba
...
@@ -194,7 +194,7 @@ fail:
...
@@ -194,7 +194,7 @@ fail:
if
(
pSub
!=
NULL
)
{
if
(
pSub
!=
NULL
)
{
taosArrayDestroy
(
pSub
->
progress
);
taosArrayDestroy
(
pSub
->
progress
);
tsem_destroy
(
&
pSub
->
sem
);
tsem_destroy
(
&
pSub
->
sem
);
free
(
pSub
);
TDMFREE
(
pSub
);
pSub
=
NULL
;
pSub
=
NULL
;
}
}
...
@@ -598,5 +598,5 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
...
@@ -598,5 +598,5 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
taosArrayDestroy
(
pSub
->
progress
);
taosArrayDestroy
(
pSub
->
progress
);
tsem_destroy
(
&
pSub
->
sem
);
tsem_destroy
(
&
pSub
->
sem
);
memset
(
pSub
,
0
,
sizeof
(
*
pSub
));
memset
(
pSub
,
0
,
sizeof
(
*
pSub
));
free
(
pSub
);
TDMFREE
(
pSub
);
}
}
src/client/src/tscSubquery.c
浏览文件 @
7daaecba
...
@@ -255,9 +255,9 @@ static void tscDestroyJoinSupporter(SJoinSupporter* pSupporter) {
...
@@ -255,9 +255,9 @@ static void tscDestroyJoinSupporter(SJoinSupporter* pSupporter) {
pSupporter
->
pVgroupTables
=
NULL
;
pSupporter
->
pVgroupTables
=
NULL
;
}
}
tfree
(
pSupporter
->
pIdTagList
);
TDMFREE
(
pSupporter
->
pIdTagList
);
tscTagCondRelease
(
&
pSupporter
->
tagCond
);
tscTagCondRelease
(
&
pSupporter
->
tagCond
);
free
(
pSupporter
);
TDMFREE
(
pSupporter
);
}
}
/*
/*
...
@@ -308,7 +308,7 @@ static void filterVgroupTables(SQueryInfo* pQueryInfo, SArray* pVgroupTables) {
...
@@ -308,7 +308,7 @@ static void filterVgroupTables(SQueryInfo* pQueryInfo, SArray* pVgroupTables) {
assert
(
taosArrayGetSize
(
pVgroupTables
)
>
0
);
assert
(
taosArrayGetSize
(
pVgroupTables
)
>
0
);
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_MULTITABLE_QUERY
);
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_MULTITABLE_QUERY
);
tfree
(
list
);
TDMFREE
(
list
);
}
}
static
SArray
*
buildVgroupTableByResult
(
SQueryInfo
*
pQueryInfo
,
SArray
*
pVgroupTables
)
{
static
SArray
*
buildVgroupTableByResult
(
SQueryInfo
*
pQueryInfo
,
SArray
*
pVgroupTables
)
{
...
@@ -335,7 +335,7 @@ static SArray* buildVgroupTableByResult(SQueryInfo* pQueryInfo, SArray* pVgroupT
...
@@ -335,7 +335,7 @@ static SArray* buildVgroupTableByResult(SQueryInfo* pQueryInfo, SArray* pVgroupT
taosArrayPush
(
pNew
,
&
info
);
taosArrayPush
(
pNew
,
&
info
);
}
}
tfree
(
list
);
TDMFREE
(
list
);
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_MULTITABLE_QUERY
);
TSDB_QUERY_SET_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_MULTITABLE_QUERY
);
return
pNew
;
return
pNew
;
...
@@ -1624,8 +1624,8 @@ static void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs) {
...
@@ -1624,8 +1624,8 @@ static void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs) {
SRetrieveSupport
*
pSupport
=
pSub
->
param
;
SRetrieveSupport
*
pSupport
=
pSub
->
param
;
tfree
(
pSupport
->
localBuffer
);
TDMFREE
(
pSupport
->
localBuffer
);
tfree
(
pSupport
);
TDMFREE
(
pSupport
);
taos_free_result
(
pSub
);
taos_free_result
(
pSub
);
}
}
...
@@ -1667,7 +1667,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
...
@@ -1667,7 +1667,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscAsyncResultOnError
(
pSql
);
tscAsyncResultOnError
(
pSql
);
tfree
(
pMemoryBuf
);
TDMFREE
(
pMemoryBuf
);
return
ret
;
return
ret
;
}
}
...
@@ -1676,7 +1676,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
...
@@ -1676,7 +1676,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
tscDebug
(
"%p retrieved query data from %d vnode(s)"
,
pSql
,
pState
->
numOfSub
);
tscDebug
(
"%p retrieved query data from %d vnode(s)"
,
pSql
,
pState
->
numOfSub
);
if
(
pSql
->
pSubs
==
NULL
)
{
if
(
pSql
->
pSubs
==
NULL
)
{
tfree
(
pSql
->
pSubs
);
TDMFREE
(
pSql
->
pSubs
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
tscLocalReducerEnvDestroy
(
pMemoryBuf
,
pDesc
,
pModel
,
pFinalModel
,
pState
->
numOfSub
);
tscLocalReducerEnvDestroy
(
pMemoryBuf
,
pDesc
,
pModel
,
pFinalModel
,
pState
->
numOfSub
);
...
@@ -1701,7 +1701,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
...
@@ -1701,7 +1701,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
trs
->
localBuffer
=
(
tFilePage
*
)
calloc
(
1
,
nBufferSize
+
sizeof
(
tFilePage
));
trs
->
localBuffer
=
(
tFilePage
*
)
calloc
(
1
,
nBufferSize
+
sizeof
(
tFilePage
));
if
(
trs
->
localBuffer
==
NULL
)
{
if
(
trs
->
localBuffer
==
NULL
)
{
tscError
(
"%p failed to malloc buffer for local buffer, orderOfSub:%d, reason:%s"
,
pSql
,
i
,
strerror
(
errno
));
tscError
(
"%p failed to malloc buffer for local buffer, orderOfSub:%d, reason:%s"
,
pSql
,
i
,
strerror
(
errno
));
tfree
(
trs
);
TDMFREE
(
trs
);
break
;
break
;
}
}
...
@@ -1713,8 +1713,8 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
...
@@ -1713,8 +1713,8 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
SSqlObj
*
pNew
=
tscCreateSTableSubquery
(
pSql
,
trs
,
NULL
);
SSqlObj
*
pNew
=
tscCreateSTableSubquery
(
pSql
,
trs
,
NULL
);
if
(
pNew
==
NULL
)
{
if
(
pNew
==
NULL
)
{
tscError
(
"%p failed to malloc buffer for subObj, orderOfSub:%d, reason:%s"
,
pSql
,
i
,
strerror
(
errno
));
tscError
(
"%p failed to malloc buffer for subObj, orderOfSub:%d, reason:%s"
,
pSql
,
i
,
strerror
(
errno
));
tfree
(
trs
->
localBuffer
);
TDMFREE
(
trs
->
localBuffer
);
tfree
(
trs
);
TDMFREE
(
trs
);
break
;
break
;
}
}
...
@@ -1764,8 +1764,8 @@ static void tscFreeRetrieveSup(SSqlObj *pSql) {
...
@@ -1764,8 +1764,8 @@ static void tscFreeRetrieveSup(SSqlObj *pSql) {
}
}
tscDebug
(
"%p start to free subquery supp obj:%p"
,
pSql
,
trsupport
);
tscDebug
(
"%p start to free subquery supp obj:%p"
,
pSql
,
trsupport
);
tfree
(
trsupport
->
localBuffer
);
TDMFREE
(
trsupport
->
localBuffer
);
tfree
(
trsupport
);
TDMFREE
(
trsupport
);
}
}
static
void
tscRetrieveFromDnodeCallBack
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
static
void
tscRetrieveFromDnodeCallBack
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
...
@@ -2177,7 +2177,7 @@ static void doFreeInsertSupporter(SSqlObj* pSqlObj) {
...
@@ -2177,7 +2177,7 @@ static void doFreeInsertSupporter(SSqlObj* pSqlObj) {
for
(
int32_t
i
=
0
;
i
<
pSqlObj
->
subState
.
numOfSub
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pSqlObj
->
subState
.
numOfSub
;
++
i
)
{
SSqlObj
*
pSql
=
pSqlObj
->
pSubs
[
i
];
SSqlObj
*
pSql
=
pSqlObj
->
pSubs
[
i
];
tfree
(
pSql
->
param
);
TDMFREE
(
pSql
->
param
);
}
}
}
}
...
@@ -2561,7 +2561,7 @@ TAOS_ROW doSetResultRowData(SSqlObj *pSql) {
...
@@ -2561,7 +2561,7 @@ TAOS_ROW doSetResultRowData(SSqlObj *pSql) {
assert
(
pRes
->
row
>=
0
&&
pRes
->
row
<=
pRes
->
numOfRows
);
assert
(
pRes
->
row
>=
0
&&
pRes
->
row
<=
pRes
->
numOfRows
);
if
(
pRes
->
row
>=
pRes
->
numOfRows
)
{
// all the results has returned to invoker
if
(
pRes
->
row
>=
pRes
->
numOfRows
)
{
// all the results has returned to invoker
tfree
(
pRes
->
tsrow
);
TDMFREE
(
pRes
->
tsrow
);
return
pRes
->
tsrow
;
return
pRes
->
tsrow
;
}
}
...
...
src/client/src/tscSystem.c
浏览文件 @
7daaecba
...
@@ -275,7 +275,7 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
...
@@ -275,7 +275,7 @@ static int taos_options_imp(TSDB_OPTION option, const char *pStr) {
tscInfo
(
"charset:%s is not valid in locale, charset remains:%s"
,
charset
,
tsCharset
);
tscInfo
(
"charset:%s is not valid in locale, charset remains:%s"
,
charset
,
tsCharset
);
}
}
free
(
charset
);
TDMFREE
(
charset
);
}
else
{
// it may be windows system
}
else
{
// it may be windows system
tscInfo
(
"charset remains:%s"
,
tsCharset
);
tscInfo
(
"charset remains:%s"
,
tsCharset
);
}
}
...
...
src/client/src/tscUtil.c
浏览文件 @
7daaecba
...
@@ -257,7 +257,7 @@ void tscClearInterpInfo(SQueryInfo* pQueryInfo) {
...
@@ -257,7 +257,7 @@ void tscClearInterpInfo(SQueryInfo* pQueryInfo) {
}
}
pQueryInfo
->
fillType
=
TSDB_FILL_NONE
;
pQueryInfo
->
fillType
=
TSDB_FILL_NONE
;
tfree
(
pQueryInfo
->
fillVal
);
TDMFREE
(
pQueryInfo
->
fillVal
);
}
}
int32_t
tscCreateResPointerInfo
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
)
{
int32_t
tscCreateResPointerInfo
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
)
{
...
@@ -271,10 +271,10 @@ int32_t tscCreateResPointerInfo(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
...
@@ -271,10 +271,10 @@ int32_t tscCreateResPointerInfo(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
// not enough memory
// not enough memory
if
(
pRes
->
tsrow
==
NULL
||
pRes
->
urow
==
NULL
||
pRes
->
length
==
NULL
||
(
pRes
->
buffer
==
NULL
&&
pRes
->
numOfCols
>
0
))
{
if
(
pRes
->
tsrow
==
NULL
||
pRes
->
urow
==
NULL
||
pRes
->
length
==
NULL
||
(
pRes
->
buffer
==
NULL
&&
pRes
->
numOfCols
>
0
))
{
tfree
(
pRes
->
tsrow
);
TDMFREE
(
pRes
->
tsrow
);
tfree
(
pRes
->
urow
);
TDMFREE
(
pRes
->
urow
);
tfree
(
pRes
->
length
);
TDMFREE
(
pRes
->
length
);
tfree
(
pRes
->
buffer
);
TDMFREE
(
pRes
->
buffer
);
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
pRes
->
code
;
return
pRes
->
code
;
...
@@ -354,25 +354,25 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
...
@@ -354,25 +354,25 @@ void tscSetResRawPtr(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
static
void
tscDestroyResPointerInfo
(
SSqlRes
*
pRes
)
{
static
void
tscDestroyResPointerInfo
(
SSqlRes
*
pRes
)
{
if
(
pRes
->
buffer
!=
NULL
)
{
// free all buffers containing the multibyte string
if
(
pRes
->
buffer
!=
NULL
)
{
// free all buffers containing the multibyte string
for
(
int
i
=
0
;
i
<
pRes
->
numOfCols
;
i
++
)
{
for
(
int
i
=
0
;
i
<
pRes
->
numOfCols
;
i
++
)
{
tfree
(
pRes
->
buffer
[
i
]);
TDMFREE
(
pRes
->
buffer
[
i
]);
}
}
pRes
->
numOfCols
=
0
;
pRes
->
numOfCols
=
0
;
}
}
tfree
(
pRes
->
pRsp
);
TDMFREE
(
pRes
->
pRsp
);
tfree
(
pRes
->
tsrow
);
TDMFREE
(
pRes
->
tsrow
);
tfree
(
pRes
->
length
);
TDMFREE
(
pRes
->
length
);
tfree
(
pRes
->
buffer
);
TDMFREE
(
pRes
->
buffer
);
tfree
(
pRes
->
urow
);
TDMFREE
(
pRes
->
urow
);
tfree
(
pRes
->
pGroupRec
);
TDMFREE
(
pRes
->
pGroupRec
);
tfree
(
pRes
->
pColumnIndex
);
TDMFREE
(
pRes
->
pColumnIndex
);
if
(
pRes
->
pArithSup
!=
NULL
)
{
if
(
pRes
->
pArithSup
!=
NULL
)
{
tfree
(
pRes
->
pArithSup
->
data
);
TDMFREE
(
pRes
->
pArithSup
->
data
);
tfree
(
pRes
->
pArithSup
);
TDMFREE
(
pRes
->
pArithSup
);
}
}
pRes
->
data
=
NULL
;
// pRes->data points to the buffer of pRsp, no need to free
pRes
->
data
=
NULL
;
// pRes->data points to the buffer of pRsp, no need to free
...
@@ -388,11 +388,11 @@ void tscFreeQueryInfo(SSqlCmd* pCmd) {
...
@@ -388,11 +388,11 @@ void tscFreeQueryInfo(SSqlCmd* pCmd) {
freeQueryInfoImpl
(
pQueryInfo
);
freeQueryInfoImpl
(
pQueryInfo
);
clearAllTableMetaInfo
(
pQueryInfo
);
clearAllTableMetaInfo
(
pQueryInfo
);
tfree
(
pQueryInfo
);
TDMFREE
(
pQueryInfo
);
}
}
pCmd
->
numOfClause
=
0
;
pCmd
->
numOfClause
=
0
;
tfree
(
pCmd
->
pQueryInfo
);
TDMFREE
(
pCmd
->
pQueryInfo
);
}
}
void
tscResetSqlCmdObj
(
SSqlCmd
*
pCmd
)
{
void
tscResetSqlCmdObj
(
SSqlCmd
*
pCmd
)
{
...
@@ -406,12 +406,12 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd) {
...
@@ -406,12 +406,12 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd) {
for
(
int32_t
i
=
0
;
i
<
pCmd
->
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pCmd
->
numOfTables
;
++
i
)
{
if
(
pCmd
->
pTableNameList
&&
pCmd
->
pTableNameList
[
i
])
{
if
(
pCmd
->
pTableNameList
&&
pCmd
->
pTableNameList
[
i
])
{
tfree
(
pCmd
->
pTableNameList
[
i
]);
TDMFREE
(
pCmd
->
pTableNameList
[
i
]);
}
}
}
}
pCmd
->
numOfTables
=
0
;
pCmd
->
numOfTables
=
0
;
tfree
(
pCmd
->
pTableNameList
);
TDMFREE
(
pCmd
->
pTableNameList
);
pCmd
->
pTableBlockHashList
=
tscDestroyBlockHashTable
(
pCmd
->
pTableBlockHashList
);
pCmd
->
pTableBlockHashList
=
tscDestroyBlockHashTable
(
pCmd
->
pTableBlockHashList
);
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
...
@@ -486,24 +486,24 @@ void tscFreeSqlObj(SSqlObj* pSql) {
...
@@ -486,24 +486,24 @@ void tscFreeSqlObj(SSqlObj* pSql) {
pSql
->
signature
=
NULL
;
pSql
->
signature
=
NULL
;
pSql
->
fp
=
NULL
;
pSql
->
fp
=
NULL
;
tfree
(
pSql
->
sqlstr
);
TDMFREE
(
pSql
->
sqlstr
);
tfree
(
pSql
->
pSubs
);
TDMFREE
(
pSql
->
pSubs
);
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
self
=
0
;
pSql
->
self
=
0
;
tscFreeSqlResult
(
pSql
);
tscFreeSqlResult
(
pSql
);
tscResetSqlCmdObj
(
pCmd
);
tscResetSqlCmdObj
(
pCmd
);
tfree
(
pCmd
->
tagData
.
data
);
TDMFREE
(
pCmd
->
tagData
.
data
);
pCmd
->
tagData
.
dataLen
=
0
;
pCmd
->
tagData
.
dataLen
=
0
;
memset
(
pCmd
->
payload
,
0
,
(
size_t
)
pCmd
->
allocSize
);
memset
(
pCmd
->
payload
,
0
,
(
size_t
)
pCmd
->
allocSize
);
tfree
(
pCmd
->
payload
);
TDMFREE
(
pCmd
->
payload
);
pCmd
->
allocSize
=
0
;
pCmd
->
allocSize
=
0
;
tsem_destroy
(
&
pSql
->
rspSem
);
tsem_destroy
(
&
pSql
->
rspSem
);
free
(
pSql
);
TDMFREE
(
pSql
);
}
}
void
tscDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
)
{
void
tscDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
)
{
...
@@ -511,15 +511,15 @@ void tscDestroyDataBlock(STableDataBlocks* pDataBlock) {
...
@@ -511,15 +511,15 @@ void tscDestroyDataBlock(STableDataBlocks* pDataBlock) {
return
;
return
;
}
}
tfree
(
pDataBlock
->
pData
);
TDMFREE
(
pDataBlock
->
pData
);
tfree
(
pDataBlock
->
params
);
TDMFREE
(
pDataBlock
->
params
);
// free the refcount for metermeta
// free the refcount for metermeta
if
(
pDataBlock
->
pTableMeta
!=
NULL
)
{
if
(
pDataBlock
->
pTableMeta
!=
NULL
)
{
tfree
(
pDataBlock
->
pTableMeta
);
TDMFREE
(
pDataBlock
->
pTableMeta
);
}
}
tfree
(
pDataBlock
);
TDMFREE
(
pDataBlock
);
}
}
SParamInfo
*
tscAddParamToDataBlock
(
STableDataBlocks
*
pDataBlock
,
char
type
,
uint8_t
timePrec
,
int16_t
bytes
,
SParamInfo
*
tscAddParamToDataBlock
(
STableDataBlocks
*
pDataBlock
,
char
type
,
uint8_t
timePrec
,
int16_t
bytes
,
...
@@ -590,7 +590,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
...
@@ -590,7 +590,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
tstrncpy
(
pTableMetaInfo
->
name
,
pDataBlock
->
tableName
,
sizeof
(
pTableMetaInfo
->
name
));
tstrncpy
(
pTableMetaInfo
->
name
,
pDataBlock
->
tableName
,
sizeof
(
pTableMetaInfo
->
name
));
if
(
pTableMetaInfo
->
pTableMeta
!=
NULL
)
{
if
(
pTableMetaInfo
->
pTableMeta
!=
NULL
)
{
tfree
(
pTableMetaInfo
->
pTableMeta
);
TDMFREE
(
pTableMetaInfo
->
pTableMeta
);
}
}
pTableMetaInfo
->
pTableMeta
=
tscTableMetaClone
(
pDataBlock
->
pTableMeta
);
pTableMetaInfo
->
pTableMeta
=
tscTableMetaClone
(
pDataBlock
->
pTableMeta
);
...
@@ -647,7 +647,7 @@ int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOff
...
@@ -647,7 +647,7 @@ int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOff
dataBuf
->
pData
=
calloc
(
1
,
dataBuf
->
nAllocSize
);
dataBuf
->
pData
=
calloc
(
1
,
dataBuf
->
nAllocSize
);
if
(
dataBuf
->
pData
==
NULL
)
{
if
(
dataBuf
->
pData
==
NULL
)
{
tscError
(
"failed to allocated memory, reason:%s"
,
strerror
(
errno
));
tscError
(
"failed to allocated memory, reason:%s"
,
strerror
(
errno
));
tfree
(
dataBuf
);
TDMFREE
(
dataBuf
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -823,7 +823,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
...
@@ -823,7 +823,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
taosHashCleanup
(
pVnodeDataBlockHashList
);
taosHashCleanup
(
pVnodeDataBlockHashList
);
tscDestroyBlockArrayList
(
pVnodeDataBlockList
);
tscDestroyBlockArrayList
(
pVnodeDataBlockList
);
tfree
(
dataBuf
->
pData
);
TDMFREE
(
dataBuf
->
pData
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
...
@@ -884,11 +884,11 @@ void tscCloseTscObj(void *param) {
...
@@ -884,11 +884,11 @@ void tscCloseTscObj(void *param) {
pObj
->
pDnodeConn
=
NULL
;
pObj
->
pDnodeConn
=
NULL
;
}
}
tfree
(
pObj
->
tscCorMgmtEpSet
);
TDMFREE
(
pObj
->
tscCorMgmtEpSet
);
pthread_mutex_destroy
(
&
pObj
->
mutex
);
pthread_mutex_destroy
(
&
pObj
->
mutex
);
tscDebug
(
"%p DB connection is closed, dnodeConn:%p"
,
pObj
,
p
);
tscDebug
(
"%p DB connection is closed, dnodeConn:%p"
,
pObj
,
p
);
tfree
(
pObj
);
TDMFREE
(
pObj
);
}
}
bool
tscIsInsertData
(
char
*
sqlstr
)
{
bool
tscIsInsertData
(
char
*
sqlstr
)
{
...
@@ -1039,16 +1039,16 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) {
...
@@ -1039,16 +1039,16 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) {
SSqlFuncMsg
*
pFuncMsg
=
&
pInfo
->
pArithExprInfo
->
base
;
SSqlFuncMsg
*
pFuncMsg
=
&
pInfo
->
pArithExprInfo
->
base
;
for
(
int32_t
j
=
0
;
j
<
pFuncMsg
->
numOfParams
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pFuncMsg
->
numOfParams
;
++
j
)
{
if
(
pFuncMsg
->
arg
[
j
].
argType
==
TSDB_DATA_TYPE_BINARY
)
{
if
(
pFuncMsg
->
arg
[
j
].
argType
==
TSDB_DATA_TYPE_BINARY
)
{
tfree
(
pFuncMsg
->
arg
[
j
].
argValue
.
pz
);
TDMFREE
(
pFuncMsg
->
arg
[
j
].
argValue
.
pz
);
}
}
}
}
tfree
(
pInfo
->
pArithExprInfo
);
TDMFREE
(
pInfo
->
pArithExprInfo
);
}
}
}
}
taosArrayDestroy
(
pFieldInfo
->
internalField
);
taosArrayDestroy
(
pFieldInfo
->
internalField
);
tfree
(
pFieldInfo
->
final
);
TDMFREE
(
pFieldInfo
->
final
);
memset
(
pFieldInfo
,
0
,
sizeof
(
SFieldInfo
));
memset
(
pFieldInfo
,
0
,
sizeof
(
SFieldInfo
));
}
}
...
@@ -1163,7 +1163,7 @@ void* sqlExprDestroy(SSqlExpr* pExpr) {
...
@@ -1163,7 +1163,7 @@ void* sqlExprDestroy(SSqlExpr* pExpr) {
tVariantDestroy
(
&
pExpr
->
param
[
i
]);
tVariantDestroy
(
&
pExpr
->
param
[
i
]);
}
}
tfree
(
pExpr
);
TDMFREE
(
pExpr
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1263,11 +1263,11 @@ SColumn* tscColumnListInsert(SArray* pColumnList, SColumnIndex* pColIndex) {
...
@@ -1263,11 +1263,11 @@ SColumn* tscColumnListInsert(SArray* pColumnList, SColumnIndex* pColIndex) {
static
void
destroyFilterInfo
(
SColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilters
)
{
static
void
destroyFilterInfo
(
SColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilters
)
{
for
(
int32_t
i
=
0
;
i
<
numOfFilters
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfFilters
;
++
i
)
{
if
(
pFilterInfo
[
i
].
filterstr
)
{
if
(
pFilterInfo
[
i
].
filterstr
)
{
tfree
(
pFilterInfo
[
i
].
pz
);
TDMFREE
(
pFilterInfo
[
i
].
pz
);
}
}
}
}
tfree
(
pFilterInfo
);
TDMFREE
(
pFilterInfo
);
}
}
SColumn
*
tscColumnClone
(
const
SColumn
*
src
)
{
SColumn
*
tscColumnClone
(
const
SColumn
*
src
)
{
...
@@ -1287,7 +1287,7 @@ SColumn* tscColumnClone(const SColumn* src) {
...
@@ -1287,7 +1287,7 @@ SColumn* tscColumnClone(const SColumn* src) {
static
void
tscColumnDestroy
(
SColumn
*
pCol
)
{
static
void
tscColumnDestroy
(
SColumn
*
pCol
)
{
destroyFilterInfo
(
pCol
->
filterInfo
,
pCol
->
numOfFilters
);
destroyFilterInfo
(
pCol
->
filterInfo
,
pCol
->
numOfFilters
);
free
(
pCol
);
TDMFREE
(
pCol
);
}
}
void
tscColumnListCopy
(
SArray
*
dst
,
const
SArray
*
src
,
int16_t
tableIndex
)
{
void
tscColumnListCopy
(
SArray
*
dst
,
const
SArray
*
src
,
int16_t
tableIndex
)
{
...
@@ -1548,13 +1548,13 @@ int32_t tscTagCondCopy(STagCond* dest, const STagCond* src) {
...
@@ -1548,13 +1548,13 @@ int32_t tscTagCondCopy(STagCond* dest, const STagCond* src) {
}
}
void
tscTagCondRelease
(
STagCond
*
pTagCond
)
{
void
tscTagCondRelease
(
STagCond
*
pTagCond
)
{
free
(
pTagCond
->
tbnameCond
.
cond
);
TDMFREE
(
pTagCond
->
tbnameCond
.
cond
);
if
(
pTagCond
->
pCond
!=
NULL
)
{
if
(
pTagCond
->
pCond
!=
NULL
)
{
size_t
s
=
taosArrayGetSize
(
pTagCond
->
pCond
);
size_t
s
=
taosArrayGetSize
(
pTagCond
->
pCond
);
for
(
int32_t
i
=
0
;
i
<
s
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
s
;
++
i
)
{
SCond
*
p
=
taosArrayGet
(
pTagCond
->
pCond
,
i
);
SCond
*
p
=
taosArrayGet
(
pTagCond
->
pCond
,
i
);
tfree
(
p
->
cond
);
TDMFREE
(
p
->
cond
);
}
}
taosArrayDestroy
(
pTagCond
->
pCond
);
taosArrayDestroy
(
pTagCond
->
pCond
);
...
@@ -1734,7 +1734,7 @@ static void freeQueryInfoImpl(SQueryInfo* pQueryInfo) {
...
@@ -1734,7 +1734,7 @@ static void freeQueryInfoImpl(SQueryInfo* pQueryInfo) {
pQueryInfo
->
tsBuf
=
tsBufDestroy
(
pQueryInfo
->
tsBuf
);
pQueryInfo
->
tsBuf
=
tsBufDestroy
(
pQueryInfo
->
tsBuf
);
tfree
(
pQueryInfo
->
fillVal
);
TDMFREE
(
pQueryInfo
->
fillVal
);
}
}
void
tscClearSubqueryInfo
(
SSqlCmd
*
pCmd
)
{
void
tscClearSubqueryInfo
(
SSqlCmd
*
pCmd
)
{
...
@@ -1754,7 +1754,7 @@ void tscFreeVgroupTableInfo(SArray* pVgroupTables) {
...
@@ -1754,7 +1754,7 @@ void tscFreeVgroupTableInfo(SArray* pVgroupTables) {
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTables
,
i
);
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTables
,
i
);
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgInfo
.
numOfEps
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgInfo
.
numOfEps
;
++
j
)
{
tfree
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
TDMFREE
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
}
}
taosArrayDestroy
(
pInfo
->
itemList
);
taosArrayDestroy
(
pInfo
->
itemList
);
...
@@ -1771,7 +1771,7 @@ void tscRemoveVgroupTableGroup(SArray* pVgroupTable, int32_t index) {
...
@@ -1771,7 +1771,7 @@ void tscRemoveVgroupTableGroup(SArray* pVgroupTable, int32_t index) {
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTable
,
index
);
SVgroupTableInfo
*
pInfo
=
taosArrayGet
(
pVgroupTable
,
index
);
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgInfo
.
numOfEps
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pInfo
->
vgInfo
.
numOfEps
;
++
j
)
{
tfree
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
TDMFREE
(
pInfo
->
vgInfo
.
epAddr
[
j
].
fqdn
);
}
}
taosArrayDestroy
(
pInfo
->
itemList
);
taosArrayDestroy
(
pInfo
->
itemList
);
...
@@ -1814,10 +1814,10 @@ void clearAllTableMetaInfo(SQueryInfo* pQueryInfo) {
...
@@ -1814,10 +1814,10 @@ void clearAllTableMetaInfo(SQueryInfo* pQueryInfo) {
tscFreeVgroupTableInfo
(
pTableMetaInfo
->
pVgroupTables
);
tscFreeVgroupTableInfo
(
pTableMetaInfo
->
pVgroupTables
);
tscClearTableMetaInfo
(
pTableMetaInfo
);
tscClearTableMetaInfo
(
pTableMetaInfo
);
free
(
pTableMetaInfo
);
TDMFREE
(
pTableMetaInfo
);
}
}
tfree
(
pQueryInfo
->
pTableMetaInfo
);
TDMFREE
(
pQueryInfo
->
pTableMetaInfo
);
}
}
STableMetaInfo
*
tscAddTableMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
STableMeta
*
pTableMeta
,
STableMetaInfo
*
tscAddTableMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
STableMeta
*
pTableMeta
,
...
@@ -1872,7 +1872,7 @@ void tscClearTableMetaInfo(STableMetaInfo* pTableMetaInfo) {
...
@@ -1872,7 +1872,7 @@ void tscClearTableMetaInfo(STableMetaInfo* pTableMetaInfo) {
return
;
return
;
}
}
tfree
(
pTableMetaInfo
->
pTableMeta
);
TDMFREE
(
pTableMetaInfo
->
pTableMeta
);
pTableMetaInfo
->
vgroupList
=
tscVgroupInfoClear
(
pTableMetaInfo
->
vgroupList
);
pTableMetaInfo
->
vgroupList
=
tscVgroupInfoClear
(
pTableMetaInfo
->
vgroupList
);
tscColumnListDestroy
(
pTableMetaInfo
->
tagColList
);
tscColumnListDestroy
(
pTableMetaInfo
->
tagColList
);
...
@@ -1915,7 +1915,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm
...
@@ -1915,7 +1915,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm
int32_t
code
=
copyTagData
(
&
pNew
->
cmd
.
tagData
,
&
pSql
->
cmd
.
tagData
);
int32_t
code
=
copyTagData
(
&
pNew
->
cmd
.
tagData
,
&
pSql
->
cmd
.
tagData
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"%p new subquery failed, unable to malloc tag data, tableIndex:%d"
,
pSql
,
0
);
tscError
(
"%p new subquery failed, unable to malloc tag data, tableIndex:%d"
,
pSql
,
0
);
free
(
pNew
);
TDMFREE
(
pNew
);
return
NULL
;
return
NULL
;
}
}
...
@@ -2411,7 +2411,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2411,7 +2411,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) {
pRes
->
numOfTotal
=
num
;
pRes
->
numOfTotal
=
num
;
tfree
(
pSql
->
pSubs
);
TDMFREE
(
pSql
->
pSubs
);
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
subState
.
numOfSub
=
0
;
pSql
->
fp
=
fp
;
pSql
->
fp
=
fp
;
...
@@ -2536,7 +2536,7 @@ void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) {
...
@@ -2536,7 +2536,7 @@ void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) {
SVgroupInfo
*
pVgroupInfo
=
&
vgroupList
->
vgroups
[
i
];
SVgroupInfo
*
pVgroupInfo
=
&
vgroupList
->
vgroups
[
i
];
for
(
int32_t
j
=
0
;
j
<
pVgroupInfo
->
numOfEps
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pVgroupInfo
->
numOfEps
;
++
j
)
{
tfree
(
pVgroupInfo
->
epAddr
[
j
].
fqdn
);
TDMFREE
(
pVgroupInfo
->
epAddr
[
j
].
fqdn
);
}
}
for
(
int32_t
j
=
pVgroupInfo
->
numOfEps
;
j
<
TSDB_MAX_REPLICA
;
j
++
)
{
for
(
int32_t
j
=
pVgroupInfo
->
numOfEps
;
j
<
TSDB_MAX_REPLICA
;
j
++
)
{
...
@@ -2544,7 +2544,7 @@ void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) {
...
@@ -2544,7 +2544,7 @@ void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) {
}
}
}
}
tfree
(
vgroupList
);
TDMFREE
(
vgroupList
);
return
NULL
;
return
NULL
;
}
}
...
@@ -2552,7 +2552,7 @@ void tscSVgroupInfoCopy(SVgroupInfo* dst, const SVgroupInfo* src) {
...
@@ -2552,7 +2552,7 @@ void tscSVgroupInfoCopy(SVgroupInfo* dst, const SVgroupInfo* src) {
dst
->
vgId
=
src
->
vgId
;
dst
->
vgId
=
src
->
vgId
;
dst
->
numOfEps
=
src
->
numOfEps
;
dst
->
numOfEps
=
src
->
numOfEps
;
for
(
int32_t
i
=
0
;
i
<
dst
->
numOfEps
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
dst
->
numOfEps
;
++
i
)
{
tfree
(
dst
->
epAddr
[
i
].
fqdn
);
TDMFREE
(
dst
->
epAddr
[
i
].
fqdn
);
dst
->
epAddr
[
i
].
port
=
src
->
epAddr
[
i
].
port
;
dst
->
epAddr
[
i
].
port
=
src
->
epAddr
[
i
].
port
;
assert
(
dst
->
epAddr
[
i
].
fqdn
==
NULL
);
assert
(
dst
->
epAddr
[
i
].
fqdn
==
NULL
);
...
@@ -2653,12 +2653,12 @@ int32_t tscCreateTableMetaFromCChildMeta(STableMeta* pChild, const char* name) {
...
@@ -2653,12 +2653,12 @@ int32_t tscCreateTableMetaFromCChildMeta(STableMeta* pChild, const char* name) {
memcpy
(
pChild
->
schema
,
p
->
schema
,
sizeof
(
SSchema
)
*
total
);
memcpy
(
pChild
->
schema
,
p
->
schema
,
sizeof
(
SSchema
)
*
total
);
tfree
(
p
);
TDMFREE
(
p
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
{
// super table has been removed, current tableMeta is also expired. remove it here
}
else
{
// super table has been removed, current tableMeta is also expired. remove it here
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
tfree
(
p
);
TDMFREE
(
p
);
return
-
1
;
return
-
1
;
}
}
}
}
...
...
src/os/inc/osMemory.h
浏览文件 @
7daaecba
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#define TDENGINE_OS_MEMORY_H
#define TDENGINE_OS_MEMORY_H
#include "osString.h"
#include "osString.h"
#include <malloc.h>
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -81,6 +82,28 @@ void taosTMemset(void *ptr, int c);
...
@@ -81,6 +82,28 @@ void taosTMemset(void *ptr, int c);
#endif
#endif
#endif
#endif
#define TDM_MAX_NUM 1000
extern
int32_t
tdm_num
;
extern
long
tdm_ps
;
void
tdmfree
(
void
*
p
);
void
*
tdmrealloc
(
void
*
p
,
int
s
);
void
*
tdmalloc
(
char
*
f
,
unsigned
line
,
int
s
,
int
set
);
void
tdminit
();
#define TDMALLOCED(p) ((*(long *)(((void*)p)-8)==0x1234567887654321L) && (*(long *)(((void *)p)-16)==0x0011223344556677L))
#define TDMSIZE(s) ((s+24)%tdm_ps == 0 ? (s+24)+tdm_ps:((s+24)/tdm_ps+2)*tdm_ps)
#define TDMALLOC(s) tdmalloc(__FILE__, __LINE__, s,0)
#define TDMCALLOC(s) tdmalloc(__FILE__, __LINE__, s,1)
#define TDMREALLOC(p,s) tdmrealloc(p,s)
#define TDMFREE(p) tdmfree((void *)p)
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
src/os/src/detail/osMemory.c
浏览文件 @
7daaecba
...
@@ -516,4 +516,122 @@ void taosTZfree(void *ptr) {
...
@@ -516,4 +516,122 @@ void taosTZfree(void *ptr) {
if
(
ptr
)
{
if
(
ptr
)
{
free
((
void
*
)((
char
*
)
ptr
-
sizeof
(
size_t
)));
free
((
void
*
)((
char
*
)
ptr
-
sizeof
(
size_t
)));
}
}
}
}
\ No newline at end of file
int32_t
tdm_num
=
0
;
long
tdm_ps
;
typedef
struct
{
uint64_t
normalfn
;
uint64_t
tdmfn
;
uint64_t
normalmn
;
uint64_t
tdmmn
;
uint64_t
normalrn
;
uint64_t
tdmrn
;
}
tdmstat
;
tdmstat
tdm_stat
;
void
tdminit
(){
tdm_ps
=
sysconf
(
_SC_PAGE_SIZE
);
srand
(
time
(
NULL
));
memset
(
&
tdm_stat
,
0
,
sizeof
(
tdm_stat
));
}
void
*
tdmrealloc
(
void
*
p
,
int
s
){
if
(
p
&&
TDMALLOCED
(
p
)){
atomic_add_fetch_64
(
&
tdm_stat
.
tdmrn
,
1
);
void
*
lp
=
*
(
void
**
)((
long
)
p
-
24
);
int
os
=
(
long
)
lp
-
(
long
)
p
;
if
(
s
<
os
){
os
=
s
;
}
void
*
nb
=
TDMALLOC
(
s
);
assert
(
nb
);
if
(
nb
){
memcpy
(
nb
,
p
,
os
);
}
tdmfree
(
p
);
return
nb
;
}
else
{
atomic_add_fetch_64
(
&
tdm_stat
.
normalrn
,
1
);
return
realloc
(
p
,
s
);
}
}
void
*
tdmalloc
(
char
*
f
,
unsigned
line
,
int
s
,
int
set
){
void
*
p
;
int
tdmn
=
atomic_load_32
(
&
tdm_num
);
if
(
tdmn
>=
TDM_MAX_NUM
||
rand
()
%
10
!=
0
){
atomic_add_fetch_64
(
&
tdm_stat
.
normalmn
,
1
);
if
(
set
){
p
=
calloc
(
s
,
1
);
}
else
{
p
=
malloc
(
s
);
}
//printf("direct malloc:%p,size:%d\n", p, s);
assert
(
p
);
return
p
;
}
atomic_add_fetch_64
(
&
tdm_stat
.
tdmmn
,
1
);
int
ns
=
TDMSIZE
(
s
);
void
*
buffer
=
memalign
(
tdm_ps
,
ns
);
if
(
buffer
==
NULL
){
assert
(
0
);
}
if
(
set
){
memset
(
buffer
,
0
,
ns
);
}
void
*
lastp
=
buffer
+
ns
-
tdm_ps
;
*
(
long
*
)(
lastp
-
s
-
8
)
=
0x1234567887654321L
;
*
(
long
*
)(
lastp
-
s
-
16
)
=
0x0011223344556677L
;
*
(
void
**
)(
lastp
-
s
-
24
)
=
buffer
+
ns
-
tdm_ps
;
sprintf
(
lastp
,
"%s:%d,len:%d"
,
f
,
line
,
s
);
*
(
char
*
)(
lastp
+
strlen
(
lastp
))
=
0
;
*
(
long
*
)(
lastp
+
strlen
(
lastp
)
+
1
)
=
0x1234567887654321L
;
if
(
mprotect
(
buffer
+
ns
-
tdm_ps
,
tdm_ps
,
PROT_READ
)
==
-
1
){
assert
(
0
);
}
atomic_add_fetch_32
(
&
tdm_num
,
1
);
//printf("os:%d,ns:%d,realb:%p,retb:%p,lpd:%p,tdm_num:%d\n", s, ns, buffer, lastp-s, buffer+ns-tdm_ps, tdm_num);
return
lastp
-
s
;
}
void
tdmfree
(
void
*
p
){
if
(
p
&&
TDMALLOCED
(
p
)){
atomic_add_fetch_64
(
&
tdm_stat
.
tdmfn
,
1
);
void
*
fp
=
(
void
*
)((
0xfffffffffffff000
|
tdm_ps
)
&
((
long
)
p
-
24
));
//printf("tdmfree realb:%p,retb:%p,lpd:%p\n", fp,p, *(void **)((long)p-24));
mprotect
(
*
(
void
**
)((
long
)
p
-
24
),
tdm_ps
,
PROT_WRITE
|
PROT_READ
);
atomic_sub_fetch_32
(
&
tdm_num
,
1
);
memset
((
void
*
)((
long
)
p
-
24
),
0
,
24
);
free
(
fp
);
fp
=
0
;
}
else
{
//printf("direct free %p\n", p);
atomic_add_fetch_64
(
&
tdm_stat
.
normalfn
,
1
);
free
(
p
);
p
=
0
;
}
}
src/query/src/qAggMain.c
浏览文件 @
7daaecba
...
@@ -2044,7 +2044,7 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) {
...
@@ -2044,7 +2044,7 @@ static void copyTopBotRes(SQLFunctionCtx *pCtx, int32_t type) {
}
}
}
}
tfree
(
pData
);
TDMFREE
(
pData
);
}
}
/*
/*
...
@@ -2597,7 +2597,7 @@ static void apercentile_finalizer(SQLFunctionCtx *pCtx) {
...
@@ -2597,7 +2597,7 @@ static void apercentile_finalizer(SQLFunctionCtx *pCtx) {
double
*
res
=
tHistogramUniform
(
pOutput
->
pHisto
,
ratio
,
1
);
double
*
res
=
tHistogramUniform
(
pOutput
->
pHisto
,
ratio
,
1
);
memcpy
(
pCtx
->
aOutputBuf
,
res
,
sizeof
(
double
));
memcpy
(
pCtx
->
aOutputBuf
,
res
,
sizeof
(
double
));
free
(
res
);
TDMFREE
(
res
);
}
else
{
}
else
{
setNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
,
pCtx
->
outputBytes
);
setNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
,
pCtx
->
outputBytes
);
return
;
return
;
...
@@ -2608,7 +2608,7 @@ static void apercentile_finalizer(SQLFunctionCtx *pCtx) {
...
@@ -2608,7 +2608,7 @@ static void apercentile_finalizer(SQLFunctionCtx *pCtx) {
double
*
res
=
tHistogramUniform
(
pOutput
->
pHisto
,
ratio
,
1
);
double
*
res
=
tHistogramUniform
(
pOutput
->
pHisto
,
ratio
,
1
);
memcpy
(
pCtx
->
aOutputBuf
,
res
,
sizeof
(
double
));
memcpy
(
pCtx
->
aOutputBuf
,
res
,
sizeof
(
double
));
free
(
res
);
TDMFREE
(
res
);
}
else
{
// no need to free
}
else
{
// no need to free
setNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
,
pCtx
->
outputBytes
);
setNull
(
pCtx
->
aOutputBuf
,
pCtx
->
outputType
,
pCtx
->
outputBytes
);
return
;
return
;
...
...
src/query/src/qAst.c
浏览文件 @
7daaecba
...
@@ -112,10 +112,10 @@ void tExprNodeDestroy(tExprNode *pNode, void (*fp)(void *)) {
...
@@ -112,10 +112,10 @@ void tExprNodeDestroy(tExprNode *pNode, void (*fp)(void *)) {
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_VALUE
)
{
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_VALUE
)
{
tVariantDestroy
(
pNode
->
pVal
);
tVariantDestroy
(
pNode
->
pVal
);
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_COL
)
{
}
else
if
(
pNode
->
nodeType
==
TSQL_NODE_COL
)
{
free
(
pNode
->
pSchema
);
TDMFREE
(
pNode
->
pSchema
);
}
}
free
(
pNode
);
TDMFREE
(
pNode
);
}
}
void
tExprTreeDestroy
(
tExprNode
**
pExpr
,
void
(
*
fp
)(
void
*
))
{
void
tExprTreeDestroy
(
tExprNode
**
pExpr
,
void
(
*
fp
)(
void
*
))
{
...
@@ -132,12 +132,12 @@ void tExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) {
...
@@ -132,12 +132,12 @@ void tExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) {
}
}
}
else
if
((
*
pExpr
)
->
nodeType
==
TSQL_NODE_VALUE
)
{
}
else
if
((
*
pExpr
)
->
nodeType
==
TSQL_NODE_VALUE
)
{
tVariantDestroy
((
*
pExpr
)
->
pVal
);
tVariantDestroy
((
*
pExpr
)
->
pVal
);
free
((
*
pExpr
)
->
pVal
);
TDMFREE
((
*
pExpr
)
->
pVal
);
}
else
if
((
*
pExpr
)
->
nodeType
==
TSQL_NODE_COL
)
{
}
else
if
((
*
pExpr
)
->
nodeType
==
TSQL_NODE_COL
)
{
free
((
*
pExpr
)
->
pSchema
);
TDMFREE
((
*
pExpr
)
->
pSchema
);
}
}
free
(
*
pExpr
);
TDMFREE
(
*
pExpr
);
*
pExpr
=
NULL
;
*
pExpr
=
NULL
;
}
}
...
@@ -270,8 +270,8 @@ void arithmeticTreeTraverse(tExprNode *pExprs, int32_t numOfRows, char *pOutput,
...
@@ -270,8 +270,8 @@ void arithmeticTreeTraverse(tExprNode *pExprs, int32_t numOfRows, char *pOutput,
}
}
}
}
free
(
pLeftOutput
);
TDMFREE
(
pLeftOutput
);
free
(
pRightOutput
);
TDMFREE
(
pRightOutput
);
}
}
static
void
exprTreeToBinaryImpl
(
SBufferWriter
*
bw
,
tExprNode
*
expr
)
{
static
void
exprTreeToBinaryImpl
(
SBufferWriter
*
bw
,
tExprNode
*
expr
)
{
...
...
src/query/src/qExecutor.c
浏览文件 @
7daaecba
...
@@ -1863,7 +1863,7 @@ static int32_t setCtxTagColumnInfo(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx
...
@@ -1863,7 +1863,7 @@ static int32_t setCtxTagColumnInfo(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx
p
->
tagInfo
.
numOfTagCols
=
num
;
p
->
tagInfo
.
numOfTagCols
=
num
;
p
->
tagInfo
.
tagsLen
=
tagLen
;
p
->
tagInfo
.
tagsLen
=
tagLen
;
}
else
{
}
else
{
tfree
(
pTagCtx
);
TDMFREE
(
pTagCtx
);
}
}
}
}
...
@@ -1984,10 +1984,10 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
...
@@ -1984,10 +1984,10 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
_clean:
_clean:
tfree
(
pRuntimeEnv
->
pCtx
);
TDMFREE
(
pRuntimeEnv
->
pCtx
);
tfree
(
pRuntimeEnv
->
offset
);
TDMFREE
(
pRuntimeEnv
->
offset
);
tfree
(
pRuntimeEnv
->
rowCellInfoOffset
);
TDMFREE
(
pRuntimeEnv
->
rowCellInfoOffset
);
tfree
(
pRuntimeEnv
->
sasArray
);
TDMFREE
(
pRuntimeEnv
->
sasArray
);
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
}
...
@@ -2025,18 +2025,18 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
...
@@ -2025,18 +2025,18 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
}
}
tVariantDestroy
(
&
pCtx
->
tag
);
tVariantDestroy
(
&
pCtx
->
tag
);
tfree
(
pCtx
->
tagInfo
.
pTagCtxList
);
TDMFREE
(
pCtx
->
tagInfo
.
pTagCtxList
);
}
}
tfree
(
pRuntimeEnv
->
pCtx
);
TDMFREE
(
pRuntimeEnv
->
pCtx
);
}
}
if
(
pRuntimeEnv
->
sasArray
!=
NULL
)
{
if
(
pRuntimeEnv
->
sasArray
!=
NULL
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfOutput
;
++
i
)
{
tfree
(
pRuntimeEnv
->
sasArray
[
i
].
data
);
TDMFREE
(
pRuntimeEnv
->
sasArray
[
i
].
data
);
}
}
tfree
(
pRuntimeEnv
->
sasArray
);
TDMFREE
(
pRuntimeEnv
->
sasArray
);
}
}
pRuntimeEnv
->
pFillInfo
=
taosDestroyFillInfo
(
pRuntimeEnv
->
pFillInfo
);
pRuntimeEnv
->
pFillInfo
=
taosDestroyFillInfo
(
pRuntimeEnv
->
pFillInfo
);
...
@@ -2046,10 +2046,10 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
...
@@ -2046,10 +2046,10 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
pRuntimeEnv
->
pTsBuf
=
tsBufDestroy
(
pRuntimeEnv
->
pTsBuf
);
pRuntimeEnv
->
pTsBuf
=
tsBufDestroy
(
pRuntimeEnv
->
pTsBuf
);
tfree
(
pRuntimeEnv
->
offset
);
TDMFREE
(
pRuntimeEnv
->
offset
);
tfree
(
pRuntimeEnv
->
keyBuf
);
TDMFREE
(
pRuntimeEnv
->
keyBuf
);
tfree
(
pRuntimeEnv
->
rowCellInfoOffset
);
TDMFREE
(
pRuntimeEnv
->
rowCellInfoOffset
);
tfree
(
pRuntimeEnv
->
prevRow
);
TDMFREE
(
pRuntimeEnv
->
prevRow
);
taosHashCleanup
(
pRuntimeEnv
->
pResultRowHashTable
);
taosHashCleanup
(
pRuntimeEnv
->
pResultRowHashTable
);
pRuntimeEnv
->
pResultRowHashTable
=
NULL
;
pRuntimeEnv
->
pResultRowHashTable
=
NULL
;
...
@@ -3297,9 +3297,9 @@ int32_t mergeIntoGroupResultImpl(SGroupResInfo* pGroupResInfo, SArray *pTableLis
...
@@ -3297,9 +3297,9 @@ int32_t mergeIntoGroupResultImpl(SGroupResInfo* pGroupResInfo, SArray *pTableLis
qDebug
(
"QInfo:%p result merge completed for group:%d, elapsed time:%"
PRId64
" ms"
,
pQInfo
,
pQInfo
->
groupIndex
,
endt
-
startt
);
qDebug
(
"QInfo:%p result merge completed for group:%d, elapsed time:%"
PRId64
" ms"
,
pQInfo
,
pQInfo
->
groupIndex
,
endt
-
startt
);
_end:
_end:
tfree
(
pTableQueryInfoList
);
TDMFREE
(
pTableQueryInfoList
);
tfree
(
posList
);
TDMFREE
(
posList
);
tfree
(
pTree
);
TDMFREE
(
pTree
);
return
code
;
return
code
;
}
}
...
@@ -5605,11 +5605,11 @@ static void doSecondaryArithmeticProcess(SQuery* pQuery) {
...
@@ -5605,11 +5605,11 @@ static void doSecondaryArithmeticProcess(SQuery* pQuery) {
}
}
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfExpr2
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfExpr2
;
++
i
)
{
tfree
(
data
[
i
]);
TDMFREE
(
data
[
i
]);
}
}
tfree
(
data
);
TDMFREE
(
data
);
tfree
(
arithSup
.
data
);
TDMFREE
(
arithSup
.
data
);
}
}
/*
/*
...
@@ -6231,14 +6231,14 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
...
@@ -6231,14 +6231,14 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
_cleanup:
_cleanup:
tfree
(
*
pExpr
);
TDMFREE
(
*
pExpr
);
taosArrayDestroy
(
*
pTableIdList
);
taosArrayDestroy
(
*
pTableIdList
);
*
pTableIdList
=
NULL
;
*
pTableIdList
=
NULL
;
tfree
(
*
tbnameCond
);
TDMFREE
(
*
tbnameCond
);
tfree
(
*
groupbyCols
);
TDMFREE
(
*
groupbyCols
);
tfree
(
*
tagCols
);
TDMFREE
(
*
tagCols
);
tfree
(
*
tagCond
);
TDMFREE
(
*
tagCond
);
tfree
(
*
sql
);
TDMFREE
(
*
sql
);
return
code
;
return
code
;
}
}
...
@@ -6289,7 +6289,7 @@ static int32_t createQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t num
...
@@ -6289,7 +6289,7 @@ static int32_t createQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t num
code
=
buildArithmeticExprFromMsg
(
&
pExprs
[
i
],
pQueryMsg
);
code
=
buildArithmeticExprFromMsg
(
&
pExprs
[
i
],
pQueryMsg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pExprs
);
TDMFREE
(
pExprs
);
return
code
;
return
code
;
}
}
...
@@ -6336,7 +6336,7 @@ static int32_t createQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t num
...
@@ -6336,7 +6336,7 @@ static int32_t createQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t num
int32_t
param
=
(
int32_t
)
pExprs
[
i
].
base
.
arg
[
0
].
argValue
.
i64
;
int32_t
param
=
(
int32_t
)
pExprs
[
i
].
base
.
arg
[
0
].
argValue
.
i64
;
if
(
getResultDataInfo
(
type
,
bytes
,
pExprs
[
i
].
base
.
functionId
,
param
,
&
pExprs
[
i
].
type
,
&
pExprs
[
i
].
bytes
,
if
(
getResultDataInfo
(
type
,
bytes
,
pExprs
[
i
].
base
.
functionId
,
param
,
&
pExprs
[
i
].
type
,
&
pExprs
[
i
].
bytes
,
&
pExprs
[
i
].
interBytes
,
0
,
isSuperTable
)
!=
TSDB_CODE_SUCCESS
)
{
&
pExprs
[
i
].
interBytes
,
0
,
isSuperTable
)
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pExprs
);
TDMFREE
(
pExprs
);
return
TSDB_CODE_QRY_INVALID_MSG
;
return
TSDB_CODE_QRY_INVALID_MSG
;
}
}
...
@@ -6734,10 +6734,10 @@ _cleanup_qinfo:
...
@@ -6734,10 +6734,10 @@ _cleanup_qinfo:
_cleanup_query:
_cleanup_query:
if
(
pGroupbyExpr
!=
NULL
)
{
if
(
pGroupbyExpr
!=
NULL
)
{
taosArrayDestroy
(
pGroupbyExpr
->
columnInfo
);
taosArrayDestroy
(
pGroupbyExpr
->
columnInfo
);
free
(
pGroupbyExpr
);
TDMFREE
(
pGroupbyExpr
);
}
}
tfree
(
pTagCols
);
TDMFREE
(
pTagCols
);
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SExprInfo
*
pExprInfo
=
&
pExprs
[
i
];
SExprInfo
*
pExprInfo
=
&
pExprs
[
i
];
if
(
pExprInfo
->
pExpr
!=
NULL
)
{
if
(
pExprInfo
->
pExpr
!=
NULL
)
{
...
@@ -6745,7 +6745,7 @@ _cleanup_query:
...
@@ -6745,7 +6745,7 @@ _cleanup_query:
}
}
}
}
tfree
(
pExprs
);
TDMFREE
(
pExprs
);
_cleanup:
_cleanup:
freeQInfo
(
pQInfo
);
freeQInfo
(
pQInfo
);
...
@@ -6820,11 +6820,11 @@ static void freeColumnFilterInfo(SColumnFilterInfo* pFilter, int32_t numOfFilter
...
@@ -6820,11 +6820,11 @@ static void freeColumnFilterInfo(SColumnFilterInfo* pFilter, int32_t numOfFilter
for
(
int32_t
i
=
0
;
i
<
numOfFilters
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
numOfFilters
;
i
++
)
{
if
(
pFilter
[
i
].
filterstr
)
{
if
(
pFilter
[
i
].
filterstr
)
{
free
((
void
*
)(
pFilter
[
i
].
pz
));
TDMFREE
((
void
*
)(
pFilter
[
i
].
pz
));
}
}
}
}
free
(
pFilter
);
TDMFREE
(
pFilter
);
}
}
static
void
doDestroyTableQueryInfo
(
STableGroupInfo
*
pTableqinfoGroupInfo
)
{
static
void
doDestroyTableQueryInfo
(
STableGroupInfo
*
pTableqinfoGroupInfo
)
{
...
@@ -6863,7 +6863,7 @@ static void* destroyQueryFuncExpr(SExprInfo* pExprInfo, int32_t numOfExpr) {
...
@@ -6863,7 +6863,7 @@ static void* destroyQueryFuncExpr(SExprInfo* pExprInfo, int32_t numOfExpr) {
}
}
}
}
tfree
(
pExprInfo
);
TDMFREE
(
pExprInfo
);
return
NULL
;
return
NULL
;
}
}
...
@@ -6882,48 +6882,48 @@ static void freeQInfo(SQInfo *pQInfo) {
...
@@ -6882,48 +6882,48 @@ static void freeQInfo(SQInfo *pQInfo) {
if
(
pQuery
!=
NULL
)
{
if
(
pQuery
!=
NULL
)
{
if
(
pQuery
->
sdata
!=
NULL
)
{
if
(
pQuery
->
sdata
!=
NULL
)
{
for
(
int32_t
col
=
0
;
col
<
pQuery
->
numOfOutput
;
++
col
)
{
for
(
int32_t
col
=
0
;
col
<
pQuery
->
numOfOutput
;
++
col
)
{
tfree
(
pQuery
->
sdata
[
col
]);
TDMFREE
(
pQuery
->
sdata
[
col
]);
}
}
tfree
(
pQuery
->
sdata
);
TDMFREE
(
pQuery
->
sdata
);
}
}
if
(
pQuery
->
fillVal
!=
NULL
)
{
if
(
pQuery
->
fillVal
!=
NULL
)
{
tfree
(
pQuery
->
fillVal
);
TDMFREE
(
pQuery
->
fillVal
);
}
}
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfFilterCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfFilterCols
;
++
i
)
{
SSingleColumnFilterInfo
*
pColFilter
=
&
pQuery
->
pFilterInfo
[
i
];
SSingleColumnFilterInfo
*
pColFilter
=
&
pQuery
->
pFilterInfo
[
i
];
if
(
pColFilter
->
numOfFilters
>
0
)
{
if
(
pColFilter
->
numOfFilters
>
0
)
{
tfree
(
pColFilter
->
pFilters
);
TDMFREE
(
pColFilter
->
pFilters
);
}
}
}
}
pQuery
->
pExpr1
=
destroyQueryFuncExpr
(
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
pQuery
->
pExpr1
=
destroyQueryFuncExpr
(
pQuery
->
pExpr1
,
pQuery
->
numOfOutput
);
pQuery
->
pExpr2
=
destroyQueryFuncExpr
(
pQuery
->
pExpr2
,
pQuery
->
numOfExpr2
);
pQuery
->
pExpr2
=
destroyQueryFuncExpr
(
pQuery
->
pExpr2
,
pQuery
->
numOfExpr2
);
tfree
(
pQuery
->
tagColList
);
TDMFREE
(
pQuery
->
tagColList
);
tfree
(
pQuery
->
pFilterInfo
);
TDMFREE
(
pQuery
->
pFilterInfo
);
if
(
pQuery
->
colList
!=
NULL
)
{
if
(
pQuery
->
colList
!=
NULL
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfCols
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pQuery
->
numOfCols
;
i
++
)
{
SColumnInfo
*
column
=
pQuery
->
colList
+
i
;
SColumnInfo
*
column
=
pQuery
->
colList
+
i
;
freeColumnFilterInfo
(
column
->
filters
,
column
->
numOfFilters
);
freeColumnFilterInfo
(
column
->
filters
,
column
->
numOfFilters
);
}
}
tfree
(
pQuery
->
colList
);
TDMFREE
(
pQuery
->
colList
);
}
}
if
(
pQuery
->
pGroupbyExpr
!=
NULL
)
{
if
(
pQuery
->
pGroupbyExpr
!=
NULL
)
{
taosArrayDestroy
(
pQuery
->
pGroupbyExpr
->
columnInfo
);
taosArrayDestroy
(
pQuery
->
pGroupbyExpr
->
columnInfo
);
tfree
(
pQuery
->
pGroupbyExpr
);
TDMFREE
(
pQuery
->
pGroupbyExpr
);
}
}
tfree
(
pQuery
);
TDMFREE
(
pQuery
);
}
}
doDestroyTableQueryInfo
(
&
pQInfo
->
tableqinfoGroupInfo
);
doDestroyTableQueryInfo
(
&
pQInfo
->
tableqinfoGroupInfo
);
tfree
(
pQInfo
->
pBuf
);
TDMFREE
(
pQInfo
->
pBuf
);
tfree
(
pQInfo
->
sql
);
TDMFREE
(
pQInfo
->
sql
);
tsdbDestroyTableGroup
(
&
pQInfo
->
tableGroupInfo
);
tsdbDestroyTableGroup
(
&
pQInfo
->
tableGroupInfo
);
taosHashCleanup
(
pQInfo
->
arrTableIdInfo
);
taosHashCleanup
(
pQInfo
->
arrTableIdInfo
);
...
@@ -6934,7 +6934,7 @@ static void freeQInfo(SQInfo *pQInfo) {
...
@@ -6934,7 +6934,7 @@ static void freeQInfo(SQInfo *pQInfo) {
qDebug
(
"QInfo:%p QInfo is freed"
,
pQInfo
);
qDebug
(
"QInfo:%p QInfo is freed"
,
pQInfo
);
tfree
(
pQInfo
);
TDMFREE
(
pQInfo
);
}
}
static
size_t
getResultSize
(
SQInfo
*
pQInfo
,
int64_t
*
numOfRows
)
{
static
size_t
getResultSize
(
SQInfo
*
pQInfo
,
int64_t
*
numOfRows
)
{
...
@@ -7136,22 +7136,22 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
...
@@ -7136,22 +7136,22 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
code
=
initQInfo
(
pQueryMsg
,
tsdb
,
vgId
,
*
pQInfo
,
isSTableQuery
);
code
=
initQInfo
(
pQueryMsg
,
tsdb
,
vgId
,
*
pQInfo
,
isSTableQuery
);
_over:
_over:
free
(
tagCond
);
TDMFREE
(
tagCond
);
free
(
tbnameCond
);
TDMFREE
(
tbnameCond
);
free
(
pGroupColIndex
);
TDMFREE
(
pGroupColIndex
);
if
(
pGroupbyExpr
!=
NULL
)
{
if
(
pGroupbyExpr
!=
NULL
)
{
taosArrayDestroy
(
pGroupbyExpr
->
columnInfo
);
taosArrayDestroy
(
pGroupbyExpr
->
columnInfo
);
free
(
pGroupbyExpr
);
TDMFREE
(
pGroupbyExpr
);
}
}
free
(
pTagColumnInfo
);
TDMFREE
(
pTagColumnInfo
);
free
(
sql
);
TDMFREE
(
sql
);
free
(
pExprs
);
TDMFREE
(
pExprs
);
free
(
pSecExprs
);
TDMFREE
(
pSecExprs
);
free
(
pExprMsg
);
TDMFREE
(
pExprMsg
);
free
(
pSecExprMsg
);
TDMFREE
(
pSecExprMsg
);
taosArrayDestroy
(
pTableIdList
);
taosArrayDestroy
(
pTableIdList
);
...
@@ -7652,7 +7652,7 @@ void qCleanupQueryMgmt(void* pQMgmt) {
...
@@ -7652,7 +7652,7 @@ void qCleanupQueryMgmt(void* pQMgmt) {
taosCacheCleanup
(
pqinfoPool
);
taosCacheCleanup
(
pqinfoPool
);
pthread_mutex_destroy
(
&
pQueryMgmt
->
lock
);
pthread_mutex_destroy
(
&
pQueryMgmt
->
lock
);
tfree
(
pQueryMgmt
);
TDMFREE
(
pQueryMgmt
);
qDebug
(
"vgId:%d, queryMgmt cleanup completed"
,
vgId
);
qDebug
(
"vgId:%d, queryMgmt cleanup completed"
,
vgId
);
}
}
...
...
src/query/src/qExtbuffer.c
浏览文件 @
7daaecba
...
@@ -64,7 +64,7 @@ void* destoryExtMemBuffer(tExtMemBuffer *pMemBuffer) {
...
@@ -64,7 +64,7 @@ void* destoryExtMemBuffer(tExtMemBuffer *pMemBuffer) {
// release flush out info link
// release flush out info link
SExtFileInfo
*
pFileMeta
=
&
pMemBuffer
->
fileMeta
;
SExtFileInfo
*
pFileMeta
=
&
pMemBuffer
->
fileMeta
;
if
(
pFileMeta
->
flushoutData
.
nAllocSize
!=
0
&&
pFileMeta
->
flushoutData
.
pFlushoutInfo
!=
NULL
)
{
if
(
pFileMeta
->
flushoutData
.
nAllocSize
!=
0
&&
pFileMeta
->
flushoutData
.
pFlushoutInfo
!=
NULL
)
{
tfree
(
pFileMeta
->
flushoutData
.
pFlushoutInfo
);
TDMFREE
(
pFileMeta
->
flushoutData
.
pFlushoutInfo
);
}
}
// release all in-memory buffer pages
// release all in-memory buffer pages
...
@@ -72,7 +72,7 @@ void* destoryExtMemBuffer(tExtMemBuffer *pMemBuffer) {
...
@@ -72,7 +72,7 @@ void* destoryExtMemBuffer(tExtMemBuffer *pMemBuffer) {
while
(
pFilePages
!=
NULL
)
{
while
(
pFilePages
!=
NULL
)
{
tFilePagesItem
*
pTmp
=
pFilePages
;
tFilePagesItem
*
pTmp
=
pFilePages
;
pFilePages
=
pFilePages
->
pNext
;
pFilePages
=
pFilePages
->
pNext
;
tfree
(
pTmp
);
TDMFREE
(
pTmp
);
}
}
// close temp file
// close temp file
...
@@ -87,8 +87,8 @@ void* destoryExtMemBuffer(tExtMemBuffer *pMemBuffer) {
...
@@ -87,8 +87,8 @@ void* destoryExtMemBuffer(tExtMemBuffer *pMemBuffer) {
destroyColumnModel
(
pMemBuffer
->
pColumnModel
);
destroyColumnModel
(
pMemBuffer
->
pColumnModel
);
tfree
(
pMemBuffer
->
path
);
TDMFREE
(
pMemBuffer
->
path
);
tfree
(
pMemBuffer
);
TDMFREE
(
pMemBuffer
);
return
NULL
;
return
NULL
;
}
}
...
@@ -275,7 +275,7 @@ int32_t tExtMemBufferFlush(tExtMemBuffer *pMemBuffer) {
...
@@ -275,7 +275,7 @@ int32_t tExtMemBufferFlush(tExtMemBuffer *pMemBuffer) {
tFilePagesItem
*
ptmp
=
first
;
tFilePagesItem
*
ptmp
=
first
;
first
=
first
->
pNext
;
first
=
first
->
pNext
;
tfree
(
ptmp
);
// release all data in memory buffer
TDMFREE
(
ptmp
);
// release all data in memory buffer
}
}
fflush
(
pMemBuffer
->
file
);
// flush to disk
fflush
(
pMemBuffer
->
file
);
// flush to disk
...
@@ -300,7 +300,7 @@ void tExtMemBufferClear(tExtMemBuffer *pMemBuffer) {
...
@@ -300,7 +300,7 @@ void tExtMemBufferClear(tExtMemBuffer *pMemBuffer) {
while
(
first
!=
NULL
)
{
while
(
first
!=
NULL
)
{
tFilePagesItem
*
ptmp
=
first
;
tFilePagesItem
*
ptmp
=
first
;
first
=
first
->
pNext
;
first
=
first
->
pNext
;
tfree
(
ptmp
);
TDMFREE
(
ptmp
);
}
}
pMemBuffer
->
fileMeta
.
numOfElemsInFile
=
0
;
pMemBuffer
->
fileMeta
.
numOfElemsInFile
=
0
;
...
@@ -751,7 +751,7 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
...
@@ -751,7 +751,7 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
columnwiseQSortImpl
(
pDescriptor
,
numOfRows
,
start
,
end
,
data
,
order
,
compareFn
,
buf
);
columnwiseQSortImpl
(
pDescriptor
,
numOfRows
,
start
,
end
,
data
,
order
,
compareFn
,
buf
);
}
}
free
(
buf
);
TDMFREE
(
buf
);
}
}
/*
/*
...
@@ -802,7 +802,7 @@ void destroyColumnModel(SColumnModel *pModel) {
...
@@ -802,7 +802,7 @@ void destroyColumnModel(SColumnModel *pModel) {
return
;
return
;
}
}
tfree
(
pModel
);
TDMFREE
(
pModel
);
}
}
static
void
printBinaryData
(
char
*
data
,
int32_t
len
)
{
static
void
printBinaryData
(
char
*
data
,
int32_t
len
)
{
...
@@ -1087,5 +1087,5 @@ void tOrderDescDestroy(tOrderDescriptor *pDesc) {
...
@@ -1087,5 +1087,5 @@ void tOrderDescDestroy(tOrderDescriptor *pDesc) {
}
}
destroyColumnModel
(
pDesc
->
pColumnModel
);
destroyColumnModel
(
pDesc
->
pColumnModel
);
tfree
(
pDesc
);
TDMFREE
(
pDesc
);
}
}
src/query/src/qFill.c
浏览文件 @
7daaecba
...
@@ -121,18 +121,18 @@ void* taosDestroyFillInfo(SFillInfo* pFillInfo) {
...
@@ -121,18 +121,18 @@ void* taosDestroyFillInfo(SFillInfo* pFillInfo) {
return
NULL
;
return
NULL
;
}
}
tfree
(
pFillInfo
->
prevValues
);
TDMFREE
(
pFillInfo
->
prevValues
);
tfree
(
pFillInfo
->
nextValues
);
TDMFREE
(
pFillInfo
->
nextValues
);
tfree
(
pFillInfo
->
pTags
);
TDMFREE
(
pFillInfo
->
pTags
);
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
tfree
(
pFillInfo
->
pData
[
i
]);
TDMFREE
(
pFillInfo
->
pData
[
i
]);
}
}
tfree
(
pFillInfo
->
pData
);
TDMFREE
(
pFillInfo
->
pData
);
tfree
(
pFillInfo
->
pFillCol
);
TDMFREE
(
pFillInfo
->
pFillCol
);
tfree
(
pFillInfo
);
TDMFREE
(
pFillInfo
);
return
NULL
;
return
NULL
;
}
}
...
@@ -457,7 +457,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t ou
...
@@ -457,7 +457,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t ou
if
(
pFillInfo
->
index
>=
pFillInfo
->
numOfRows
||
pFillInfo
->
numOfCurrent
>=
outputRows
)
{
if
(
pFillInfo
->
index
>=
pFillInfo
->
numOfRows
||
pFillInfo
->
numOfCurrent
>=
outputRows
)
{
/* the raw data block is exhausted, next value does not exists */
/* the raw data block is exhausted, next value does not exists */
if
(
pFillInfo
->
index
>=
pFillInfo
->
numOfRows
)
{
if
(
pFillInfo
->
index
>=
pFillInfo
->
numOfRows
)
{
tfree
(
*
next
);
TDMFREE
(
*
next
);
}
}
pFillInfo
->
numOfTotal
+=
pFillInfo
->
numOfCurrent
;
pFillInfo
->
numOfTotal
+=
pFillInfo
->
numOfCurrent
;
...
...
src/query/src/qHistogram.c
浏览文件 @
7daaecba
...
@@ -438,7 +438,7 @@ void tHistogramDestroy(SHistogramInfo** pHisto) {
...
@@ -438,7 +438,7 @@ void tHistogramDestroy(SHistogramInfo** pHisto) {
return
;
return
;
}
}
free
(
*
pHisto
);
TDMFREE
(
*
pHisto
);
*
pHisto
=
NULL
;
*
pHisto
=
NULL
;
}
}
...
@@ -659,6 +659,6 @@ SHistogramInfo* tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2
...
@@ -659,6 +659,6 @@ SHistogramInfo* tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2
pResHistogram
->
numOfEntries
=
k
;
pResHistogram
->
numOfEntries
=
k
;
memcpy
(
pResHistogram
->
elems
,
pHistoBins
,
sizeof
(
SHistBin
)
*
k
);
memcpy
(
pResHistogram
->
elems
,
pHistoBins
,
sizeof
(
SHistBin
)
*
k
);
free
(
pHistoBins
);
TDMFREE
(
pHistoBins
);
return
pResHistogram
;
return
pResHistogram
;
}
}
src/query/src/qParserImpl.c
浏览文件 @
7daaecba
...
@@ -67,7 +67,7 @@ SSqlInfo qSQLParse(const char *pStr) {
...
@@ -67,7 +67,7 @@ SSqlInfo qSQLParse(const char *pStr) {
}
}
abort_parse:
abort_parse:
ParseFree
(
pParser
,
free
);
ParseFree
(
pParser
,
tdm
free
);
return
sqlInfo
;
return
sqlInfo
;
}
}
...
@@ -106,13 +106,13 @@ void tSqlExprListDestroy(tSQLExprList *pList) {
...
@@ -106,13 +106,13 @@ void tSqlExprListDestroy(tSQLExprList *pList) {
for
(
int32_t
i
=
0
;
i
<
pList
->
nExpr
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pList
->
nExpr
;
++
i
)
{
if
(
pList
->
a
[
i
].
aliasName
!=
NULL
)
{
if
(
pList
->
a
[
i
].
aliasName
!=
NULL
)
{
free
(
pList
->
a
[
i
].
aliasName
);
TDMFREE
(
pList
->
a
[
i
].
aliasName
);
}
}
tSqlExprDestroy
(
pList
->
a
[
i
].
pNode
);
tSqlExprDestroy
(
pList
->
a
[
i
].
pNode
);
}
}
free
(
pList
->
a
);
TDMFREE
(
pList
->
a
);
free
(
pList
);
TDMFREE
(
pList
);
}
}
tSQLExpr
*
tSqlExprIdValueCreate
(
SStrToken
*
pToken
,
int32_t
optrType
)
{
tSQLExpr
*
tSqlExprIdValueCreate
(
SStrToken
*
pToken
,
int32_t
optrType
)
{
...
@@ -299,7 +299,7 @@ void tSqlExprNodeDestroy(tSQLExpr *pExpr) {
...
@@ -299,7 +299,7 @@ void tSqlExprNodeDestroy(tSQLExpr *pExpr) {
tSqlExprListDestroy
(
pExpr
->
pParam
);
tSqlExprListDestroy
(
pExpr
->
pParam
);
free
(
pExpr
);
TDMFREE
(
pExpr
);
}
}
void
tSqlExprDestroy
(
tSQLExpr
*
pExpr
)
{
void
tSqlExprDestroy
(
tSQLExpr
*
pExpr
)
{
...
@@ -487,8 +487,8 @@ static void freeVariant(void *pItem) {
...
@@ -487,8 +487,8 @@ static void freeVariant(void *pItem) {
void
freeCreateTableInfo
(
void
*
p
)
{
void
freeCreateTableInfo
(
void
*
p
)
{
SCreatedTableInfo
*
pInfo
=
(
SCreatedTableInfo
*
)
p
;
SCreatedTableInfo
*
pInfo
=
(
SCreatedTableInfo
*
)
p
;
taosArrayDestroyEx
(
pInfo
->
pTagVals
,
freeVariant
);
taosArrayDestroyEx
(
pInfo
->
pTagVals
,
freeVariant
);
tfree
(
pInfo
->
fullname
);
TDMFREE
(
pInfo
->
fullname
);
tfree
(
pInfo
->
tagdata
.
data
);
TDMFREE
(
pInfo
->
tagdata
.
data
);
}
}
void
doDestroyQuerySql
(
SQuerySQL
*
pQuerySql
)
{
void
doDestroyQuerySql
(
SQuerySQL
*
pQuerySql
)
{
...
@@ -515,7 +515,7 @@ void doDestroyQuerySql(SQuerySQL *pQuerySql) {
...
@@ -515,7 +515,7 @@ void doDestroyQuerySql(SQuerySQL *pQuerySql) {
taosArrayDestroyEx
(
pQuerySql
->
fillType
,
freeVariant
);
taosArrayDestroyEx
(
pQuerySql
->
fillType
,
freeVariant
);
pQuerySql
->
fillType
=
NULL
;
pQuerySql
->
fillType
=
NULL
;
free
(
pQuerySql
);
TDMFREE
(
pQuerySql
);
}
}
void
destroyAllSelectClause
(
SSubclauseInfo
*
pClause
)
{
void
destroyAllSelectClause
(
SSubclauseInfo
*
pClause
)
{
...
@@ -528,7 +528,7 @@ void destroyAllSelectClause(SSubclauseInfo *pClause) {
...
@@ -528,7 +528,7 @@ void destroyAllSelectClause(SSubclauseInfo *pClause) {
doDestroyQuerySql
(
pQuerySql
);
doDestroyQuerySql
(
pQuerySql
);
}
}
tfree
(
pClause
->
pClause
);
TDMFREE
(
pClause
->
pClause
);
}
}
SCreateTableSQL
*
tSetCreateSqlElems
(
SArray
*
pCols
,
SArray
*
pTags
,
SQuerySQL
*
pSelect
,
int32_t
type
)
{
SCreateTableSQL
*
tSetCreateSqlElems
(
SArray
*
pCols
,
SArray
*
pTags
,
SQuerySQL
*
pSelect
,
int32_t
type
)
{
...
@@ -603,7 +603,7 @@ void* destroyCreateTableSql(SCreateTableSQL* pCreate) {
...
@@ -603,7 +603,7 @@ void* destroyCreateTableSql(SCreateTableSQL* pCreate) {
taosArrayDestroy
(
pCreate
->
colInfo
.
pTagColumns
);
taosArrayDestroy
(
pCreate
->
colInfo
.
pTagColumns
);
taosArrayDestroyEx
(
pCreate
->
childTableInfo
,
freeCreateTableInfo
);
taosArrayDestroyEx
(
pCreate
->
childTableInfo
,
freeCreateTableInfo
);
tfree
(
pCreate
);
TDMFREE
(
pCreate
);
return
NULL
;
return
NULL
;
}
}
...
@@ -618,18 +618,18 @@ void SqlInfoDestroy(SSqlInfo *pInfo) {
...
@@ -618,18 +618,18 @@ void SqlInfoDestroy(SSqlInfo *pInfo) {
}
else
if
(
pInfo
->
type
==
TSDB_SQL_ALTER_TABLE
)
{
}
else
if
(
pInfo
->
type
==
TSDB_SQL_ALTER_TABLE
)
{
taosArrayDestroyEx
(
pInfo
->
pAlterInfo
->
varList
,
freeVariant
);
taosArrayDestroyEx
(
pInfo
->
pAlterInfo
->
varList
,
freeVariant
);
taosArrayDestroy
(
pInfo
->
pAlterInfo
->
pAddColumns
);
taosArrayDestroy
(
pInfo
->
pAlterInfo
->
pAddColumns
);
tfree
(
pInfo
->
pAlterInfo
->
tagData
.
data
);
TDMFREE
(
pInfo
->
pAlterInfo
->
tagData
.
data
);
tfree
(
pInfo
->
pAlterInfo
);
TDMFREE
(
pInfo
->
pAlterInfo
);
}
else
{
}
else
{
if
(
pInfo
->
pDCLInfo
!=
NULL
&&
pInfo
->
pDCLInfo
->
nAlloc
>
0
)
{
if
(
pInfo
->
pDCLInfo
!=
NULL
&&
pInfo
->
pDCLInfo
->
nAlloc
>
0
)
{
free
(
pInfo
->
pDCLInfo
->
a
);
TDMFREE
(
pInfo
->
pDCLInfo
->
a
);
}
}
if
(
pInfo
->
pDCLInfo
!=
NULL
&&
pInfo
->
type
==
TSDB_SQL_CREATE_DB
)
{
if
(
pInfo
->
pDCLInfo
!=
NULL
&&
pInfo
->
type
==
TSDB_SQL_CREATE_DB
)
{
taosArrayDestroyEx
(
pInfo
->
pDCLInfo
->
dbOpt
.
keep
,
freeVariant
);
taosArrayDestroyEx
(
pInfo
->
pDCLInfo
->
dbOpt
.
keep
,
freeVariant
);
}
}
tfree
(
pInfo
->
pDCLInfo
);
TDMFREE
(
pInfo
->
pDCLInfo
);
}
}
}
}
...
@@ -657,7 +657,7 @@ SSqlInfo*setSqlInfo(SSqlInfo *pInfo, void *pSqlExprInfo, SStrToken *pTableName,
...
@@ -657,7 +657,7 @@ SSqlInfo*setSqlInfo(SSqlInfo *pInfo, void *pSqlExprInfo, SStrToken *pTableName,
if
(
type
==
TSDB_SQL_SELECT
)
{
if
(
type
==
TSDB_SQL_SELECT
)
{
pInfo
->
subclauseInfo
=
*
(
SSubclauseInfo
*
)
pSqlExprInfo
;
pInfo
->
subclauseInfo
=
*
(
SSubclauseInfo
*
)
pSqlExprInfo
;
free
(
pSqlExprInfo
);
TDMFREE
(
pSqlExprInfo
);
}
else
{
}
else
{
pInfo
->
pCreateTableInfo
=
pSqlExprInfo
;
pInfo
->
pCreateTableInfo
=
pSqlExprInfo
;
}
}
...
...
src/query/src/qPercentile.c
浏览文件 @
7daaecba
...
@@ -329,7 +329,7 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
...
@@ -329,7 +329,7 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
if
(
setBoundingBox
(
&
pBucket
->
range
,
pBucket
->
type
,
minval
,
maxval
)
!=
0
)
{
if
(
setBoundingBox
(
&
pBucket
->
range
,
pBucket
->
type
,
minval
,
maxval
)
!=
0
)
{
uError
(
"MemBucket:%p, invalid value range: %f-%f"
,
pBucket
,
minval
,
maxval
);
uError
(
"MemBucket:%p, invalid value range: %f-%f"
,
pBucket
,
minval
,
maxval
);
free
(
pBucket
);
TDMFREE
(
pBucket
);
return
NULL
;
return
NULL
;
}
}
...
@@ -339,13 +339,13 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
...
@@ -339,13 +339,13 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
pBucket
->
hashFunc
=
getHashFunc
(
pBucket
->
type
);
pBucket
->
hashFunc
=
getHashFunc
(
pBucket
->
type
);
if
(
pBucket
->
hashFunc
==
NULL
)
{
if
(
pBucket
->
hashFunc
==
NULL
)
{
uError
(
"MemBucket:%p, not support data type %d, failed"
,
pBucket
,
pBucket
->
type
);
uError
(
"MemBucket:%p, not support data type %d, failed"
,
pBucket
,
pBucket
->
type
);
free
(
pBucket
);
TDMFREE
(
pBucket
);
return
NULL
;
return
NULL
;
}
}
pBucket
->
pSlots
=
(
tMemBucketSlot
*
)
calloc
(
pBucket
->
numOfSlots
,
sizeof
(
tMemBucketSlot
));
pBucket
->
pSlots
=
(
tMemBucketSlot
*
)
calloc
(
pBucket
->
numOfSlots
,
sizeof
(
tMemBucketSlot
));
if
(
pBucket
->
pSlots
==
NULL
)
{
if
(
pBucket
->
pSlots
==
NULL
)
{
free
(
pBucket
);
TDMFREE
(
pBucket
);
return
NULL
;
return
NULL
;
}
}
...
@@ -367,8 +367,8 @@ void tMemBucketDestroy(tMemBucket *pBucket) {
...
@@ -367,8 +367,8 @@ void tMemBucketDestroy(tMemBucket *pBucket) {
}
}
destroyResultBuf
(
pBucket
->
pBuffer
);
destroyResultBuf
(
pBucket
->
pBuffer
);
tfree
(
pBucket
->
pSlots
);
TDMFREE
(
pBucket
->
pSlots
);
tfree
(
pBucket
);
TDMFREE
(
pBucket
);
}
}
void
tMemBucketUpdateBoundingBox
(
MinMaxEntry
*
r
,
const
char
*
data
,
int32_t
dataType
)
{
void
tMemBucketUpdateBoundingBox
(
MinMaxEntry
*
r
,
const
char
*
data
,
int32_t
dataType
)
{
...
@@ -686,7 +686,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
...
@@ -686,7 +686,7 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
}
}
double
val
=
(
1
-
fraction
)
*
td
+
fraction
*
nd
;
double
val
=
(
1
-
fraction
)
*
td
+
fraction
*
nd
;
tfree
(
buffer
);
TDMFREE
(
buffer
);
return
val
;
return
val
;
}
else
{
// incur a second round bucket split
}
else
{
// incur a second round bucket split
...
...
src/query/src/qResultbuf.c
浏览文件 @
7daaecba
...
@@ -270,7 +270,7 @@ static char* evicOneDataPage(SDiskbasedResultBuf* pResultBuf) {
...
@@ -270,7 +270,7 @@ static char* evicOneDataPage(SDiskbasedResultBuf* pResultBuf) {
assert
(
d
->
pn
==
pn
);
assert
(
d
->
pn
==
pn
);
d
->
pn
=
NULL
;
d
->
pn
=
NULL
;
tfree
(
pn
);
TDMFREE
(
pn
);
bufPage
=
flushPageToDisk
(
pResultBuf
,
d
);
bufPage
=
flushPageToDisk
(
pResultBuf
,
d
);
}
}
...
@@ -421,15 +421,15 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
...
@@ -421,15 +421,15 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
}
}
unlink
(
pResultBuf
->
path
);
unlink
(
pResultBuf
->
path
);
tfree
(
pResultBuf
->
path
);
TDMFREE
(
pResultBuf
->
path
);
SArray
**
p
=
taosHashIterate
(
pResultBuf
->
groupSet
,
NULL
);
SArray
**
p
=
taosHashIterate
(
pResultBuf
->
groupSet
,
NULL
);
while
(
p
)
{
while
(
p
)
{
size_t
n
=
taosArrayGetSize
(
*
p
);
size_t
n
=
taosArrayGetSize
(
*
p
);
for
(
int32_t
i
=
0
;
i
<
n
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
n
;
++
i
)
{
SPageInfo
*
pi
=
taosArrayGetP
(
*
p
,
i
);
SPageInfo
*
pi
=
taosArrayGetP
(
*
p
,
i
);
tfree
(
pi
->
pData
);
TDMFREE
(
pi
->
pData
);
tfree
(
pi
);
TDMFREE
(
pi
);
}
}
taosArrayDestroy
(
*
p
);
taosArrayDestroy
(
*
p
);
...
@@ -441,8 +441,8 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
...
@@ -441,8 +441,8 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
taosHashCleanup
(
pResultBuf
->
groupSet
);
taosHashCleanup
(
pResultBuf
->
groupSet
);
taosHashCleanup
(
pResultBuf
->
all
);
taosHashCleanup
(
pResultBuf
->
all
);
tfree
(
pResultBuf
->
assistBuf
);
TDMFREE
(
pResultBuf
->
assistBuf
);
tfree
(
pResultBuf
);
TDMFREE
(
pResultBuf
);
}
}
SPageInfo
*
getLastPageInfo
(
SIDList
pList
)
{
SPageInfo
*
getLastPageInfo
(
SIDList
pList
)
{
...
...
src/query/src/qTsbuf.c
浏览文件 @
7daaecba
...
@@ -23,7 +23,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
...
@@ -23,7 +23,7 @@ STSBuf* tsBufCreate(bool autoDelete, int32_t order) {
taosGetTmpfilePath
(
"join"
,
pTSBuf
->
path
);
taosGetTmpfilePath
(
"join"
,
pTSBuf
->
path
);
pTSBuf
->
f
=
fopen
(
pTSBuf
->
path
,
"w+"
);
pTSBuf
->
f
=
fopen
(
pTSBuf
->
path
,
"w+"
);
if
(
pTSBuf
->
f
==
NULL
)
{
if
(
pTSBuf
->
f
==
NULL
)
{
free
(
pTSBuf
);
TDMFREE
(
pTSBuf
);
return
NULL
;
return
NULL
;
}
}
...
@@ -54,7 +54,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
...
@@ -54,7 +54,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
pTSBuf
->
f
=
fopen
(
pTSBuf
->
path
,
"r+"
);
pTSBuf
->
f
=
fopen
(
pTSBuf
->
path
,
"r+"
);
if
(
pTSBuf
->
f
==
NULL
)
{
if
(
pTSBuf
->
f
==
NULL
)
{
free
(
pTSBuf
);
TDMFREE
(
pTSBuf
);
return
NULL
;
return
NULL
;
}
}
...
@@ -113,7 +113,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
...
@@ -113,7 +113,7 @@ STSBuf* tsBufCreateFromFile(const char* path, bool autoDelete) {
STSGroupBlockInfoEx
*
pBlockList
=
&
pTSBuf
->
pData
[
i
];
STSGroupBlockInfoEx
*
pBlockList
=
&
pTSBuf
->
pData
[
i
];
memcpy
(
&
pBlockList
->
info
,
&
buf
[
i
],
sizeof
(
STSGroupBlockInfo
));
memcpy
(
&
pBlockList
->
info
,
&
buf
[
i
],
sizeof
(
STSGroupBlockInfo
));
}
}
free
(
buf
);
TDMFREE
(
buf
);
ret
=
fseek
(
pTSBuf
->
f
,
0
,
SEEK_END
);
ret
=
fseek
(
pTSBuf
->
f
,
0
,
SEEK_END
);
UNUSED
(
ret
);
UNUSED
(
ret
);
...
@@ -142,11 +142,11 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
...
@@ -142,11 +142,11 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
return
NULL
;
return
NULL
;
}
}
tfree
(
pTSBuf
->
assistBuf
);
TDMFREE
(
pTSBuf
->
assistBuf
);
tfree
(
pTSBuf
->
tsData
.
rawBuf
);
TDMFREE
(
pTSBuf
->
tsData
.
rawBuf
);
tfree
(
pTSBuf
->
pData
);
TDMFREE
(
pTSBuf
->
pData
);
tfree
(
pTSBuf
->
block
.
payload
);
TDMFREE
(
pTSBuf
->
block
.
payload
);
fclose
(
pTSBuf
->
f
);
fclose
(
pTSBuf
->
f
);
...
@@ -158,7 +158,7 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
...
@@ -158,7 +158,7 @@ void* tsBufDestroy(STSBuf* pTSBuf) {
}
}
tVariantDestroy
(
&
pTSBuf
->
block
.
tag
);
tVariantDestroy
(
&
pTSBuf
->
block
.
tag
);
free
(
pTSBuf
);
TDMFREE
(
pTSBuf
);
return
NULL
;
return
NULL
;
}
}
...
...
src/query/src/qUtil.c
浏览文件 @
7daaecba
...
@@ -59,11 +59,11 @@ void cleanupResultRowInfo(SResultRowInfo *pResultRowInfo) {
...
@@ -59,11 +59,11 @@ void cleanupResultRowInfo(SResultRowInfo *pResultRowInfo) {
if
(
pResultRowInfo
->
type
==
TSDB_DATA_TYPE_BINARY
||
pResultRowInfo
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pResultRowInfo
->
type
==
TSDB_DATA_TYPE_BINARY
||
pResultRowInfo
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
tfree
(
pResultRowInfo
->
pResult
[
i
]
->
key
);
TDMFREE
(
pResultRowInfo
->
pResult
[
i
]
->
key
);
}
}
}
}
tfree
(
pResultRowInfo
->
pResult
);
TDMFREE
(
pResultRowInfo
->
pResult
);
}
}
void
resetResultRowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
pResultRowInfo
)
{
void
resetResultRowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
pResultRowInfo
)
{
...
@@ -143,7 +143,7 @@ void clearResultRow(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResultRow, int16
...
@@ -143,7 +143,7 @@ void clearResultRow(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResultRow, int16
pResultRow
->
closed
=
false
;
pResultRow
->
closed
=
false
;
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
tfree
(
pResultRow
->
key
);
TDMFREE
(
pResultRow
->
key
);
}
else
{
}
else
{
pResultRow
->
win
=
TSWINDOW_INITIALIZER
;
pResultRow
->
win
=
TSWINDOW_INITIALIZER
;
}
}
...
@@ -221,11 +221,11 @@ void* destroyResultRowPool(SResultRowPool* p) {
...
@@ -221,11 +221,11 @@ void* destroyResultRowPool(SResultRowPool* p) {
size_t
size
=
taosArrayGetSize
(
p
->
pData
);
size_t
size
=
taosArrayGetSize
(
p
->
pData
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
void
**
ptr
=
taosArrayGet
(
p
->
pData
,
i
);
void
**
ptr
=
taosArrayGet
(
p
->
pData
,
i
);
tfree
(
*
ptr
);
TDMFREE
(
*
ptr
);
}
}
taosArrayDestroy
(
p
->
pData
);
taosArrayDestroy
(
p
->
pData
);
tfree
(
p
);
TDMFREE
(
p
);
return
NULL
;
return
NULL
;
}
}
\ No newline at end of file
src/query/src/sql.c
浏览文件 @
7daaecba
...
@@ -1461,7 +1461,7 @@ void ParseFinalize(void *p){
...
@@ -1461,7 +1461,7 @@ void ParseFinalize(void *p){
yyParser
*
pParser
=
(
yyParser
*
)
p
;
yyParser
*
pParser
=
(
yyParser
*
)
p
;
while
(
pParser
->
yytos
>
pParser
->
yystack
)
yy_pop_parser_stack
(
pParser
);
while
(
pParser
->
yytos
>
pParser
->
yystack
)
yy_pop_parser_stack
(
pParser
);
#if YYSTACKDEPTH<=0
#if YYSTACKDEPTH<=0
if
(
pParser
->
yystack
!=&
pParser
->
yystk0
)
free
(
pParser
->
yystack
);
if
(
pParser
->
yystack
!=&
pParser
->
yystk0
)
TDMFREE
(
pParser
->
yystack
);
#endif
#endif
}
}
...
...
src/util/src/hash.c
浏览文件 @
7daaecba
...
@@ -172,7 +172,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
...
@@ -172,7 +172,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
pHashObj
->
hashList
=
(
SHashEntry
**
)
calloc
(
pHashObj
->
capacity
,
sizeof
(
void
*
));
pHashObj
->
hashList
=
(
SHashEntry
**
)
calloc
(
pHashObj
->
capacity
,
sizeof
(
void
*
));
if
(
pHashObj
->
hashList
==
NULL
)
{
if
(
pHashObj
->
hashList
==
NULL
)
{
free
(
pHashObj
);
tdm
free
(
pHashObj
);
uError
(
"failed to allocate memory, reason:%s"
,
strerror
(
errno
));
uError
(
"failed to allocate memory, reason:%s"
,
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
else
{
}
else
{
...
@@ -526,7 +526,7 @@ void taosHashCleanup(SHashObj *pHashObj) {
...
@@ -526,7 +526,7 @@ void taosHashCleanup(SHashObj *pHashObj) {
taosArrayDestroy
(
pHashObj
->
pMemBlock
);
taosArrayDestroy
(
pHashObj
->
pMemBlock
);
memset
(
pHashObj
,
0
,
sizeof
(
SHashObj
));
memset
(
pHashObj
,
0
,
sizeof
(
SHashObj
));
free
(
pHashObj
);
tdm
free
(
pHashObj
);
}
}
// for profile only
// for profile only
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录