Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6b085308
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6b085308
编写于
8月 05, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1057
上级
f84ac22b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
52 addition
and
46 deletion
+52
-46
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+1
-1
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+2
-2
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+6
-6
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+23
-17
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+3
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+15
-15
src/util/inc/tutil.h
src/util/inc/tutil.h
+2
-2
未找到文件。
src/client/src/TSDBJNIConnector.c
浏览文件 @
6b085308
...
...
@@ -224,7 +224,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_connectImp(JNIEn
*/
tsNumOfThreadsPerCore
=
0
.
0
;
ret
=
(
jlong
)
taos_connect
((
char
*
)
host
,
(
char
*
)
user
,
(
char
*
)
pass
,
(
char
*
)
dbname
,
jport
);
ret
=
(
jlong
)
taos_connect
((
char
*
)
host
,
(
char
*
)
user
,
(
char
*
)
pass
,
(
char
*
)
dbname
,
(
uint16_t
)
jport
);
if
(
ret
==
0
)
{
jniError
(
"jobj:%p, conn:%p, connect to database failed, host=%s, user=%s, dbname=%s, port=%d"
,
jobj
,
(
void
*
)
ret
,
(
char
*
)
host
,
(
char
*
)
user
,
(
char
*
)
dbname
,
jport
);
...
...
src/client/src/tscAsync.c
浏览文件 @
6b085308
...
...
@@ -54,7 +54,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
return
;
}
strntolower
(
pSql
->
sqlstr
,
sqlstr
,
sqlLen
);
strntolower
(
pSql
->
sqlstr
,
sqlstr
,
(
int32_t
)
sqlLen
);
tscDebugL
(
"%p SQL: %s"
,
pSql
,
pSql
->
sqlstr
);
pSql
->
cmd
.
curSql
=
pSql
->
sqlstr
;
...
...
@@ -81,7 +81,7 @@ void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *pa
return
;
}
int32_t
sqlLen
=
strlen
(
sqlstr
);
int32_t
sqlLen
=
(
int32_t
)
strlen
(
sqlstr
);
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
tscError
(
"sql string exceeds max length:%d"
,
tsMaxSQLStringLen
);
terrno
=
TSDB_CODE_TSC_INVALID_SQL
;
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
6b085308
...
...
@@ -169,7 +169,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
// (uid, tid) + VGID + TAGSIZE + VARSTR_HEADER_SIZE
if
(
functionId
==
TSDB_FUNC_TID_TAG
)
{
// todo use struct
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
dataBytes
+
sizeof
(
int64_t
)
+
sizeof
(
int32_t
)
+
sizeof
(
int32_t
)
+
VARSTR_HEADER_SIZE
;
*
bytes
=
(
int16_t
)(
dataBytes
+
sizeof
(
int64_t
)
+
sizeof
(
int32_t
)
+
sizeof
(
int32_t
)
+
VARSTR_HEADER_SIZE
)
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -198,7 +198,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
if
(
isSuperTable
)
{
if
(
functionId
==
TSDB_FUNC_MIN
||
functionId
==
TSDB_FUNC_MAX
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
dataBytes
+
DATA_SET_FLAG_SIZE
;
*
bytes
=
(
int16_t
)(
dataBytes
+
DATA_SET_FLAG_SIZE
)
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -221,7 +221,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
return
TSDB_CODE_SUCCESS
;
}
else
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
sizeof
(
STopBotInfo
)
+
(
sizeof
(
tValuePair
)
+
POINTER_BYTES
+
extLength
)
*
param
;
*
bytes
=
(
int16_t
)(
sizeof
(
STopBotInfo
)
+
(
sizeof
(
tValuePair
)
+
POINTER_BYTES
+
extLength
)
*
param
)
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -239,7 +239,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
return
TSDB_CODE_SUCCESS
;
}
else
if
(
functionId
==
TSDB_FUNC_LAST_ROW
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
sizeof
(
SLastrowInfo
)
+
dataBytes
;
*
bytes
=
(
int16_t
)(
sizeof
(
SLastrowInfo
)
+
dataBytes
)
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -308,7 +308,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*
interBytes
=
*
bytes
+
sizeof
(
SResultInfo
);
}
else
if
(
functionId
==
TSDB_FUNC_FIRST_DST
||
functionId
==
TSDB_FUNC_LAST_DST
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
dataBytes
+
sizeof
(
SFirstLastInfo
);
*
bytes
=
(
int16_t
)(
dataBytes
+
sizeof
(
SFirstLastInfo
)
);
*
interBytes
=
*
bytes
;
}
else
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
*
type
=
(
int16_t
)
dataType
;
...
...
@@ -317,7 +317,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
size_t
size
=
sizeof
(
STopBotInfo
)
+
(
sizeof
(
tValuePair
)
+
POINTER_BYTES
+
extLength
)
*
param
;
// the output column may be larger than sizeof(STopBotInfo)
*
interBytes
=
size
;
*
interBytes
=
(
int32_t
)
size
;
}
else
if
(
functionId
==
TSDB_FUNC_LAST_ROW
)
{
*
type
=
(
int16_t
)
dataType
;
*
bytes
=
(
int16_t
)
dataBytes
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
6b085308
...
...
@@ -641,8 +641,8 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
pSupporter
->
pIdTagList
=
tmp
;
memcpy
(
pSupporter
->
pIdTagList
+
pSupporter
->
totalLen
,
pRes
->
data
,
validLen
);
pSupporter
->
totalLen
+=
validLen
;
pSupporter
->
num
+=
pRes
->
numOfRows
;
pSupporter
->
totalLen
+=
(
int32_t
)
validLen
;
pSupporter
->
num
+=
(
int32_t
)
pRes
->
numOfRows
;
// query not completed, continue to retrieve tid + tag tuples
if
(
!
pRes
->
completed
)
{
...
...
@@ -775,7 +775,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
if
(
!
pRes
->
completed
)
{
taosGetTmpfilePath
(
"ts-join"
,
pSupporter
->
path
);
pSupporter
->
f
=
fopen
(
pSupporter
->
path
,
"w"
);
pRes
->
row
=
pRes
->
numOfRows
;
pRes
->
row
=
(
int32_t
)
pRes
->
numOfRows
;
taos_fetch_rows_a
(
tres
,
tsCompRetrieveCallback
,
param
);
return
;
...
...
@@ -801,7 +801,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
// TODO check for failure
pSupporter
->
f
=
fopen
(
pSupporter
->
path
,
"w"
);
pRes
->
row
=
pRes
->
numOfRows
;
pRes
->
row
=
(
int32_t
)
pRes
->
numOfRows
;
// set the callback function
pSql
->
fp
=
tscJoinQueryCallback
;
...
...
@@ -1214,7 +1214,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
getResultDataInfo
(
s
->
type
,
s
->
bytes
,
TSDB_FUNC_TID_TAG
,
0
,
&
type
,
&
bytes
,
&
inter
,
0
,
0
);
SSchema
s1
=
{.
colId
=
s
->
colId
,
.
type
=
type
,
.
bytes
=
bytes
};
SSchema
s1
=
{.
colId
=
s
->
colId
,
.
type
=
(
uint8_t
)
type
,
.
bytes
=
bytes
};
pSupporter
->
tagSize
=
s1
.
bytes
;
assert
(
isValidDataType
(
s1
.
type
)
&&
s1
.
bytes
>
0
);
...
...
@@ -1561,7 +1561,8 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
tscDebug
(
"%p sub:%p orderOfSub:%d freed, finished subqueries:%d"
,
pParentSql
,
pSql
,
trsupport
->
subqueryIndex
,
pState
->
numOfTotal
-
remain
);
return
tscFreeSubSqlObj
(
trsupport
,
pSql
);
tscFreeSubSqlObj
(
trsupport
,
pSql
);
return
;
}
// all subqueries are failed
...
...
@@ -1598,7 +1599,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
STableMetaInfo
*
pTableMetaInfo
=
pQueryInfo
->
pTableMetaInfo
[
0
];
// data in from current vnode is stored in cache and disk
uint32_t
numOfRowsFromSubquery
=
trsupport
->
pExtMemBuffer
[
idx
]
->
numOfTotalElems
+
trsupport
->
localBuffer
->
num
;
uint32_t
numOfRowsFromSubquery
=
(
uint32_t
)(
trsupport
->
pExtMemBuffer
[
idx
]
->
numOfTotalElems
+
trsupport
->
localBuffer
->
num
)
;
tscDebug
(
"%p sub:%p all data retrieved from ep:%s, vgId:%d, numOfRows:%d, orderOfSub:%d"
,
pParentSql
,
pSql
,
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
].
epAddr
[
0
].
fqdn
,
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
].
vgId
,
numOfRowsFromSubquery
,
idx
);
...
...
@@ -1616,14 +1617,16 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
if
(
tsTotalTmpDirGB
!=
0
&&
tsAvailTmpDirectorySpace
<
tsReservedTmpDirectorySpace
)
{
tscError
(
"%p sub:%p client disk space remain %.3f GB, need at least %.3f GB, stop query"
,
pParentSql
,
pSql
,
tsAvailTmpDirectorySpace
,
tsReservedTmpDirectorySpace
);
return
tscAbortFurtherRetryRetrieval
(
trsupport
,
pSql
,
TSDB_CODE_TSC_NO_DISKSPACE
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
pSql
,
TSDB_CODE_TSC_NO_DISKSPACE
);
return
;
}
// each result for a vnode is ordered as an independant list,
// then used as an input of loser tree for disk-based merge
int32_t
code
=
tscFlushTmpBuffer
(
trsupport
->
pExtMemBuffer
[
idx
],
pDesc
,
trsupport
->
localBuffer
,
pQueryInfo
->
groupbyExpr
.
orderType
);
if
(
code
!=
0
)
{
// set no disk space error info, and abort retry
return
tscAbortFurtherRetryRetrieval
(
trsupport
,
pSql
,
code
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
pSql
,
code
);
return
;
}
int32_t
remain
=
-
1
;
...
...
@@ -1631,7 +1634,8 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
tscDebug
(
"%p sub:%p orderOfSub:%d freed, finished subqueries:%d"
,
pParentSql
,
pSql
,
trsupport
->
subqueryIndex
,
pState
->
numOfTotal
-
remain
);
return
tscFreeSubSqlObj
(
trsupport
,
pSql
);
tscFreeSubSqlObj
(
trsupport
,
pSql
);
return
;
}
// all sub-queries are returned, start to local merge process
...
...
@@ -1724,7 +1728,8 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
if
(
num
>
tsMaxNumOfOrderedResults
&&
tscIsProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
tscError
(
"%p sub:%p num of OrderedRes is too many, max allowed:%"
PRId32
" , current:%"
PRId64
,
pParentSql
,
pSql
,
tsMaxNumOfOrderedResults
,
num
);
return
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_TSC_SORTED_RES_TOO_MANY
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_TSC_SORTED_RES_TOO_MANY
);
return
;
}
#ifdef _DEBUG_VIEW
...
...
@@ -1739,11 +1744,12 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
if
(
tsTotalTmpDirGB
!=
0
&&
tsAvailTmpDirectorySpace
<
tsReservedTmpDirectorySpace
)
{
tscError
(
"%p sub:%p client disk space remain %.3f GB, need at least %.3f GB, stop query"
,
pParentSql
,
pSql
,
tsAvailTmpDirectorySpace
,
tsReservedTmpDirectorySpace
);
return
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_TSC_NO_DISKSPACE
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_TSC_NO_DISKSPACE
);
return
;
}
int32_t
ret
=
saveToBuffer
(
trsupport
->
pExtMemBuffer
[
idx
],
pDesc
,
trsupport
->
localBuffer
,
pRes
->
data
,
pRes
->
numOfRows
,
pQueryInfo
->
groupbyExpr
.
orderType
);
(
int32_t
)
pRes
->
numOfRows
,
pQueryInfo
->
groupbyExpr
.
orderType
);
if
(
ret
!=
0
)
{
// set no disk space error info, and abort retry
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_TSC_NO_DISKSPACE
);
...
...
@@ -1871,7 +1877,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
// todo remove this parameter in async callback function definition.
// all data has been sent to vnode, call user function
int32_t
v
=
(
pParentObj
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
?
pParentObj
->
res
.
code
:
pParentObj
->
res
.
numOfRows
;
int32_t
v
=
(
pParentObj
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
?
pParentObj
->
res
.
code
:
(
int32_t
)
pParentObj
->
res
.
numOfRows
;
(
*
pParentObj
->
fp
)(
pParentObj
->
param
,
pParentObj
,
v
);
}
...
...
@@ -1907,7 +1913,7 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
assert
(
size
>
0
);
pSql
->
pSubs
=
calloc
(
size
,
POINTER_BYTES
);
pSql
->
numOfSubs
=
size
;
pSql
->
numOfSubs
=
(
uint16_t
)
size
;
tscDebug
(
"%p submit data to %zu vnode(s)"
,
pSql
,
size
);
...
...
@@ -1999,7 +2005,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) {
continue
;
}
numOfRes
=
MIN
(
numOfRes
,
pSql
->
pSubs
[
i
]
->
res
.
numOfRows
);
numOfRes
=
(
int32_t
)(
MIN
(
numOfRes
,
pSql
->
pSubs
[
i
]
->
res
.
numOfRows
)
);
}
int32_t
totalSize
=
tscGetResRowLength
(
pQueryInfo
->
exprList
);
...
...
@@ -2172,7 +2178,7 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) {
SArithmeticSupport
*
sas
=
(
SArithmeticSupport
*
)
calloc
(
1
,
sizeof
(
SArithmeticSupport
));
sas
->
offset
=
0
;
sas
->
pArithExpr
=
pSup
->
pArithExprInfo
;
sas
->
numOfCols
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
sas
->
numOfCols
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pQueryInfo
);
sas
->
exprList
=
pQueryInfo
->
exprList
;
sas
->
data
=
calloc
(
sas
->
numOfCols
,
POINTER_BYTES
);
...
...
src/client/src/tscSystem.c
浏览文件 @
6b085308
...
...
@@ -78,7 +78,7 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) {
return
0
;
}
void
taos_init_imp
()
{
void
taos_init_imp
(
void
)
{
char
temp
[
128
];
errno
=
TSDB_CODE_SUCCESS
;
...
...
@@ -124,9 +124,9 @@ void taos_init_imp() {
int
queueSize
=
tsMaxConnections
*
2
;
if
(
tscEmbedded
==
0
)
{
tscNumOfThreads
=
tsNumOfCores
*
tsNumOfThreadsPerCore
/
2
.
0
;
tscNumOfThreads
=
(
int
)(
tsNumOfCores
*
tsNumOfThreadsPerCore
/
2
.
0
)
;
}
else
{
tscNumOfThreads
=
tsNumOfCores
*
tsNumOfThreadsPerCore
/
4
.
0
;
tscNumOfThreads
=
(
int
)(
tsNumOfCores
*
tsNumOfThreadsPerCore
/
4
.
0
)
;
}
if
(
tscNumOfThreads
<
2
)
tscNumOfThreads
=
2
;
...
...
src/client/src/tscUtil.c
浏览文件 @
6b085308
...
...
@@ -57,7 +57,7 @@ void tsSetSTableQueryCond(STagCond* pTagCond, uint64_t uid, SBufferWriter* bw) {
SCond
cond
=
{
.
uid
=
uid
,
.
len
=
tbufTell
(
bw
),
.
len
=
(
int32_t
)(
tbufTell
(
bw
)
),
.
cond
=
NULL
,
};
...
...
@@ -481,7 +481,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
*/
pCmd
->
payloadLen
=
pDataBlock
->
size
;
assert
(
pCmd
->
allocSize
>=
pCmd
->
payloadLen
+
100
&&
pCmd
->
payloadLen
>
0
);
assert
(
pCmd
->
allocSize
>=
(
uint32_t
)(
pCmd
->
payloadLen
+
100
)
&&
pCmd
->
payloadLen
>
0
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -570,7 +570,7 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bo
SSubmitBlk
*
pBlock
=
pDataBlock
;
memcpy
(
pDataBlock
,
pTableDataBlock
->
pData
,
sizeof
(
SSubmitBlk
));
pDataBlock
+=
sizeof
(
SSubmitBlk
);
pDataBlock
=
(
char
*
)
pDataBlock
+
sizeof
(
SSubmitBlk
);
int32_t
flen
=
0
;
// original total length of row
...
...
@@ -584,7 +584,7 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bo
pCol
->
bytes
=
htons
(
pSchema
[
j
].
bytes
);
pCol
->
offset
=
0
;
pDataBlock
+=
sizeof
(
STColumn
);
pDataBlock
=
(
char
*
)
pDataBlock
+
sizeof
(
STColumn
);
flen
+=
TYPE_BYTES
[
pSchema
[
j
].
type
];
}
...
...
@@ -604,7 +604,7 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bo
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
SDataRow
trow
=
(
SDataRow
)
pDataBlock
;
dataRowSetLen
(
trow
,
TD_DATA_ROW_HEAD_SIZE
+
flen
);
dataRowSetLen
(
trow
,
(
uint16_t
)(
TD_DATA_ROW_HEAD_SIZE
+
flen
)
);
dataRowSetVersion
(
trow
,
pTableMeta
->
sversion
);
int
toffset
=
0
;
...
...
@@ -614,7 +614,7 @@ static int trimDataBlock(void* pDataBlock, STableDataBlocks* pTableDataBlock, bo
p
+=
pSchema
[
j
].
bytes
;
}
pDataBlock
+=
dataRowLen
(
trow
);
pDataBlock
=
(
char
*
)
pDataBlock
+
dataRowLen
(
trow
);
pBlock
->
dataLen
+=
dataRowLen
(
trow
);
}
...
...
@@ -667,7 +667,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, SArray* pTableDataBlockList) {
if
(
dataBuf
->
nAllocSize
<
destSize
)
{
while
(
dataBuf
->
nAllocSize
<
destSize
)
{
dataBuf
->
nAllocSize
=
dataBuf
->
nAllocSize
*
1
.
5
;
dataBuf
->
nAllocSize
=
(
uint32_t
)(
dataBuf
->
nAllocSize
*
1
.
5
)
;
}
char
*
tmp
=
realloc
(
dataBuf
->
pData
,
dataBuf
->
nAllocSize
);
...
...
@@ -759,7 +759,7 @@ int tscAllocPayload(SSqlCmd* pCmd, int size) {
if
(
pCmd
->
payload
==
NULL
)
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pCmd
->
allocSize
=
size
;
}
else
{
if
(
pCmd
->
allocSize
<
size
)
{
if
(
pCmd
->
allocSize
<
(
uint32_t
)
size
)
{
char
*
b
=
realloc
(
pCmd
->
payload
,
size
);
if
(
b
==
NULL
)
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
pCmd
->
payload
=
b
;
...
...
@@ -769,7 +769,7 @@ int tscAllocPayload(SSqlCmd* pCmd, int size) {
memset
(
pCmd
->
payload
,
0
,
pCmd
->
allocSize
);
}
assert
(
pCmd
->
allocSize
>=
size
);
assert
(
pCmd
->
allocSize
>=
(
uint32_t
)
size
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -963,7 +963,7 @@ static SSqlExpr* doBuildSqlExpr(SQueryInfo* pQueryInfo, int16_t functionId, SCol
SSqlExpr
*
tscSqlExprInsert
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
interSize
,
bool
isTagCol
)
{
int32_t
num
=
taosArrayGetSize
(
pQueryInfo
->
exprList
);
int32_t
num
=
(
int32_t
)
taosArrayGetSize
(
pQueryInfo
->
exprList
);
if
(
index
==
num
)
{
return
tscSqlExprAppend
(
pQueryInfo
,
functionId
,
pColIndex
,
type
,
size
,
interSize
,
isTagCol
);
}
...
...
@@ -1184,7 +1184,7 @@ void tscColumnListDestroy(SArray* pColumnList) {
*/
static
int32_t
validateQuoteToken
(
SSQLToken
*
pToken
)
{
strdequote
(
pToken
->
z
);
pToken
->
n
=
strtrim
(
pToken
->
z
);
pToken
->
n
=
(
uint32_t
)
strtrim
(
pToken
->
z
);
int32_t
k
=
tSQLGetToken
(
pToken
->
z
,
&
pToken
->
type
);
...
...
@@ -1207,7 +1207,7 @@ int32_t tscValidateName(SSQLToken* pToken) {
if
(
sep
==
NULL
)
{
// single part
if
(
pToken
->
type
==
TK_STRING
)
{
strdequote
(
pToken
->
z
);
pToken
->
n
=
strtrim
(
pToken
->
z
);
pToken
->
n
=
(
uint32_t
)
strtrim
(
pToken
->
z
);
int
len
=
tSQLGetToken
(
pToken
->
z
,
&
pToken
->
type
);
...
...
@@ -1232,7 +1232,7 @@ int32_t tscValidateName(SSQLToken* pToken) {
char
*
pStr
=
pToken
->
z
;
if
(
pToken
->
type
==
TK_SPACE
)
{
pToken
->
n
=
strtrim
(
pToken
->
z
);
pToken
->
n
=
(
uint32_t
)
strtrim
(
pToken
->
z
);
}
pToken
->
n
=
tSQLGetToken
(
pToken
->
z
,
&
pToken
->
type
);
...
...
@@ -1251,7 +1251,7 @@ int32_t tscValidateName(SSQLToken* pToken) {
int32_t
firstPartLen
=
pToken
->
n
;
pToken
->
z
=
sep
+
1
;
pToken
->
n
=
oldLen
-
(
sep
-
pStr
)
-
1
;
pToken
->
n
=
(
uint32_t
)(
oldLen
-
(
sep
-
pStr
)
-
1
)
;
int32_t
len
=
tSQLGetToken
(
pToken
->
z
,
&
pToken
->
type
);
if
(
len
!=
pToken
->
n
||
(
pToken
->
type
!=
TK_STRING
&&
pToken
->
type
!=
TK_ID
))
{
return
TSDB_CODE_TSC_INVALID_SQL
;
...
...
@@ -1763,7 +1763,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
uint64_t
uid
=
pTableMetaInfo
->
pTableMeta
->
id
.
uid
;
tscSqlExprCopy
(
pNewQueryInfo
->
exprList
,
pQueryInfo
->
exprList
,
uid
,
true
);
int32_t
numOfOutput
=
tscSqlExprNumOfExprs
(
pNewQueryInfo
);
int32_t
numOfOutput
=
(
int32_t
)
tscSqlExprNumOfExprs
(
pNewQueryInfo
);
if
(
numOfOutput
>
0
)
{
// todo refactor to extract method
size_t
numOfExprs
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
...
...
src/util/inc/tutil.h
浏览文件 @
6b085308
...
...
@@ -44,10 +44,10 @@ int taosCheckVersion(char *input_client_version, char *input_server_version, in
char
*
taosIpStr
(
uint32_t
ipInt
);
uint32_t
ip2uint
(
const
char
*
const
ip_addr
);
static
FORCE_INLINE
void
taosEncryptPass
(
uint8_t
*
inBuf
,
unsigned
in
t
inLen
,
char
*
target
)
{
static
FORCE_INLINE
void
taosEncryptPass
(
uint8_t
*
inBuf
,
size_
t
inLen
,
char
*
target
)
{
MD5_CTX
context
;
MD5Init
(
&
context
);
MD5Update
(
&
context
,
inBuf
,
inLen
);
MD5Update
(
&
context
,
inBuf
,
(
unsigned
int
)
inLen
);
MD5Final
(
&
context
);
memcpy
(
target
,
context
.
digest
,
TSDB_KEY_LEN
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录