Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c00069ed
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c00069ed
编写于
10月 19, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
10月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17472 from taosdata/fix/3.0_bugfix_wxy
fix: handle coverity scan
上级
c58daa70
079a03f3
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
130 addition
and
94 deletion
+130
-94
include/common/trow.h
include/common/trow.h
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+29
-30
source/libs/executor/src/dataDeleter.c
source/libs/executor/src/dataDeleter.c
+1
-0
source/libs/nodes/src/nodesMsgFuncs.c
source/libs/nodes/src/nodesMsgFuncs.c
+15
-3
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+12
-3
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+6
-2
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+18
-16
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+5
-1
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+40
-36
source/libs/qcom/src/queryUtil.c
source/libs/qcom/src/queryUtil.c
+3
-2
未找到文件。
include/common/trow.h
浏览文件 @
c00069ed
...
...
@@ -30,7 +30,7 @@
extern
"C"
{
#endif
typedef
struct
{
typedef
struct
STSRow
{
TSKEY
ts
;
union
{
uint32_t
info
;
...
...
source/client/src/clientImpl.c
浏览文件 @
c00069ed
...
...
@@ -186,8 +186,8 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
STscObj
*
pTscObj
=
(
*
pRequest
)
->
pTscObj
;
if
(
taosHashPut
(
pTscObj
->
pRequests
,
&
(
*
pRequest
)
->
self
,
sizeof
((
*
pRequest
)
->
self
),
&
(
*
pRequest
)
->
self
,
sizeof
((
*
pRequest
)
->
self
)))
{
tscError
(
"%"
PRIx64
" failed to add to request container, reqId:0x%"
PRIu64
", conn:%"
PRIx64
", %s"
,
(
*
pRequest
)
->
self
,
(
*
pRequest
)
->
requestId
,
pTscObj
->
id
,
sql
);
tscError
(
"%"
PRIx64
" failed to add to request container, reqId:0x%"
PRIu64
", conn:%"
PRIx64
", %s"
,
(
*
pRequest
)
->
self
,
(
*
pRequest
)
->
requestId
,
pTscObj
->
id
,
sql
);
taosMemoryFree
(
param
);
destroyRequest
(
*
pRequest
);
...
...
@@ -199,9 +199,8 @@ int32_t buildRequest(uint64_t connId, const char* sql, int sqlLen, void* param,
if
(
tsQueryUseNodeAllocator
&&
!
qIsInsertValuesSql
((
*
pRequest
)
->
sqlstr
,
(
*
pRequest
)
->
sqlLen
))
{
if
(
TSDB_CODE_SUCCESS
!=
nodesCreateAllocator
((
*
pRequest
)
->
requestId
,
tsQueryNodeChunkSize
,
&
((
*
pRequest
)
->
allocatorRefId
)))
{
tscError
(
"%"
PRId64
" failed to create node allocator, reqId:0x%"
PRIx64
", conn:%"
PRId64
", %s"
,
(
*
pRequest
)
->
self
,
(
*
pRequest
)
->
requestId
,
pTscObj
->
id
,
sql
);
tscError
(
"%"
PRId64
" failed to create node allocator, reqId:0x%"
PRIx64
", conn:%"
PRId64
", %s"
,
(
*
pRequest
)
->
self
,
(
*
pRequest
)
->
requestId
,
pTscObj
->
id
,
sql
);
destroyRequest
(
*
pRequest
);
*
pRequest
=
NULL
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
@@ -1040,39 +1039,39 @@ static int32_t asyncExecSchQuery(SRequestObj* pRequest, SQuery* pQuery, SMetaDat
SSqlCallbackWrapper
*
pWrapper
)
{
pRequest
->
type
=
pQuery
->
msgType
;
SArray
*
pMnodeList
=
taosArrayInit
(
4
,
sizeof
(
SQueryNodeLoad
));
SArray
*
pMnodeList
=
taosArrayInit
(
4
,
sizeof
(
SQueryNodeLoad
));
SPlanContext
cxt
=
{.
queryId
=
pRequest
->
requestId
,
.
acctId
=
pRequest
->
pTscObj
->
acctId
,
.
mgmtEpSet
=
getEpSet_s
(
&
pRequest
->
pTscObj
->
pAppInfo
->
mgmtEp
),
.
pAstRoot
=
pQuery
->
pRoot
,
.
showRewrite
=
pQuery
->
showRewrite
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
pUser
=
pRequest
->
pTscObj
->
user
,
.
sysInfo
=
pRequest
->
pTscObj
->
sysInfo
,
.
allocatorId
=
pRequest
->
allocatorRefId
};
SAppInstInfo
*
pAppInfo
=
getAppInfo
(
pRequest
);
SQueryPlan
*
pDag
=
NULL
;
.
acctId
=
pRequest
->
pTscObj
->
acctId
,
.
mgmtEpSet
=
getEpSet_s
(
&
pRequest
->
pTscObj
->
pAppInfo
->
mgmtEp
),
.
pAstRoot
=
pQuery
->
pRoot
,
.
showRewrite
=
pQuery
->
showRewrite
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
pUser
=
pRequest
->
pTscObj
->
user
,
.
sysInfo
=
pRequest
->
pTscObj
->
sysInfo
,
.
allocatorId
=
pRequest
->
allocatorRefId
};
SAppInstInfo
*
pAppInfo
=
getAppInfo
(
pRequest
);
SQueryPlan
*
pDag
=
NULL
;
int64_t
st
=
taosGetTimestampUs
();
int32_t
code
=
qCreateQueryPlan
(
&
cxt
,
&
pDag
,
pMnodeList
);
if
(
code
)
{
tscError
(
"0x%"
PRIx64
" failed to create query plan, code:%s 0x%"
PRIx64
,
pRequest
->
self
,
tstrerror
(
code
),
pRequest
->
requestId
);
}
else
{
pRequest
->
body
.
subplanNum
=
pDag
->
numOfSubplans
;
}
if
(
code
)
{
tscError
(
"0x%"
PRIx64
" failed to create query plan, code:%s 0x%"
PRIx64
,
pRequest
->
self
,
tstrerror
(
code
),
pRequest
->
requestId
);
}
else
{
pRequest
->
body
.
subplanNum
=
pDag
->
numOfSubplans
;
}
pRequest
->
metric
.
planEnd
=
taosGetTimestampUs
();
pRequest
->
metric
.
planEnd
=
taosGetTimestampUs
();
if
(
code
==
TSDB_CODE_SUCCESS
)
{
tscDebug
(
"0x%"
PRIx64
" create query plan success, elapsed time:%.2f ms, 0x%"
PRIx64
,
pRequest
->
self
,
(
pRequest
->
metric
.
planEnd
-
st
)
/
1000
.
0
,
pRequest
->
requestId
);
(
pRequest
->
metric
.
planEnd
-
st
)
/
1000
.
0
,
pRequest
->
requestId
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
!
pRequest
->
validateOnly
)
{
SArray
*
pNodeList
=
NULL
;
buildAsyncExecNodeList
(
pRequest
,
&
pNodeList
,
pMnodeList
,
pResultMeta
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
!
pRequest
->
validateOnly
)
{
SArray
*
pNodeList
=
NULL
;
buildAsyncExecNodeList
(
pRequest
,
&
pNodeList
,
pMnodeList
,
pResultMeta
);
SRequestConnInfo
conn
=
{.
pTrans
=
getAppInfo
(
pRequest
)
->
pTransporter
,
.
requestId
=
pRequest
->
requestId
,
...
...
@@ -2262,7 +2261,7 @@ void taosAsyncQueryImpl(uint64_t connId, const char* sql, __taos_async_fn_t fp,
if
(
fp
)
{
fp
(
param
,
NULL
,
terrno
);
}
return
;
}
...
...
source/libs/executor/src/dataDeleter.c
浏览文件 @
c00069ed
...
...
@@ -183,6 +183,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int64_t* pLen, bool* pQueryE
SDataDeleterBuf
*
pBuf
=
NULL
;
taosReadQitem
(
pDeleter
->
pDataBlocks
,
(
void
**
)
&
pBuf
);
ASSERT
(
NULL
!=
pBuf
);
memcpy
(
&
pDeleter
->
nextOutput
,
pBuf
,
sizeof
(
SDataDeleterBuf
));
taosFreeQitem
(
pBuf
);
...
...
source/libs/nodes/src/nodesMsgFuncs.c
浏览文件 @
c00069ed
...
...
@@ -84,13 +84,12 @@ static void endTlvEncode(STlvEncoder* pEncoder, char** pMsg, int32_t* pLen) {
*
pMsg
=
pEncoder
->
pBuf
;
pEncoder
->
pBuf
=
NULL
;
*
pLen
=
pEncoder
->
offset
;
// nodesWarn("encode tlv count = %d, tl size = %d", pEncoder->tlvCount, sizeof(STlv) * pEncoder->tlvCount);
}
static
int32_t
tlvEncodeImpl
(
STlvEncoder
*
pEncoder
,
int16_t
type
,
const
void
*
pValue
,
int32_t
len
)
{
int32_t
tlvLen
=
sizeof
(
STlv
)
+
len
;
if
(
pEncoder
->
offset
+
tlvLen
>
pEncoder
->
allocSize
)
{
pEncoder
->
allocSize
=
TMAX
(
pEncoder
->
allocSize
*
2
,
pEncoder
->
allocSize
+
pEncoder
->
offset
+
tlvLen
);
pEncoder
->
allocSize
=
TMAX
(
pEncoder
->
allocSize
*
2
,
pEncoder
->
allocSize
+
tlvLen
);
void
*
pNewBuf
=
taosMemoryRealloc
(
pEncoder
->
pBuf
,
pEncoder
->
allocSize
);
if
(
NULL
==
pNewBuf
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -241,6 +240,15 @@ static int32_t tlvEncodeObj(STlvEncoder* pEncoder, int16_t type, FToMsg func, co
return
TSDB_CODE_SUCCESS
;
}
if
(
pEncoder
->
offset
+
sizeof
(
STlv
)
>
pEncoder
->
allocSize
)
{
pEncoder
->
allocSize
=
TMAX
(
pEncoder
->
allocSize
*
2
,
pEncoder
->
allocSize
+
sizeof
(
STlv
));
void
*
pNewBuf
=
taosMemoryRealloc
(
pEncoder
->
pBuf
,
pEncoder
->
allocSize
);
if
(
NULL
==
pNewBuf
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pEncoder
->
pBuf
=
pNewBuf
;
}
int32_t
start
=
pEncoder
->
offset
;
pEncoder
->
offset
+=
sizeof
(
STlv
);
int32_t
code
=
func
(
pObj
,
pEncoder
);
...
...
@@ -307,7 +315,7 @@ static int32_t tlvDecodeImpl(STlv* pTlv, void* pValue, int32_t len) {
}
static
int32_t
tlvDecodeValueImpl
(
STlvDecoder
*
pDecoder
,
void
*
pValue
,
int32_t
len
)
{
if
(
pDecoder
->
offset
+
len
>
pDecoder
->
bufSize
)
{
if
(
len
>
pDecoder
->
bufSize
-
pDecoder
->
offset
)
{
return
TSDB_CODE_FAILED
;
}
memcpy
(
pValue
,
pDecoder
->
pBuf
+
pDecoder
->
offset
,
len
);
...
...
@@ -911,6 +919,10 @@ static int32_t msgToDatum(STlv* pTlv, void* pObj) {
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_VARCHAR
:
case
TSDB_DATA_TYPE_VARBINARY
:
{
if
(
pTlv
->
len
>
pNode
->
node
.
resType
.
bytes
+
VARSTR_HEADER_SIZE
)
{
code
=
TSDB_CODE_FAILED
;
break
;
}
pNode
->
datum
.
p
=
taosMemoryCalloc
(
1
,
pNode
->
node
.
resType
.
bytes
+
VARSTR_HEADER_SIZE
+
1
);
if
(
NULL
==
pNode
->
datum
.
p
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
c00069ed
...
...
@@ -190,14 +190,23 @@ int32_t nodesReleaseAllocator(int64_t allocatorId) {
return
TSDB_CODE_SUCCESS
;
}
if
(
NULL
==
g_pNodeAllocator
)
{
SNodeAllocator
*
pAllocator
=
taosAcquireRef
(
g_allocatorReqRefPool
,
allocatorId
);
if
(
NULL
==
pAllocator
)
{
return
terrno
;
}
int32_t
code
=
taosThreadMutexTryLock
(
&
pAllocator
->
mutex
);
if
(
EBUSY
!=
code
)
{
nodesError
(
"allocator id %"
PRIx64
" release failed: The nodesReleaseAllocator function needs to be called after the nodesAcquireAllocator "
"function is called!"
,
allocatorId
);
if
(
0
==
code
)
{
taosThreadMutexUnlock
(
&
pAllocator
->
mutex
);
}
return
TSDB_CODE_FAILED
;
}
SNodeAllocator
*
pAllocator
=
g_pNodeAllocator
;
g_pNodeAllocator
=
NULL
;
taosThreadMutexUnlock
(
&
pAllocator
->
mutex
);
return
taosReleaseRef
(
g_allocatorReqRefPool
,
allocatorId
);
...
...
@@ -1826,7 +1835,7 @@ static EDealRes collectFuncs(SNode* pNode, void* pContext) {
if
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
pCxt
->
classifier
(((
SFunctionNode
*
)
pNode
)
->
funcId
)
&&
!
(((
SExprNode
*
)
pNode
)
->
orderAlias
))
{
SExprNode
*
pExpr
=
(
SExprNode
*
)
pNode
;
if
(
NULL
==
taosHashGet
(
pCxt
->
pFuncsSet
,
&
pExpr
,
POINTER_BYTES
))
{
if
(
NULL
==
taosHashGet
(
pCxt
->
pFuncsSet
,
&
pExpr
,
sizeof
(
SExprNode
*
)
))
{
pCxt
->
errCode
=
nodesListStrictAppend
(
pCxt
->
pFuncs
,
nodesCloneNode
(
pNode
));
taosHashPut
(
pCxt
->
pFuncsSet
,
&
pExpr
,
POINTER_BYTES
,
&
pExpr
,
POINTER_BYTES
);
}
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
c00069ed
...
...
@@ -1365,8 +1365,12 @@ static int32_t parseCsvFile(SInsertParseContext* pCxt, TdFilePtr fp, STableDataB
strtolower
(
pLine
,
pLine
);
char
*
pRawSql
=
pCxt
->
pSql
;
pCxt
->
pSql
=
pLine
;
bool
gotRow
=
false
;
CHECK_CODE
(
parseOneRow
(
pCxt
,
pDataBlock
,
tinfo
.
precision
,
&
gotRow
,
tmpTokenBuf
));
bool
gotRow
=
false
;
int32_t
code
=
parseOneRow
(
pCxt
,
pDataBlock
,
tinfo
.
precision
,
&
gotRow
,
tmpTokenBuf
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
pCxt
->
pSql
=
pRawSql
;
return
code
;
}
if
(
gotRow
)
{
pDataBlock
->
size
+=
extendedRowSize
;
// len;
(
*
numOfRows
)
++
;
...
...
source/libs/parser/src/parInsertData.c
浏览文件 @
c00069ed
...
...
@@ -222,6 +222,21 @@ int32_t buildCreateTbMsg(STableDataBlocks* pBlocks, SVCreateTbReq* pCreateTbReq)
return
code
;
}
static
void
destroyDataBlock
(
STableDataBlocks
*
pDataBlock
)
{
if
(
pDataBlock
==
NULL
)
{
return
;
}
taosMemoryFreeClear
(
pDataBlock
->
pData
);
// if (!pDataBlock->cloned) {
// free the refcount for metermeta
taosMemoryFreeClear
(
pDataBlock
->
pTableMeta
);
destroyBoundColumnInfo
(
&
pDataBlock
->
boundColumnInfo
);
// }
taosMemoryFreeClear
(
pDataBlock
);
}
int32_t
getDataBlockFromList
(
SHashObj
*
pHashList
,
void
*
id
,
int32_t
idLen
,
int32_t
size
,
int32_t
startOffset
,
int32_t
rowSize
,
STableMeta
*
pTableMeta
,
STableDataBlocks
**
dataBlocks
,
SArray
*
pBlockList
,
SVCreateTbReq
*
pCreateTbReq
)
{
...
...
@@ -240,11 +255,13 @@ int32_t getDataBlockFromList(SHashObj* pHashList, void* id, int32_t idLen, int32
if
(
NULL
!=
pCreateTbReq
&&
NULL
!=
pCreateTbReq
->
ctb
.
pTag
)
{
ret
=
buildCreateTbMsg
(
*
dataBlocks
,
pCreateTbReq
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
destroyDataBlock
(
*
dataBlocks
);
return
ret
;
}
}
taosHashPut
(
pHashList
,
id
,
idLen
,
dataBlocks
,
POINTER_BYTES
);
// converting to 'const char*' is to handle coverity scan errors
taosHashPut
(
pHashList
,
(
const
char
*
)
id
,
idLen
,
(
const
char
*
)
dataBlocks
,
POINTER_BYTES
);
if
(
pBlockList
)
{
taosArrayPush
(
pBlockList
,
dataBlocks
);
}
...
...
@@ -266,21 +283,6 @@ static int32_t getRowExpandSize(STableMeta* pTableMeta) {
return
result
;
}
static
void
destroyDataBlock
(
STableDataBlocks
*
pDataBlock
)
{
if
(
pDataBlock
==
NULL
)
{
return
;
}
taosMemoryFreeClear
(
pDataBlock
->
pData
);
// if (!pDataBlock->cloned) {
// free the refcount for metermeta
taosMemoryFreeClear
(
pDataBlock
->
pTableMeta
);
destroyBoundColumnInfo
(
&
pDataBlock
->
boundColumnInfo
);
// }
taosMemoryFreeClear
(
pDataBlock
);
}
void
destroyBlockArrayList
(
SArray
*
pDataBlockList
)
{
if
(
pDataBlockList
==
NULL
)
{
return
;
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
c00069ed
...
...
@@ -248,8 +248,12 @@ int32_t getNumOfTags(const STableMeta* pTableMeta) { return getTableInfo(pTableM
STableComInfo
getTableInfo
(
const
STableMeta
*
pTableMeta
)
{
return
pTableMeta
->
tableInfo
;
}
STableMeta
*
tableMetaDup
(
const
STableMeta
*
pTableMeta
)
{
size_t
size
=
TABLE_META_SIZE
(
pTableMeta
);
int32_t
numOfFields
=
TABLE_TOTAL_COL_NUM
(
pTableMeta
);
if
(
numOfFields
>
TSDB_MAX_COLUMNS
||
numOfFields
<
TSDB_MIN_COLUMNS
)
{
return
NULL
;
}
size_t
size
=
sizeof
(
STableMeta
)
+
numOfFields
*
sizeof
(
SSchema
);
STableMeta
*
p
=
taosMemoryMalloc
(
size
);
memcpy
(
p
,
pTableMeta
,
size
);
return
p
;
...
...
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
c00069ed
...
...
@@ -32,23 +32,29 @@
namespace
{
void
generateInformationSchema
(
MockCatalogService
*
mcs
)
{
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DNODES
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DNODES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"endpoint"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_EP_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_MNODES
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_MNODES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"endpoint"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_EP_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_MODULES
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_MODULES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"endpoint"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_EP_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_QNODES
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_QNODES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"endpoint"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_EP_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DATABASES
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DATABASES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
addColumn
(
"create_time"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_FUNCTIONS
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_FUNCTIONS
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_FUNC_NAME_LEN
)
.
addColumn
(
"aggregate"
,
TSDB_DATA_TYPE_INT
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_INDEXES
,
TSDB_SYSTEM_TABLE
,
3
)
.
addColumn
(
"index_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
)
...
...
@@ -63,22 +69,28 @@ void generateInformationSchema(MockCatalogService* mcs) {
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
addColumn
(
"table_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_TABLE_DISTRIBUTED
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
addColumn
(
"table_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_USERS
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_USERS
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_USER_LEN
)
.
addColumn
(
"super"
,
TSDB_DATA_TYPE_TINYINT
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_VGROUPS
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_VGROUPS
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"vgroup_id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"db_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_DB_NAME_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_CONFIGS
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_CONFIGS
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_CONFIG_OPTION_LEN
)
.
addColumn
(
"value"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_CONFIG_VALUE_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DNODE_VARIABLES
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_DNODE_VARIABLES
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"dnode_id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_CONFIG_OPTION_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_CLUSTER
,
TSDB_SYSTEM_TABLE
,
1
)
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_CLUSTER
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"id"
,
TSDB_DATA_TYPE_BIGINT
)
.
addColumn
(
"name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_CLUSTER_ID_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_VNODES
,
TSDB_SYSTEM_TABLE
,
2
)
...
...
@@ -92,30 +104,22 @@ void generateInformationSchema(MockCatalogService* mcs) {
}
void
generatePerformanceSchema
(
MockCatalogService
*
mcs
)
{
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_PERFORMANCE_SCHEMA_DB
,
TSDB_PERFS_TABLE_TRANS
,
TSDB_SYSTEM_TABLE
,
1
)
.
addColumn
(
"id"
,
TSDB_DATA_TYPE_INT
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_STREAMS
,
TSDB_SYSTEM_TABLE
,
1
)
.
addColumn
(
"stream_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_PERFORMANCE_SCHEMA_DB
,
TSDB_PERFS_TABLE_CONSUMERS
,
TSDB_SYSTEM_TABLE
,
1
)
.
addColumn
(
"stream_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
);
builder
.
done
();
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_SUBSCRIPTIONS
,
TSDB_SYSTEM_TABLE
,
1
)
.
addColumn
(
"stream_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
);
builder
.
done
();
}
mcs
->
createTableBuilder
(
TSDB_PERFORMANCE_SCHEMA_DB
,
TSDB_PERFS_TABLE_TRANS
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"create_time"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_STREAMS
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"stream_name"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
)
.
addColumn
(
"create_time"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_PERFORMANCE_SCHEMA_DB
,
TSDB_PERFS_TABLE_CONSUMERS
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"consumer_id"
,
TSDB_DATA_TYPE_BIGINT
)
.
addColumn
(
"consumer_group"
,
TSDB_DATA_TYPE_BINARY
,
TSDB_TABLE_NAME_LEN
)
.
done
();
mcs
->
createTableBuilder
(
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_INS_TABLE_SUBSCRIPTIONS
,
TSDB_SYSTEM_TABLE
,
2
)
.
addColumn
(
"vgroup_id"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"consumer_id"
,
TSDB_DATA_TYPE_BIGINT
)
.
done
();
}
/*
...
...
source/libs/qcom/src/queryUtil.c
浏览文件 @
c00069ed
...
...
@@ -423,13 +423,14 @@ int32_t cloneTableMeta(STableMeta* pSrc, STableMeta** pDst) {
return
TSDB_CODE_SUCCESS
;
}
if
((
pSrc
->
tableInfo
.
numOfColumns
+
pSrc
->
tableInfo
.
numOfTags
)
>
TSDB_MAX_COL_TAG_NUM
)
{
int32_t
numOfField
=
pSrc
->
tableInfo
.
numOfColumns
+
pSrc
->
tableInfo
.
numOfTags
;
if
(
numOfField
>
TSDB_MAX_COL_TAG_NUM
||
numOfField
<
TSDB_MIN_COLUMNS
)
{
*
pDst
=
NULL
;
qError
(
"too many column and tag num:%d,%d"
,
pSrc
->
tableInfo
.
numOfColumns
,
pSrc
->
tableInfo
.
numOfTags
);
return
TSDB_CODE_INVALID_PARA
;
}
int32_t
metaSize
=
sizeof
(
STableMeta
)
+
(
pSrc
->
tableInfo
.
numOfColumns
+
pSrc
->
tableInfo
.
numOfTags
)
*
sizeof
(
SSchema
);
int32_t
metaSize
=
sizeof
(
STableMeta
)
+
numOfField
*
sizeof
(
SSchema
);
*
pDst
=
taosMemoryMalloc
(
metaSize
);
if
(
NULL
==
*
pDst
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录