Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
~笨蛋陪你哭
TDengine
提交
7e2abf0e
T
TDengine
项目概览
~笨蛋陪你哭
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7e2abf0e
编写于
6月 06, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-527] Group error codes by module
上级
0d18e577
变更
61
展开全部
隐藏空白更改
内联
并排
Showing
61 changed file
with
896 addition
and
870 deletion
+896
-870
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+1
-1
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+17
-17
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+2
-2
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+4
-4
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+20
-20
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+20
-20
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+106
-106
src/client/src/tscSecondaryMerge.c
src/client/src/tscSecondaryMerge.c
+11
-11
src/client/src/tscServer.c
src/client/src/tscServer.c
+51
-51
src/client/src/tscSql.c
src/client/src/tscSql.c
+28
-28
src/client/src/tscStream.c
src/client/src/tscStream.c
+6
-6
src/client/src/tscSub.c
src/client/src/tscSub.c
+3
-3
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+19
-19
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+25
-25
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-1
src/dnode/src/dnodeMPeer.c
src/dnode/src/dnodeMPeer.c
+2
-2
src/dnode/src/dnodeMRead.c
src/dnode/src/dnodeMRead.c
+3
-3
src/dnode/src/dnodeMWrite.c
src/dnode/src/dnodeMWrite.c
+3
-3
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+3
-3
src/dnode/src/dnodePeer.c
src/dnode/src/dnodePeer.c
+3
-3
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+3
-3
src/dnode/src/dnodeVRead.c
src/dnode/src/dnodeVRead.c
+3
-3
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+1
-1
src/inc/taoserror.h
src/inc/taoserror.h
+164
-129
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+1
-1
src/mnode/src/mnodeAcct.c
src/mnode/src/mnodeAcct.c
+1
-1
src/mnode/src/mnodeBalance.c
src/mnode/src/mnodeBalance.c
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+40
-40
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+17
-17
src/mnode/src/mnodeInt.c
src/mnode/src/mnodeInt.c
+1
-1
src/mnode/src/mnodeMnode.c
src/mnode/src/mnodeMnode.c
+7
-7
src/mnode/src/mnodePeer.c
src/mnode/src/mnodePeer.c
+3
-3
src/mnode/src/mnodeProfile.c
src/mnode/src/mnodeProfile.c
+12
-12
src/mnode/src/mnodeRead.c
src/mnode/src/mnodeRead.c
+3
-3
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+3
-3
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+11
-11
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+75
-75
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+22
-22
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+12
-12
src/mnode/src/mnodeWrite.c
src/mnode/src/mnodeWrite.c
+4
-4
src/plugins/http/src/httpJson.c
src/plugins/http/src/httpJson.c
+2
-2
src/plugins/http/src/httpSql.c
src/plugins/http/src/httpSql.c
+3
-3
src/plugins/http/src/tgJson.c
src/plugins/http/src/tgJson.c
+2
-2
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+19
-25
src/query/src/qast.c
src/query/src/qast.c
+3
-3
src/query/src/qresultBuf.c
src/query/src/qresultBuf.c
+5
-5
src/query/src/tlosertree.c
src/query/src/tlosertree.c
+1
-1
src/query/tests/unitTest.cpp
src/query/tests/unitTest.cpp
+52
-52
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+41
-41
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+11
-12
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+6
-6
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+8
-8
src/util/src/tbuffer.c
src/util/src/tbuffer.c
+3
-3
src/util/src/tqueue.c
src/util/src/tqueue.c
+2
-2
src/util/src/tutil.c
src/util/src/tutil.c
+3
-3
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+11
-11
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+4
-4
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+3
-3
tests/examples/C#/TDengineDriver.cs
tests/examples/C#/TDengineDriver.cs
+0
-2
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+4
-4
未找到文件。
src/client/src/TSDBJNIConnector.c
浏览文件 @
7e2abf0e
...
...
@@ -309,7 +309,7 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getErrCodeImp(JNI
TAOS
*
tscon
=
(
TAOS
*
)
con
;
if
(
tscon
==
NULL
)
{
jniError
(
"jobj:%p, connection is closed"
,
jobj
);
return
(
jint
)
TSDB_CODE_INVALID_CONNECTION
;
return
(
jint
)
TSDB_CODE_
TSC_
INVALID_CONNECTION
;
}
if
((
void
*
)
tres
==
NULL
)
{
...
...
src/client/src/tscAsync.c
浏览文件 @
7e2abf0e
...
...
@@ -53,7 +53,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
sem_init
(
&
pSql
->
rspSem
,
0
,
0
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
tscError
(
"failed to malloc payload"
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
CLI
_OUT_OF_MEMORY
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC
_OUT_OF_MEMORY
);
return
;
}
...
...
@@ -61,7 +61,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
pSql
->
sqlstr
=
calloc
(
1
,
sqlLen
+
1
);
if
(
pSql
->
sqlstr
==
NULL
)
{
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
CLI
_OUT_OF_MEMORY
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC
_OUT_OF_MEMORY
);
free
(
pCmd
->
payload
);
return
;
}
...
...
@@ -73,7 +73,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const
tscDump
(
"%p SQL: %s"
,
pSql
,
pSql
->
sqlstr
);
int32_t
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
return
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pSql
->
res
.
code
=
code
;
...
...
@@ -89,16 +89,16 @@ void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *pa
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
tscError
(
"bug!!! pObj:%p"
,
pObj
);
terrno
=
TSDB_CODE_DISCONNECTED
;
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_DISCONNECTED
);
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC_
DISCONNECTED
);
return
;
}
int32_t
sqlLen
=
strlen
(
sqlstr
);
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
tscError
(
"sql string exceeds max length:%d"
,
tsMaxSQLStringLen
);
terrno
=
TSDB_CODE_INVALID_SQL
;
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_INVALID_SQL
);
terrno
=
TSDB_CODE_
TSC_
INVALID_SQL
;
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC_
INVALID_SQL
);
return
;
}
...
...
@@ -107,8 +107,8 @@ void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *pa
SSqlObj
*
pSql
=
(
SSqlObj
*
)
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
pSql
==
NULL
)
{
tscError
(
"failed to malloc sqlObj"
);
terrno
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
CLI
_OUT_OF_MEMORY
);
terrno
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC
_OUT_OF_MEMORY
);
return
;
}
...
...
@@ -203,7 +203,7 @@ void taos_fetch_rows_a(TAOS_RES *taosa, void (*fp)(void *, TAOS_RES *, int), voi
SSqlObj
*
pSql
=
(
SSqlObj
*
)
taosa
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
tscError
(
"sql object is NULL"
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_DISCONNECTED
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC_
DISCONNECTED
);
return
;
}
...
...
@@ -212,7 +212,7 @@ void taos_fetch_rows_a(TAOS_RES *taosa, void (*fp)(void *, TAOS_RES *, int), voi
if
(
pRes
->
qhandle
==
0
)
{
tscError
(
"qhandle is NULL"
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_INVALID_QHANDLE
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC_
INVALID_QHANDLE
);
return
;
}
...
...
@@ -260,7 +260,7 @@ void taos_fetch_row_a(TAOS_RES *taosa, void (*fp)(void *, TAOS_RES *, TAOS_ROW),
SSqlObj
*
pSql
=
(
SSqlObj
*
)
taosa
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
tscError
(
"sql object is NULL"
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_DISCONNECTED
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC_
DISCONNECTED
);
return
;
}
...
...
@@ -269,7 +269,7 @@ void taos_fetch_row_a(TAOS_RES *taosa, void (*fp)(void *, TAOS_RES *, TAOS_ROW),
if
(
pRes
->
qhandle
==
0
)
{
tscError
(
"qhandle is NULL"
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_INVALID_QHANDLE
);
tscQueueAsyncError
(
fp
,
param
,
TSDB_CODE_
TSC_
INVALID_QHANDLE
);
return
;
}
...
...
@@ -466,7 +466,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
code
=
tscGetSTableVgroupInfo
(
pSql
,
0
);
pRes
->
code
=
code
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
return
;
}
else
{
// normal async query continues
if
(
pCmd
->
parseFinished
)
{
tscTrace
(
"%p re-send data to vnode in table Meta callback since sql parsed completed"
,
pSql
);
...
...
@@ -491,7 +491,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
return
;
}
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
return
;
}
}
...
...
@@ -500,13 +500,13 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
code
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
pRes
->
code
=
code
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_SUCCESS
&&
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
code
=
tscGetSTableVgroupInfo
(
pSql
,
pCmd
->
clauseIndex
);
pRes
->
code
=
code
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
return
;
}
}
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
7e2abf0e
...
...
@@ -156,7 +156,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
int16_t
*
bytes
,
int32_t
*
interBytes
,
int16_t
extLength
,
bool
isSuperTable
)
{
if
(
!
isValidDataType
(
dataType
,
dataBytes
))
{
tscError
(
"Illegal data type %d or data type length %d"
,
dataType
,
dataBytes
);
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
if
(
functionId
==
TSDB_FUNC_TS
||
functionId
==
TSDB_FUNC_TS_DUMMY
||
functionId
==
TSDB_FUNC_TAG_DUMMY
||
...
...
@@ -325,7 +325,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*
bytes
=
(
int16_t
)
dataBytes
;
*
interBytes
=
dataBytes
+
sizeof
(
SLastrowInfo
);
}
else
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
return
TSDB_CODE_SUCCESS
;
...
...
src/client/src/tscLocal.c
浏览文件 @
7e2abf0e
...
...
@@ -312,12 +312,12 @@ static void tscProcessServStatus(SSqlObj *pSql) {
STscObj
*
pObj
=
pSql
->
pTscObj
;
if
(
pObj
->
pHb
!=
NULL
)
{
if
(
pObj
->
pHb
->
res
.
code
==
TSDB_CODE_NETWORK_UNAVAIL
)
{
pSql
->
res
.
code
=
TSDB_CODE_NETWORK_UNAVAIL
;
if
(
pObj
->
pHb
->
res
.
code
==
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
)
{
pSql
->
res
.
code
=
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
;
return
;
}
}
else
{
if
(
pSql
->
res
.
code
==
TSDB_CODE_NETWORK_UNAVAIL
)
{
if
(
pSql
->
res
.
code
==
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
)
{
return
;
}
}
...
...
@@ -378,7 +378,7 @@ int tscProcessLocalCmd(SSqlObj *pSql) {
}
else
if
(
pCmd
->
command
==
TSDB_SQL_SERV_STATUS
)
{
tscProcessServStatus
(
pSql
);
}
else
{
pSql
->
res
.
code
=
TSDB_CODE_INVALID_SQL
;
pSql
->
res
.
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
tscError
(
"%p not support command:%d"
,
pSql
,
pCmd
->
command
);
}
...
...
src/client/src/tscParseInsert.c
浏览文件 @
7e2abf0e
...
...
@@ -134,7 +134,7 @@ int tsParseTime(SSQLToken *pToken, int64_t *time, char **next, char *error, int1
}
if
(
getTimestampInUsFromStr
(
valueToken
.
z
,
valueToken
.
n
,
&
interval
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
if
(
timePrec
==
TSDB_TIME_PRECISION_MILLI
)
{
...
...
@@ -423,7 +423,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
}
strcpy
(
error
,
"client out of memory"
);
*
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
*
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
@@ -431,7 +431,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
if
((
type
!=
TK_NOW
&&
type
!=
TK_INTEGER
&&
type
!=
TK_STRING
&&
type
!=
TK_FLOAT
&&
type
!=
TK_BOOL
&&
type
!=
TK_NULL
&&
type
!=
TK_HEX
&&
type
!=
TK_OCT
&&
type
!=
TK_BIN
)
||
(
sToken
.
n
==
0
)
||
(
type
==
TK_RP
))
{
tscInvalidSQLErrMsg
(
error
,
"invalid data or symbol"
,
sToken
.
z
);
*
code
=
TSDB_CODE_INVALID_SQL
;
*
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
return
-
1
;
}
...
...
@@ -463,13 +463,13 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[
bool
isPrimaryKey
=
(
colIndex
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
);
int32_t
ret
=
tsParseOneColumnData
(
pSchema
,
&
sToken
,
start
,
error
,
str
,
isPrimaryKey
,
timePrec
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
*
code
=
TSDB_CODE_INVALID_SQL
;
*
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
return
-
1
;
// NOTE: here 0 mean error!
}
if
(
isPrimaryKey
&&
tsCheckTimestamp
(
pDataBlocks
,
start
)
!=
TSDB_CODE_SUCCESS
)
{
tscInvalidSQLErrMsg
(
error
,
"client time/server time can not be mixed up"
,
sToken
.
z
);
*
code
=
TSDB_CODE_INVALID_TIME_STAMP
;
*
code
=
TSDB_CODE_
TSC_
INVALID_TIME_STAMP
;
return
-
1
;
}
}
...
...
@@ -526,7 +526,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, STableMeta *pTableMe
if
(
spd
->
hasVal
[
0
]
==
false
)
{
strcpy
(
error
,
"primary timestamp column can not be null"
);
*
code
=
TSDB_CODE_INVALID_SQL
;
*
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
return
-
1
;
}
...
...
@@ -560,7 +560,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, STableMeta *pTableMe
*
str
+=
index
;
if
(
sToken
.
n
==
0
||
sToken
.
type
!=
TK_RP
)
{
tscInvalidSQLErrMsg
(
error
,
") expected"
,
*
str
);
*
code
=
TSDB_CODE_INVALID_SQL
;
*
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
return
-
1
;
}
...
...
@@ -569,7 +569,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, STableMeta *pTableMe
if
(
numOfRows
<=
0
)
{
strcpy
(
error
,
"no any data points"
);
*
code
=
TSDB_CODE_INVALID_SQL
;
*
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
return
-
1
;
}
else
{
return
numOfRows
;
...
...
@@ -611,7 +611,7 @@ int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int3
// do nothing, if allocate more memory failed
pDataBlock
->
nAllocSize
=
nAllocSizeOld
;
*
numOfRows
=
(
int32_t
)(
pDataBlock
->
nAllocSize
-
pDataBlock
->
headerSize
)
/
rowSize
;
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
}
...
...
@@ -687,13 +687,13 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableList, char **st
int32_t
maxNumOfRows
;
ret
=
tscAllocateMemIfNeed
(
dataBuf
,
tinfo
.
rowSize
,
&
maxNumOfRows
);
if
(
TSDB_CODE_SUCCESS
!=
ret
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
int32_t
code
=
TSDB_CODE_INVALID_SQL
;
int32_t
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
char
*
tmpTokenBuf
=
calloc
(
1
,
4096
);
// used for deleting Escape character: \\, \', \"
if
(
NULL
==
tmpTokenBuf
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
int32_t
numOfRows
=
tsParseValues
(
str
,
dataBuf
,
pTableMeta
,
maxNumOfRows
,
spd
,
pCmd
->
payload
,
&
code
,
tmpTokenBuf
);
...
...
@@ -772,7 +772,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
}
if
(
numOfColList
==
0
&&
cstart
!=
NULL
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
TABLE_INDEX
);
...
...
@@ -954,7 +954,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
createTable
=
true
;
code
=
tscGetMeterMetaEx
(
pSql
,
pTableMetaInfo
,
true
);
if
(
TSDB_CODE_ACTION_IN_PROGRESS
==
code
)
{
if
(
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
==
code
)
{
return
code
;
}
...
...
@@ -967,7 +967,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
code
=
tscGetMeterMetaEx
(
pSql
,
pTableMetaInfo
,
false
);
if
(
pCmd
->
curSql
==
NULL
)
{
assert
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
);
assert
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
);
}
}
...
...
@@ -981,7 +981,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
}
if
(
*
sqlstr
==
NULL
)
{
code
=
TSDB_CODE_INVALID_SQL
;
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
}
return
code
;
...
...
@@ -1046,7 +1046,7 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
pSql
->
cmd
.
pDataBlocks
=
tscCreateBlockArrayList
();
if
(
NULL
==
pCmd
->
pTableList
||
NULL
==
pSql
->
cmd
.
pDataBlocks
)
{
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
goto
_error_clean
;
}
}
else
{
...
...
@@ -1075,7 +1075,7 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
* Otherwise, create the first submit block and submit to virtual node.
*/
if
(
totalNum
==
0
)
{
code
=
TSDB_CODE_INVALID_SQL
;
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
goto
_error_clean
;
}
else
{
break
;
...
...
@@ -1103,7 +1103,7 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
* And during the getMeterMetaCallback function, the sql string will be parsed from the
* interrupted position.
*/
if
(
TSDB_CODE_ACTION_IN_PROGRESS
==
code
)
{
if
(
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
==
code
)
{
tscTrace
(
"%p waiting for get table meta during insert, then resume from offset: %"
PRId64
" , %s"
,
pSql
,
pos
,
pCmd
->
curSql
);
return
code
;
...
...
@@ -1297,7 +1297,7 @@ _clean:
int
tsParseInsertSql
(
SSqlObj
*
pSql
)
{
if
(
!
pSql
->
pTscObj
->
writeAuth
)
{
return
TSDB_CODE_
NO_RIGHTS
;
return
TSDB_CODE_
TSC_NO_WRITE_AUTH
;
}
int32_t
index
=
0
;
...
...
src/client/src/tscPrepare.c
浏览文件 @
7e2abf0e
...
...
@@ -62,7 +62,7 @@ static int normalStmtAddPart(SNormalStmt* stmt, bool isParam, char* str, uint32_
size
*=
2
;
void
*
tmp
=
realloc
(
stmt
->
parts
,
sizeof
(
SNormalStmtPart
)
*
size
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
stmt
->
sizeParts
=
size
;
stmt
->
parts
=
(
SNormalStmtPart
*
)
tmp
;
...
...
@@ -133,7 +133,7 @@ static int normalStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_NCHAR
:
var
->
pz
=
(
char
*
)
malloc
((
*
tb
->
length
)
+
1
);
if
(
var
->
pz
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
memcpy
(
var
->
pz
,
tb
->
buffer
,
(
*
tb
->
length
));
var
->
pz
[
*
tb
->
length
]
=
0
;
...
...
@@ -142,7 +142,7 @@ static int normalStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) {
default:
tscTrace
(
"param %d: type mismatch or invalid"
,
i
);
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
}
...
...
@@ -187,7 +187,7 @@ static int normalStmtPrepare(STscStmt* stmt) {
if
(
normal
->
numParams
>
0
)
{
normal
->
params
=
calloc
(
normal
->
numParams
,
sizeof
(
tVariant
));
if
(
normal
->
params
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
}
...
...
@@ -273,7 +273,7 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
}
if
(
bind
->
buffer_type
!=
param
->
type
)
{
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
short
size
=
0
;
...
...
@@ -300,7 +300,7 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_BINARY
:
if
((
*
bind
->
length
)
>
param
->
bytes
)
{
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
size
=
(
short
)
*
bind
->
length
;
STR_WITH_SIZE_TO_VARSTR
(
data
+
param
->
offset
,
bind
->
buffer
,
size
);
...
...
@@ -309,14 +309,14 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_NCHAR
:
{
size_t
output
=
0
;
if
(
!
taosMbsToUcs4
(
bind
->
buffer
,
*
bind
->
length
,
varDataVal
(
data
+
param
->
offset
),
param
->
bytes
-
VARSTR_HEADER_SIZE
,
&
output
))
{
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
varDataSetLen
(
data
+
param
->
offset
,
output
);
return
TSDB_CODE_SUCCESS
;
}
default:
assert
(
false
);
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
memcpy
(
data
+
param
->
offset
,
bind
->
buffer
,
size
);
...
...
@@ -344,7 +344,7 @@ static int insertStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) {
const
double
factor
=
1
.
5
;
void
*
tmp
=
realloc
(
pBlock
->
pData
,
(
uint32_t
)(
totalDataSize
*
factor
));
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
pBlock
->
pData
=
(
char
*
)
tmp
;
pBlock
->
nAllocSize
=
(
uint32_t
)(
totalDataSize
*
factor
);
...
...
@@ -416,7 +416,7 @@ static int insertStmtReset(STscStmt* pStmt) {
static
int
insertStmtExecute
(
STscStmt
*
stmt
)
{
SSqlCmd
*
pCmd
=
&
stmt
->
pSql
->
cmd
;
if
(
pCmd
->
batchSize
==
0
)
{
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
if
((
pCmd
->
batchSize
%
2
)
==
1
)
{
++
pCmd
->
batchSize
;
...
...
@@ -470,14 +470,14 @@ static int insertStmtExecute(STscStmt* stmt) {
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
)
{
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
tscError
(
"connection disconnected"
);
return
NULL
;
}
STscStmt
*
pStmt
=
calloc
(
1
,
sizeof
(
STscStmt
));
if
(
pStmt
==
NULL
)
{
terrno
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
tscError
(
"failed to allocate memory for statement"
);
return
NULL
;
}
...
...
@@ -486,7 +486,7 @@ TAOS_STMT* taos_stmt_init(TAOS* taos) {
SSqlObj
*
pSql
=
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
pSql
==
NULL
)
{
free
(
pStmt
);
terrno
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
tscError
(
"failed to allocate memory for statement"
);
return
NULL
;
}
...
...
@@ -505,8 +505,8 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
stmt
==
NULL
||
pStmt
->
taos
==
NULL
||
pStmt
->
pSql
==
NULL
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
return
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
return
TSDB_CODE_
TSC_
DISCONNECTED
;
}
SSqlObj
*
pSql
=
pStmt
->
pSql
;
...
...
@@ -521,7 +521,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
tscError
(
"%p failed to malloc payload buffer"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
pSql
->
sqlstr
=
realloc
(
pSql
->
sqlstr
,
sqlLen
+
1
);
...
...
@@ -529,7 +529,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
if
(
pSql
->
sqlstr
==
NULL
)
{
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
free
(
pCmd
->
payload
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
pRes
->
qhandle
=
0
;
...
...
@@ -545,7 +545,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
pSql
->
cmd
.
batchSize
=
0
;
int32_t
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
{
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
{
// wait for the callback function to post the semaphore
tsem_wait
(
&
pSql
->
rspSem
);
return
pSql
->
res
.
code
;
...
...
@@ -590,7 +590,7 @@ int taos_stmt_add_batch(TAOS_STMT* stmt) {
if
(
pStmt
->
isInsert
)
{
return
insertStmtAddBatch
(
pStmt
);
}
return
TSDB_CODE_OPS_NOT_SUPPORT
;
return
TSDB_CODE_
COM_
OPS_NOT_SUPPORT
;
}
int
taos_stmt_reset
(
TAOS_STMT
*
stmt
)
{
...
...
@@ -609,7 +609,7 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
}
else
{
char
*
sql
=
normalStmtBuildSql
(
pStmt
);
if
(
sql
==
NULL
)
{
ret
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
ret
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
else
{
tfree
(
pStmt
->
pSql
->
sqlstr
);
pStmt
->
pSql
->
sqlstr
=
sql
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/client/src/tscSecondaryMerge.c
浏览文件 @
7e2abf0e
...
...
@@ -161,7 +161,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
tscLocalReducerEnvDestroy
(
pMemBuffer
,
pDesc
,
finalmodel
,
numOfBuffer
);
tscError
(
"%p pMemBuffer is NULL"
,
pMemBuffer
);
pRes
->
code
=
TSDB_CODE_APP_ERROR
;
pRes
->
code
=
TSDB_CODE_
TSC_
APP_ERROR
;
return
;
}
...
...
@@ -169,7 +169,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
tscLocalReducerEnvDestroy
(
pMemBuffer
,
pDesc
,
finalmodel
,
numOfBuffer
);
tscError
(
"%p no local buffer or intermediate result format model"
,
pSql
);
pRes
->
code
=
TSDB_CODE_APP_ERROR
;
pRes
->
code
=
TSDB_CODE_
TSC_
APP_ERROR
;
return
;
}
...
...
@@ -196,7 +196,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
pMemBuffer
[
0
]
->
pageSize
);
tscLocalReducerEnvDestroy
(
pMemBuffer
,
pDesc
,
finalmodel
,
numOfBuffer
);
pRes
->
code
=
TSDB_CODE_APP_ERROR
;
pRes
->
code
=
TSDB_CODE_
TSC_
APP_ERROR
;
return
;
}
...
...
@@ -207,7 +207,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
tscError
(
"%p failed to create local merge structure, out of memory"
,
pSql
);
tscLocalReducerEnvDestroy
(
pMemBuffer
,
pDesc
,
finalmodel
,
numOfBuffer
);
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
;
}
...
...
@@ -229,7 +229,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
SLocalDataSource
*
ds
=
(
SLocalDataSource
*
)
malloc
(
sizeof
(
SLocalDataSource
)
+
pMemBuffer
[
0
]
->
pageSize
);
if
(
ds
==
NULL
)
{
tscError
(
"%p failed to create merge structure"
,
pSql
);
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
;
}
...
...
@@ -326,7 +326,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
// tfree(pReducer->pBufForInterpo);
tfree
(
pReducer
->
prevRowOfInput
);
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
;
}
...
...
@@ -560,7 +560,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCm
int32_t
*
orderIdx
=
(
int32_t
*
)
calloc
(
numOfGroupByCols
,
sizeof
(
int32_t
));
if
(
orderIdx
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
if
(
numOfGroupByCols
>
0
)
{
...
...
@@ -581,7 +581,7 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCm
tfree
(
orderIdx
);
if
(
*
pOrderDesc
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
else
{
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -641,7 +641,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
(
*
pMemBuffer
)
=
(
tExtMemBuffer
**
)
malloc
(
POINTER_BYTES
*
pSql
->
numOfSubs
);
if
(
*
pMemBuffer
==
NULL
)
{
tscError
(
"%p failed to allocate memory"
,
pSql
);
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
pRes
->
code
;
}
...
...
@@ -650,7 +650,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
pSchema
=
(
SSchema
*
)
calloc
(
1
,
sizeof
(
SSchema
)
*
size
);
if
(
pSchema
==
NULL
)
{
tscError
(
"%p failed to allocate memory"
,
pSql
);
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
pRes
->
code
;
}
...
...
@@ -678,7 +678,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
}
if
(
createOrderDescriptor
(
pOrderDesc
,
pCmd
,
pModel
)
!=
TSDB_CODE_SUCCESS
)
{
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
pRes
->
code
;
}
...
...
src/client/src/tscServer.c
浏览文件 @
7e2abf0e
...
...
@@ -179,7 +179,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
char
*
pMsg
=
rpcMallocCont
(
pCmd
->
payloadLen
);
if
(
NULL
==
pMsg
)
{
tscError
(
"%p msg:%s malloc fail"
,
pSql
,
taosMsg
[
pSql
->
cmd
.
msgType
]);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
if
(
pSql
->
cmd
.
command
<
TSDB_SQL_MGMT
)
{
...
...
@@ -234,11 +234,11 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
}
if
(
rpcMsg
->
pCont
==
NULL
)
{
rpcMsg
->
code
=
TSDB_CODE_NETWORK_UNAVAIL
;
rpcMsg
->
code
=
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
;
}
else
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
if
(
rpcMsg
->
code
==
TSDB_CODE_
INVALID_TABLE_ID
||
rpcMsg
->
code
==
TSDB_CODE
_INVALID_VGROUP_ID
||
rpcMsg
->
code
==
TSDB_CODE_NETWORK_UNAVAIL
)
{
if
(
rpcMsg
->
code
==
TSDB_CODE_
TDB_INVALID_TABLE_ID
||
rpcMsg
->
code
==
TSDB_CODE_VND
_INVALID_VGROUP_ID
||
rpcMsg
->
code
==
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
)
{
/*
* not_active_table: 1. the virtual node may fail to create table, since the procedure of create table is asynchronized,
* the virtual node may have not create table till now, so try again by using the new metermeta.
...
...
@@ -250,11 +250,11 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
* not_active_session: db has been move to other node, the vnode does not exist on this dnode anymore.
*/
if
(
pCmd
->
command
==
TSDB_SQL_CONNECT
)
{
rpcMsg
->
code
=
TSDB_CODE_NETWORK_UNAVAIL
;
rpcMsg
->
code
=
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
;
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
else
if
(
pCmd
->
command
==
TSDB_SQL_HB
)
{
rpcMsg
->
code
=
TSDB_CODE_NOT_READY
;
rpcMsg
->
code
=
TSDB_CODE_
RPC_
NOT_READY
;
rpcFreeCont
(
rpcMsg
->
pCont
);
return
;
}
else
if
(
pCmd
->
command
==
TSDB_SQL_META
)
{
...
...
@@ -281,8 +281,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
pRes
->
rspLen
=
0
;
if
(
pRes
->
code
!=
TSDB_CODE_QUERY_CANCELLED
)
{
pRes
->
code
=
(
rpcMsg
->
code
!=
TSDB_CODE_SUCCESS
)
?
rpcMsg
->
code
:
TSDB_CODE_NETWORK_UNAVAIL
;
if
(
pRes
->
code
!=
TSDB_CODE_
TSC_
QUERY_CANCELLED
)
{
pRes
->
code
=
(
rpcMsg
->
code
!=
TSDB_CODE_SUCCESS
)
?
rpcMsg
->
code
:
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
;
}
else
{
tscTrace
(
"%p query is cancelled, code:%d"
,
pSql
,
tstrerror
(
pRes
->
code
));
}
...
...
@@ -292,7 +292,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
pSql
->
retry
=
0
;
}
if
(
pRes
->
code
!=
TSDB_CODE_QUERY_CANCELLED
)
{
if
(
pRes
->
code
!=
TSDB_CODE_
TSC_
QUERY_CANCELLED
)
{
assert
(
rpcMsg
->
msgType
==
pCmd
->
msgType
+
1
);
pRes
->
code
=
rpcMsg
->
code
;
pRes
->
rspType
=
rpcMsg
->
msgType
;
...
...
@@ -301,7 +301,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
if
(
pRes
->
rspLen
>
0
&&
rpcMsg
->
pCont
)
{
char
*
tmp
=
(
char
*
)
realloc
(
pRes
->
pRsp
,
pRes
->
rspLen
);
if
(
tmp
==
NULL
)
{
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
else
{
pRes
->
pRsp
=
tmp
;
memcpy
(
pRes
->
pRsp
,
rpcMsg
->
pCont
,
pRes
->
rspLen
);
...
...
@@ -333,7 +333,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
tscProcessMsgRsp
[
pCmd
->
command
])
rpcMsg
->
code
=
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
if
(
rpcMsg
->
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
if
(
rpcMsg
->
code
!=
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
{
rpcMsg
->
code
=
pRes
->
code
?
pRes
->
code
:
pRes
->
numOfRows
;
tscTrace
(
"%p SQL result:%s res:%p"
,
pSql
,
tstrerror
(
pRes
->
code
),
pSql
);
...
...
@@ -402,7 +402,7 @@ int tscProcessSql(SSqlObj *pSql) {
tscTrace
(
"%p SQL cmd:%s will be processed, name:%s, type:%d"
,
pSql
,
sqlCmd
[
pCmd
->
command
],
name
,
type
);
if
(
pCmd
->
command
<
TSDB_SQL_MGMT
)
{
// the pTableMetaInfo cannot be NULL
if
(
pTableMetaInfo
==
NULL
)
{
pSql
->
res
.
code
=
TSDB_CODE_
OTHERS
;
pSql
->
res
.
code
=
TSDB_CODE_
TSC_APP_ERROR
;
return
pSql
->
res
.
code
;
}
}
else
if
(
pCmd
->
command
<
TSDB_SQL_LOCAL
)
{
...
...
@@ -433,7 +433,7 @@ void tscKillSTableQuery(SSqlObj *pSql) {
* here, we cannot set the command = TSDB_SQL_KILL_QUERY. Otherwise, it may cause
* sub-queries not correctly released and master sql object of metric query reaches an abnormal state.
*/
pSql
->
pSubs
[
i
]
->
res
.
code
=
TSDB_CODE_QUERY_CANCELLED
;
pSql
->
pSubs
[
i
]
->
res
.
code
=
TSDB_CODE_
TSC_
QUERY_CANCELLED
;
//taosStopRpcConn(pSql->pSubs[i]->thandle);
}
...
...
@@ -678,7 +678,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pSql
,
pTableMeta
->
sid
,
pTableMeta
->
uid
,
pTableMetaInfo
->
name
,
tscGetNumOfColumns
(
pTableMeta
),
pCol
->
colIndex
,
pColSchema
->
name
);
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
pQueryMsg
->
colList
[
i
].
colId
=
htons
(
pColSchema
->
colId
);
...
...
@@ -796,7 +796,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pSql
,
pTableMeta
->
sid
,
pTableMeta
->
uid
,
pTableMetaInfo
->
name
,
total
,
numOfTagColumns
,
pCol
->
colIndex
,
pColSchema
->
name
);
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
SColumnInfo
*
pTagCol
=
(
SColumnInfo
*
)
pMsg
;
...
...
@@ -886,7 +886,7 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pCmd
->
payloadLen
=
sizeof
(
SCMCreateDnodeMsg
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMCreateDnodeMsg
*
pCreate
=
(
SCMCreateDnodeMsg
*
)
pCmd
->
payload
;
...
...
@@ -902,7 +902,7 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pCmd
->
payloadLen
=
sizeof
(
SCMCreateAcctMsg
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMCreateAcctMsg
*
pAlterMsg
=
(
SCMCreateAcctMsg
*
)
pCmd
->
payload
;
...
...
@@ -948,7 +948,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMCreateUserMsg
*
pAlterMsg
=
(
SCMCreateUserMsg
*
)
pCmd
->
payload
;
...
...
@@ -987,7 +987,7 @@ int32_t tscBuildDropDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMDropDbMsg
*
pDropDbMsg
=
(
SCMDropDbMsg
*
)
pCmd
->
payload
;
...
...
@@ -1006,7 +1006,7 @@ int32_t tscBuildDropTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMDropTableMsg
*
pDropTableMsg
=
(
SCMDropTableMsg
*
)
pCmd
->
payload
;
...
...
@@ -1023,7 +1023,7 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pCmd
->
payloadLen
=
sizeof
(
SCMDropDnodeMsg
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMDropDnodeMsg
*
pDrop
=
(
SCMDropDnodeMsg
*
)
pCmd
->
payload
;
...
...
@@ -1041,7 +1041,7 @@ int32_t tscBuildDropUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMDropUserMsg
*
pDropMsg
=
(
SCMDropUserMsg
*
)
pCmd
->
payload
;
...
...
@@ -1058,7 +1058,7 @@ int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMDropUserMsg
*
pDropMsg
=
(
SCMDropUserMsg
*
)
pCmd
->
payload
;
...
...
@@ -1074,7 +1074,7 @@ int32_t tscBuildUseDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMUseDbMsg
*
pUseDbMsg
=
(
SCMUseDbMsg
*
)
pCmd
->
payload
;
...
...
@@ -1093,7 +1093,7 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMShowMsg
*
pShowMsg
=
(
SCMShowMsg
*
)
pCmd
->
payload
;
...
...
@@ -1177,7 +1177,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
size
=
tscEstimateCreateTableMsgLength
(
pSql
,
pInfo
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
tscError
(
"%p failed to malloc for create table msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
...
...
@@ -1322,7 +1322,7 @@ int tscBuildRetrieveFromMgmtMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
...
...
@@ -1445,7 +1445,7 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
pCmd
->
payloadLen
))
{
tscError
(
"%p failed to malloc for query msg"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
SCMConnectMsg
*
pConnect
=
(
SCMConnectMsg
*
)
pCmd
->
payload
;
...
...
@@ -1470,7 +1470,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
if
(
len
>
0
)
{
tmpData
=
calloc
(
1
,
len
);
if
(
NULL
==
tmpData
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
// STagData is in binary format, strncpy is not available
...
...
@@ -1792,17 +1792,17 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
if
(
pMetaMsg
->
sid
<
0
||
pMetaMsg
->
vgroup
.
numOfIps
<
0
)
{
tscError
(
"invalid meter vgId:%d, sid%d"
,
pMetaMsg
->
vgroup
.
numOfIps
,
pMetaMsg
->
sid
);
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
if
(
pMetaMsg
->
numOfTags
>
TSDB_MAX_TAGS
||
pMetaMsg
->
numOfTags
<
0
)
{
tscError
(
"invalid numOfTags:%d"
,
pMetaMsg
->
numOfTags
);
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
if
(
pMetaMsg
->
numOfColumns
>
TSDB_MAX_COLUMNS
||
pMetaMsg
->
numOfColumns
<=
0
)
{
tscError
(
"invalid numOfColumns:%d"
,
pMetaMsg
->
numOfColumns
);
return
TSDB_CODE_INVALID_VALUE
;
return
TSDB_CODE_
TSC_
INVALID_VALUE
;
}
for
(
int
i
=
0
;
i
<
pMetaMsg
->
vgroup
.
numOfIps
;
++
i
)
{
...
...
@@ -1832,7 +1832,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
// todo handle out of memory case
if
(
pTableMetaInfo
->
pTableMeta
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
tscTrace
(
"%p recv table meta: %"
PRId64
", tid:%d, name:%s"
,
pSql
,
pTableMeta
->
uid
,
pTableMeta
->
sid
,
pTableMetaInfo
->
name
);
...
...
@@ -1853,9 +1853,9 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
ieType = *rsp;
if (ieType != TSDB_IE_TYPE_META) {
tscError("invalid ie type:%d", ieType);
pSql->res.code = TSDB_CODE_INVALID_IE;
pSql->res.code = TSDB_CODE_
TSC_
INVALID_IE;
pSql->res.numOfTotal = 0;
return TSDB_CODE_
OTHERS
;
return TSDB_CODE_
TSC_APP_ERROR
;
}
rsp++;
...
...
@@ -1875,32 +1875,32 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
if (pMeta->sid <= 0 || pMeta->vgId < 0) {
tscError("invalid meter vgId:%d, sid%d", pMeta->vgId, pMeta->sid);
pSql->res.code = TSDB_CODE_INVALID_VALUE;
pSql->res.code = TSDB_CODE_
TSC_
INVALID_VALUE;
pSql->res.numOfTotal = i;
return TSDB_CODE_
OTHERS
;
return TSDB_CODE_
TSC_APP_ERROR
;
}
// pMeta->numOfColumns = htons(pMeta->numOfColumns);
//
// if (pMeta->numOfTags > TSDB_MAX_TAGS || pMeta->numOfTags < 0) {
// tscError("invalid tag value count:%d", pMeta->numOfTags);
// pSql->res.code = TSDB_CODE_INVALID_VALUE;
// pSql->res.code = TSDB_CODE_
TSC_
INVALID_VALUE;
// pSql->res.numOfTotal = i;
// return TSDB_CODE_
OTHERS
;
// return TSDB_CODE_
TSC_APP_ERROR
;
// }
//
// if (pMeta->numOfTags > TSDB_MAX_TAGS || pMeta->numOfTags < 0) {
// tscError("invalid numOfTags:%d", pMeta->numOfTags);
// pSql->res.code = TSDB_CODE_INVALID_VALUE;
// pSql->res.code = TSDB_CODE_
TSC_
INVALID_VALUE;
// pSql->res.numOfTotal = i;
// return TSDB_CODE_
OTHERS
;
// return TSDB_CODE_
TSC_APP_ERROR
;
// }
//
// if (pMeta->numOfColumns > TSDB_MAX_COLUMNS || pMeta->numOfColumns < 0) {
// tscError("invalid numOfColumns:%d", pMeta->numOfColumns);
// pSql->res.code = TSDB_CODE_INVALID_VALUE;
// pSql->res.code = TSDB_CODE_
TSC_
INVALID_VALUE;
// pSql->res.numOfTotal = i;
// return TSDB_CODE_
OTHERS
;
// return TSDB_CODE_
TSC_APP_ERROR
;
// }
//
// for (int j = 0; j < TSDB_REPLICA_MAX_NUM; ++j) {
...
...
@@ -1965,7 +1965,7 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
if (metricMetaList == NULL || sizes == NULL) {
tfree(metricMetaList);
tfree(sizes);
pSql->res.code = TSDB_CODE_
CLI
_OUT_OF_MEMORY;
pSql->res.code = TSDB_CODE_
TSC
_OUT_OF_MEMORY;
return pSql->res.code;
}
...
...
@@ -1984,7 +1984,7 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
char *pBuf = calloc(1, size);
if (pBuf == NULL) {
pSql->res.code = TSDB_CODE_
CLI
_OUT_OF_MEMORY;
pSql->res.code = TSDB_CODE_
TSC
_OUT_OF_MEMORY;
goto _error_clean;
}
...
...
@@ -2044,7 +2044,7 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
// failed to put into cache
if (pTableMetaInfo->pMetricMeta == NULL) {
pSql->res.code = TSDB_CODE_
CLI
_OUT_OF_MEMORY;
pSql->res.code = TSDB_CODE_
TSC
_OUT_OF_MEMORY;
goto _error_clean;
}
}
...
...
@@ -2338,7 +2338,7 @@ static int32_t getTableMetaFromMgmt(SSqlObj *pSql, STableMetaInfo *pTableMetaInf
SSqlObj
*
pNew
=
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
NULL
==
pNew
)
{
tscError
(
"%p malloc failed for new sqlobj to get table meta"
,
pSql
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
pNew
->
pTscObj
=
pSql
->
pTscObj
;
...
...
@@ -2355,7 +2355,7 @@ static int32_t getTableMetaFromMgmt(SSqlObj *pSql, STableMetaInfo *pTableMetaInf
tscError
(
"%p malloc failed for payload to get table meta"
,
pSql
);
free
(
pNew
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
STableMetaInfo
*
pNewMeterMetaInfo
=
tscAddEmptyMetaInfo
(
pNewQueryInfo
);
...
...
@@ -2371,7 +2371,7 @@ static int32_t getTableMetaFromMgmt(SSqlObj *pSql, STableMetaInfo *pTableMetaInf
int32_t
code
=
tscProcessSql
(
pNew
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
code
=
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
;
}
return
code
;
...
...
@@ -2468,7 +2468,7 @@ static bool allVgroupInfoRetrieved(SSqlCmd* pCmd, int32_t clauseIndex) {
}
int
tscGetSTableVgroupInfo
(
SSqlObj
*
pSql
,
int32_t
clauseIndex
)
{
int
code
=
TSDB_CODE_NETWORK_UNAVAIL
;
int
code
=
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
if
(
allVgroupInfoRetrieved
(
pCmd
,
clauseIndex
))
{
...
...
@@ -2505,7 +2505,7 @@ int tscGetSTableVgroupInfo(SSqlObj *pSql, int32_t clauseIndex) {
pNew
->
param
=
pSql
;
code
=
tscProcessSql
(
pNew
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
code
=
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
;
}
return
code
;
...
...
src/client/src/tscSql.c
浏览文件 @
7e2abf0e
...
...
@@ -57,12 +57,12 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
taos_init
();
if
(
!
validUserName
(
user
))
{
terrno
=
TSDB_CODE_
INVALID_ACCT
;
terrno
=
TSDB_CODE_
TSC_INVALID_USER_LENGTH
;
return
NULL
;
}
if
(
!
validPassword
(
pass
))
{
terrno
=
TSDB_CODE_
INVALID_PASS
;
terrno
=
TSDB_CODE_
TSC_INVALID_PASS_LENGTH
;
return
NULL
;
}
...
...
@@ -73,13 +73,13 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
void
*
pDnodeConn
=
NULL
;
if
(
tscInitRpc
(
user
,
pass
,
&
pDnodeConn
)
!=
0
)
{
terrno
=
TSDB_CODE_NETWORK_UNAVAIL
;
terrno
=
TSDB_CODE_
RPC_
NETWORK_UNAVAIL
;
return
NULL
;
}
STscObj
*
pObj
=
(
STscObj
*
)
calloc
(
1
,
sizeof
(
STscObj
));
if
(
NULL
==
pObj
)
{
terrno
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
return
NULL
;
}
...
...
@@ -94,7 +94,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
int32_t
len
=
strlen
(
db
);
/* db name is too long */
if
(
len
>
TSDB_DB_NAME_LEN
)
{
terrno
=
TSDB_CODE_
INVALID_DB
;
terrno
=
TSDB_CODE_
TSC_INVALID_DB_LENGTH
;
rpcClose
(
pDnodeConn
);
free
(
pObj
);
return
NULL
;
...
...
@@ -111,7 +111,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
SSqlObj
*
pSql
=
(
SSqlObj
*
)
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
NULL
==
pSql
)
{
terrno
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
free
(
pObj
);
return
NULL
;
...
...
@@ -132,7 +132,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
pSql
->
cmd
.
command
=
TSDB_SQL_CONNECT
;
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
pSql
->
cmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
))
{
terrno
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
rpcClose
(
pDnodeConn
);
free
(
pSql
);
free
(
pObj
);
...
...
@@ -265,14 +265,14 @@ void waitForQueryRsp(void *param, TAOS_RES *tres, int code) {
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sqlstr
)
{
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
return
NULL
;
}
int32_t
sqlLen
=
strlen
(
sqlstr
);
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
tscError
(
"sql string exceeds max length:%d"
,
tsMaxSQLStringLen
);
terrno
=
TSDB_CODE_INVALID_SQL
;
terrno
=
TSDB_CODE_
TSC_
INVALID_SQL
;
return
NULL
;
}
...
...
@@ -281,7 +281,7 @@ TAOS_RES* taos_query(TAOS *taos, const char *sqlstr) {
SSqlObj
*
pSql
=
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
pSql
==
NULL
)
{
tscError
(
"failed to malloc sqlObj"
);
terrno
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
NULL
;
}
...
...
@@ -424,7 +424,7 @@ static void waitForRetrieveRsp(void *param, TAOS_RES *tres, int numOfRows) {
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
res
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
return
NULL
;
}
...
...
@@ -462,7 +462,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
int nRows = 0;
if (pSql == NULL || pSql->signature != pSql) {
terrno = TSDB_CODE_DISCONNECTED;
terrno = TSDB_CODE_
TSC_
DISCONNECTED;
*rows = NULL;
return 0;
}
...
...
@@ -505,8 +505,8 @@ int taos_select_db(TAOS *taos, const char *db) {
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
return
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
return
TSDB_CODE_
TSC_
DISCONNECTED
;
}
snprintf
(
sql
,
tListLen
(
sql
),
"use %s"
,
db
);
...
...
@@ -587,7 +587,7 @@ int taos_errno(TAOS_RES *tres) {
* why the sql is invalid
*/
static
bool
hasAdditionalErrorInfo
(
int32_t
code
,
SSqlCmd
*
pCmd
)
{
if
(
code
!=
TSDB_CODE_INVALID_SQL
)
{
if
(
code
!=
TSDB_CODE_
TSC_
INVALID_SQL
)
{
return
false
;
}
...
...
@@ -649,7 +649,7 @@ void taos_stop_query(TAOS_RES *res) {
if
(
pSql
->
signature
!=
pSql
)
return
;
tscTrace
(
"%p start to cancel query"
,
res
);
pSql
->
res
.
code
=
TSDB_CODE_QUERY_CANCELLED
;
pSql
->
res
.
code
=
TSDB_CODE_
TSC_
QUERY_CANCELLED
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
if
(
tscIsTwoStageSTableQuery
(
pQueryInfo
,
0
))
{
...
...
@@ -734,8 +734,8 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
)
{
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
return
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
return
TSDB_CODE_
TSC_
DISCONNECTED
;
}
SSqlObj
*
pSql
=
calloc
(
1
,
sizeof
(
SSqlObj
));
...
...
@@ -752,13 +752,13 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
int32_t
sqlLen
=
strlen
(
sql
);
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
tscError
(
"%p sql too long"
,
pSql
);
pRes
->
code
=
TSDB_CODE_INVALID_SQL
;
pRes
->
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
return
pRes
->
code
;
}
pSql
->
sqlstr
=
realloc
(
pSql
->
sqlstr
,
sqlLen
+
1
);
if
(
pSql
->
sqlstr
==
NULL
)
{
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
tscTrace
(
"%p Valid SQL result:%d, %s pObj:%p"
,
pSql
,
pRes
->
code
,
taos_errstr
(
taos
),
pObj
);
return
pRes
->
code
;
...
...
@@ -790,7 +790,7 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
pCmd
->
command
=
TSDB_SQL_MULTI_META
;
pCmd
->
count
=
0
;
int
code
=
TSDB_CODE_
INVALID_TABLE_ID
;
int
code
=
TSDB_CODE_
TSC_INVALID_TABLE_ID_LENGTH
;
char
*
str
=
(
char
*
)
tblNameList
;
SQueryInfo
*
pQueryInfo
=
NULL
;
...
...
@@ -824,7 +824,7 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
// Check if the table name available or not
if
(
tscValidateName
(
&
sToken
)
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_
INVALID_TABLE_ID
;
code
=
TSDB_CODE_
TSC_INVALID_TABLE_ID_LENGTH
;
sprintf
(
pCmd
->
payload
,
"table name is invalid"
);
return
code
;
}
...
...
@@ -834,7 +834,7 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
}
if
(
++
pCmd
->
count
>
TSDB_MULTI_METERMETA_MAX_NUM
)
{
code
=
TSDB_CODE_
INVALID_TABLE_ID
;
code
=
TSDB_CODE_
TSC_INVALID_TABLE_ID_LENGTH
;
sprintf
(
pCmd
->
payload
,
"tables over the max number"
);
return
code
;
}
...
...
@@ -842,7 +842,7 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
if
(
payloadLen
+
strlen
(
pTableMetaInfo
->
name
)
+
128
>=
pCmd
->
allocSize
)
{
char
*
pNewMem
=
realloc
(
pCmd
->
payload
,
pCmd
->
allocSize
+
tblListLen
);
if
(
pNewMem
==
NULL
)
{
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
sprintf
(
pCmd
->
payload
,
"failed to allocate memory"
);
return
code
;
}
...
...
@@ -866,8 +866,8 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
return
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
return
TSDB_CODE_
TSC_
DISCONNECTED
;
}
SSqlObj
*
pSql
=
calloc
(
1
,
sizeof
(
SSqlObj
));
...
...
@@ -884,13 +884,13 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
int32_t
tblListLen
=
strlen
(
tableNameList
);
if
(
tblListLen
>
MAX_TABLE_NAME_LENGTH
)
{
tscError
(
"%p tableNameList too long, length:%d, maximum allowed:%d"
,
pSql
,
tblListLen
,
MAX_TABLE_NAME_LENGTH
);
pRes
->
code
=
TSDB_CODE_INVALID_SQL
;
pRes
->
code
=
TSDB_CODE_
TSC_
INVALID_SQL
;
return
pRes
->
code
;
}
char
*
str
=
calloc
(
1
,
tblListLen
+
1
);
if
(
str
==
NULL
)
{
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
tscError
(
"%p failed to malloc sql string buffer"
,
pSql
);
return
pRes
->
code
;
}
...
...
src/client/src/tscStream.c
浏览文件 @
7e2abf0e
...
...
@@ -77,13 +77,13 @@ static void tscProcessStreamLaunchQuery(SSchedMsg *pMsg) {
int
code
=
tscGetTableMeta
(
pSql
,
pTableMetaInfo
);
pSql
->
res
.
code
=
code
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
return
;
if
(
code
==
0
&&
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
code
=
tscGetSTableVgroupInfo
(
pSql
,
0
);
pSql
->
res
.
code
=
code
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
return
;
}
tscTansformSQLFuncForSTableQuery
(
pQueryInfo
);
...
...
@@ -480,7 +480,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
SSqlObj
*
pSql
=
(
SSqlObj
*
)
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
pSql
==
NULL
)
{
setErrorInfo
(
pSql
,
TSDB_CODE_
CLI
_OUT_OF_MEMORY
,
NULL
);
setErrorInfo
(
pSql
,
TSDB_CODE_
TSC
_OUT_OF_MEMORY
,
NULL
);
return
NULL
;
}
...
...
@@ -497,7 +497,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
pSql
->
sqlstr
=
strdup
(
sqlstr
);
if
(
pSql
->
sqlstr
==
NULL
)
{
setErrorInfo
(
pSql
,
TSDB_CODE_
CLI
_OUT_OF_MEMORY
,
NULL
);
setErrorInfo
(
pSql
,
TSDB_CODE_
TSC
_OUT_OF_MEMORY
,
NULL
);
tfree
(
pSql
);
return
NULL
;
...
...
@@ -512,7 +512,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
ret
=
tscAllocPayload
(
&
pSql
->
cmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
);
if
(
TSDB_CODE_SUCCESS
!=
ret
)
{
setErrorInfo
(
pSql
,
ret
,
NULL
);
tscError
(
"%p open stream failed, sql:%s, code:%d"
,
pSql
,
sqlstr
,
TSDB_CODE_
CLI
_OUT_OF_MEMORY
);
tscError
(
"%p open stream failed, sql:%s, code:%d"
,
pSql
,
sqlstr
,
TSDB_CODE_
TSC
_OUT_OF_MEMORY
);
tscFreeSqlObj
(
pSql
);
return
NULL
;
}
...
...
@@ -530,7 +530,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
SSqlStream
*
pStream
=
(
SSqlStream
*
)
calloc
(
1
,
sizeof
(
SSqlStream
));
if
(
pStream
==
NULL
)
{
setErrorInfo
(
pSql
,
TSDB_CODE_
CLI
_OUT_OF_MEMORY
,
NULL
);
setErrorInfo
(
pSql
,
TSDB_CODE_
TSC
_OUT_OF_MEMORY
,
NULL
);
tscError
(
"%p open stream failed, sql:%s, reason:%s, code:%d"
,
pSql
,
sqlstr
,
pCmd
->
payload
,
pRes
->
code
);
tscFreeSqlObj
(
pSql
);
...
...
src/client/src/tscSub.c
浏览文件 @
7e2abf0e
...
...
@@ -124,7 +124,7 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
strtolower
(
pSql
->
sqlstr
,
pSql
->
sqlstr
);
code
=
tsParseSql
(
pSql
,
false
);
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
{
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
{
// wait for the callback function to post the semaphore
sem_wait
(
&
pSql
->
rspSem
);
code
=
pSql
->
res
.
code
;
...
...
@@ -148,7 +148,7 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
pSub
->
topic
[
sizeof
(
pSub
->
topic
)
-
1
]
=
0
;
pSub
->
progress
=
taosArrayInit
(
32
,
sizeof
(
SSubscriptionProgress
));
if
(
pSub
->
progress
==
NULL
)
{
THROW
(
TSDB_CODE_
CLI
_OUT_OF_MEMORY
);
THROW
(
TSDB_CODE_
TSC
_OUT_OF_MEMORY
);
}
CLEANUP_EXECUTE
();
...
...
@@ -324,7 +324,7 @@ void tscSaveSubscriptionProgress(void* sub) {
TAOS_SUB
*
taos_subscribe
(
TAOS
*
taos
,
int
restart
,
const
char
*
topic
,
const
char
*
sql
,
TAOS_SUBSCRIBE_CALLBACK
fp
,
void
*
param
,
int
interval
)
{
STscObj
*
pObj
=
(
STscObj
*
)
taos
;
if
(
pObj
==
NULL
||
pObj
->
signature
!=
pObj
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
tscError
(
"connection disconnected"
);
return
NULL
;
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
7e2abf0e
...
...
@@ -348,7 +348,7 @@ int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql) {
//prepare the subqueries object failed, abort
if
(
!
success
)
{
pSql
->
res
.
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pSql
->
res
.
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
tscError
(
"%p failed to prepare subqueries objs for secondary phase query, numOfSub:%d, code:%d"
,
pSql
,
pSql
->
numOfSubs
,
pSql
->
res
.
code
);
freeJoinSubqueryObj
(
pSql
);
...
...
@@ -698,7 +698,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
if
(
pBuf
==
NULL
)
{
tscError
(
"%p invalid ts comp file from vnode, abort subquery, file size:%d"
,
pSql
,
numOfRows
);
pSupporter
->
pState
->
code
=
TSDB_CODE_APP_ERROR
;
// todo set the informative code
pSupporter
->
pState
->
code
=
TSDB_CODE_
TSC_
APP_ERROR
;
// todo set the informative code
quitAllSubquery
(
pParentSql
,
pSupporter
);
return
;
}
...
...
@@ -1019,13 +1019,13 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
if
(
pSql
->
pSubs
==
NULL
)
{
pSql
->
pSubs
=
calloc
(
pSupporter
->
pState
->
numOfTotal
,
POINTER_BYTES
);
if
(
pSql
->
pSubs
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
}
SSqlObj
*
pNew
=
createSubqueryObj
(
pSql
,
tableIndex
,
tscJoinQueryCallback
,
pSupporter
,
TSDB_SQL_SELECT
,
NULL
);
if
(
pNew
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
pSql
->
pSubs
[
pSql
->
numOfSubs
++
]
=
pNew
;
...
...
@@ -1163,7 +1163,7 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) {
if
(
pSupporter
==
NULL
)
{
// failed to create support struct, abort current query
tscError
(
"%p tableIndex:%d, failed to allocate join support object, abort further query"
,
pSql
,
i
);
pState
->
numOfCompleted
=
pQueryInfo
->
numOfTables
-
i
-
1
;
pSql
->
res
.
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pSql
->
res
.
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
pSql
->
res
.
code
;
}
...
...
@@ -1171,7 +1171,7 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) {
int32_t
code
=
tscLaunchJoinSubquery
(
pSql
,
i
,
pSupporter
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// failed to create subquery object, quit query
tscDestroyJoinSupporter
(
pSupporter
);
pSql
->
res
.
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pSql
->
res
.
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
break
;
}
...
...
@@ -1209,7 +1209,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
// pRes->code check only serves in launching metric sub-queries
if
(
pRes
->
code
==
TSDB_CODE_QUERY_CANCELLED
)
{
if
(
pRes
->
code
==
TSDB_CODE_
TSC_
QUERY_CANCELLED
)
{
pCmd
->
command
=
TSDB_SQL_RETRIEVE_LOCALMERGE
;
// enable the abort of kill super table function.
return
pRes
->
code
;
}
...
...
@@ -1230,7 +1230,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
int32_t
ret
=
tscLocalReducerEnvCreate
(
pSql
,
&
pMemoryBuf
,
&
pDesc
,
&
pModel
,
nBufferSize
);
if
(
ret
!=
0
)
{
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
tscQueueAsyncRes
(
pSql
);
return
ret
;
}
...
...
@@ -1291,14 +1291,14 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
if
(
i
<
pSql
->
numOfSubs
)
{
tscError
(
"%p failed to prepare subquery structure and launch subqueries"
,
pSql
);
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
tscLocalReducerEnvDestroy
(
pMemoryBuf
,
pDesc
,
pModel
,
pSql
->
numOfSubs
);
doCleanupSubqueries
(
pSql
,
i
,
pState
);
return
pRes
->
code
;
// free all allocated resource
}
if
(
pRes
->
code
==
TSDB_CODE_QUERY_CANCELLED
)
{
if
(
pRes
->
code
==
TSDB_CODE_
TSC_
QUERY_CANCELLED
)
{
tscLocalReducerEnvDestroy
(
pMemoryBuf
,
pDesc
,
pModel
,
pSql
->
numOfSubs
);
doCleanupSubqueries
(
pSql
,
i
,
pState
);
return
pRes
->
code
;
...
...
@@ -1369,7 +1369,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
/*
* kill current sub-query connection, which may retrieve data from vnodes;
* Here we get: pPObj->res.code == TSDB_CODE_QUERY_CANCELLED
* Here we get: pPObj->res.code == TSDB_CODE_
TSC_
QUERY_CANCELLED
*/
pSql
->
res
.
numOfRows
=
0
;
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
// disable retry efforts
...
...
@@ -1401,7 +1401,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
tscError
(
"%p sub:%p failed to create new subquery sqlObj due to out of memory, abort retry"
,
trsupport
->
pParentSqlObj
,
pSql
);
pState
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pState
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
return
;
}
...
...
@@ -1475,7 +1475,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
if
(
tsTotalTmpDirGB
!=
0
&&
tsAvailTmpDirGB
<
tsMinimalTmpDirGB
)
{
tscError
(
"%p sub:%p client disk space remain %.3f GB, need at least %.3f GB, stop query"
,
pPObj
,
pSql
,
tsAvailTmpDirGB
,
tsMinimalTmpDirGB
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
pSql
,
TSDB_CODE_
CLI
_NO_DISKSPACE
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
pSql
,
TSDB_CODE_
TSC
_NO_DISKSPACE
);
return
;
}
...
...
@@ -1484,7 +1484,7 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
int32_t
ret
=
tscFlushTmpBuffer
(
trsupport
->
pExtMemBuffer
[
idx
],
pDesc
,
trsupport
->
localBuffer
,
pQueryInfo
->
groupbyExpr
.
orderType
);
if
(
ret
!=
0
)
{
// set no disk space error info, and abort retry
return
tscAbortFurtherRetryRetrieval
(
trsupport
,
pSql
,
TSDB_CODE_
CLI
_NO_DISKSPACE
);
return
tscAbortFurtherRetryRetrieval
(
trsupport
,
pSql
,
TSDB_CODE_
TSC
_NO_DISKSPACE
);
}
// keep this value local variable, since the pState variable may be released by other threads, if atomic_add opertion
...
...
@@ -1563,7 +1563,7 @@ 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:%"
PRId64
" , current:%"
PRId64
,
pPObj
,
pSql
,
tsMaxNumOfOrderedResults
,
num
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_SORTED_RES_TOO_MANY
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_
TSC_
SORTED_RES_TOO_MANY
);
return
;
}
...
...
@@ -1578,14 +1578,14 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
if
(
tsTotalTmpDirGB
!=
0
&&
tsAvailTmpDirGB
<
tsMinimalTmpDirGB
)
{
tscError
(
"%p sub:%p client disk space remain %.3f GB, need at least %.3f GB, stop query"
,
pPObj
,
pSql
,
tsAvailTmpDirGB
,
tsMinimalTmpDirGB
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_
CLI
_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
);
if
(
ret
<
0
)
{
// set no disk space error info, and abort retry
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_
CLI
_NO_DISKSPACE
);
tscAbortFurtherRetryRetrieval
(
trsupport
,
tres
,
TSDB_CODE_
TSC
_NO_DISKSPACE
);
}
else
if
(
pRes
->
completed
)
{
tscAllDataRetrievedFromDnode
(
trsupport
,
pSql
);
...
...
@@ -1672,7 +1672,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
tscError
(
"%p sub:%p failed to create new subquery due to out of memory, abort retry, vgId:%d, orderOfSub:%d"
,
trsupport
->
pParentSqlObj
,
pSql
,
pVgroup
->
vgId
,
trsupport
->
subqueryIndex
);
pState
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pState
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
}
else
{
SQueryInfo
*
pNewQueryInfo
=
tscGetQueryInfoDetail
(
&
pNew
->
cmd
,
0
);
...
...
@@ -1778,7 +1778,7 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
if
(
i
<
pSql
->
numOfSubs
)
{
tscError
(
"%p failed to prepare subObj structure and launch sub-insertion"
,
pSql
);
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
pRes
->
code
;
// free all allocated resource
}
...
...
src/client/src/tscUtil.c
浏览文件 @
7e2abf0e
...
...
@@ -299,7 +299,7 @@ int32_t tscCreateResPointerInfo(SSqlRes* pRes, SQueryInfo* pQueryInfo) {
tfree
(
pRes
->
buffer
);
tfree
(
pRes
->
length
);
pRes
->
code
=
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
pRes
->
code
=
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
return
pRes
->
code
;
}
}
...
...
@@ -576,7 +576,7 @@ int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOff
STableDataBlocks
*
dataBuf
=
(
STableDataBlocks
*
)
calloc
(
1
,
sizeof
(
STableDataBlocks
));
if
(
dataBuf
==
NULL
)
{
tscError
(
"failed to allocated memory, reason:%s"
,
strerror
(
errno
));
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
dataBuf
->
nAllocSize
=
(
uint32_t
)
initialSize
;
...
...
@@ -711,7 +711,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, SDataBlockList* pTableDataBlockLi
tscDestroyBlockArrayList
(
pVnodeDataBlockList
);
tfree
(
dataBuf
->
pData
);
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
}
...
...
@@ -782,12 +782,12 @@ int tscAllocPayload(SSqlCmd* pCmd, int size) {
assert
(
pCmd
->
allocSize
==
0
);
pCmd
->
payload
=
(
char
*
)
calloc
(
1
,
size
);
if
(
pCmd
->
payload
==
NULL
)
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
if
(
pCmd
->
payload
==
NULL
)
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
pCmd
->
allocSize
=
size
;
}
else
{
if
(
pCmd
->
allocSize
<
size
)
{
char
*
b
=
realloc
(
pCmd
->
payload
,
size
);
if
(
b
==
NULL
)
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
if
(
b
==
NULL
)
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
pCmd
->
payload
=
b
;
pCmd
->
allocSize
=
size
;
}
...
...
@@ -1242,14 +1242,14 @@ static int32_t validateQuoteToken(SSQLToken* pToken) {
}
if
(
k
!=
pToken
->
n
||
pToken
->
type
!=
TK_ID
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
tscValidateName
(
SSQLToken
*
pToken
)
{
if
(
pToken
->
type
!=
TK_STRING
&&
pToken
->
type
!=
TK_ID
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
char
*
sep
=
strnchr
(
pToken
->
z
,
TS_PATH_DELIMITER
[
0
],
pToken
->
n
,
true
);
...
...
@@ -1266,14 +1266,14 @@ int32_t tscValidateName(SSQLToken* pToken) {
}
else
{
sep
=
strnchr
(
pToken
->
z
,
TS_PATH_DELIMITER
[
0
],
pToken
->
n
,
true
);
if
(
sep
==
NULL
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
return
tscValidateName
(
pToken
);
}
}
else
{
if
(
isNumber
(
pToken
))
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
}
}
else
{
// two part
...
...
@@ -1286,15 +1286,15 @@ int32_t tscValidateName(SSQLToken* pToken) {
pToken
->
n
=
tSQLGetToken
(
pToken
->
z
,
&
pToken
->
type
);
if
(
pToken
->
z
[
pToken
->
n
]
!=
TS_PATH_DELIMITER
[
0
])
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
if
(
pToken
->
type
!=
TK_STRING
&&
pToken
->
type
!=
TK_ID
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
if
(
pToken
->
type
==
TK_STRING
&&
validateQuoteToken
(
pToken
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
int32_t
firstPartLen
=
pToken
->
n
;
...
...
@@ -1303,11 +1303,11 @@ int32_t tscValidateName(SSQLToken* pToken) {
pToken
->
n
=
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_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
if
(
pToken
->
type
==
TK_STRING
&&
validateQuoteToken
(
pToken
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
// re-build the whole name string
...
...
@@ -1576,7 +1576,7 @@ int32_t tscAddSubqueryInfo(SSqlCmd* pCmd) {
size_t
s
=
pCmd
->
numOfClause
+
1
;
char
*
tmp
=
realloc
(
pCmd
->
pQueryInfo
,
s
*
POINTER_BYTES
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
TSC
_OUT_OF_MEMORY
;
}
pCmd
->
pQueryInfo
=
(
SQueryInfo
**
)
tmp
;
...
...
@@ -1944,8 +1944,8 @@ int16_t tscGetJoinTagColIndexByUid(STagCond* pTagCond, uint64_t uid) {
bool
tscIsUpdateQuery
(
SSqlObj
*
pSql
)
{
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
terrno
=
TSDB_CODE_DISCONNECTED
;
return
TSDB_CODE_DISCONNECTED
;
terrno
=
TSDB_CODE_
TSC_
DISCONNECTED
;
return
TSDB_CODE_
TSC_
DISCONNECTED
;
}
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
@@ -1962,7 +1962,7 @@ int32_t tscInvalidSQLErrMsg(char* msg, const char* additionalInfo, const char* s
if
(
sql
==
NULL
)
{
assert
(
additionalInfo
!=
NULL
);
sprintf
(
msg
,
msgFormat1
,
additionalInfo
);
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
char
buf
[
64
]
=
{
0
};
// only extract part of sql string
...
...
@@ -1974,7 +1974,7 @@ int32_t tscInvalidSQLErrMsg(char* msg, const char* additionalInfo, const char* s
sprintf
(
msg
,
msgFormat3
,
buf
);
// no additional information for invalid sql error
}
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_
TSC_
INVALID_SQL
;
}
bool
tscHasReachLimitation
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
)
{
...
...
@@ -2143,7 +2143,7 @@ void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pFieldInfo, int32_t column
void
*
malloc_throw
(
size_t
size
)
{
void
*
p
=
malloc
(
size
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_
CLI
_OUT_OF_MEMORY
);
THROW
(
TSDB_CODE_
TSC
_OUT_OF_MEMORY
);
}
return
p
;
}
...
...
@@ -2151,7 +2151,7 @@ void* malloc_throw(size_t size) {
void
*
calloc_throw
(
size_t
nmemb
,
size_t
size
)
{
void
*
p
=
calloc
(
nmemb
,
size
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_
CLI
_OUT_OF_MEMORY
);
THROW
(
TSDB_CODE_
TSC
_OUT_OF_MEMORY
);
}
return
p
;
}
...
...
@@ -2159,7 +2159,7 @@ void* calloc_throw(size_t nmemb, size_t size) {
char
*
strdup_throw
(
const
char
*
str
)
{
char
*
p
=
strdup
(
str
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_
CLI
_OUT_OF_MEMORY
);
THROW
(
TSDB_CODE_
TSC
_OUT_OF_MEMORY
);
}
return
p
;
}
...
...
@@ -2170,7 +2170,7 @@ int tscSetMgmtIpListFromCfg(const char *first, const char *second) {
if
(
first
&&
first
[
0
]
!=
0
)
{
if
(
strlen
(
first
)
>=
TSDB_EP_LEN
)
{
terrno
=
TSDB_CODE_INVALID_FQDN
;
terrno
=
TSDB_CODE_
TSC_
INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
first
,
tscMgmtIpSet
.
fqdn
[
tscMgmtIpSet
.
numOfIps
],
&
tscMgmtIpSet
.
port
[
tscMgmtIpSet
.
numOfIps
]);
...
...
@@ -2179,7 +2179,7 @@ int tscSetMgmtIpListFromCfg(const char *first, const char *second) {
if
(
second
&&
second
[
0
]
!=
0
)
{
if
(
strlen
(
second
)
>=
TSDB_EP_LEN
)
{
terrno
=
TSDB_CODE_INVALID_FQDN
;
terrno
=
TSDB_CODE_
TSC_
INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
second
,
tscMgmtIpSet
.
fqdn
[
tscMgmtIpSet
.
numOfIps
],
&
tscMgmtIpSet
.
port
[
tscMgmtIpSet
.
numOfIps
]);
...
...
@@ -2187,7 +2187,7 @@ int tscSetMgmtIpListFromCfg(const char *first, const char *second) {
}
if
(
tscMgmtIpSet
.
numOfIps
==
0
)
{
terrno
=
TSDB_CODE_INVALID_FQDN
;
terrno
=
TSDB_CODE_
TSC_
INVALID_FQDN
;
return
-
1
;
}
...
...
src/common/src/tglobal.c
浏览文件 @
7e2abf0e
...
...
@@ -234,7 +234,7 @@ bool taosCfgDynamicOptions(char *msg) {
int32_t
vint
=
0
;
paGetToken
(
msg
,
&
option
,
&
olen
);
if
(
olen
==
0
)
return
TSDB_CODE_
INVALID_MSG_CONTENT
;
if
(
olen
==
0
)
return
TSDB_CODE_
COM_INVALID_CFG_MSG
;
paGetToken
(
option
+
olen
+
1
,
&
value
,
&
vlen
);
if
(
vlen
==
0
)
...
...
src/dnode/src/dnodeMPeer.c
浏览文件 @
7e2abf0e
...
...
@@ -79,7 +79,7 @@ void dnodeCleanupMnodePeer() {
int32_t
dnodeAllocateMnodePqueue
()
{
tsMPeerQueue
=
taosOpenQueue
();
if
(
tsMPeerQueue
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
tsMPeerQueue
==
NULL
)
return
TSDB_CODE_
DND
_OUT_OF_MEMORY
;
taosAddIntoQset
(
tsMPeerQset
,
tsMPeerQueue
,
NULL
);
...
...
@@ -125,7 +125,7 @@ static void dnodeFreeMnodePeerMsg(SMnodeMsg *pPeer) {
}
static
void
dnodeSendRpcMnodePeerRsp
(
SMnodeMsg
*
pPeer
,
int32_t
code
)
{
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
MND_
ACTION_IN_PROGRESS
)
return
;
SRpcMsg
rpcRsp
=
{
.
handle
=
pPeer
->
rpcMsg
.
handle
,
...
...
src/dnode/src/dnodeMRead.c
浏览文件 @
7e2abf0e
...
...
@@ -84,7 +84,7 @@ void dnodeCleanupMnodeRead() {
int32_t
dnodeAllocateMnodeRqueue
()
{
tsMReadQueue
=
taosOpenQueue
();
if
(
tsMReadQueue
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
tsMReadQueue
==
NULL
)
return
TSDB_CODE_
DND
_OUT_OF_MEMORY
;
taosAddIntoQset
(
tsMReadQset
,
tsMReadQueue
,
NULL
);
...
...
@@ -130,8 +130,8 @@ static void dnodeFreeMnodeReadMsg(SMnodeMsg *pRead) {
}
static
void
dnodeSendRpcMnodeReadRsp
(
SMnodeMsg
*
pRead
,
int32_t
code
)
{
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_ACTION_NEED_REPROCESSED
)
{
if
(
code
==
TSDB_CODE_
MND_
ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
MND_
ACTION_NEED_REPROCESSED
)
{
// may be a auto create req, should put into write queue
dnodeReprocessMnodeWriteMsg
(
pRead
);
return
;
...
...
src/dnode/src/dnodeMWrite.c
浏览文件 @
7e2abf0e
...
...
@@ -81,7 +81,7 @@ void dnodeCleanupMnodeWrite() {
int32_t
dnodeAllocateMnodeWqueue
()
{
tsMWriteQueue
=
taosOpenQueue
();
if
(
tsMWriteQueue
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
tsMWriteQueue
==
NULL
)
return
TSDB_CODE_
DND
_OUT_OF_MEMORY
;
taosAddIntoQset
(
tsMWriteQset
,
tsMWriteQueue
,
NULL
);
...
...
@@ -128,8 +128,8 @@ static void dnodeFreeMnodeWriteMsg(SMnodeMsg *pWrite) {
void
dnodeSendRpcMnodeWriteRsp
(
void
*
pRaw
,
int32_t
code
)
{
SMnodeMsg
*
pWrite
=
pRaw
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_ACTION_NEED_REPROCESSED
)
{
if
(
code
==
TSDB_CODE_
MND_
ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
MND_
ACTION_NEED_REPROCESSED
)
{
dnodeReprocessMnodeWriteMsg
(
pWrite
);
return
;
}
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
7e2abf0e
...
...
@@ -180,7 +180,7 @@ void dnodeDispatchToMgmtQueue(SRpcMsg *pMsg) {
SRpcMsg
rsp
;
rsp
.
handle
=
pMsg
->
handle
;
rsp
.
pCont
=
NULL
;
rsp
.
code
=
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
rsp
.
code
=
TSDB_CODE_
DND
_OUT_OF_MEMORY
;
rpcSendResponse
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
}
...
...
@@ -202,7 +202,7 @@ static void *dnodeProcessMgmtQueue(void *param) {
if
(
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])
{
rsp
.
code
=
(
*
dnodeProcessMgmtMsgFp
[
pMsg
->
msgType
])(
pMsg
);
}
else
{
rsp
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
;
rsp
.
code
=
TSDB_CODE_
DND_
MSG_NOT_PROCESSED
;
}
rsp
.
handle
=
pMsg
->
handle
;
...
...
@@ -219,7 +219,7 @@ static void *dnodeProcessMgmtQueue(void *param) {
static
int32_t
dnodeGetVnodeList
(
int32_t
vnodeList
[],
int32_t
*
numOfVnodes
)
{
DIR
*
dir
=
opendir
(
tsVnodeDir
);
if
(
dir
==
NULL
)
{
return
TSDB_CODE_NO_WRITE_ACCESS
;
return
TSDB_CODE_
DND_
NO_WRITE_ACCESS
;
}
*
numOfVnodes
=
0
;
...
...
src/dnode/src/dnodePeer.c
浏览文件 @
7e2abf0e
...
...
@@ -89,7 +89,7 @@ static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
rspMsg
.
contLen
=
0
;
if
(
dnodeGetRunStatus
()
!=
TSDB_DNODE_RUN_STATUS_RUNING
)
{
rspMsg
.
code
=
TSDB_CODE_NOT_READY
;
rspMsg
.
code
=
TSDB_CODE_
RPC_
NOT_READY
;
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
dTrace
(
"RPC %p, msg:%s is ignored since dnode not running"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
...
...
@@ -97,7 +97,7 @@ static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
}
if
(
pMsg
->
pCont
==
NULL
)
{
rspMsg
.
code
=
TSDB_CODE_INVALID_MSG_LEN
;
rspMsg
.
code
=
TSDB_CODE_
DND_
INVALID_MSG_LEN
;
rpcSendResponse
(
&
rspMsg
);
return
;
}
...
...
@@ -106,7 +106,7 @@ static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
(
*
dnodeProcessReqMsgFp
[
pMsg
->
msgType
])(
pMsg
);
}
else
{
dTrace
(
"RPC %p, message:%s not processed"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
rspMsg
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
;
rspMsg
.
code
=
TSDB_CODE_
DND_
MSG_NOT_PROCESSED
;
rpcSendResponse
(
&
rspMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
}
...
...
src/dnode/src/dnodeShell.c
浏览文件 @
7e2abf0e
...
...
@@ -115,7 +115,7 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
if
(
dnodeGetRunStatus
()
!=
TSDB_DNODE_RUN_STATUS_RUNING
)
{
dError
(
"RPC %p, shell msg:%s is ignored since dnode not running"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
rpcMsg
.
code
=
TSDB_CODE_NOT_READY
;
rpcMsg
.
code
=
TSDB_CODE_
RPC_
NOT_READY
;
rpcSendResponse
(
&
rpcMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
...
...
@@ -131,7 +131,7 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
(
*
dnodeProcessShellMsgFp
[
pMsg
->
msgType
])(
pMsg
);
}
else
{
dError
(
"RPC %p, shell msg:%s is not processed"
,
pMsg
->
handle
,
taosMsg
[
pMsg
->
msgType
]);
rpcMsg
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
;
rpcMsg
.
code
=
TSDB_CODE_
DND_
MSG_NOT_PROCESSED
;
rpcSendResponse
(
&
rpcMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
return
;
...
...
@@ -140,7 +140,7 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
static
int
dnodeRetrieveUserAuthInfo
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
int
code
=
mnodeRetriveAuth
(
user
,
spi
,
encrypt
,
secret
,
ckey
);
if
(
code
!=
TSDB_CODE_NOT_READY
)
return
code
;
if
(
code
!=
TSDB_CODE_
RPC_
NOT_READY
)
return
code
;
SDMAuthMsg
*
pMsg
=
rpcMallocCont
(
sizeof
(
SDMAuthMsg
));
strcpy
(
pMsg
->
user
,
user
);
...
...
src/dnode/src/dnodeVRead.c
浏览文件 @
7e2abf0e
...
...
@@ -134,7 +134,7 @@ void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg) {
.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
contLen
=
0
,
.
code
=
TSDB_CODE_INVALID_VGROUP_ID
,
.
code
=
TSDB_CODE_
VND_
INVALID_VGROUP_ID
,
.
msgType
=
0
};
rpcSendResponse
(
&
rpcRsp
);
...
...
@@ -189,8 +189,8 @@ static void dnodeContinueExecuteQuery(void* pVnode, void* qhandle, SReadMsg *pMs
}
void
dnodeSendRpcReadRsp
(
void
*
pVnode
,
SReadMsg
*
pRead
,
int32_t
code
)
{
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_ACTION_NEED_REPROCESSED
)
{
if
(
code
==
TSDB_CODE_
VND_
ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_
VND_
ACTION_NEED_REPROCESSED
)
{
dnodeContinueExecuteQuery
(
pVnode
,
pRead
->
rspRet
.
qhandle
,
pRead
);
}
...
...
src/dnode/src/dnodeVWrite.c
浏览文件 @
7e2abf0e
...
...
@@ -115,7 +115,7 @@ void dnodeDispatchToVnodeWriteQueue(SRpcMsg *pMsg) {
.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
.
contLen
=
0
,
.
code
=
TSDB_CODE_INVALID_VGROUP_ID
,
.
code
=
TSDB_CODE_
VND_
INVALID_VGROUP_ID
,
.
msgType
=
0
};
rpcSendResponse
(
&
rpcRsp
);
...
...
src/inc/taoserror.h
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/kit/shell/src/shellEngine.c
浏览文件 @
7e2abf0e
...
...
@@ -862,7 +862,7 @@ void shellGetGrantInfo(void *con) {
int
code
=
taos_errno
(
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_OPS_NOT_SUPPORT
)
{
if
(
code
==
TSDB_CODE_
COM_
OPS_NOT_SUPPORT
)
{
fprintf
(
stdout
,
"Server is Community Edition, version is %s
\n\n
"
,
taos_get_server_info
(
con
));
}
else
{
fprintf
(
stderr
,
"Failed to check Server Edition, Reason:%d:%s
\n\n
"
,
taos_errno
(
con
),
taos_errstr
(
con
));
...
...
src/mnode/src/mnodeAcct.c
浏览文件 @
7e2abf0e
...
...
@@ -70,7 +70,7 @@ static int32_t mnodeActionActionEncode(SSdbOper *pOper) {
static
int32_t
mnodeAcctActionDecode
(
SSdbOper
*
pOper
)
{
SAcctObj
*
pAcct
=
(
SAcctObj
*
)
calloc
(
1
,
sizeof
(
SAcctObj
));
if
(
pAcct
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
pAcct
==
NULL
)
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
memcpy
(
pAcct
,
pOper
->
rowData
,
tsAcctUpdateSize
);
pOper
->
pObj
=
pAcct
;
...
...
src/mnode/src/mnodeBalance.c
浏览文件 @
7e2abf0e
...
...
@@ -56,7 +56,7 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) {
if
(
pSelDnode
==
NULL
)
{
mError
(
"failed to alloc vnode to vgroup"
);
return
TSDB_CODE_NO_ENOUGH_DNODES
;
return
TSDB_CODE_
MND_
NO_ENOUGH_DNODES
;
}
pVgroup
->
vnodeGid
[
0
].
dnodeId
=
pSelDnode
->
dnodeId
;
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
7e2abf0e
...
...
@@ -71,7 +71,7 @@ static int32_t mnodeDbActionInsert(SSdbOper *pOper) {
}
else
{
mError
(
"db:%s, acct:%s info not exist in sdb"
,
pDb
->
name
,
pDb
->
acct
);
return
TSDB_CODE_INVALID_ACCT
;
return
TSDB_CODE_
MND_
INVALID_ACCT
;
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -111,7 +111,7 @@ static int32_t mnodeDbActionEncode(SSdbOper *pOper) {
static
int32_t
mnodeDbActionDecode
(
SSdbOper
*
pOper
)
{
SDbObj
*
pDb
=
(
SDbObj
*
)
calloc
(
1
,
sizeof
(
SDbObj
));
if
(
pDb
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
pDb
==
NULL
)
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
memcpy
(
pDb
,
pOper
->
rowData
,
tsDbUpdateSize
);
pOper
->
pObj
=
pDb
;
...
...
@@ -189,102 +189,102 @@ static int32_t mnodeCheckDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
cacheBlockSize
<
TSDB_MIN_CACHE_BLOCK_SIZE
||
pCfg
->
cacheBlockSize
>
TSDB_MAX_CACHE_BLOCK_SIZE
)
{
mError
(
"invalid db option cacheBlockSize:%d valid range: [%d, %d]"
,
pCfg
->
cacheBlockSize
,
TSDB_MIN_CACHE_BLOCK_SIZE
,
TSDB_MAX_CACHE_BLOCK_SIZE
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
totalBlocks
<
TSDB_MIN_TOTAL_BLOCKS
||
pCfg
->
totalBlocks
>
TSDB_MAX_TOTAL_BLOCKS
)
{
mError
(
"invalid db option totalBlocks:%d valid range: [%d, %d]"
,
pCfg
->
totalBlocks
,
TSDB_MIN_TOTAL_BLOCKS
,
TSDB_MAX_TOTAL_BLOCKS
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
maxTables
<
TSDB_MIN_TABLES
||
pCfg
->
maxTables
>
TSDB_MAX_TABLES
)
{
mError
(
"invalid db option maxTables:%d valid range: [%d, %d]"
,
pCfg
->
maxTables
,
TSDB_MIN_TABLES
,
TSDB_MAX_TABLES
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
daysPerFile
<
TSDB_MIN_DAYS_PER_FILE
||
pCfg
->
daysPerFile
>
TSDB_MAX_DAYS_PER_FILE
)
{
mError
(
"invalid db option daysPerFile:%d valid range: [%d, %d]"
,
pCfg
->
daysPerFile
,
TSDB_MIN_DAYS_PER_FILE
,
TSDB_MAX_DAYS_PER_FILE
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
daysToKeep
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep
>
TSDB_MAX_KEEP
)
{
mError
(
"invalid db option daysToKeep:%d valid range: [%d, %d]"
,
pCfg
->
daysToKeep
,
TSDB_MIN_KEEP
,
TSDB_MAX_KEEP
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
daysToKeep
<
pCfg
->
daysPerFile
)
{
mError
(
"invalid db option daysToKeep:%d should larger than daysPerFile:%d"
,
pCfg
->
daysToKeep
,
pCfg
->
daysPerFile
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
daysToKeep2
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep2
>
pCfg
->
daysToKeep
)
{
mError
(
"invalid db option daysToKeep2:%d valid range: [%d, %d]"
,
pCfg
->
daysToKeep
,
TSDB_MIN_KEEP
,
pCfg
->
daysToKeep
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
daysToKeep1
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep1
>
pCfg
->
daysToKeep2
)
{
mError
(
"invalid db option daysToKeep1:%d valid range: [%d, %d]"
,
pCfg
->
daysToKeep1
,
TSDB_MIN_KEEP
,
pCfg
->
daysToKeep2
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
maxRowsPerFileBlock
<
TSDB_MIN_MAX_ROW_FBLOCK
||
pCfg
->
maxRowsPerFileBlock
>
TSDB_MAX_MAX_ROW_FBLOCK
)
{
mError
(
"invalid db option maxRowsPerFileBlock:%d valid range: [%d, %d]"
,
pCfg
->
maxRowsPerFileBlock
,
TSDB_MIN_MAX_ROW_FBLOCK
,
TSDB_MAX_MAX_ROW_FBLOCK
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
minRowsPerFileBlock
<
TSDB_MIN_MIN_ROW_FBLOCK
||
pCfg
->
minRowsPerFileBlock
>
TSDB_MAX_MIN_ROW_FBLOCK
)
{
mError
(
"invalid db option minRowsPerFileBlock:%d valid range: [%d, %d]"
,
pCfg
->
minRowsPerFileBlock
,
TSDB_MIN_MIN_ROW_FBLOCK
,
TSDB_MAX_MIN_ROW_FBLOCK
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
minRowsPerFileBlock
>
pCfg
->
maxRowsPerFileBlock
)
{
mError
(
"invalid db option minRowsPerFileBlock:%d should smaller than maxRowsPerFileBlock:%d"
,
pCfg
->
minRowsPerFileBlock
,
pCfg
->
maxRowsPerFileBlock
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
commitTime
<
TSDB_MIN_COMMIT_TIME
||
pCfg
->
commitTime
>
TSDB_MAX_COMMIT_TIME
)
{
mError
(
"invalid db option commitTime:%d valid range: [%d, %d]"
,
pCfg
->
commitTime
,
TSDB_MIN_COMMIT_TIME
,
TSDB_MAX_COMMIT_TIME
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
precision
<
TSDB_MIN_PRECISION
&&
pCfg
->
precision
>
TSDB_MAX_PRECISION
)
{
mError
(
"invalid db option timePrecision:%d valid value: [%d, %d]"
,
pCfg
->
precision
,
TSDB_MIN_PRECISION
,
TSDB_MAX_PRECISION
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
compression
<
TSDB_MIN_COMP_LEVEL
||
pCfg
->
compression
>
TSDB_MAX_COMP_LEVEL
)
{
mError
(
"invalid db option compression:%d valid range: [%d, %d]"
,
pCfg
->
compression
,
TSDB_MIN_COMP_LEVEL
,
TSDB_MAX_COMP_LEVEL
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
walLevel
<
TSDB_MIN_WAL_LEVEL
||
pCfg
->
walLevel
>
TSDB_MAX_WAL_LEVEL
)
{
mError
(
"invalid db option walLevel:%d, valid range: [%d, %d]"
,
pCfg
->
walLevel
,
TSDB_MIN_WAL_LEVEL
,
TSDB_MAX_WAL_LEVEL
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
replications
<
TSDB_MIN_REPLICA_NUM
||
pCfg
->
replications
>
TSDB_MAX_REPLICA_NUM
)
{
mError
(
"invalid db option replications:%d valid range: [%d, %d]"
,
pCfg
->
replications
,
TSDB_MIN_REPLICA_NUM
,
TSDB_MAX_REPLICA_NUM
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
pCfg
->
walLevel
<
TSDB_MIN_WAL_LEVEL
)
{
mError
(
"invalid db option walLevel:%d must be greater than 0"
,
pCfg
->
walLevel
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
#ifndef _SYNC
if
(
pCfg
->
replications
!=
1
)
{
mError
(
"invalid db option replications:%d can only be 1 in this version"
,
pCfg
->
replications
);
return
TSDB_CODE_
INVALID
_OPTION
;
return
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
#endif
...
...
@@ -320,7 +320,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) {
return
TSDB_CODE_SUCCESS
;
}
else
{
mError
(
"db:%s, is already exist, ignore exist not set"
,
pCreate
->
db
);
return
TSDB_CODE_DB_ALREADY_EXIST
;
return
TSDB_CODE_
MND_
DB_ALREADY_EXIST
;
}
}
...
...
@@ -366,7 +366,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) {
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pDb
);
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
return
code
;
...
...
@@ -743,7 +743,7 @@ static int32_t mnodeSetDbDropping(SDbObj *pDb) {
int32_t
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_SDB_ERROR
;
return
TSDB_CODE_
MND_
SDB_ERROR
;
}
return
code
;
...
...
@@ -766,7 +766,7 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_GRANT_EXPIRED
;
}
else
if
(
!
pMsg
->
pUser
->
writeAuth
)
{
code
=
TSDB_CODE_NO_RIGHTS
;
code
=
TSDB_CODE_
MND_
NO_RIGHTS
;
}
else
{
code
=
mnodeCreateDb
(
pMsg
->
pUser
->
pAcct
,
pCreate
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
...
...
@@ -800,7 +800,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
if
(
cacheBlockSize
>
0
&&
cacheBlockSize
!=
pDb
->
cfg
.
cacheBlockSize
)
{
mError
(
"db:%s, can't alter cache option"
,
pDb
->
name
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
totalBlocks
>
0
&&
totalBlocks
!=
pDb
->
cfg
.
totalBlocks
)
{
...
...
@@ -813,13 +813,13 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
newCfg
.
maxTables
=
maxTables
;
if
(
newCfg
.
maxTables
<
pDb
->
cfg
.
maxTables
)
{
mError
(
"db:%s, tables:%d should larger than origin:%d"
,
pDb
->
name
,
newCfg
.
maxTables
,
pDb
->
cfg
.
maxTables
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
}
if
(
daysPerFile
>
0
&&
daysPerFile
!=
pDb
->
cfg
.
daysPerFile
)
{
mError
(
"db:%s, can't alter days option"
,
pDb
->
name
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
daysToKeep
>
0
&&
daysToKeep
!=
pDb
->
cfg
.
daysToKeep
)
{
...
...
@@ -839,22 +839,22 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
if
(
minRows
>
0
&&
minRows
!=
pDb
->
cfg
.
minRowsPerFileBlock
)
{
mError
(
"db:%s, can't alter minRows option"
,
pDb
->
name
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
maxRows
>
0
&&
maxRows
!=
pDb
->
cfg
.
maxRowsPerFileBlock
)
{
mError
(
"db:%s, can't alter maxRows option"
,
pDb
->
name
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
commitTime
>
0
&&
commitTime
!=
pDb
->
cfg
.
commitTime
)
{
mError
(
"db:%s, can't alter commitTime option"
,
pDb
->
name
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
precision
>
0
&&
precision
!=
pDb
->
cfg
.
precision
)
{
mError
(
"db:%s, can't alter precision option"
,
pDb
->
name
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
compression
>=
0
&&
compression
!=
pDb
->
cfg
.
compression
)
{
...
...
@@ -864,7 +864,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
if
(
walLevel
>
0
&&
walLevel
!=
pDb
->
cfg
.
walLevel
)
{
mError
(
"db:%s, can't alter walLevel option"
,
pDb
->
name
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
replications
>
0
&&
replications
!=
pDb
->
cfg
.
replications
)
{
...
...
@@ -873,17 +873,17 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
if
(
pDb
->
cfg
.
walLevel
<
TSDB_MIN_WAL_LEVEL
)
{
mError
(
"db:%s, walLevel:%d must be greater than 0"
,
pDb
->
name
,
pDb
->
cfg
.
walLevel
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
if
(
replications
>
mnodeGetDnodesNum
())
{
mError
(
"db:%s, no enough dnode to change replica:%d"
,
pDb
->
name
,
replications
);
terrno
=
TSDB_CODE_NO_ENOUGH_DNODES
;
terrno
=
TSDB_CODE_
MND_
NO_ENOUGH_DNODES
;
}
if
(
pDb
->
cfg
.
replications
-
replications
>=
2
)
{
mError
(
"db:%s, replica number can't change from 3 to 1"
,
pDb
->
name
,
replications
);
terrno
=
TSDB_CODE_
INVALID
_OPTION
;
terrno
=
TSDB_CODE_
MND_INVALID_DB
_OPTION
;
}
}
...
...
@@ -914,7 +914,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
int32_t
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_SDB_ERROR
;
return
TSDB_CODE_
MND_
SDB_ERROR
;
}
}
...
...
@@ -942,7 +942,7 @@ static int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg) {
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pAlter
->
db
);
if
(
pMsg
->
pDb
==
NULL
)
{
mError
(
"db:%s, failed to alter, invalid db"
,
pAlter
->
db
);
return
TSDB_CODE_INVALID_DB
;
return
TSDB_CODE_
MND_
INVALID_DB
;
}
int32_t
code
=
mnodeAlterDb
(
pMsg
->
pDb
,
pAlter
);
...
...
@@ -966,7 +966,7 @@ static int32_t mnodeDropDb(SMnodeMsg *pMsg) {
};
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
0
)
{
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
return
code
;
...
...
@@ -983,13 +983,13 @@ static int32_t mnodeProcessDropDbMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_SUCCESS
;
}
else
{
mError
(
"db:%s, failed to drop, invalid db"
,
pDrop
->
db
);
return
TSDB_CODE_INVALID_DB
;
return
TSDB_CODE_
MND_
INVALID_DB
;
}
}
if
(
mnodeCheckIsMonitorDB
(
pMsg
->
pDb
->
name
,
tsMonitorDbName
))
{
mError
(
"db:%s, can't drop monitor database"
,
pDrop
->
db
);
return
TSDB_CODE_MONITOR_DB_FORBIDDEN
;
return
TSDB_CODE_M
ND_M
ONITOR_DB_FORBIDDEN
;
}
int32_t
code
=
mnodeSetDbDropping
(
pMsg
->
pDb
);
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
7e2abf0e
...
...
@@ -107,7 +107,7 @@ static int32_t mnodeDnodeActionEncode(SSdbOper *pOper) {
static
int32_t
mnodeDnodeActionDecode
(
SSdbOper
*
pOper
)
{
SDnodeObj
*
pDnode
=
(
SDnodeObj
*
)
calloc
(
1
,
sizeof
(
SDnodeObj
));
if
(
pDnode
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
pDnode
==
NULL
)
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
memcpy
(
pDnode
,
pOper
->
rowData
,
tsDnodeUpdateSize
);
pOper
->
pObj
=
pDnode
;
...
...
@@ -249,7 +249,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
}
if
(
strcmp
(
pMsg
->
pUser
->
user
,
"root"
)
!=
0
)
{
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
SRpcIpSet
ipSet
=
mnodeGetIpSetFromIp
(
pCmCfgDnode
->
ep
);
...
...
@@ -286,7 +286,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
uint32_t
version
=
htonl
(
pStatus
->
version
);
if
(
version
!=
tsVersion
)
{
mError
(
"status msg version:%d not equal with mnode:%d"
,
version
,
tsVersion
);
return
TSDB_CODE_INVALID_MSG_VERSION
;
return
TSDB_CODE_
MND_
INVALID_MSG_VERSION
;
}
SDnodeObj
*
pDnode
=
NULL
;
...
...
@@ -294,13 +294,13 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pDnode
=
mnodeGetDnodeByEp
(
pStatus
->
dnodeEp
);
if
(
pDnode
==
NULL
)
{
mTrace
(
"dnode %s not created"
,
pStatus
->
dnodeEp
);
return
TSDB_CODE_DNODE_NOT_EXIST
;
return
TSDB_CODE_
MND_
DNODE_NOT_EXIST
;
}
}
else
{
pDnode
=
mnodeGetDnode
(
pStatus
->
dnodeId
);
if
(
pDnode
==
NULL
)
{
mError
(
"dnode id:%d, %s not exist"
,
pStatus
->
dnodeId
,
pStatus
->
dnodeEp
);
return
TSDB_CODE_DNODE_NOT_EXIST
;
return
TSDB_CODE_
MND_
DNODE_NOT_EXIST
;
}
}
...
...
@@ -347,7 +347,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
int32_t
contLen
=
sizeof
(
SDMStatusRsp
)
+
TSDB_MAX_VNODES
*
sizeof
(
SDMVgroupAccess
);
SDMStatusRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
}
mnodeGetMnodeInfos
(
&
pRsp
->
mnodes
);
...
...
@@ -376,7 +376,7 @@ static int32_t mnodeCreateDnode(char *ep) {
if
(
pDnode
!=
NULL
)
{
mnodeDecDnodeRef
(
pDnode
);
mError
(
"dnode:%d is alredy exist, %s:%d"
,
pDnode
->
dnodeId
,
pDnode
->
dnodeFqdn
,
pDnode
->
dnodePort
);
return
TSDB_CODE_DNODE_ALREADY_EXIST
;
return
TSDB_CODE_
MND_
DNODE_ALREADY_EXIST
;
}
pDnode
=
(
SDnodeObj
*
)
calloc
(
1
,
sizeof
(
SDnodeObj
));
...
...
@@ -398,7 +398,7 @@ static int32_t mnodeCreateDnode(char *ep) {
int
dnodeId
=
pDnode
->
dnodeId
;
tfree
(
pDnode
);
mError
(
"failed to create dnode:%d, result:%s"
,
dnodeId
,
tstrerror
(
code
));
return
TSDB_CODE_SDB_ERROR
;
return
TSDB_CODE_
MND_
SDB_ERROR
;
}
mPrint
(
"dnode:%d is created, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
...
...
@@ -414,7 +414,7 @@ int32_t mnodeDropDnode(SDnodeObj *pDnode) {
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
mLPrint
(
"dnode:%d, is dropped from cluster, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
...
...
@@ -425,13 +425,13 @@ static int32_t mnodeDropDnodeByEp(char *ep) {
SDnodeObj
*
pDnode
=
mnodeGetDnodeByEp
(
ep
);
if
(
pDnode
==
NULL
)
{
mError
(
"dnode:%s, is not exist"
,
ep
);
return
TSDB_CODE_DNODE_NOT_EXIST
;
return
TSDB_CODE_
MND_
DNODE_NOT_EXIST
;
}
mnodeDecDnodeRef
(
pDnode
);
if
(
strcmp
(
pDnode
->
dnodeEp
,
dnodeGetMnodeMasterEp
())
==
0
)
{
mError
(
"dnode:%d, can't drop dnode:%s which is master"
,
pDnode
->
dnodeId
,
ep
);
return
TSDB_CODE_NO_REMOVE_MASTER
;
return
TSDB_CODE_
MND_
NO_REMOVE_MASTER
;
}
mPrint
(
"dnode:%d, start to drop it"
,
pDnode
->
dnodeId
);
...
...
@@ -446,7 +446,7 @@ static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
SCMCreateDnodeMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
if
(
strcmp
(
pMsg
->
pUser
->
user
,
"root"
)
!=
0
)
{
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
else
{
int32_t
code
=
mnodeCreateDnode
(
pCreate
->
ep
);
...
...
@@ -466,7 +466,7 @@ static int32_t mnodeProcessDropDnodeMsg(SMnodeMsg *pMsg) {
SCMDropDnodeMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
if
(
strcmp
(
pMsg
->
pUser
->
user
,
"root"
)
!=
0
)
{
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
else
{
int32_t
code
=
mnodeDropDnodeByEp
(
pDrop
->
ep
);
...
...
@@ -486,7 +486,7 @@ static int32_t mnodeGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
if
(
strcmp
(
pUser
->
pAcct
->
user
,
"root"
)
!=
0
)
{
mnodeDecUserRef
(
pUser
);
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
int32_t
cols
=
0
;
...
...
@@ -615,7 +615,7 @@ static int32_t mnodeGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
{
mnodeDecUserRef
(
pUser
);
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -725,7 +725,7 @@ static int32_t mnodeGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
{
mnodeDecUserRef
(
pUser
);
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -812,7 +812,7 @@ static int32_t mnodeGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
{
mnodeDecUserRef
(
pUser
);
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
src/mnode/src/mnodeInt.c
浏览文件 @
7e2abf0e
...
...
@@ -41,7 +41,7 @@ void mnodeCreateMsg(SMnodeMsg *pMsg, SRpcMsg *rpcMsg) {
int32_t
mnodeInitMsg
(
SMnodeMsg
*
pMsg
)
{
pMsg
->
pUser
=
mnodeGetUserFromConn
(
pMsg
->
rpcMsg
.
handle
);
if
(
pMsg
->
pUser
==
NULL
)
{
return
TSDB_CODE_INVALID_USER
;
return
TSDB_CODE_
MND_
INVALID_USER
;
}
return
TSDB_CODE_SUCCESS
;
...
...
src/mnode/src/mnodeMnode.c
浏览文件 @
7e2abf0e
...
...
@@ -63,7 +63,7 @@ static int32_t mnodeMnodeActionDestroy(SSdbOper *pOper) {
static
int32_t
mnodeMnodeActionInsert
(
SSdbOper
*
pOper
)
{
SMnodeObj
*
pMnode
=
pOper
->
pObj
;
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pMnode
->
mnodeId
);
if
(
pDnode
==
NULL
)
return
TSDB_CODE_DNODE_NOT_EXIST
;
if
(
pDnode
==
NULL
)
return
TSDB_CODE_
MND_
DNODE_NOT_EXIST
;
pDnode
->
isMgmt
=
true
;
mnodeDecDnodeRef
(
pDnode
);
...
...
@@ -75,7 +75,7 @@ static int32_t mnodeMnodeActionDelete(SSdbOper *pOper) {
SMnodeObj
*
pMnode
=
pOper
->
pObj
;
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pMnode
->
mnodeId
);
if
(
pDnode
==
NULL
)
return
TSDB_CODE_DNODE_NOT_EXIST
;
if
(
pDnode
==
NULL
)
return
TSDB_CODE_
MND_
DNODE_NOT_EXIST
;
pDnode
->
isMgmt
=
false
;
mnodeDecDnodeRef
(
pDnode
);
...
...
@@ -103,7 +103,7 @@ static int32_t mnodeMnodeActionEncode(SSdbOper *pOper) {
static
int32_t
mnodeMnodeActionDecode
(
SSdbOper
*
pOper
)
{
SMnodeObj
*
pMnode
=
calloc
(
1
,
sizeof
(
SMnodeObj
));
if
(
pMnode
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
pMnode
==
NULL
)
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
memcpy
(
pMnode
,
pOper
->
rowData
,
tsMnodeUpdateSize
);
pOper
->
pObj
=
pMnode
;
...
...
@@ -285,7 +285,7 @@ int32_t mnodeAddMnode(int32_t dnodeId) {
int32_t
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pMnode
);
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
mnodeUpdateMnodeIpSet
();
...
...
@@ -307,7 +307,7 @@ void mnodeDropMnodeLocal(int32_t dnodeId) {
int32_t
mnodeDropMnode
(
int32_t
dnodeId
)
{
SMnodeObj
*
pMnode
=
mnodeGetMnode
(
dnodeId
);
if
(
pMnode
==
NULL
)
{
return
TSDB_CODE_DNODE_NOT_EXIST
;
return
TSDB_CODE_
MND_
DNODE_NOT_EXIST
;
}
SSdbOper
oper
=
{
...
...
@@ -318,7 +318,7 @@ int32_t mnodeDropMnode(int32_t dnodeId) {
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
sdbDecRef
(
tsMnodeSdb
,
pMnode
);
...
...
@@ -335,7 +335,7 @@ static int32_t mnodeGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
if
(
strcmp
(
pUser
->
pAcct
->
user
,
"root"
)
!=
0
)
{
mnodeDecUserRef
(
pUser
);
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
int32_t
cols
=
0
;
...
...
src/mnode/src/mnodePeer.c
浏览文件 @
7e2abf0e
...
...
@@ -48,7 +48,7 @@ void mnodeAddPeerRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) {
int32_t
mnodeProcessPeerReq
(
SMnodeMsg
*
pMsg
)
{
if
(
pMsg
->
rpcMsg
.
pCont
==
NULL
)
{
mError
(
"%p, msg:%s in mpeer queue, content is null"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
]);
return
TSDB_CODE_INVALID_MSG_LEN
;
return
TSDB_CODE_
MND_
INVALID_MSG_LEN
;
}
if
(
!
sdbIsMaster
())
{
...
...
@@ -63,12 +63,12 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg) {
mTrace
(
"mnode index:%d ip:%s:%d"
,
i
,
ipSet
->
fqdn
[
i
],
htons
(
ipSet
->
port
[
i
]));
}
return
TSDB_CODE_REDIRECT
;
return
TSDB_CODE_R
PC_R
EDIRECT
;
}
if
(
tsMnodeProcessPeerMsgFp
[
pMsg
->
rpcMsg
.
msgType
]
==
NULL
)
{
mError
(
"%p, msg:%s in mpeer queue, not processed"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
]);
return
TSDB_CODE_MSG_NOT_PROCESSED
;
return
TSDB_CODE_M
ND_M
SG_NOT_PROCESSED
;
}
return
(
*
tsMnodeProcessPeerMsgFp
[
pMsg
->
rpcMsg
.
msgType
])(
pMsg
);
...
...
src/mnode/src/mnodeProfile.c
浏览文件 @
7e2abf0e
...
...
@@ -84,7 +84,7 @@ SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port) {
if
(
connSize
>
tsMaxShellConns
)
{
mError
(
"failed to create conn for user:%s ip:%s:%u, conns:%d larger than maxShellConns:%d, "
,
user
,
taosIpStr
(
ip
),
port
,
connSize
,
tsMaxShellConns
);
terrno
=
TSDB_CODE_TOO_MANY_SHELL_CONNS
;
terrno
=
TSDB_CODE_
MND_
TOO_MANY_SHELL_CONNS
;
return
NULL
;
}
...
...
@@ -168,7 +168,7 @@ static void *mnodeGetNextConn(SHashMutableIterator *pIter, SConnObj **pConn) {
static
int32_t
mnodeGetConnsMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
SUserObj
*
pUser
=
mnodeGetUserFromConn
(
pConn
);
if
(
pUser
==
NULL
)
return
0
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_
MND_
NO_RIGHTS
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -282,7 +282,7 @@ int32_t mnodeSaveQueryStreamList(SConnObj *pConn, SCMHeartBeatMsg *pHBMsg) {
static
int32_t
mnodeGetQueryMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
SUserObj
*
pUser
=
mnodeGetUserFromConn
(
pConn
);
if
(
pUser
==
NULL
)
return
0
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_
MND_
NO_RIGHTS
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -391,7 +391,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
static
int32_t
mnodeGetStreamMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
SUserObj
*
pUser
=
mnodeGetUserFromConn
(
pConn
);
if
(
pUser
==
NULL
)
return
0
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_
MND_
NO_RIGHTS
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -519,7 +519,7 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v
static
int32_t
mnodeProcessKillQueryMsg
(
SMnodeMsg
*
pMsg
)
{
SUserObj
*
pUser
=
pMsg
->
pUser
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_
MND_
NO_RIGHTS
;
SCMKillQueryMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
mPrint
(
"kill query msg is received, queryId:%s"
,
pKill
->
queryId
);
...
...
@@ -530,7 +530,7 @@ static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
if
(
queryIdStr
==
NULL
||
connIdStr
==
NULL
)
{
mPrint
(
"failed to kill query, queryId:%s"
,
pKill
->
queryId
);
return
TSDB_CODE_INVALID_QUERY_ID
;
return
TSDB_CODE_
MND_
INVALID_QUERY_ID
;
}
int32_t
queryId
=
(
int32_t
)
strtol
(
queryIdStr
,
NULL
,
10
);
...
...
@@ -538,7 +538,7 @@ static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
SConnObj
*
pConn
=
taosCacheAcquireByName
(
tsMnodeConnCache
,
connIdStr
);
if
(
pConn
==
NULL
)
{
mError
(
"connId:%s, failed to kill queryId:%d, conn not exist"
,
connIdStr
,
queryId
);
return
TSDB_CODE_
INVALID_CONNECTION
;
return
TSDB_CODE_
MND_INVALID_CONN_ID
;
}
else
{
mPrint
(
"connId:%s, queryId:%d is killed by user:%s"
,
connIdStr
,
queryId
,
pUser
->
user
);
pConn
->
queryId
=
queryId
;
...
...
@@ -549,7 +549,7 @@ static int32_t mnodeProcessKillQueryMsg(SMnodeMsg *pMsg) {
static
int32_t
mnodeProcessKillStreamMsg
(
SMnodeMsg
*
pMsg
)
{
SUserObj
*
pUser
=
pMsg
->
pUser
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_
MND_
NO_RIGHTS
;
SCMKillQueryMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
mPrint
(
"kill stream msg is received, streamId:%s"
,
pKill
->
queryId
);
...
...
@@ -560,7 +560,7 @@ static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
if
(
streamIdStr
==
NULL
||
connIdStr
==
NULL
)
{
mPrint
(
"failed to kill stream, streamId:%s"
,
pKill
->
queryId
);
return
TSDB_CODE_INVALID_STREAM_ID
;
return
TSDB_CODE_
MND_
INVALID_STREAM_ID
;
}
int32_t
streamId
=
(
int32_t
)
strtol
(
streamIdStr
,
NULL
,
10
);
...
...
@@ -568,7 +568,7 @@ static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
SConnObj
*
pConn
=
taosCacheAcquireByName
(
tsMnodeConnCache
,
connIdStr
);
if
(
pConn
==
NULL
)
{
mError
(
"connId:%s, failed to kill streamId:%d, conn not exist"
,
connIdStr
,
streamId
);
return
TSDB_CODE_
INVALID_CONNECTION
;
return
TSDB_CODE_
MND_INVALID_CONN_ID
;
}
else
{
mPrint
(
"connId:%s, streamId:%d is killed by user:%s"
,
connIdStr
,
streamId
,
pUser
->
user
);
pConn
->
streamId
=
streamId
;
...
...
@@ -579,13 +579,13 @@ static int32_t mnodeProcessKillStreamMsg(SMnodeMsg *pMsg) {
static
int32_t
mnodeProcessKillConnectionMsg
(
SMnodeMsg
*
pMsg
)
{
SUserObj
*
pUser
=
pMsg
->
pUser
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_NO_RIGHTS
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_
MND_
NO_RIGHTS
;
SCMKillConnMsg
*
pKill
=
pMsg
->
rpcMsg
.
pCont
;
SConnObj
*
pConn
=
taosCacheAcquireByName
(
tsMnodeConnCache
,
pKill
->
queryId
);
if
(
pConn
==
NULL
)
{
mError
(
"connId:%s, failed to kill, conn not exist"
,
pKill
->
queryId
);
return
TSDB_CODE_
INVALID_CONNECTION
;
return
TSDB_CODE_
MND_INVALID_CONN_ID
;
}
else
{
mPrint
(
"connId:%s, is killed by user:%s"
,
pKill
->
queryId
,
pUser
->
user
);
pConn
->
killed
=
1
;
...
...
src/mnode/src/mnodeRead.c
浏览文件 @
7e2abf0e
...
...
@@ -44,7 +44,7 @@ void mnodeAddReadMsgHandle(uint8_t msgType, int32_t (*fp)(SMnodeMsg *pMsg)) {
int32_t
mnodeProcessRead
(
SMnodeMsg
*
pMsg
)
{
if
(
pMsg
->
rpcMsg
.
pCont
==
NULL
)
{
mError
(
"%p, msg:%s in mread queue, content is null"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
]);
return
TSDB_CODE_INVALID_MSG_LEN
;
return
TSDB_CODE_
MND_
INVALID_MSG_LEN
;
}
if
(
!
sdbIsMaster
())
{
...
...
@@ -59,12 +59,12 @@ int32_t mnodeProcessRead(SMnodeMsg *pMsg) {
mTrace
(
"mnode index:%d ip:%s:%d"
,
i
,
ipSet
->
fqdn
[
i
],
htons
(
ipSet
->
port
[
i
]));
}
return
TSDB_CODE_REDIRECT
;
return
TSDB_CODE_R
PC_R
EDIRECT
;
}
if
(
tsMnodeProcessReadMsgFp
[
pMsg
->
rpcMsg
.
msgType
]
==
NULL
)
{
mError
(
"%p, msg:%s in mread queue, not processed"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
]);
return
TSDB_CODE_MSG_NOT_PROCESSED
;
return
TSDB_CODE_M
ND_M
SG_NOT_PROCESSED
;
}
int32_t
code
=
mnodeInitMsg
(
pMsg
);
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
7e2abf0e
...
...
@@ -518,7 +518,7 @@ static int sdbWrite(void *param, void *data, int type) {
sdbError
(
"table:%s, failed to restore %s record:%s from wal, version:%"
PRId64
" too large, sdb version:%"
PRId64
,
pTable
->
tableName
,
sdbGetActionStr
(
action
),
sdbGetKeyStr
(
pTable
,
pHead
->
cont
),
pHead
->
version
,
tsSdbObj
.
version
);
return
TSDB_CODE_
OTHERS
;
return
TSDB_CODE_
MND_APP_ERROR
;
}
else
{
tsSdbObj
.
version
=
pHead
->
version
;
}
...
...
@@ -561,7 +561,7 @@ static int sdbWrite(void *param, void *data, int type) {
SSdbOper
oper
=
{.
rowSize
=
pHead
->
len
,
.
rowData
=
pHead
->
cont
,
.
table
=
pTable
};
code
=
(
*
pTable
->
decodeFp
)(
&
oper
);
return
sdbUpdateHash
(
pTable
,
&
oper
);
}
else
{
return
TSDB_CODE_INVALID_MSG_TYPE
;
}
}
else
{
return
TSDB_CODE_
MND_
INVALID_MSG_TYPE
;
}
}
int32_t
sdbInsertRow
(
SSdbOper
*
pOper
)
{
...
...
@@ -571,7 +571,7 @@ int32_t sdbInsertRow(SSdbOper *pOper) {
if
(
sdbGetRowFromObj
(
pTable
,
pOper
->
pObj
))
{
sdbError
(
"table:%s, failed to insert record:%s, already exist"
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pOper
->
pObj
));
sdbDecRef
(
pTable
,
pOper
->
pObj
);
return
TSDB_CODE_ALREADY_THERE
;
return
TSDB_CODE_
MND_SDB_OBJ_
ALREADY_THERE
;
}
if
(
pTable
->
keyType
==
SDB_KEY_AUTO
)
{
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
7e2abf0e
...
...
@@ -110,12 +110,12 @@ static char *mnodeGetShowType(int32_t showType) {
static
int32_t
mnodeProcessShowMsg
(
SMnodeMsg
*
pMsg
)
{
SCMShowMsg
*
pShowMsg
=
pMsg
->
rpcMsg
.
pCont
;
if
(
pShowMsg
->
type
>=
TSDB_MGMT_TABLE_MAX
)
{
return
TSDB_CODE_INVALID_MSG_TYPE
;
return
TSDB_CODE_
MND_
INVALID_MSG_TYPE
;
}
if
(
!
tsMnodeShowMetaFp
[
pShowMsg
->
type
]
||
!
tsMnodeShowRetrieveFp
[
pShowMsg
->
type
])
{
mError
(
"show type:%s is not support"
,
mnodeGetShowType
(
pShowMsg
->
type
));
return
TSDB_CODE_OPS_NOT_SUPPORT
;
return
TSDB_CODE_
COM_
OPS_NOT_SUPPORT
;
}
int32_t
showObjSize
=
sizeof
(
SShowObj
)
+
htons
(
pShowMsg
->
payloadLen
);
...
...
@@ -127,14 +127,14 @@ static int32_t mnodeProcessShowMsg(SMnodeMsg *pMsg) {
pShow
=
mnodePutShowObj
(
pShow
,
showObjSize
);
if
(
pShow
==
NULL
)
{
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
}
int32_t
size
=
sizeof
(
SCMShowRsp
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
+
TSDB_EXTRA_PAYLOAD_SIZE
;
SCMShowRsp
*
pShowRsp
=
rpcMallocCont
(
size
);
if
(
pShowRsp
==
NULL
)
{
mnodeReleaseShowObj
(
pShow
,
true
);
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
}
pShowRsp
->
qhandle
=
htobe64
((
uint64_t
)
pShow
);
...
...
@@ -169,7 +169,7 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
*/
if
(
!
mnodeAccquireShowObj
(
pShow
))
{
mError
(
"%p, show is invalid"
,
pShow
);
return
TSDB_CODE_
INVALID_QHANDLE
;
return
TSDB_CODE_
MND_INVALID_SHOWOBJ
;
}
if
(
mnodeCheckShowFinished
(
pShow
))
{
...
...
@@ -202,7 +202,7 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
rpcFreeCont
(
pRsp
);
mnodeReleaseShowObj
(
pShow
,
false
);
assert
(
false
);
return
TSDB_CODE_ACTION_IN_PROGRESS
;
return
TSDB_CODE_
MND_
ACTION_IN_PROGRESS
;
}
pRsp
->
numOfRows
=
htonl
(
rowsRead
);
...
...
@@ -224,7 +224,7 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
static
int32_t
mnodeProcessHeartBeatMsg
(
SMnodeMsg
*
pMsg
)
{
SCMHeartBeatRsp
*
pHBRsp
=
(
SCMHeartBeatRsp
*
)
rpcMallocCont
(
sizeof
(
SCMHeartBeatRsp
));
if
(
pHBRsp
==
NULL
)
{
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
}
SCMHeartBeatMsg
*
pHBMsg
=
pMsg
->
rpcMsg
.
pCont
;
...
...
@@ -278,7 +278,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
SRpcConnInfo
connInfo
;
if
(
rpcGetConnInfo
(
pMsg
->
rpcMsg
.
handle
,
&
connInfo
)
!=
0
)
{
mError
(
"thandle:%p is already released while process connect msg"
,
pMsg
->
rpcMsg
.
handle
);
code
=
TSDB_CODE_
INVALID_MSG_CONTENT
;
code
=
TSDB_CODE_
MND_INVALID_CONNECTION
;
goto
connect_over
;
}
...
...
@@ -295,7 +295,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
sprintf
(
dbName
,
"%x%s%s"
,
pAcct
->
acctId
,
TS_PATH_DELIMITER
,
pConnectMsg
->
db
);
SDbObj
*
pDb
=
mnodeGetDb
(
dbName
);
if
(
pDb
==
NULL
)
{
code
=
TSDB_CODE_INVALID_DB
;
code
=
TSDB_CODE_
MND_
INVALID_DB
;
goto
connect_over
;
}
mnodeDecDbRef
(
pDb
);
...
...
@@ -303,7 +303,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
SCMConnectRsp
*
pConnectRsp
=
rpcMallocCont
(
sizeof
(
SCMConnectRsp
));
if
(
pConnectRsp
==
NULL
)
{
code
=
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
code
=
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
goto
connect_over
;
}
...
...
@@ -340,7 +340,7 @@ static int32_t mnodeProcessUseMsg(SMnodeMsg *pMsg) {
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pUseDbMsg
->
db
);
if
(
pMsg
->
pDb
==
NULL
)
{
code
=
TSDB_CODE_INVALID_DB
;
code
=
TSDB_CODE_
MND_
INVALID_DB
;
}
return
code
;
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/mnode/src/mnodeUser.c
浏览文件 @
7e2abf0e
...
...
@@ -56,7 +56,7 @@ static int32_t mnodeUserActionInsert(SSdbOper *pOper) {
mnodeDecAcctRef
(
pAcct
);
}
else
{
mError
(
"user:%s, acct:%s info not exist in sdb"
,
pUser
->
user
,
pUser
->
acct
);
return
TSDB_CODE_INVALID_ACCT
;
return
TSDB_CODE_
MND_
INVALID_ACCT
;
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -94,7 +94,7 @@ static int32_t mnodeUserActionEncode(SSdbOper *pOper) {
static
int32_t
mnodeUserActionDecode
(
SSdbOper
*
pOper
)
{
SUserObj
*
pUser
=
(
SUserObj
*
)
calloc
(
1
,
sizeof
(
SUserObj
));
if
(
pUser
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
pUser
==
NULL
)
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
memcpy
(
pUser
,
pOper
->
rowData
,
tsUserUpdateSize
);
pOper
->
pObj
=
pUser
;
...
...
@@ -179,7 +179,7 @@ static int32_t mnodeUpdateUser(SUserObj *pUser) {
int32_t
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
return
code
;
...
...
@@ -192,18 +192,18 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass) {
}
if
(
name
[
0
]
==
0
)
{
return
TSDB_CODE_INVALID_USER_FORMAT
;
return
TSDB_CODE_
MND_
INVALID_USER_FORMAT
;
}
if
(
pass
[
0
]
==
0
)
{
return
TSDB_CODE_INVALID_PASS_FORMAT
;
return
TSDB_CODE_
MND_
INVALID_PASS_FORMAT
;
}
SUserObj
*
pUser
=
mnodeGetUser
(
name
);
if
(
pUser
!=
NULL
)
{
mTrace
(
"user:%s, is already there"
,
name
);
mnodeDecUserRef
(
pUser
);
return
TSDB_CODE_USER_ALREADY_EXIST
;
return
TSDB_CODE_
MND_
USER_ALREADY_EXIST
;
}
code
=
grantCheck
(
TSDB_GRANT_USER
);
...
...
@@ -232,7 +232,7 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass) {
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pUser
);
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
return
code
;
...
...
@@ -247,7 +247,7 @@ static int32_t mnodeDropUser(SUserObj *pUser) {
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
return
code
;
...
...
@@ -256,7 +256,7 @@ static int32_t mnodeDropUser(SUserObj *pUser) {
static
int32_t
mnodeGetUserMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
SUserObj
*
pUser
=
mnodeGetUserFromConn
(
pConn
);
if
(
pUser
==
NULL
)
{
return
TSDB_CODE_NO_USER_FROM_CONN
;
return
TSDB_CODE_
MND_
NO_USER_FROM_CONN
;
}
int32_t
cols
=
0
;
...
...
@@ -369,7 +369,7 @@ static int32_t mnodeProcessCreateUserMsg(SMnodeMsg *pMsg) {
}
}
else
{
mError
(
"user:%s, no rights to create user"
,
pOperUser
->
user
);
code
=
TSDB_CODE_NO_RIGHTS
;
code
=
TSDB_CODE_
MND_
NO_RIGHTS
;
}
return
code
;
...
...
@@ -382,12 +382,12 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg) {
SCMAlterUserMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
SUserObj
*
pUser
=
mnodeGetUser
(
pAlter
->
user
);
if
(
pUser
==
NULL
)
{
return
TSDB_CODE_INVALID_USER
;
return
TSDB_CODE_
MND_
INVALID_USER
;
}
if
(
strcmp
(
pUser
->
user
,
"monitor"
)
==
0
||
(
strcmp
(
pUser
->
user
+
1
,
pUser
->
acct
)
==
0
&&
pUser
->
user
[
0
]
==
'_'
))
{
mnodeDecUserRef
(
pUser
);
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
if
((
pAlter
->
flag
&
TSDB_ALTER_USER_PASSWD
)
!=
0
)
{
...
...
@@ -413,7 +413,7 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg) {
mLPrint
(
"user:%s, password is altered by %s, result:%s"
,
pUser
->
user
,
pOperUser
->
user
,
tstrerror
(
code
));
}
else
{
mError
(
"user:%s, no rights to alter user"
,
pOperUser
->
user
);
code
=
TSDB_CODE_NO_RIGHTS
;
code
=
TSDB_CODE_
MND_
NO_RIGHTS
;
}
}
else
if
((
pAlter
->
flag
&
TSDB_ALTER_USER_PRIVILEGES
)
!=
0
)
{
bool
hasRight
=
false
;
...
...
@@ -454,11 +454,11 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg) {
mLPrint
(
"user:%s, privilege is altered by %s, result:%s"
,
pUser
->
user
,
pOperUser
->
user
,
tstrerror
(
code
));
}
else
{
mError
(
"user:%s, no rights to alter user"
,
pOperUser
->
user
);
code
=
TSDB_CODE_NO_RIGHTS
;
code
=
TSDB_CODE_
MND_
NO_RIGHTS
;
}
}
else
{
mError
(
"user:%s, no rights to alter user"
,
pOperUser
->
user
);
code
=
TSDB_CODE_NO_RIGHTS
;
code
=
TSDB_CODE_
MND_
NO_RIGHTS
;
}
mnodeDecUserRef
(
pUser
);
...
...
@@ -472,13 +472,13 @@ static int32_t mnodeProcessDropUserMsg(SMnodeMsg *pMsg) {
SCMDropUserMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SUserObj
*
pUser
=
mnodeGetUser
(
pDrop
->
user
);
if
(
pUser
==
NULL
)
{
return
TSDB_CODE_INVALID_USER
;
return
TSDB_CODE_
MND_
INVALID_USER
;
}
if
(
strcmp
(
pUser
->
user
,
"monitor"
)
==
0
||
strcmp
(
pUser
->
user
,
pUser
->
acct
)
==
0
||
(
strcmp
(
pUser
->
user
+
1
,
pUser
->
acct
)
==
0
&&
pUser
->
user
[
0
]
==
'_'
))
{
mnodeDecUserRef
(
pUser
);
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
bool
hasRight
=
false
;
...
...
@@ -502,7 +502,7 @@ static int32_t mnodeProcessDropUserMsg(SMnodeMsg *pMsg) {
mLPrint
(
"user:%s, is dropped by %s, result:%s"
,
pUser
->
user
,
pOperUser
->
user
,
tstrerror
(
code
));
}
}
else
{
code
=
TSDB_CODE_NO_RIGHTS
;
code
=
TSDB_CODE_
MND_
NO_RIGHTS
;
}
mnodeDecUserRef
(
pUser
);
...
...
@@ -540,15 +540,15 @@ void mnodeDropAllUsers(SAcctObj *pAcct) {
int32_t
mnodeRetriveAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
if
(
!
sdbIsMaster
())
{
*
secret
=
0
;
mTrace
(
"user:%s, failed to auth user, reason:%s"
,
user
,
tstrerror
(
TSDB_CODE_NOT_READY
));
return
TSDB_CODE_NOT_READY
;
mTrace
(
"user:%s, failed to auth user, reason:%s"
,
user
,
tstrerror
(
TSDB_CODE_
RPC_
NOT_READY
));
return
TSDB_CODE_
RPC_
NOT_READY
;
}
SUserObj
*
pUser
=
mnodeGetUser
(
user
);
if
(
pUser
==
NULL
)
{
*
secret
=
0
;
mError
(
"user:%s, failed to auth user, reason:%s"
,
user
,
tstrerror
(
TSDB_CODE_INVALID_USER
));
return
TSDB_CODE_INVALID_USER
;
mError
(
"user:%s, failed to auth user, reason:%s"
,
user
,
tstrerror
(
TSDB_CODE_
MND_
INVALID_USER
));
return
TSDB_CODE_
MND_
INVALID_USER
;
}
else
{
*
spi
=
1
;
*
encrypt
=
0
;
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
7e2abf0e
...
...
@@ -68,7 +68,7 @@ static int32_t mnodeVgroupActionInsert(SSdbOper *pOper) {
// refer to db
SDbObj
*
pDb
=
mnodeGetDb
(
pVgroup
->
dbName
);
if
(
pDb
==
NULL
)
{
return
TSDB_CODE_INVALID_DB
;
return
TSDB_CODE_
MND_
INVALID_DB
;
}
pVgroup
->
pDb
=
pDb
;
...
...
@@ -185,7 +185,7 @@ static int32_t mnodeVgroupActionEncode(SSdbOper *pOper) {
static
int32_t
mnodeVgroupActionDecode
(
SSdbOper
*
pOper
)
{
SVgObj
*
pVgroup
=
(
SVgObj
*
)
calloc
(
1
,
sizeof
(
SVgObj
));
if
(
pVgroup
==
NULL
)
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
if
(
pVgroup
==
NULL
)
return
TSDB_CODE_
MND
_OUT_OF_MEMORY
;
memcpy
(
pVgroup
,
pOper
->
rowData
,
tsVgUpdateSize
);
pOper
->
pObj
=
pVgroup
;
...
...
@@ -307,7 +307,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg, SDbObj *pDb) {
if
(
balanceAllocVnodes
(
pVgroup
)
!=
0
)
{
mError
(
"db:%s, no enough dnode to alloc %d vnodes to vgroup"
,
pDb
->
name
,
pVgroup
->
numOfVnodes
);
free
(
pVgroup
);
return
TSDB_CODE_NO_ENOUGH_DNODES
;
return
TSDB_CODE_
MND_
NO_ENOUGH_DNODES
;
}
SSdbOper
oper
=
{
...
...
@@ -320,7 +320,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg, SDbObj *pDb) {
int32_t
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pVgroup
);
return
TSDB_CODE_SDB_ERROR
;
return
TSDB_CODE_
MND_
SDB_ERROR
;
}
mPrint
(
"vgId:%d, is created in mnode, db:%s replica:%d"
,
pVgroup
->
vgId
,
pDb
->
name
,
pVgroup
->
numOfVnodes
);
...
...
@@ -333,7 +333,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg, SDbObj *pDb) {
pMsg
->
expected
=
pVgroup
->
numOfVnodes
;
mnodeSendCreateVgroupMsg
(
pVgroup
,
pMsg
);
return
TSDB_CODE_ACTION_IN_PROGRESS
;
return
TSDB_CODE_
MND_
ACTION_IN_PROGRESS
;
}
void
mnodeDropVgroup
(
SVgObj
*
pVgroup
,
void
*
ahandle
)
{
...
...
@@ -358,7 +358,7 @@ void mnodeCleanupVgroups() {
int32_t
mnodeGetVgroupMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
{
return
TSDB_CODE_DB_NOT_SELECTED
;
return
TSDB_CODE_
MND_
DB_NOT_SELECTED
;
}
int32_t
cols
=
0
;
...
...
@@ -383,11 +383,11 @@ int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
pTable
=
mnodeGetTable
(
pShow
->
payload
);
if
(
NULL
==
pTable
||
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
mnodeDecTableRef
(
pTable
);
return
TSDB_CODE_INVALID_TABLE_ID
;
return
TSDB_CODE_
MND_
INVALID_TABLE_ID
;
}
mnodeDecTableRef
(
pTable
);
pVgroup
=
mnodeGetVgroup
(((
SChildTableObj
*
)
pTable
)
->
vgId
);
if
(
NULL
==
pVgroup
)
return
TSDB_CODE_INVALID_TABLE_ID
;
if
(
NULL
==
pVgroup
)
return
TSDB_CODE_
MND_
INVALID_TABLE_ID
;
mnodeDecVgroupRef
(
pVgroup
);
maxReplica
=
pVgroup
->
numOfVnodes
>
maxReplica
?
pVgroup
->
numOfVnodes
:
maxReplica
;
}
else
{
...
...
@@ -643,7 +643,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
};
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
0
)
{
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
dnodeSendRpcMnodeWriteRsp
(
mnodeMsg
,
code
);
...
...
@@ -704,7 +704,7 @@ static void mnodeProcessDropVnodeRsp(SRpcMsg *rpcMsg) {
};
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
0
)
{
code
=
TSDB_CODE_SDB_ERROR
;
code
=
TSDB_CODE_
MND_
SDB_ERROR
;
}
dnodeReprocessMnodeWriteMsg
(
mnodeMsg
);
...
...
@@ -718,14 +718,14 @@ static int32_t mnodeProcessVnodeCfgMsg(SMnodeMsg *pMsg) {
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pCfg
->
dnodeId
);
if
(
pDnode
==
NULL
)
{
mTrace
(
"dnode:%s, invalid dnode"
,
taosIpStr
(
pCfg
->
dnodeId
),
pCfg
->
vgId
);
return
TSDB_CODE_
INVALID_VGROUP_ID
;
return
TSDB_CODE_
MND_VGROUP_NOT_EXIST
;
}
mnodeDecDnodeRef
(
pDnode
);
SVgObj
*
pVgroup
=
mnodeGetVgroup
(
pCfg
->
vgId
);
if
(
pVgroup
==
NULL
)
{
mTrace
(
"dnode:%s, vgId:%d, no vgroup info"
,
taosIpStr
(
pCfg
->
dnodeId
),
pCfg
->
vgId
);
return
TSDB_CODE_
INVALID_VGROUP_ID
;
return
TSDB_CODE_
MND_VGROUP_NOT_EXIST
;
}
mnodeDecVgroupRef
(
pVgroup
);
...
...
src/mnode/src/mnodeWrite.c
浏览文件 @
7e2abf0e
...
...
@@ -44,7 +44,7 @@ void mnodeAddWriteMsgHandle(uint8_t msgType, int32_t (*fp)(SMnodeMsg *mnodeMsg))
int32_t
mnodeProcessWrite
(
SMnodeMsg
*
pMsg
)
{
if
(
pMsg
->
rpcMsg
.
pCont
==
NULL
)
{
mError
(
"%p, msg:%s in mwrite queue, content is null"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
]);
return
TSDB_CODE_INVALID_MSG_LEN
;
return
TSDB_CODE_
MND_
INVALID_MSG_LEN
;
}
if
(
!
sdbIsMaster
())
{
...
...
@@ -59,12 +59,12 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) {
mTrace
(
"mnode index:%d ip:%s:%d"
,
i
,
ipSet
->
fqdn
[
i
],
htons
(
ipSet
->
port
[
i
]));
}
return
TSDB_CODE_REDIRECT
;
return
TSDB_CODE_R
PC_R
EDIRECT
;
}
if
(
tsMnodeProcessWriteMsgFp
[
pMsg
->
rpcMsg
.
msgType
]
==
NULL
)
{
mError
(
"%p, msg:%s in mwrite queue, not processed"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
]);
return
TSDB_CODE_MSG_NOT_PROCESSED
;
return
TSDB_CODE_M
ND_M
SG_NOT_PROCESSED
;
}
int32_t
code
=
mnodeInitMsg
(
pMsg
);
...
...
@@ -75,7 +75,7 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) {
if
(
!
pMsg
->
pUser
->
writeAuth
)
{
mError
(
"%p, msg:%s in mwrite queue, not processed, no write auth"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
]);
return
TSDB_CODE_NO_RIGHTS
;
return
TSDB_CODE_
MND_
NO_RIGHTS
;
}
return
(
*
tsMnodeProcessWriteMsgFp
[
pMsg
->
rpcMsg
.
msgType
])(
pMsg
);
...
...
src/plugins/http/src/httpJson.c
浏览文件 @
7e2abf0e
...
...
@@ -443,9 +443,9 @@ void httpJsonPairStatus(JsonBuf* buf, int code) {
httpJsonPairIntVal
(
buf
,
"code"
,
4
,
code
);
if
(
code
>=
0
)
{
httpJsonItemToken
(
buf
);
if
(
code
==
TSDB_CODE_DB_NOT_SELECTED
)
{
if
(
code
==
TSDB_CODE_
MND_
DB_NOT_SELECTED
)
{
httpJsonPair
(
buf
,
"desc"
,
4
,
"failed to create database"
,
23
);
}
else
if
(
code
==
TSDB_CODE_INVALID_TABLE_ID
)
{
}
else
if
(
code
==
TSDB_CODE_
MND_
INVALID_TABLE_ID
)
{
httpJsonPair
(
buf
,
"desc"
,
4
,
"failed to create table"
,
22
);
}
else
httpJsonPair
(
buf
,
"desc"
,
4
,
(
char
*
)
tstrerror
(
code
),
(
int
)
strlen
(
tstrerror
(
code
)));
...
...
src/plugins/http/src/httpSql.c
浏览文件 @
7e2abf0e
...
...
@@ -80,7 +80,7 @@ void httpProcessMultiSqlCallBack(void *param, TAOS_RES *result, int code) {
HttpSqlCmd
*
singleCmd
=
multiCmds
->
cmds
+
multiCmds
->
pos
;
char
*
sql
=
httpGetCmdsString
(
pContext
,
singleCmd
->
sql
);
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
{
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
{
httpWarn
(
"context:%p, fd:%d, ip:%s, user:%s, process pos:%d, code:%s:inprogress, sql:%s"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
multiCmds
->
pos
,
tstrerror
(
code
),
sql
);
return
;
...
...
@@ -234,7 +234,7 @@ void httpProcessSingleSqlCallBack(void *param, TAOS_RES *result, int code) {
HttpEncodeMethod
*
encode
=
pContext
->
encodeMethod
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
{
if
(
code
==
TSDB_CODE_
TSC_
ACTION_IN_PROGRESS
)
{
httpError
(
"context:%p, fd:%d, ip:%s, user:%s, query error, taos:%p, code:%s:inprogress, sqlObj:%p"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
pContext
->
session
->
taos
,
tstrerror
(
code
),
(
SSqlObj
*
)
result
);
return
;
...
...
@@ -242,7 +242,7 @@ void httpProcessSingleSqlCallBack(void *param, TAOS_RES *result, int code) {
if
(
code
<
0
)
{
SSqlObj
*
pObj
=
(
SSqlObj
*
)
result
;
if
(
code
==
TSDB_CODE_INVALID_SQL
)
{
if
(
code
==
TSDB_CODE_
TSC_
INVALID_SQL
)
{
httpError
(
"context:%p, fd:%d, ip:%s, user:%s, query error, taos:%p, code:%s, sqlObj:%p, error:%s"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
pContext
->
session
->
taos
,
tstrerror
(
code
),
pObj
,
pObj
->
cmd
.
payload
);
httpSendTaosdInvalidSqlErrorResp
(
pContext
,
pObj
->
cmd
.
payload
);
...
...
src/plugins/http/src/tgJson.c
浏览文件 @
7e2abf0e
...
...
@@ -103,7 +103,7 @@ bool tgCheckFinished(struct HttpContext *pContext, HttpSqlCmd *cmd, int code) {
if
(
cmd
->
cmdType
==
HTTP_CMD_TYPE_INSERT
)
{
if
(
cmd
->
cmdState
==
HTTP_CMD_STATE_NOT_RUN_YET
)
{
if
(
code
==
TSDB_CODE_
DB_NOT_SELECTED
||
code
==
TSDB_CODE
_INVALID_DB
)
{
if
(
code
==
TSDB_CODE_
MND_DB_NOT_SELECTED
||
code
==
TSDB_CODE_MND
_INVALID_DB
)
{
cmd
->
cmdState
=
HTTP_CMD_STATE_RUN_FINISHED
;
if
(
multiCmds
->
cmds
[
0
].
cmdState
==
HTTP_CMD_STATE_NOT_RUN_YET
)
{
multiCmds
->
pos
=
(
int16_t
)
-
1
;
...
...
@@ -111,7 +111,7 @@ bool tgCheckFinished(struct HttpContext *pContext, HttpSqlCmd *cmd, int code) {
pContext
->
ipstr
);
return
false
;
}
}
else
if
(
code
==
TSDB_CODE_INVALID_TABLE_ID
)
{
}
else
if
(
code
==
TSDB_CODE_
MND_
INVALID_TABLE_ID
)
{
cmd
->
cmdState
=
HTTP_CMD_STATE_RUN_FINISHED
;
if
(
multiCmds
->
cmds
[
multiCmds
->
pos
-
1
].
cmdState
==
HTTP_CMD_STATE_NOT_RUN_YET
)
{
multiCmds
->
pos
=
(
int16_t
)(
multiCmds
->
pos
-
2
);
...
...
src/plugins/monitor/src/monitorMain.c
浏览文件 @
7e2abf0e
...
...
@@ -207,7 +207,7 @@ static void monitorInitDatabase() {
}
static
void
monitorInitDatabaseCb
(
void
*
param
,
TAOS_RES
*
result
,
int32_t
code
)
{
if
(
-
code
==
TSDB_CODE_
TABLE_ALREADY_EXIST
||
-
code
==
TSDB_CODE
_DB_ALREADY_EXIST
||
code
>=
0
)
{
if
(
-
code
==
TSDB_CODE_
MND_TABLE_ALREADY_EXIST
||
-
code
==
TSDB_CODE_MND
_DB_ALREADY_EXIST
||
code
>=
0
)
{
monitorTrace
(
"monitor:%p, sql success, reason:%d, %s"
,
tsMonitorConn
.
conn
,
tstrerror
(
code
),
tsMonitorConn
.
sql
);
if
(
tsMonitorConn
.
cmdIndex
==
MONITOR_CMD_CREATE_TB_LOG
)
{
monitorPrint
(
"dnode:%s is started"
,
tsLocalEp
);
...
...
src/query/src/qExecutor.c
浏览文件 @
7e2abf0e
...
...
@@ -1434,7 +1434,7 @@ _clean:
tfree
(
pRuntimeEnv
->
resultInfo
);
tfree
(
pRuntimeEnv
->
pCtx
);
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
return
TSDB_CODE_
QRY
_OUT_OF_MEMORY
;
}
static
void
teardownQueryRuntimeEnv
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
...
...
@@ -1475,7 +1475,7 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
}
static
bool
isQueryKilled
(
SQInfo
*
pQInfo
)
{
return
(
pQInfo
->
code
==
TSDB_CODE_QUERY_CANCELLED
);
return
(
pQInfo
->
code
==
TSDB_CODE_
TSC_
QUERY_CANCELLED
);
#if 0
/*
* check if the queried meter is going to be deleted.
...
...
@@ -1491,7 +1491,7 @@ static bool isQueryKilled(SQInfo *pQInfo) {
#endif
}
static
void
setQueryKilled
(
SQInfo
*
pQInfo
)
{
pQInfo
->
code
=
TSDB_CODE_QUERY_CANCELLED
;
}
static
void
setQueryKilled
(
SQInfo
*
pQInfo
)
{
pQInfo
->
code
=
TSDB_CODE_
TSC_
QUERY_CANCELLED
;
}
static
bool
isFixedOutputQuery
(
SQuery
*
pQuery
)
{
if
(
pQuery
->
intervalTime
!=
0
)
{
...
...
@@ -4973,7 +4973,7 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
// query msg safety check
if
(
!
validateQueryMsg
(
pQueryMsg
))
{
return
TSDB_CODE_
INVALID_QUERY
_MSG
;
return
TSDB_CODE_
QRY_INVALID
_MSG
;
}
char
*
pMsg
=
(
char
*
)(
pQueryMsg
->
colList
)
+
sizeof
(
SColumnInfo
)
*
pQueryMsg
->
numOfCols
;
...
...
@@ -5046,11 +5046,11 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
if
(
pExprMsg
->
functionId
==
TSDB_FUNC_TAG
||
pExprMsg
->
functionId
==
TSDB_FUNC_TAGPRJ
||
pExprMsg
->
functionId
==
TSDB_FUNC_TAG_DUMMY
)
{
if
(
pExprMsg
->
colInfo
.
flag
!=
TSDB_COL_TAG
)
{
// ignore the column index check for arithmetic expression.
return
TSDB_CODE_
INVALID_QUERY
_MSG
;
return
TSDB_CODE_
QRY_INVALID
_MSG
;
}
}
else
{
// if (!validateExprColumnInfo(pQueryMsg, pExprMsg)) {
// return TSDB_CODE_
INVALID_QUERY
_MSG;
// return TSDB_CODE_
QRY_INVALID
_MSG;
// }
}
...
...
@@ -5060,7 +5060,7 @@ static int32_t convertQueryMsg(SQueryTableMsg *pQueryMsg, SArray **pTableIdList,
if
(
!
validateQuerySourceCols
(
pQueryMsg
,
*
pExpr
))
{
tfree
(
*
pExpr
);
return
TSDB_CODE_
INVALID_QUERY
_MSG
;
return
TSDB_CODE_
QRY_INVALID
_MSG
;
}
pMsg
=
createTableIdList
(
pQueryMsg
,
pMsg
,
pTableIdList
);
...
...
@@ -5149,7 +5149,7 @@ static int32_t buildAirthmeticExprFromMsg(SExprInfo *pArithExprInfo, SQueryTable
if
(
pExprNode
==
NULL
)
{
qError
(
"qmsg:%p failed to create arithmetic expression string from:%s"
,
pQueryMsg
,
pArithExprInfo
->
base
.
arg
[
0
].
argValue
.
pz
);
return
TSDB_CODE_APP_ERROR
;
return
TSDB_CODE_
QRY_
APP_ERROR
;
}
pArithExprInfo
->
pExpr
=
pExprNode
;
...
...
@@ -5163,7 +5163,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo
SExprInfo
*
pExprs
=
(
SExprInfo
*
)
calloc
(
1
,
sizeof
(
SExprInfo
)
*
pQueryMsg
->
numOfOutput
);
if
(
pExprs
==
NULL
)
{
return
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
return
TSDB_CODE_
QRY
_OUT_OF_MEMORY
;
}
bool
isSuperTable
=
QUERY_IS_STABLE_QUERY
(
pQueryMsg
->
queryType
);
...
...
@@ -5203,7 +5203,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo
if
(
getResultDataInfo
(
type
,
bytes
,
pExprs
[
i
].
base
.
functionId
,
param
,
&
pExprs
[
i
].
type
,
&
pExprs
[
i
].
bytes
,
&
pExprs
[
i
].
interBytes
,
0
,
isSuperTable
)
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pExprs
);
return
TSDB_CODE_
INVALID_QUERY
_MSG
;
return
TSDB_CODE_
QRY_INVALID
_MSG
;
}
if
(
pExprs
[
i
].
base
.
functionId
==
TSDB_FUNC_TAG_DUMMY
||
pExprs
[
i
].
base
.
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
...
...
@@ -5244,7 +5244,7 @@ static SSqlGroupbyExpr *createGroupbyExprFromMsg(SQueryTableMsg *pQueryMsg, SCol
// using group by tag columns
SSqlGroupbyExpr
*
pGroupbyExpr
=
(
SSqlGroupbyExpr
*
)
calloc
(
1
,
sizeof
(
SSqlGroupbyExpr
));
if
(
pGroupbyExpr
==
NULL
)
{
*
code
=
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
*
code
=
TSDB_CODE_
QRY
_OUT_OF_MEMORY
;
return
NULL
;
}
...
...
@@ -5292,7 +5292,7 @@ static int32_t createFilterInfo(void *pQInfo, SQuery *pQuery) {
if
(
lower
==
TSDB_RELATION_INVALID
&&
upper
==
TSDB_RELATION_INVALID
)
{
qError
(
"QInfo:%p invalid filter info"
,
pQInfo
);
return
TSDB_CODE_
INVALID_QUERY
_MSG
;
return
TSDB_CODE_
QRY_INVALID
_MSG
;
}
int16_t
type
=
pQuery
->
colList
[
i
].
type
;
...
...
@@ -5304,7 +5304,7 @@ static int32_t createFilterInfo(void *pQInfo, SQuery *pQuery) {
if
(
rangeFilterArray
==
NULL
&&
filterArray
==
NULL
)
{
qError
(
"QInfo:%p failed to get filter function, invalid data type:%d"
,
pQInfo
,
type
);
return
TSDB_CODE_
INVALID_QUERY
_MSG
;
return
TSDB_CODE_
QRY_INVALID
_MSG
;
}
if
((
lower
==
TSDB_RELATION_GREATER_EQUAL
||
lower
==
TSDB_RELATION_GREATER
)
&&
...
...
@@ -5328,7 +5328,7 @@ static int32_t createFilterInfo(void *pQInfo, SQuery *pQuery) {
if
(
upper
!=
TSDB_RELATION_INVALID
)
{
qError
(
"pQInfo:%p failed to get filter function, invalid filter condition"
,
pQInfo
,
type
);
return
TSDB_CODE_
INVALID_QUERY
_MSG
;
return
TSDB_CODE_
QRY_INVALID
_MSG
;
}
}
else
{
pSingleColFilter
->
fp
=
filterArray
[
upper
];
...
...
@@ -5777,13 +5777,13 @@ int32_t qCreateQueryInfo(void *tsdb, int32_t vgId, SQueryTableMsg *pQueryMsg, qi
if
(
pQueryMsg
->
numOfTables
<=
0
)
{
qError
(
"Invalid number of tables to query, numOfTables:%d"
,
pQueryMsg
->
numOfTables
);
code
=
TSDB_CODE_
INVALID_QUERY
_MSG
;
code
=
TSDB_CODE_
QRY_INVALID
_MSG
;
goto
_over
;
}
if
(
pTableIdList
==
NULL
||
taosArrayGetSize
(
pTableIdList
)
==
0
)
{
qError
(
"qmsg:%p, SQueryTableMsg wrong format"
,
pQueryMsg
);
code
=
TSDB_CODE_
INVALID_QUERY
_MSG
;
code
=
TSDB_CODE_
QRY_INVALID
_MSG
;
goto
_over
;
}
...
...
@@ -5846,7 +5846,7 @@ int32_t qCreateQueryInfo(void *tsdb, int32_t vgId, SQueryTableMsg *pQueryMsg, qi
(
*
pQInfo
)
=
createQInfoImpl
(
pQueryMsg
,
pTableIdList
,
pGroupbyExpr
,
pExprs
,
&
groupInfo
,
pTagColumnInfo
);
if
((
*
pQInfo
)
==
NULL
)
{
code
=
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
code
=
TSDB_CODE_
QRY
_OUT_OF_MEMORY
;
goto
_over
;
}
...
...
@@ -5905,7 +5905,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo) {
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
if
(
pQInfo
==
NULL
||
!
isValidQInfo
(
pQInfo
))
{
return
TSDB_CODE_INVALID_QHANDLE
;
return
TSDB_CODE_
QRY_
INVALID_QHANDLE
;
}
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
...
...
@@ -5944,7 +5944,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
if
(
pQInfo
==
NULL
||
!
isValidQInfo
(
pQInfo
))
{
return
TSDB_CODE_INVALID_QHANDLE
;
return
TSDB_CODE_
QRY_
INVALID_QHANDLE
;
}
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
...
...
@@ -5980,12 +5980,6 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
}
return
code
;
// if (numOfRows == 0 && (pRetrieve->qhandle == (uint64_t)pObj->qhandle) && (code != TSDB_CODE_ACTION_IN_PROGRESS)) {
// qTrace("QInfo:%p %s free qhandle code:%d", pObj->qhandle, __FUNCTION__, code);
// vnodeDecRefCount(pObj->qhandle);
// pObj->qhandle = NULL;
// }
}
static
void
buildTagQueryResult
(
SQInfo
*
pQInfo
)
{
...
...
src/query/src/qast.c
浏览文件 @
7e2abf0e
...
...
@@ -1035,7 +1035,7 @@ void exprTreeToBinary(SBufferWriter* bw, tExprNode* expr) {
static
void
*
exception_calloc
(
size_t
nmemb
,
size_t
size
)
{
void
*
p
=
calloc
(
nmemb
,
size
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_
SERV
_OUT_OF_MEMORY
);
THROW
(
TSDB_CODE_
QRY
_OUT_OF_MEMORY
);
}
return
p
;
}
...
...
@@ -1043,7 +1043,7 @@ static void* exception_calloc(size_t nmemb, size_t size) {
static
void
*
exception_malloc
(
size_t
size
)
{
void
*
p
=
malloc
(
size
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_
SERV
_OUT_OF_MEMORY
);
THROW
(
TSDB_CODE_
QRY
_OUT_OF_MEMORY
);
}
return
p
;
}
...
...
@@ -1051,7 +1051,7 @@ static void* exception_malloc(size_t size) {
static
UNUSED_FUNC
char
*
exception_strdup
(
const
char
*
str
)
{
char
*
p
=
strdup
(
str
);
if
(
p
==
NULL
)
{
THROW
(
TSDB_CODE_
SERV
_OUT_OF_MEMORY
);
THROW
(
TSDB_CODE_
QRY
_OUT_OF_MEMORY
);
}
return
p
;
}
...
...
src/query/src/qresultBuf.c
浏览文件 @
7e2abf0e
...
...
@@ -28,19 +28,19 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t si
if
(
!
FD_VALID
(
pResBuf
->
fd
))
{
qError
(
"failed to create tmp file: %s on disk. %s"
,
pResBuf
->
path
,
strerror
(
errno
));
return
TSDB_CODE_
CLI
_NO_DISKSPACE
;
return
TSDB_CODE_
QRY
_NO_DISKSPACE
;
}
int32_t
ret
=
ftruncate
(
pResBuf
->
fd
,
pResBuf
->
numOfPages
*
DEFAULT_INTERN_BUF_PAGE_SIZE
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to create tmp file: %s on disk. %s"
,
pResBuf
->
path
,
strerror
(
errno
));
return
TSDB_CODE_
CLI
_NO_DISKSPACE
;
return
TSDB_CODE_
QRY
_NO_DISKSPACE
;
}
pResBuf
->
pBuf
=
mmap
(
NULL
,
pResBuf
->
totalBufSize
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
pResBuf
->
fd
,
0
);
if
(
pResBuf
->
pBuf
==
MAP_FAILED
)
{
qError
(
"QInfo:%p failed to map temp file: %s. %s"
,
handle
,
pResBuf
->
path
,
strerror
(
errno
));
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
// todo change error code
return
TSDB_CODE_
QRY
_OUT_OF_MEMORY
;
// todo change error code
}
qTrace
(
"QInfo:%p create tmp file for output result, %s, %"
PRId64
"bytes"
,
handle
,
pResBuf
->
path
,
...
...
@@ -74,7 +74,7 @@ static int32_t extendDiskFileSize(SDiskbasedResultBuf* pResultBuf, int32_t numOf
if
(
ret
!=
0
)
{
// dError("QInfo:%p failed to create intermediate result output file:%s. %s", pQInfo, pSupporter->extBufFile,
// strerror(errno));
return
-
TSDB_CODE_
SERV
_NO_DISKSPACE
;
return
-
TSDB_CODE_
QRY
_NO_DISKSPACE
;
}
pResultBuf
->
totalBufSize
=
pResultBuf
->
numOfPages
*
DEFAULT_INTERN_BUF_PAGE_SIZE
;
...
...
@@ -82,7 +82,7 @@ static int32_t extendDiskFileSize(SDiskbasedResultBuf* pResultBuf, int32_t numOf
if
(
pResultBuf
->
pBuf
==
MAP_FAILED
)
{
// dError("QInfo:%p failed to map temp file: %s. %s", pQInfo, pSupporter->extBufFile, strerror(errno));
return
-
TSDB_CODE_
SERV
_OUT_OF_MEMORY
;
return
-
TSDB_CODE_
QRY
_OUT_OF_MEMORY
;
}
return
TSDB_CODE_SUCCESS
;
...
...
src/query/src/tlosertree.c
浏览文件 @
7e2abf0e
...
...
@@ -46,7 +46,7 @@ uint32_t tLoserTreeCreate(SLoserTreeInfo** pTree, int32_t numOfEntries, void* pa
*
pTree
=
(
SLoserTreeInfo
*
)
calloc
(
1
,
sizeof
(
SLoserTreeInfo
)
+
sizeof
(
SLoserTreeNode
)
*
totalEntries
);
if
((
*
pTree
)
==
NULL
)
{
qError
(
"allocate memory for loser-tree failed. reason:%s"
,
strerror
(
errno
));
return
TSDB_CODE_
CLI
_OUT_OF_MEMORY
;
return
TSDB_CODE_
QRY
_OUT_OF_MEMORY
;
}
(
*
pTree
)
->
pNode
=
(
SLoserTreeNode
*
)(((
char
*
)(
*
pTree
))
+
sizeof
(
SLoserTreeInfo
));
...
...
src/query/tests/unitTest.cpp
浏览文件 @
7e2abf0e
...
...
@@ -99,47 +99,47 @@ TEST(testCase, db_table_name) {
EXPECT_EQ
(
testValidateName
(
t4
),
TSDB_CODE_SUCCESS
);
char
t5
[]
=
"table.'def'"
;
EXPECT_EQ
(
testValidateName
(
t5
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t5
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t6
[]
=
"'table'.'def'"
;
EXPECT_EQ
(
testValidateName
(
t6
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t6
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t7
[]
=
"'_ab1234'.'def'"
;
EXPECT_EQ
(
testValidateName
(
t7
),
TSDB_CODE_SUCCESS
);
printf
(
"%s
\n
"
,
t7
);
char
t8
[]
=
"'_ab&^%1234'.'def'"
;
EXPECT_EQ
(
testValidateName
(
t8
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t8
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t9
[]
=
"'_123'.'gtest中文'"
;
EXPECT_EQ
(
testValidateName
(
t9
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t9
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t10
[]
=
"abc.'gtest中文'"
;
EXPECT_EQ
(
testValidateName
(
t10
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t10
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t10_1
[]
=
"abc.'中文gtest'"
;
EXPECT_EQ
(
testValidateName
(
t10_1
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t10_1
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t11
[]
=
"'192.168.0.1'.abc"
;
EXPECT_EQ
(
testValidateName
(
t11
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t11
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t12
[]
=
"192.168.0.1.abc"
;
EXPECT_EQ
(
testValidateName
(
t12
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t12
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t13
[]
=
"abc."
;
EXPECT_EQ
(
testValidateName
(
t13
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t13
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t14
[]
=
".abc"
;
EXPECT_EQ
(
testValidateName
(
t14
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t14
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t15
[]
=
".'abc'"
;
EXPECT_EQ
(
testValidateName
(
t15
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t15
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t16
[]
=
".abc'"
;
EXPECT_EQ
(
testValidateName
(
t16
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t16
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t17
[]
=
"123a.
\"
abc
\"
"
;
EXPECT_EQ
(
testValidateName
(
t17
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t17
),
TSDB_CODE_
TSC_
INVALID_SQL
);
printf
(
"%s
\n
"
,
t17
);
char
t18
[]
=
"a.
\"
abc
\"
"
;
...
...
@@ -147,13 +147,13 @@ TEST(testCase, db_table_name) {
printf
(
"%s
\n
"
,
t18
);
char
t19
[]
=
"'_ab1234'.'def'.'ab123'"
;
EXPECT_EQ
(
testValidateName
(
t19
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t19
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t20
[]
=
"'_ab1234*&^'"
;
EXPECT_EQ
(
testValidateName
(
t20
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t20
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t21
[]
=
"'1234_abc'"
;
EXPECT_EQ
(
testValidateName
(
t21
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t21
),
TSDB_CODE_
TSC_
INVALID_SQL
);
// =======Containing capital letters=================
...
...
@@ -167,10 +167,10 @@ TEST(testCase, db_table_name) {
EXPECT_EQ
(
testValidateName
(
t32
),
TSDB_CODE_SUCCESS
);
char
t33
[]
=
"'ABC.def"
;
EXPECT_EQ
(
testValidateName
(
t33
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t33
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t33_0
[]
=
"abc.DEF'"
;
EXPECT_EQ
(
testValidateName
(
t33_0
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t33_0
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t34
[]
=
"'ABC.def'"
;
//int32_t tmp0 = testValidateName(t34);
...
...
@@ -193,38 +193,38 @@ TEST(testCase, db_table_name) {
// do not use key words
char
t39
[]
=
"table.'DEF'"
;
EXPECT_EQ
(
testValidateName
(
t39
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t39
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t40
[]
=
"'table'.'DEF'"
;
EXPECT_EQ
(
testValidateName
(
t40
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t40
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t41
[]
=
"'_abXYZ1234'.'deFF'"
;
EXPECT_EQ
(
testValidateName
(
t41
),
TSDB_CODE_SUCCESS
);
char
t42
[]
=
"'_abDEF&^%1234'.'DIef'"
;
EXPECT_EQ
(
testValidateName
(
t42
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t42
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t43
[]
=
"'_123'.'Gtest中文'"
;
EXPECT_EQ
(
testValidateName
(
t43
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t43
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t44
[]
=
"'aABC'.'Gtest中文'"
;
EXPECT_EQ
(
testValidateName
(
t44
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t44
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t45
[]
=
"'ABC'."
;
EXPECT_EQ
(
testValidateName
(
t45
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t45
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t46
[]
=
".'ABC'"
;
EXPECT_EQ
(
testValidateName
(
t46
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t46
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t47
[]
=
"a.
\"
aTWc
\"
"
;
EXPECT_EQ
(
testValidateName
(
t47
),
TSDB_CODE_SUCCESS
);
// ================has space =================
char
t60
[]
=
" ABC "
;
EXPECT_EQ
(
testValidateName
(
t60
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t60
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t60_1
[]
=
" ABC "
;
EXPECT_EQ
(
testValidateName
(
t60_1
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t60_1
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t61
[]
=
"' ABC '"
;
EXPECT_EQ
(
testValidateName
(
t61
),
TSDB_CODE_SUCCESS
);
...
...
@@ -233,96 +233,96 @@ TEST(testCase, db_table_name) {
EXPECT_EQ
(
testValidateName
(
t61_1
),
TSDB_CODE_SUCCESS
);
char
t62
[]
=
" ABC . def "
;
EXPECT_EQ
(
testValidateName
(
t62
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t62
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t63
[]
=
"' ABC . def "
;
EXPECT_EQ
(
testValidateName
(
t63
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t63
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t63_0
[]
=
" abc . DEF ' "
;
EXPECT_EQ
(
testValidateName
(
t63_0
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t63_0
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t64
[]
=
" ' ABC . def ' "
;
//int32_t tmp1 = testValidateName(t64);
EXPECT_EQ
(
testValidateName
(
t64
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t64
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t65
[]
=
" ' ABC '. def "
;
EXPECT_EQ
(
testValidateName
(
t65
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t65
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t66
[]
=
"' ABC '.' DEF '"
;
EXPECT_EQ
(
testValidateName
(
t66
),
TSDB_CODE_SUCCESS
);
char
t67
[]
=
"abc . ' DEF '"
;
EXPECT_EQ
(
testValidateName
(
t67
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t67
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t68
[]
=
"' abc '.' DEF '"
;
EXPECT_EQ
(
testValidateName
(
t68
),
TSDB_CODE_SUCCESS
);
// do not use key words
char
t69
[]
=
"table.'DEF'"
;
EXPECT_EQ
(
testValidateName
(
t69
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t69
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t70
[]
=
"'table'.'DEF'"
;
EXPECT_EQ
(
testValidateName
(
t70
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t70
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t71
[]
=
"'_abXYZ1234 '.' deFF '"
;
EXPECT_EQ
(
testValidateName
(
t71
),
TSDB_CODE_SUCCESS
);
char
t72
[]
=
"'_abDEF&^%1234'.' DIef'"
;
EXPECT_EQ
(
testValidateName
(
t72
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t72
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t73
[]
=
"'_123'.' Gtest中文'"
;
EXPECT_EQ
(
testValidateName
(
t73
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t73
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t74
[]
=
"' aABC'.'Gtest中文'"
;
EXPECT_EQ
(
testValidateName
(
t74
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t74
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t75
[]
=
"' ABC '."
;
EXPECT_EQ
(
testValidateName
(
t75
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t75
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t76
[]
=
".' ABC'"
;
EXPECT_EQ
(
testValidateName
(
t76
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t76
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t77
[]
=
" a .
\"
aTWc
\"
"
;
EXPECT_EQ
(
testValidateName
(
t77
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t77
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t78
[]
=
" a.
\"
aTWc
\"
"
;
EXPECT_EQ
(
testValidateName
(
t78
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t78
),
TSDB_CODE_
TSC_
INVALID_SQL
);
// ===============muti string by space ===================
// There's no such case.
//char t160[] = "A BC";
//EXPECT_EQ(testValidateName(t160), TSDB_CODE_INVALID_SQL);
//EXPECT_EQ(testValidateName(t160), TSDB_CODE_
TSC_
INVALID_SQL);
//printf("end:%s\n", t160);
// There's no such case.
//char t161[] = "' A BC '";
//EXPECT_EQ(testValidateName(t161), TSDB_CODE_INVALID_SQL);
//EXPECT_EQ(testValidateName(t161), TSDB_CODE_
TSC_
INVALID_SQL);
char
t162
[]
=
" AB C . de f "
;
EXPECT_EQ
(
testValidateName
(
t162
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t162
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t163
[]
=
"' AB C . de f "
;
EXPECT_EQ
(
testValidateName
(
t163
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t163
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t163_0
[]
=
" ab c . DE F ' "
;
EXPECT_EQ
(
testValidateName
(
t163_0
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t163_0
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t164
[]
=
" ' AB C . de f ' "
;
//int32_t tmp2 = testValidateName(t164);
EXPECT_EQ
(
testValidateName
(
t164
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t164
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t165
[]
=
" ' A BC '. de f "
;
EXPECT_EQ
(
testValidateName
(
t165
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t165
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t166
[]
=
"' AB C '.' DE F '"
;
EXPECT_EQ
(
testValidateName
(
t166
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t166
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t167
[]
=
"ab c . ' D EF '"
;
EXPECT_EQ
(
testValidateName
(
t167
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t167
),
TSDB_CODE_
TSC_
INVALID_SQL
);
char
t168
[]
=
"' a bc '.' DE F '"
;
EXPECT_EQ
(
testValidateName
(
t168
),
TSDB_CODE_INVALID_SQL
);
EXPECT_EQ
(
testValidateName
(
t168
),
TSDB_CODE_
TSC_
INVALID_SQL
);
}
...
...
src/rpc/src/rpcMain.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbMain.c
浏览文件 @
7e2abf0e
...
...
@@ -92,16 +92,15 @@ STsdbCfg *tsdbGetCfg(const TsdbRepoT *repo) {
* @return a TSDB repository handle on success, NULL for failure
*/
int32_t
tsdbCreateRepo
(
char
*
rootDir
,
STsdbCfg
*
pCfg
,
void
*
limiter
/* TODO */
)
{
if
(
mkdir
(
rootDir
,
0755
)
!=
0
)
{
tsdbError
(
"vgId:%d, failed to create rootDir! rootDir:%s, reason:%s"
,
pCfg
->
tsdbId
,
rootDir
,
strerror
(
errno
));
if
(
errno
==
EACCES
)
{
return
TSDB_CODE_NO_DISK_PERMISSIONS
;
return
TSDB_CODE_
TDB_
NO_DISK_PERMISSIONS
;
}
else
if
(
errno
==
ENOSPC
)
{
return
TSDB_CODE_
SERV
_NO_DISKSPACE
;
return
TSDB_CODE_
TDB
_NO_DISKSPACE
;
}
else
if
(
errno
==
EEXIST
)
{
}
else
{
return
TSDB_CODE_
VG
_INIT_FAILED
;
return
TSDB_CODE_
TDB
_INIT_FAILED
;
}
}
...
...
@@ -315,7 +314,7 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg) {
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
STsdbCfg
*
pRCfg
=
&
pRepo
->
config
;
if
(
tsdbCheckAndSetDefaultCfg
(
pCfg
)
<
0
)
return
TSDB_CODE_INVALID_CONFIG
;
if
(
tsdbCheckAndSetDefaultCfg
(
pCfg
)
<
0
)
return
TSDB_CODE_
TDB_
INVALID_CONFIG
;
ASSERT
(
pRCfg
->
tsdbId
==
pCfg
->
tsdbId
);
ASSERT
(
pRCfg
->
cacheBlockSize
==
pCfg
->
cacheBlockSize
);
...
...
@@ -416,13 +415,13 @@ int tsdbUpdateTagValue(TsdbRepoT *repo, SUpdateTableTagValMsg *pMsg) {
int16_t
tversion
=
htons
(
pMsg
->
tversion
);
STable
*
pTable
=
tsdbGetTableByUid
(
pMeta
,
htobe64
(
pMsg
->
uid
));
if
(
pTable
==
NULL
)
return
TSDB_CODE_INVALID_TABLE_ID
;
if
(
pTable
->
tableId
.
tid
!=
htonl
(
pMsg
->
tid
))
return
TSDB_CODE_INVALID_TABLE_ID
;
if
(
pTable
==
NULL
)
return
TSDB_CODE_
TDB_
INVALID_TABLE_ID
;
if
(
pTable
->
tableId
.
tid
!=
htonl
(
pMsg
->
tid
))
return
TSDB_CODE_
TDB_
INVALID_TABLE_ID
;
if
(
pTable
->
type
!=
TSDB_CHILD_TABLE
)
{
tsdbError
(
"vgId:%d failed to update tag value of table %s since its type is %d"
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
pTable
->
name
),
pTable
->
type
);
return
TSDB_CODE_INVALID_TABLE_TYPE
;
return
TSDB_CODE_
TDB_
INVALID_TABLE_TYPE
;
}
if
(
schemaVersion
(
tsdbGetTableTagSchema
(
pMeta
,
pTable
))
<
tversion
)
{
...
...
@@ -452,7 +451,7 @@ int tsdbUpdateTagValue(TsdbRepoT *repo, SUpdateTableTagValMsg *pMsg) {
"vgId:%d failed to update tag value of table %s since version out of date, client tag version:%d server tag "
"version:%d"
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
pTable
->
name
),
tversion
,
schemaVersion
(
pTable
->
tagSchema
));
return
TSDB_CODE_TAG_VER_OUT_OF_DATE
;
return
TSDB_CODE_T
DB_T
AG_VER_OUT_OF_DATE
;
}
if
(
schemaColAt
(
pTagSchema
,
DEFAULT_TAG_INDEX_COLUMN
)
->
colId
==
htons
(
pMsg
->
colId
))
{
tsdbRemoveTableFromIndex
(
pMeta
,
pTable
);
...
...
@@ -948,7 +947,7 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
if
(
pTable
==
NULL
)
{
tsdbError
(
"vgId:%d, failed to get table for insert, uid:"
PRIu64
", tid:%d"
,
pRepo
->
config
.
tsdbId
,
pBlock
->
uid
,
pBlock
->
tid
);
return
TSDB_CODE_INVALID_TABLE_ID
;
return
TSDB_CODE_
TDB_
INVALID_TABLE_ID
;
}
// Check schema version
...
...
@@ -980,7 +979,7 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
if
(
tsdbGetTableSchemaByVersion
(
pMeta
,
pTable
,
tversion
)
==
NULL
)
{
tsdbError
(
"vgId:%d table:%s tid:%d invalid schema version %d from client"
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
pTable
->
name
),
pTable
->
tableId
.
tid
,
tversion
);
return
TSDB_CODE_TABLE_SCHEMA_VERSION
;
return
TSDB_CODE_T
DB_T
ABLE_SCHEMA_VERSION
;
}
}
...
...
@@ -996,7 +995,7 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
tsdbError
(
"vgId:%d, table:%s, tid:%d, talbe uid:%ld timestamp is out of range. now:"
PRId64
", maxKey:"
PRId64
", minKey:"
PRId64
,
pRepo
->
config
.
tsdbId
,
varDataVal
(
pTable
->
name
),
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
now
,
minKey
,
maxKey
);
return
TSDB_CODE_TIMESTAMP_OUT_OF_RANGE
;
return
TSDB_CODE_T
DB_T
IMESTAMP_OUT_OF_RANGE
;
}
if
(
tdInsertRowToTable
(
pRepo
,
row
,
pTable
)
<
0
)
{
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbRead.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/util/src/tbuffer.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/util/src/tqueue.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/util/src/tutil.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/vnode/src/vnodeMain.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/vnode/src/vnodeRead.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
src/vnode/src/vnodeWrite.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
tests/examples/C#/TDengineDriver.cs
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
tests/tsim/src/simExe.c
浏览文件 @
7e2abf0e
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录