Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
295eee47
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看板
未验证
提交
295eee47
编写于
1月 07, 2023
作者:
S
Shengliang Guan
提交者:
GitHub
1月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19416 from taosdata/refact/submit_req_marks
fix:ASSERT in client mode & converity error
上级
45ef1c74
ce3fbae9
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
202 addition
and
62 deletion
+202
-62
include/util/taoserror.h
include/util/taoserror.h
+2
-0
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-0
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+6
-2
source/client/src/clientHb.c
source/client/src/clientHb.c
+20
-6
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+67
-21
source/client/src/clientJniConnector.c
source/client/src/clientJniConnector.c
+5
-1
source/client/src/clientMain.c
source/client/src/clientMain.c
+31
-11
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+7
-3
source/client/src/clientRawBlockWrite.c
source/client/src/clientRawBlockWrite.c
+17
-4
source/client/src/clientSml.c
source/client/src/clientSml.c
+14
-6
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+9
-2
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+8
-2
source/client/src/clientSmlTelnet.c
source/client/src/clientSmlTelnet.c
+5
-1
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+4
-2
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+4
-1
source/util/src/terror.c
source/util/src/terror.c
+2
-0
未找到文件。
include/util/taoserror.h
浏览文件 @
295eee47
...
...
@@ -159,6 +159,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_NO_EXEC_NODE TAOS_DEF_ERROR_CODE(0, 0X022E)
#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022F)
#define TSDB_CODE_TSC_STMT_CACHE_ERROR TAOS_DEF_ERROR_CODE(0, 0X0230)
#define TSDB_CODE_TSC_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0X0231)
// mnode-common
// #define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) // 2.x
...
...
@@ -700,6 +701,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_SML_INVALID_DATA TAOS_DEF_ERROR_CODE(0, 0x3002)
#define TSDB_CODE_SML_INVALID_DB_CONF TAOS_DEF_ERROR_CODE(0, 0x3003)
#define TSDB_CODE_SML_NOT_SAME_TYPE TAOS_DEF_ERROR_CODE(0, 0x3004)
#define TSDB_CODE_SML_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x3005)
//tsma
#define TSDB_CODE_TSMA_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x3100)
...
...
source/client/inc/clientSml.h
浏览文件 @
295eee47
...
...
@@ -232,6 +232,7 @@ int32_t smlClearForRerun(SSmlHandle *info);
int32_t
smlParseValue
(
SSmlKv
*
pVal
,
SSmlMsgBuf
*
msg
);
uint8_t
smlGetTimestampLen
(
int64_t
num
);
void
clearColValArray
(
SArray
*
pCols
);
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
);
int32_t
smlParseInfluxString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
int32_t
smlParseTelnetString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
...
...
source/client/src/clientEnv.c
浏览文件 @
295eee47
...
...
@@ -62,7 +62,10 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) {
static
void
deregisterRequest
(
SRequestObj
*
pRequest
)
{
const
static
int64_t
SLOW_QUERY_INTERVAL
=
3000000L
;
// todo configurable
assert
(
pRequest
!=
NULL
);
if
(
pRequest
==
NULL
){
tscError
(
"pRequest == NULL"
);
return
;
}
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
...
...
@@ -412,7 +415,8 @@ void taos_init_imp(void) {
initQueryModuleMsgHandle
();
if
(
taosConvInit
()
!=
0
)
{
ASSERTS
(
0
,
"failed to init conv"
);
tscError
(
"failed to init conv"
);
return
;
}
rpcInit
();
...
...
source/client/src/clientHb.c
浏览文件 @
295eee47
...
...
@@ -376,7 +376,6 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
desc
.
subPlanNum
=
0
;
}
desc
.
subPlanNum
=
taosArrayGetSize
(
desc
.
subDesc
);
ASSERT
(
desc
.
subPlanNum
==
taosArrayGetSize
(
desc
.
subDesc
));
}
else
{
desc
.
subDesc
=
NULL
;
}
...
...
@@ -813,7 +812,10 @@ static void hbStopThread() {
}
SAppHbMgr
*
appHbMgrInit
(
SAppInstInfo
*
pAppInstInfo
,
char
*
key
)
{
hbMgrInit
();
if
(
hbMgrInit
()
!=
0
){
terrno
=
TSDB_CODE_TSC_INTERNAL_ERROR
;
return
NULL
;
}
SAppHbMgr
*
pAppHbMgr
=
taosMemoryMalloc
(
sizeof
(
SAppHbMgr
));
if
(
pAppHbMgr
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -899,16 +901,28 @@ int hbMgrInit() {
TdThreadMutexAttr
attr
=
{
0
};
int
ret
=
taosThreadMutexAttrInit
(
&
attr
);
assert
(
ret
==
0
);
if
(
ret
!=
0
){
uError
(
"hbMgrInit:taosThreadMutexAttrInit error"
)
return
ret
;
}
ret
=
taosThreadMutexAttrSetType
(
&
attr
,
PTHREAD_MUTEX_RECURSIVE
);
assert
(
ret
==
0
);
if
(
ret
!=
0
){
uError
(
"hbMgrInit:taosThreadMutexAttrSetType error"
)
return
ret
;
}
ret
=
taosThreadMutexInit
(
&
clientHbMgr
.
lock
,
&
attr
);
assert
(
ret
==
0
);
if
(
ret
!=
0
){
uError
(
"hbMgrInit:taosThreadMutexInit error"
)
return
ret
;
}
ret
=
taosThreadMutexAttrDestroy
(
&
attr
);
assert
(
ret
==
0
);
if
(
ret
!=
0
){
uError
(
"hbMgrInit:taosThreadMutexAttrDestroy error"
)
return
ret
;
}
// init handle funcs
hbMgrInitHandle
();
...
...
source/client/src/clientImpl.c
浏览文件 @
295eee47
...
...
@@ -452,7 +452,10 @@ int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArra
}
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SSchema
*
pSchema
,
int32_t
numOfCols
)
{
ASSERT
(
pSchema
!=
NULL
&&
numOfCols
>
0
);
if
(
pResInfo
==
NULL
||
pSchema
==
NULL
||
numOfCols
<=
0
){
tscError
(
"invalid paras, pResInfo == NULL || pSchema == NULL || numOfCols <= 0"
);
return
;
}
pResInfo
->
numOfCols
=
numOfCols
;
if
(
pResInfo
->
fields
!=
NULL
)
{
...
...
@@ -463,7 +466,10 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t
}
pResInfo
->
fields
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
TAOS_FIELD
));
pResInfo
->
userFields
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
TAOS_FIELD
));
ASSERT
(
numOfCols
==
pResInfo
->
numOfCols
);
if
(
numOfCols
!=
pResInfo
->
numOfCols
){
tscError
(
"numOfCols:%d != pResInfo->numOfCols:%d"
,
numOfCols
,
pResInfo
->
numOfCols
);
return
;
}
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
pResInfo
->
fields
[
i
].
bytes
=
pSchema
[
i
].
bytes
;
...
...
@@ -1339,7 +1345,10 @@ int32_t doProcessMsgFromServer(void* param) {
SEpSet
*
pEpSet
=
arg
->
pEpset
;
SMsgSendInfo
*
pSendInfo
=
(
SMsgSendInfo
*
)
pMsg
->
info
.
ahandle
;
assert
(
pMsg
->
info
.
ahandle
!=
NULL
);
if
(
pMsg
->
info
.
ahandle
==
NULL
){
tscError
(
"doProcessMsgFromServer pMsg->info.ahandle == NULL"
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
STscObj
*
pTscObj
=
NULL
;
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
...
...
@@ -1352,8 +1361,10 @@ int32_t doProcessMsgFromServer(void* param) {
if
(
pSendInfo
->
requestObjRefId
!=
0
)
{
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
taosAcquireRef
(
clientReqRefPool
,
pSendInfo
->
requestObjRefId
);
if
(
pRequest
)
{
assert
(
pRequest
->
self
==
pSendInfo
->
requestObjRefId
);
if
(
pRequest
->
self
!=
pSendInfo
->
requestObjRefId
){
tscError
(
"doProcessMsgFromServer pRequest->self:%"
PRId64
" != pSendInfo->requestObjRefId:%"
PRId64
,
pRequest
->
self
,
pSendInfo
->
requestObjRefId
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
pRequest
->
metric
.
rsp
=
taosGetTimestampUs
();
pTscObj
=
pRequest
->
pTscObj
;
/*
...
...
@@ -1495,7 +1506,9 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
}
void
*
doFetchRows
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
)
{
assert
(
pRequest
!=
NULL
);
if
(
pRequest
==
NULL
){
return
NULL
;
}
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
if
(
pResultInfo
->
pData
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
numOfRows
)
{
...
...
@@ -1549,7 +1562,9 @@ static void syncFetchFn(void* param, TAOS_RES* res, int32_t numOfRows) {
}
void
*
doAsyncFetchRows
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
)
{
assert
(
pRequest
!=
NULL
);
if
(
pRequest
==
NULL
){
return
NULL
;
}
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
if
(
pResultInfo
->
pData
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
numOfRows
)
{
...
...
@@ -1613,8 +1628,10 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
char
*
pStart
=
pCol
->
offset
[
j
]
+
pCol
->
pData
;
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
p
));
ASSERT
(
len
<=
bytes
);
ASSERT
((
p
+
len
)
<
(
pResultInfo
->
convertBuf
[
i
]
+
colLength
[
i
]));
if
(
len
>
bytes
||
(
p
+
len
)
>=
(
pResultInfo
->
convertBuf
[
i
]
+
colLength
[
i
])){
tscError
(
"doConvertUCS4 error, invalid data. len:%d, bytes:%d, (p + len):%p, (pResultInfo->convertBuf[i] + colLength[i]):%p"
,
len
,
bytes
,
(
p
+
len
),
(
pResultInfo
->
convertBuf
[
i
]
+
colLength
[
i
]));
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
varDataSetLen
(
p
,
len
);
pCol
->
offset
[
j
]
=
(
p
-
pResultInfo
->
convertBuf
[
i
]);
...
...
@@ -1631,9 +1648,6 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
}
int32_t
getVersion1BlockMetaSize
(
const
char
*
p
,
int32_t
numOfCols
)
{
int32_t
cols
=
*
(
int32_t
*
)(
p
+
sizeof
(
int32_t
)
*
3
);
ASSERT
(
numOfCols
==
cols
);
return
sizeof
(
int32_t
)
+
sizeof
(
int32_t
)
+
sizeof
(
int32_t
)
*
3
+
sizeof
(
uint64_t
)
+
numOfCols
*
(
sizeof
(
int8_t
)
+
sizeof
(
int32_t
));
}
...
...
@@ -1643,6 +1657,12 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, i
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column
// length |
int32_t
cols
=
*
(
int32_t
*
)(
p
+
sizeof
(
int32_t
)
*
3
);
if
(
ASSERT
(
numOfCols
==
cols
)){
tscError
(
"estimateJsonLen error: numOfCols:%d != cols:%d"
,
numOfCols
,
cols
);
return
-
1
;
}
int32_t
len
=
getVersion1BlockMetaSize
(
p
,
numOfCols
);
int32_t
*
colLength
=
(
int32_t
*
)(
p
+
len
);
len
+=
sizeof
(
int32_t
)
*
numOfCols
;
...
...
@@ -1676,7 +1696,8 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, i
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BOOL
)
{
len
+=
(
VARSTR_HEADER_SIZE
+
5
);
}
else
{
ASSERT
(
0
);
tscError
(
"estimateJsonLen error: invalid type:%d"
,
jsonInnerType
);
return
-
1
;
}
}
}
else
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
...
...
@@ -1710,12 +1731,21 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
char
*
p
=
(
char
*
)
pResultInfo
->
pData
;
int32_t
dataLen
=
estimateJsonLen
(
pResultInfo
,
numOfCols
,
numOfRows
);
if
(
dataLen
<=
0
){
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
pResultInfo
->
convertJson
=
taosMemoryCalloc
(
1
,
dataLen
);
if
(
pResultInfo
->
convertJson
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
char
*
p1
=
pResultInfo
->
convertJson
;
int32_t
totalLen
=
0
;
int32_t
cols
=
*
(
int32_t
*
)(
p
+
sizeof
(
int32_t
)
*
3
);
if
(
ASSERT
(
numOfCols
==
cols
)){
tscError
(
"doConvertJson error: numOfCols:%d != cols:%d"
,
numOfCols
,
cols
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
int32_t
len
=
getVersion1BlockMetaSize
(
p
,
numOfCols
);
memcpy
(
p1
,
p
,
len
);
...
...
@@ -1736,8 +1766,10 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
int32_t
colLen
=
htonl
(
colLength
[
i
]);
int32_t
colLen1
=
htonl
(
colLength1
[
i
]);
ASSERT
(
colLen
<
dataLen
);
if
(
ASSERT
(
colLen
<
dataLen
)){
tscError
(
"doConvertJson error: colLen:%d >= dataLen:%d"
,
colLen
,
dataLen
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
if
(
pResultInfo
->
fields
[
i
].
type
==
TSDB_DATA_TYPE_JSON
)
{
int32_t
*
offset
=
(
int32_t
*
)
pStart
;
int32_t
*
offset1
=
(
int32_t
*
)
pStart1
;
...
...
@@ -1782,7 +1814,8 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
sprintf
(
varDataVal
(
dst
),
"%s"
,
(
*
((
char
*
)
jsonInnerData
)
==
1
)
?
"true"
:
"false"
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
{
ASSERT
(
0
);
tscError
(
"doConvertJson error: invalid type:%d"
,
jsonInnerType
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
offset1
[
j
]
=
len
;
...
...
@@ -1820,7 +1853,10 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
int32_t
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
,
bool
convertUcs4
)
{
assert
(
numOfCols
>
0
&&
pFields
!=
NULL
&&
pResultInfo
!=
NULL
);
if
(
ASSERT
(
numOfCols
>
0
&&
pFields
!=
NULL
&&
pResultInfo
!=
NULL
)){
tscError
(
"setResultDataPtr paras error"
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
if
(
numOfRows
==
0
)
{
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1849,7 +1885,10 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
int32_t
cols
=
*
(
int32_t
*
)
p
;
p
+=
sizeof
(
int32_t
);
ASSERT
(
rows
==
numOfRows
&&
cols
==
numOfCols
);
if
(
ASSERT
(
rows
==
numOfRows
&&
cols
==
numOfCols
)){
tscError
(
"setResultDataPtr paras error:rows;%d numOfRows:%d cols:%d numOfCols:%d"
,
rows
,
numOfRows
,
cols
,
numOfCols
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
int32_t
hasColumnSeg
=
*
(
int32_t
*
)
p
;
p
+=
sizeof
(
int32_t
);
...
...
@@ -1876,7 +1915,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
colLength
[
i
]
=
htonl
(
colLength
[
i
]);
if
(
colLength
[
i
]
>=
dataLen
)
{
tscError
(
"invalid colLength %d, dataLen %d"
,
colLength
[
i
],
dataLen
);
ASSERT
(
0
)
;
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
...
...
@@ -1914,7 +1953,11 @@ char* getDbOfConnection(STscObj* pObj) {
}
void
setConnectionDB
(
STscObj
*
pTscObj
,
const
char
*
db
)
{
assert
(
db
!=
NULL
&&
pTscObj
!=
NULL
);
if
(
db
==
NULL
||
pTscObj
==
NULL
){
tscError
(
"setConnectionDB para is NULL"
);
return
;
}
taosThreadMutexLock
(
&
pTscObj
->
mutex
);
tstrncpy
(
pTscObj
->
db
,
db
,
tListLen
(
pTscObj
->
db
));
taosThreadMutexUnlock
(
&
pTscObj
->
mutex
);
...
...
@@ -1932,7 +1975,10 @@ void resetConnectDB(STscObj* pTscObj) {
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
,
bool
convertUcs4
,
bool
freeAfterUse
)
{
assert
(
pResultInfo
!=
NULL
&&
pRsp
!=
NULL
);
if
(
pResultInfo
==
NULL
||
pRsp
==
NULL
){
tscError
(
"setQueryResultFromRsp paras is null"
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
if
(
freeAfterUse
)
taosMemoryFreeClear
(
pResultInfo
->
pRspMsg
);
...
...
source/client/src/clientJniConnector.c
浏览文件 @
295eee47
...
...
@@ -574,7 +574,11 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchBlockImp(JNI
TAOS_RES
*
tres
=
(
TAOS_RES
*
)
res
;
int32_t
numOfFields
=
taos_num_fields
(
tres
);
assert
(
numOfFields
>
0
);
if
(
numOfFields
<=
0
){
jniError
(
"jobj:%p, conn:%p, query interrupted. taos_num_fields error code:%d, msg:%s"
,
jobj
,
tscon
,
numOfFields
,
taos_errstr
(
tres
));
return
JNI_RESULT_SET_NULL
;
}
void
*
data
;
int32_t
numOfRows
;
...
...
source/client/src/clientMain.c
浏览文件 @
295eee47
...
...
@@ -291,7 +291,6 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
tscError
(
"invalid result passed to taos_fetch_row"
);
return
NULL
;
}
return
NULL
;
}
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
)
{
...
...
@@ -355,9 +354,13 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
case
TSDB_DATA_TYPE_NCHAR
:
{
int32_t
charLen
=
varDataLen
((
char
*
)
row
[
i
]
-
VARSTR_HEADER_SIZE
);
if
(
fields
[
i
].
type
==
TSDB_DATA_TYPE_BINARY
)
{
assert
(
charLen
<=
fields
[
i
].
bytes
&&
charLen
>=
0
);
if
(
ASSERT
(
charLen
<=
fields
[
i
].
bytes
&&
charLen
>=
0
)){
tscError
(
"taos_print_row error binary. charLen:%d, fields[i].bytes:%d"
,
charLen
,
fields
[
i
].
bytes
);
}
}
else
{
assert
(
charLen
<=
fields
[
i
].
bytes
*
TSDB_NCHAR_SIZE
&&
charLen
>=
0
);
if
(
ASSERT
(
charLen
<=
fields
[
i
].
bytes
*
TSDB_NCHAR_SIZE
&&
charLen
>=
0
)){
tscError
(
"taos_print_row error. charLen:%d, fields[i].bytes:%d"
,
charLen
,
fields
[
i
].
bytes
);
}
}
memcpy
(
str
+
len
,
row
[
i
],
charLen
);
...
...
@@ -577,7 +580,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) {
(
*
numOfRows
)
=
pResultInfo
->
numOfRows
;
return
0
;
}
else
{
ASSERT
(
0
);
tscError
(
"taos_fetch_block_s invalid res type"
);
return
-
1
;
}
}
...
...
@@ -1000,8 +1003,14 @@ static void fetchCallback(void *pResult, void *param, int32_t code) {
}
void
taos_fetch_rows_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
)
{
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
);
ASSERT
(
TD_RES_QUERY
(
res
));
if
(
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
)){
tscError
(
"taos_fetch_rows_a invalid paras"
);
return
;
}
if
(
ASSERT
(
TD_RES_QUERY
(
res
))){
tscError
(
"taos_fetch_rows_a res is NULL"
);
return
;
}
SRequestObj
*
pRequest
=
res
;
pRequest
->
body
.
fetchFp
=
fp
;
...
...
@@ -1044,9 +1053,14 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
}
void
taos_fetch_raw_block_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
)
{
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
);
ASSERT
(
TD_RES_QUERY
(
res
));
if
(
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
)){
tscError
(
"taos_fetch_rows_a invalid paras"
);
return
;
}
if
(
ASSERT
(
TD_RES_QUERY
(
res
))){
tscError
(
"taos_fetch_rows_a res is NULL"
);
return
;
}
SRequestObj
*
pRequest
=
res
;
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
...
...
@@ -1058,8 +1072,14 @@ void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
}
const
void
*
taos_get_raw_block
(
TAOS_RES
*
res
)
{
ASSERT
(
res
!=
NULL
);
ASSERT
(
TD_RES_QUERY
(
res
));
if
(
ASSERT
(
res
!=
NULL
)){
tscError
(
"taos_fetch_rows_a invalid paras"
);
return
NULL
;
}
if
(
ASSERT
(
TD_RES_QUERY
(
res
))){
tscError
(
"taos_fetch_rows_a res is NULL"
);
return
NULL
;
}
SRequestObj
*
pRequest
=
res
;
return
pRequest
->
body
.
resInfo
.
pData
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
295eee47
...
...
@@ -149,7 +149,6 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pRequest) {
pMsgSendInfo
->
msgType
=
pRequest
->
type
;
pMsgSendInfo
->
target
.
type
=
TARGET_TYPE_MNODE
;
assert
(
pRequest
!=
NULL
);
pMsgSendInfo
->
msgInfo
=
pRequest
->
body
.
requestMsg
;
pMsgSendInfo
->
fp
=
getMsgRspHandle
(
pRequest
->
type
);
return
pMsgSendInfo
;
...
...
@@ -273,7 +272,9 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
}
int32_t
processCreateSTableRsp
(
void
*
param
,
SDataBuf
*
pMsg
,
int32_t
code
)
{
assert
(
pMsg
!=
NULL
&&
param
!=
NULL
);
if
(
pMsg
==
NULL
||
param
==
NULL
){
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
SRequestObj
*
pRequest
=
param
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -454,7 +455,10 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) {
(
*
pRsp
)
->
numOfCols
=
htonl
(
SHOW_VARIABLES_RESULT_COLS
);
int32_t
len
=
blockEncode
(
pBlock
,
(
*
pRsp
)
->
data
,
SHOW_VARIABLES_RESULT_COLS
);
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
if
(
len
!=
rspSize
-
sizeof
(
SRetrieveTableRsp
)){
uError
(
"buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%"
PRIu64
,
len
,
(
uint64_t
)
(
rspSize
-
sizeof
(
SRetrieveTableRsp
)));
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
...
...
source/client/src/clientRawBlockWrite.c
浏览文件 @
295eee47
...
...
@@ -373,7 +373,10 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) {
}
static
char
*
processAutoCreateTable
(
STaosxRsp
*
rsp
)
{
ASSERT
(
rsp
->
createTableNum
!=
0
);
if
(
rsp
->
createTableNum
<=
0
){
uError
(
"WriteRaw:processAutoCreateTable rsp->createTableNum <= 0"
);
goto
_exit
;
}
SDecoder
*
decoder
=
taosMemoryCalloc
(
rsp
->
createTableNum
,
sizeof
(
SDecoder
));
SVCreateTbReq
*
pCreateReq
=
taosMemoryCalloc
(
rsp
->
createTableNum
,
sizeof
(
SVCreateTbReq
));
...
...
@@ -389,7 +392,10 @@ static char* processAutoCreateTable(STaosxRsp* rsp) {
goto
_exit
;
}
ASSERT
(
pCreateReq
[
iReq
].
type
==
TSDB_CHILD_TABLE
);
if
(
pCreateReq
[
iReq
].
type
!=
TSDB_CHILD_TABLE
){
uError
(
"WriteRaw:processAutoCreateTable pCreateReq[iReq].type != TSDB_CHILD_TABLE"
);
goto
_exit
;
}
}
string
=
buildCreateCTableJson
(
pCreateReq
,
rsp
->
createTableNum
);
...
...
@@ -494,7 +500,10 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) {
char
*
buf
=
NULL
;
if
(
vAlterTbReq
.
tagType
==
TSDB_DATA_TYPE_JSON
)
{
ASSERT
(
tTagIsJson
(
vAlterTbReq
.
pTagVal
)
==
true
);
if
(
!
tTagIsJson
(
vAlterTbReq
.
pTagVal
)){
uError
(
"processAlterTable isJson false"
);
goto
_exit
;
}
buf
=
parseTagDatatoJson
(
vAlterTbReq
.
pTagVal
);
}
else
{
buf
=
taosMemoryCalloc
(
vAlterTbReq
.
nTagVal
+
1
,
1
);
...
...
@@ -1610,7 +1619,11 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
goto
end
;
}
ASSERT
(
pCreateReq
.
type
==
TSDB_CHILD_TABLE
);
if
(
pCreateReq
.
type
!=
TSDB_CHILD_TABLE
){
uError
(
"WriteRaw:pCreateReq.type != TSDB_CHILD_TABLE. table name: %s"
,
tbName
);
code
=
TSDB_CODE_TSC_INVALID_VALUE
;
goto
end
;
}
if
(
strcmp
(
tbName
,
pCreateReq
.
name
)
==
0
)
{
strcpy
(
pName
.
tname
,
pCreateReq
.
ctb
.
stbName
);
tDecoderClear
(
&
decoderTmp
);
...
...
source/client/src/clientSml.c
浏览文件 @
295eee47
...
...
@@ -523,7 +523,10 @@ STableMeta *smlGetMeta(SSmlHandle *info, const void *measure, int32_t measureLen
memset
(
pName
.
tname
,
0
,
TSDB_TABLE_NAME_LEN
);
memcpy
(
pName
.
tname
,
measure
,
measureLen
);
catalogGetSTableMeta
(
info
->
pCatalog
,
&
conn
,
&
pName
,
&
pTableMeta
);
int32_t
code
=
catalogGetSTableMeta
(
info
->
pCatalog
,
&
conn
,
&
pName
,
&
pTableMeta
);
if
(
code
!=
TSDB_CODE_SUCCESS
){
return
NULL
;
}
return
pTableMeta
;
}
...
...
@@ -996,7 +999,10 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
}
}
else
{
size_t
tmp
=
taosArrayGetSize
(
metaArray
);
ASSERT
(
tmp
<=
INT16_MAX
);
if
(
tmp
>
INT16_MAX
){
uError
(
"too many cols or tags"
);
return
-
1
;
}
int16_t
size
=
tmp
;
int
ret
=
taosHashPut
(
metaHash
,
kv
->
key
,
kv
->
keyLen
,
&
size
,
SHORT_BYTES
);
if
(
ret
==
0
)
{
...
...
@@ -1008,7 +1014,7 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
return
TSDB_CODE_SUCCESS
;
}
static
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
)
{
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
)
{
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
tag
->
cols
);
i
++
)
{
SHashObj
*
kvHash
=
(
SHashObj
*
)
taosArrayGetP
(
tag
->
cols
,
i
);
taosHashCleanup
(
kvHash
);
...
...
@@ -1229,7 +1235,10 @@ static int32_t smlInsertData(SSmlHandle *info) {
SSmlSTableMeta
*
pMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
tableData
->
sTableName
,
tableData
->
sTableNameLen
,
NULL
);
ASSERT
(
NULL
!=
pMeta
);
if
(
unlikely
(
NULL
==
pMeta
||
NULL
==
pMeta
->
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == pMeta. table name: %s"
,
info
->
id
,
tableData
->
childTableName
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
// use tablemeta of stable to save vgid and uid of child table
pMeta
->
tableMeta
->
vgId
=
vg
.
vgId
;
...
...
@@ -1365,9 +1374,8 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
}
else
{
code
=
smlParseTelnetString
(
info
,
(
char
*
)
tmp
,
(
char
*
)
tmp
+
len
,
info
->
lines
+
i
);
}
}
else
{
ASSERT
(
0
)
;
code
=
TSDB_CODE_SML_INVALID_PROTOCOL_TYPE
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" smlParseLine failed. line %d : %s"
,
info
->
id
,
i
,
tmp
);
...
...
source/client/src/clientSmlJson.c
浏览文件 @
295eee47
...
...
@@ -143,7 +143,10 @@ while(*(start)){\
// if(unlikely(kv.length > preKV->length)){
// preKV->length = kv.length;
// SSmlSTableMeta *tableMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL);
// ASSERT(tableMeta != NULL);
// if(unlikely(NULL == tableMeta)){
// uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id);
// return TSDB_CODE_SML_INTERNAL_ERROR;
// }
//
// SSmlKv *oldKV = (SSmlKv *)taosArrayGet(tableMeta->tags, cnt);
// oldKV->length = kv.length;
...
...
@@ -723,7 +726,10 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
if
(
unlikely
(
kv
.
length
>
maxKV
->
length
)){
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
if
(
unlikely
(
NULL
==
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
(
tableMeta
->
tags
,
cnt
);
oldKV
->
length
=
kv
.
length
;
...
...
@@ -780,6 +786,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlDestroyTableInfo
(
info
,
tinfo
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
...
...
source/client/src/clientSmlLine.c
浏览文件 @
295eee47
...
...
@@ -259,7 +259,10 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
if
(
unlikely
(
kv
.
length
>
maxKV
->
length
)){
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
if
(
unlikely
(
NULL
==
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
(
tableMeta
->
tags
,
cnt
);
oldKV
->
length
=
kv
.
length
;
...
...
@@ -484,7 +487,10 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
if
(
unlikely
(
IS_VAR_DATA_TYPE
(
kv
.
type
)
&&
kv
.
length
>
maxKV
->
length
)){
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
if
(
unlikely
(
NULL
==
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
(
tableMeta
->
cols
,
cnt
);
oldKV
->
length
=
kv
.
length
;
...
...
source/client/src/clientSmlTelnet.c
浏览文件 @
295eee47
...
...
@@ -184,7 +184,10 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
if
(
unlikely
(
kv
.
length
>
maxKV
->
length
)){
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
if
(
unlikely
(
NULL
==
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
(
tableMeta
->
tags
,
cnt
);
oldKV
->
length
=
kv
.
length
;
...
...
@@ -240,6 +243,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlDestroyTableInfo
(
info
,
tinfo
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
...
...
source/client/src/clientStmt.c
浏览文件 @
295eee47
...
...
@@ -296,7 +296,6 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool deepClean) {
STableMeta
*
pMeta
=
qGetTableMetaInDataBlock
(
pBlocks
);
if
(
keepTable
&&
pBlocks
==
pStmt
->
exec
.
pCurrBlock
)
{
ASSERT
(
NULL
==
pBlocks
->
pData
);
TSWAP
(
pBlocks
->
pData
,
pStmt
->
exec
.
pCurrTbData
);
STMT_ERR_RET
(
qResetStmtDataBlock
(
pBlocks
,
false
));
...
...
@@ -394,7 +393,10 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
if
(
NULL
==
pStmt
->
sql
.
pTableCache
||
taosHashGetSize
(
pStmt
->
sql
.
pTableCache
)
<=
0
)
{
if
(
pStmt
->
bInfo
.
inExecCache
)
{
ASSERT
(
taosHashGetSize
(
pStmt
->
exec
.
pBlockHash
)
==
1
);
if
(
ASSERT
(
taosHashGetSize
(
pStmt
->
exec
.
pBlockHash
)
==
1
)){
tscError
(
"stmtGetFromCache error"
);
return
TSDB_CODE_TSC_STMT_CACHE_ERROR
;
}
pStmt
->
bInfo
.
needParse
=
false
;
tscDebug
(
"reuse stmt block for tb %s in execBlock"
,
pStmt
->
bInfo
.
tbFName
);
return
TSDB_CODE_SUCCESS
;
...
...
source/client/src/clientTmq.c
浏览文件 @
295eee47
...
...
@@ -418,7 +418,10 @@ int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) {
static
void
tmqCommitRspCountDown
(
SMqCommitCbParamSet
*
pParamSet
)
{
int32_t
waitingRspNum
=
atomic_sub_fetch_32
(
&
pParamSet
->
waitingRspNum
,
1
);
ASSERT
(
waitingRspNum
>=
0
);
if
(
ASSERT
(
waitingRspNum
>=
0
)){
tscError
(
"tmqCommitRspCountDown error:%d"
,
waitingRspNum
);
return
;
}
if
(
waitingRspNum
==
0
)
{
tmqCommitDone
(
pParamSet
);
}
...
...
source/util/src/terror.c
浏览文件 @
295eee47
...
...
@@ -138,6 +138,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_QUERY_KILLED, "Query killed")
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_NO_EXEC_NODE
,
"No available execution node in current query policy configuration"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_NOT_STABLE_ERROR
,
"Table is not a super table"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_STMT_CACHE_ERROR
,
"Stmt cache error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INTERNAL_ERROR
,
"Internal error"
)
// mnode-common
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_RIGHTS
,
"Insufficient privilege for operation"
)
...
...
@@ -578,6 +579,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SML_INVALID_PRECISION_TYPE, "Invalid timestamp p
TAOS_DEFINE_ERROR
(
TSDB_CODE_SML_INVALID_DATA
,
"Invalid data format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SML_INVALID_DB_CONF
,
"Invalid schemaless db config"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SML_NOT_SAME_TYPE
,
"Not the same type like before"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SML_INTERNAL_ERROR
,
"Internal error"
)
//tsma
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSMA_INIT_FAILED
,
"Tsma init failed"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录