Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2ef7bf1c
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2ef7bf1c
编写于
2月 16, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
差异文件
merge from 3.0
上级
d0a61176
88b569e6
变更
73
展开全部
隐藏空白更改
内联
并排
Showing
73 changed file
with
6596 addition
and
3526 deletion
+6596
-3526
2.0/src/query/inc/qExecutor.h
2.0/src/query/inc/qExecutor.h
+3
-3
2.0/src/query/src/qExecutor.c
2.0/src/query/src/qExecutor.c
+12
-12
2.0/src/query/tests/resultBufferTest.cpp
2.0/src/query/tests/resultBufferTest.cpp
+27
-27
include/common/common.h
include/common/common.h
+33
-14
include/common/tep.h
include/common/tep.h
+81
-0
include/common/tmsg.h
include/common/tmsg.h
+78
-113
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-1
include/common/trow.h
include/common/trow.h
+1
-1
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+2
-2
include/libs/planner/plannerOp.h
include/libs/planner/plannerOp.h
+1
-1
include/util/tlosertree.h
include/util/tlosertree.h
+16
-13
include/util/tpagedbuf.h
include/util/tpagedbuf.h
+171
-0
source/client/src/clientHb.c
source/client/src/clientHb.c
+16
-36
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+19
-21
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+27
-43
source/client/src/tmq.c
source/client/src/tmq.c
+4
-4
source/common/src/tep.c
source/common/src/tep.c
+979
-36
source/common/src/tmsg.c
source/common/src/tmsg.c
+484
-58
source/common/src/tname.c
source/common/src/tname.c
+3
-1
source/common/src/ttszip.c
source/common/src/ttszip.c
+2
-2
source/common/test/commonTests.cpp
source/common/test/commonTests.cpp
+197
-1
source/dnode/mgmt/impl/test/sut/inc/sut.h
source/dnode/mgmt/impl/test/sut/inc/sut.h
+1
-1
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+23
-24
source/dnode/mnode/impl/inc/mndAuth.h
source/dnode/mnode/impl/inc/mndAuth.h
+3
-0
source/dnode/mnode/impl/inc/mndDb.h
source/dnode/mnode/impl/inc/mndDb.h
+1
-1
source/dnode/mnode/impl/inc/mndStb.h
source/dnode/mnode/impl/inc/mndStb.h
+6
-7
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+26
-0
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+5
-5
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+5
-5
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+8
-6
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+40
-21
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+13
-13
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+9
-9
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+8
-8
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+55
-52
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+5
-5
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+12
-9
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+5
-5
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+193
-178
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+37
-37
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+66
-81
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+22
-10
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+10
-10
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+43
-45
source/dnode/mnode/impl/test/show/show.cpp
source/dnode/mnode/impl/test/show/show.cpp
+7
-5
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+49
-64
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+8
-8
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+40
-27
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+1
-1
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+132
-117
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+8
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+406
-351
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+6
-7
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1001
-903
source/libs/executor/test/executorTests.cpp
source/libs/executor/test/executorTests.cpp
+294
-175
source/libs/function/inc/thistogram.h
source/libs/function/inc/thistogram.h
+1
-1
source/libs/function/inc/tpercentile.h
source/libs/function/inc/tpercentile.h
+2
-2
source/libs/function/src/thistogram.c
source/libs/function/src/thistogram.c
+12
-12
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+10
-10
source/libs/parser/inc/new_sql.y
source/libs/parser/inc/new_sql.y
+62
-15
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+4
-6
source/libs/parser/src/new_sql.c
source/libs/parser/src/new_sql.c
+740
-683
source/libs/parser/src/parserImpl.c
source/libs/parser/src/parserImpl.c
+8
-0
source/libs/parser/test/newParserTest.cpp
source/libs/parser/test/newParserTest.cpp
+40
-1
source/libs/planner/src/physicalPlan.c
source/libs/planner/src/physicalPlan.c
+2
-2
source/libs/planner/src/physicalPlanJson.c
source/libs/planner/src/physicalPlanJson.c
+3
-3
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+95
-108
source/libs/qworker/src/qworkerMsg.c
source/libs/qworker/src/qworkerMsg.c
+25
-16
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+66
-43
source/util/src/tlosertree.c
source/util/src/tlosertree.c
+57
-42
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+597
-0
source/util/test/pageBufferTest.cpp
source/util/test/pageBufferTest.cpp
+165
-0
未找到文件。
2.0/src/query/inc/qExecutor.h
浏览文件 @
2ef7bf1c
...
@@ -582,9 +582,9 @@ typedef struct SOrderOperatorInfo {
...
@@ -582,9 +582,9 @@ typedef struct SOrderOperatorInfo {
void
appendUpstream
(
SOperatorInfo
*
p
,
SOperatorInfo
*
pUpstream
);
void
appendUpstream
(
SOperatorInfo
*
p
,
SOperatorInfo
*
pUpstream
);
SOperatorInfo
*
create
DataBlocksOptScan
Info
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
,
int32_t
reverseTime
);
SOperatorInfo
*
create
TableScanOperator
Info
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
,
int32_t
reverseTime
);
SOperatorInfo
*
createTableScanOperator
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
);
SOperatorInfo
*
createTableScanOperator
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
);
SOperatorInfo
*
createTableSeqScanOperator
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createTableSeqScanOperator
Info
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createAggregateOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createAggregateOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createProjectOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createProjectOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
...
@@ -622,7 +622,7 @@ void doCompactSDataBlock(SSDataBlock* pBlock, int32_t numOfRows, int8_t* p);
...
@@ -622,7 +622,7 @@ void doCompactSDataBlock(SSDataBlock* pBlock, int32_t numOfRows, int8_t* p);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
SSDataBlock
*
createOutputBuf
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
);
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
);
void
*
blockDataDestroy
(
SSDataBlock
*
pBlock
);
void
*
doDestroyFilterInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
);
void
*
doDestroyFilterInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
void
setInputDataBlock
(
SOperatorInfo
*
pOperator
,
SQLFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
,
int32_t
order
);
...
...
2.0/src/query/src/qExecutor.c
浏览文件 @
2ef7bf1c
...
@@ -336,7 +336,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
...
@@ -336,7 +336,7 @@ SSDataBlock* createOutputBuf(SExprInfo* pExpr, int32_t numOfOutput, int32_t numO
return
res
;
return
res
;
}
}
void
*
destroyOutputBuf
(
SSDataBlock
*
pBlock
)
{
void
*
blockDataDestroy
(
SSDataBlock
*
pBlock
)
{
if
(
pBlock
==
NULL
)
{
if
(
pBlock
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
...
@@ -4835,11 +4835,11 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
...
@@ -4835,11 +4835,11 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
break
;
break
;
}
}
case
OP_TableSeqScan
:
{
case
OP_TableSeqScan
:
{
pRuntimeEnv
->
proot
=
createTableSeqScanOperator
(
pRuntimeEnv
->
pTsdbReadHandle
,
pRuntimeEnv
);
pRuntimeEnv
->
proot
=
createTableSeqScanOperator
Info
(
pRuntimeEnv
->
pTsdbReadHandle
,
pRuntimeEnv
);
break
;
break
;
}
}
case
OP_DataBlocksOptScan
:
{
case
OP_DataBlocksOptScan
:
{
pRuntimeEnv
->
proot
=
create
DataBlocksOptScan
Info
(
pRuntimeEnv
->
pTsdbReadHandle
,
pRuntimeEnv
,
getNumOfScanTimes
(
pQueryAttr
),
pQueryAttr
->
needReverseScan
?
1
:
0
);
pRuntimeEnv
->
proot
=
create
TableScanOperator
Info
(
pRuntimeEnv
->
pTsdbReadHandle
,
pRuntimeEnv
,
getNumOfScanTimes
(
pQueryAttr
),
pQueryAttr
->
needReverseScan
?
1
:
0
);
break
;
break
;
}
}
case
OP_TableScan
:
{
case
OP_TableScan
:
{
...
@@ -5162,7 +5162,7 @@ SOperatorInfo* createTableScanOperator(void* pTsdbQueryHandle, SQueryRuntimeEnv*
...
@@ -5162,7 +5162,7 @@ SOperatorInfo* createTableScanOperator(void* pTsdbQueryHandle, SQueryRuntimeEnv*
return
pOperator
;
return
pOperator
;
}
}
SOperatorInfo
*
createTableSeqScanOperator
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
SOperatorInfo
*
createTableSeqScanOperator
Info
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
STableScanInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
STableScanInfo
));
STableScanInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
STableScanInfo
));
pInfo
->
pTsdbReadHandle
=
pTsdbQueryHandle
;
pInfo
->
pTsdbReadHandle
=
pTsdbQueryHandle
;
...
@@ -5267,7 +5267,7 @@ void setTableScanFilterOperatorInfo(STableScanInfo* pTableScanInfo, SOperatorInf
...
@@ -5267,7 +5267,7 @@ void setTableScanFilterOperatorInfo(STableScanInfo* pTableScanInfo, SOperatorInf
}
}
}
}
SOperatorInfo
*
create
DataBlocksOptScan
Info
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
,
int32_t
reverseTime
)
{
SOperatorInfo
*
create
TableScanOperator
Info
(
void
*
pTsdbQueryHandle
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
,
int32_t
reverseTime
)
{
assert
(
repeatTime
>
0
);
assert
(
repeatTime
>
0
);
STableScanInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
STableScanInfo
));
STableScanInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
STableScanInfo
));
...
@@ -5278,7 +5278,7 @@ SOperatorInfo* createDataBlocksOptScanInfo(void* pTsdbQueryHandle, SQueryRuntime
...
@@ -5278,7 +5278,7 @@ SOperatorInfo* createDataBlocksOptScanInfo(void* pTsdbQueryHandle, SQueryRuntime
pInfo
->
order
=
pRuntimeEnv
->
pQueryAttr
->
order
.
order
;
pInfo
->
order
=
pRuntimeEnv
->
pQueryAttr
->
order
.
order
;
SOperatorInfo
*
pOptr
=
calloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOptr
=
calloc
(
1
,
sizeof
(
SOperatorInfo
));
pOptr
->
name
=
"
DataBlocksOptimized
ScanOperator"
;
pOptr
->
name
=
"
Table
ScanOperator"
;
pOptr
->
operatorType
=
OP_DataBlocksOptScan
;
pOptr
->
operatorType
=
OP_DataBlocksOptScan
;
pOptr
->
pRuntimeEnv
=
pRuntimeEnv
;
pOptr
->
pRuntimeEnv
=
pRuntimeEnv
;
pOptr
->
blockingOptr
=
false
;
pOptr
->
blockingOptr
=
false
;
...
@@ -5373,7 +5373,7 @@ static void destroyGlobalAggOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -5373,7 +5373,7 @@ static void destroyGlobalAggOperatorInfo(void* param, int32_t numOfOutput) {
static
void
destroySlimitOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
static
void
destroySlimitOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SSLimitOperatorInfo
*
pInfo
=
(
SSLimitOperatorInfo
*
)
param
;
SSLimitOperatorInfo
*
pInfo
=
(
SSLimitOperatorInfo
*
)
param
;
taosArrayDestroy
(
pInfo
->
orderColumnList
);
taosArrayDestroy
(
pInfo
->
orderColumnList
);
pInfo
->
pRes
=
destroyOutputBuf
(
pInfo
->
pRes
);
pInfo
->
pRes
=
blockDataDestroy
(
pInfo
->
pRes
);
tfree
(
pInfo
->
prevRow
);
tfree
(
pInfo
->
prevRow
);
}
}
...
@@ -6566,7 +6566,7 @@ static void doDestroyBasicInfo(SOptrBasicInfo* pInfo, int32_t numOfOutput) {
...
@@ -6566,7 +6566,7 @@ static void doDestroyBasicInfo(SOptrBasicInfo* pInfo, int32_t numOfOutput) {
tfree
(
pInfo
->
rowCellInfoOffset
);
tfree
(
pInfo
->
rowCellInfoOffset
);
cleanupResultRowInfo
(
&
pInfo
->
resultRowInfo
);
cleanupResultRowInfo
(
&
pInfo
->
resultRowInfo
);
pInfo
->
pRes
=
destroyOutputBuf
(
pInfo
->
pRes
);
pInfo
->
pRes
=
blockDataDestroy
(
pInfo
->
pRes
);
}
}
static
void
destroyBasicOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
static
void
destroyBasicOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
...
@@ -6590,7 +6590,7 @@ static void destroySWindowOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -6590,7 +6590,7 @@ static void destroySWindowOperatorInfo(void* param, int32_t numOfOutput) {
static
void
destroySFillOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
static
void
destroySFillOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SFillOperatorInfo
*
pInfo
=
(
SFillOperatorInfo
*
)
param
;
SFillOperatorInfo
*
pInfo
=
(
SFillOperatorInfo
*
)
param
;
pInfo
->
pFillInfo
=
taosDestroyFillInfo
(
pInfo
->
pFillInfo
);
pInfo
->
pFillInfo
=
taosDestroyFillInfo
(
pInfo
->
pFillInfo
);
pInfo
->
pRes
=
destroyOutputBuf
(
pInfo
->
pRes
);
pInfo
->
pRes
=
blockDataDestroy
(
pInfo
->
pRes
);
tfree
(
pInfo
->
p
);
tfree
(
pInfo
->
p
);
}
}
...
@@ -6607,12 +6607,12 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -6607,12 +6607,12 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
static
void
destroyTagScanOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
static
void
destroyTagScanOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
STagScanInfo
*
pInfo
=
(
STagScanInfo
*
)
param
;
STagScanInfo
*
pInfo
=
(
STagScanInfo
*
)
param
;
pInfo
->
pRes
=
destroyOutputBuf
(
pInfo
->
pRes
);
pInfo
->
pRes
=
blockDataDestroy
(
pInfo
->
pRes
);
}
}
static
void
destroyOrderOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
static
void
destroyOrderOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SOrderOperatorInfo
*
pInfo
=
(
SOrderOperatorInfo
*
)
param
;
SOrderOperatorInfo
*
pInfo
=
(
SOrderOperatorInfo
*
)
param
;
pInfo
->
pDataBlock
=
destroyOutputBuf
(
pInfo
->
pDataBlock
);
pInfo
->
pDataBlock
=
blockDataDestroy
(
pInfo
->
pDataBlock
);
}
}
static
void
destroyConditionOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
static
void
destroyConditionOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
...
@@ -6625,7 +6625,7 @@ static void destroyDistinctOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -6625,7 +6625,7 @@ static void destroyDistinctOperatorInfo(void* param, int32_t numOfOutput) {
taosHashCleanup
(
pInfo
->
pSet
);
taosHashCleanup
(
pInfo
->
pSet
);
tfree
(
pInfo
->
buf
);
tfree
(
pInfo
->
buf
);
taosArrayDestroy
(
pInfo
->
pDistinctDataInfo
);
taosArrayDestroy
(
pInfo
->
pDistinctDataInfo
);
pInfo
->
pRes
=
destroyOutputBuf
(
pInfo
->
pRes
);
pInfo
->
pRes
=
blockDataDestroy
(
pInfo
->
pRes
);
}
}
SOperatorInfo
*
createMultiTableAggOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
)
{
SOperatorInfo
*
createMultiTableAggOperatorInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
)
{
...
...
2.0/src/query/tests/resultBufferTest.cpp
浏览文件 @
2ef7bf1c
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
namespace
{
namespace
{
// simple test
// simple test
void
simpleTest
()
{
void
simpleTest
()
{
SDiskbased
Result
Buf
*
pResultBuf
=
NULL
;
SDiskbasedBuf
*
pResultBuf
=
NULL
;
int32_t
ret
=
createDiskbasedResultBuffer
(
&
pResultBuf
,
1024
,
4096
,
1
);
int32_t
ret
=
createDiskbasedResultBuffer
(
&
pResultBuf
,
1024
,
4096
,
1
);
int32_t
pageId
=
0
;
int32_t
pageId
=
0
;
...
@@ -22,40 +22,40 @@ void simpleTest() {
...
@@ -22,40 +22,40 @@ void simpleTest() {
tFilePage
*
pBufPage
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
ASSERT_TRUE
(
pBufPage
!=
NULL
);
ASSERT_TRUE
(
pBufPage
!=
NULL
);
ASSERT_EQ
(
get
Res
BufSize
(
pResultBuf
),
1024
);
ASSERT_EQ
(
get
Total
BufSize
(
pResultBuf
),
1024
);
SIDList
list
=
getDataBufPagesIdList
(
pResultBuf
,
groupId
);
SIDList
list
=
getDataBufPagesIdList
(
pResultBuf
,
groupId
);
ASSERT_EQ
(
taosArrayGetSize
(
list
),
1
);
ASSERT_EQ
(
taosArrayGetSize
(
list
),
1
);
ASSERT_EQ
(
getNumOfResultBufGroupId
(
pResultBuf
),
1
);
ASSERT_EQ
(
getNumOfResultBufGroupId
(
pResultBuf
),
1
);
release
Res
BufPage
(
pResultBuf
,
pBufPage
);
releaseBufPage
(
pResultBuf
,
pBufPage
);
tFilePage
*
pBufPage1
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage1
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t
==
pBufPage1
);
ASSERT_TRUE
(
t
==
pBufPage1
);
tFilePage
*
pBufPage2
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage2
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t1
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t1
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t1
==
pBufPage2
);
ASSERT_TRUE
(
t1
==
pBufPage2
);
tFilePage
*
pBufPage3
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage3
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t2
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t2
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t2
==
pBufPage3
);
ASSERT_TRUE
(
t2
==
pBufPage3
);
tFilePage
*
pBufPage4
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage4
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t3
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t3
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t3
==
pBufPage4
);
ASSERT_TRUE
(
t3
==
pBufPage4
);
tFilePage
*
pBufPage5
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage5
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t4
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t4
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t4
==
pBufPage5
);
ASSERT_TRUE
(
t4
==
pBufPage5
);
destroyResultBuf
(
pResultBuf
);
destroyResultBuf
(
pResultBuf
);
}
}
void
writeDownTest
()
{
void
writeDownTest
()
{
SDiskbased
Result
Buf
*
pResultBuf
=
NULL
;
SDiskbasedBuf
*
pResultBuf
=
NULL
;
int32_t
ret
=
createDiskbasedResultBuffer
(
&
pResultBuf
,
1024
,
4
*
1024
,
1
);
int32_t
ret
=
createDiskbasedResultBuffer
(
&
pResultBuf
,
1024
,
4
*
1024
,
1
);
int32_t
pageId
=
0
;
int32_t
pageId
=
0
;
...
@@ -68,31 +68,31 @@ void writeDownTest() {
...
@@ -68,31 +68,31 @@ void writeDownTest() {
*
(
int32_t
*
)(
pBufPage
->
data
)
=
nx
;
*
(
int32_t
*
)(
pBufPage
->
data
)
=
nx
;
writePageId
=
pageId
;
writePageId
=
pageId
;
release
Res
BufPage
(
pResultBuf
,
pBufPage
);
releaseBufPage
(
pResultBuf
,
pBufPage
);
tFilePage
*
pBufPage1
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage1
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t1
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t1
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t1
==
pBufPage1
);
ASSERT_TRUE
(
t1
==
pBufPage1
);
ASSERT_TRUE
(
pageId
==
1
);
ASSERT_TRUE
(
pageId
==
1
);
tFilePage
*
pBufPage2
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage2
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t2
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t2
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t2
==
pBufPage2
);
ASSERT_TRUE
(
t2
==
pBufPage2
);
ASSERT_TRUE
(
pageId
==
2
);
ASSERT_TRUE
(
pageId
==
2
);
tFilePage
*
pBufPage3
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage3
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t3
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t3
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t3
==
pBufPage3
);
ASSERT_TRUE
(
t3
==
pBufPage3
);
ASSERT_TRUE
(
pageId
==
3
);
ASSERT_TRUE
(
pageId
==
3
);
tFilePage
*
pBufPage4
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage4
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t4
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t4
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t4
==
pBufPage4
);
ASSERT_TRUE
(
t4
==
pBufPage4
);
ASSERT_TRUE
(
pageId
==
4
);
ASSERT_TRUE
(
pageId
==
4
);
release
Res
BufPage
(
pResultBuf
,
t4
);
releaseBufPage
(
pResultBuf
,
t4
);
// flush the written page to disk, and read it out again
// flush the written page to disk, and read it out again
tFilePage
*
pBufPagex
=
get
Res
BufPage
(
pResultBuf
,
writePageId
);
tFilePage
*
pBufPagex
=
getBufPage
(
pResultBuf
,
writePageId
);
ASSERT_EQ
(
*
(
int32_t
*
)
pBufPagex
->
data
,
nx
);
ASSERT_EQ
(
*
(
int32_t
*
)
pBufPagex
->
data
,
nx
);
SArray
*
pa
=
getDataBufPagesIdList
(
pResultBuf
,
groupId
);
SArray
*
pa
=
getDataBufPagesIdList
(
pResultBuf
,
groupId
);
...
@@ -102,7 +102,7 @@ void writeDownTest() {
...
@@ -102,7 +102,7 @@ void writeDownTest() {
}
}
void
recyclePageTest
()
{
void
recyclePageTest
()
{
SDiskbased
Result
Buf
*
pResultBuf
=
NULL
;
SDiskbasedBuf
*
pResultBuf
=
NULL
;
int32_t
ret
=
createDiskbasedResultBuffer
(
&
pResultBuf
,
1024
,
4
*
1024
,
1
);
int32_t
ret
=
createDiskbasedResultBuffer
(
&
pResultBuf
,
1024
,
4
*
1024
,
1
);
int32_t
pageId
=
0
;
int32_t
pageId
=
0
;
...
@@ -112,41 +112,41 @@ void recyclePageTest() {
...
@@ -112,41 +112,41 @@ void recyclePageTest() {
tFilePage
*
pBufPage
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
ASSERT_TRUE
(
pBufPage
!=
NULL
);
ASSERT_TRUE
(
pBufPage
!=
NULL
);
release
Res
BufPage
(
pResultBuf
,
pBufPage
);
releaseBufPage
(
pResultBuf
,
pBufPage
);
tFilePage
*
pBufPage1
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage1
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t1
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t1
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t1
==
pBufPage1
);
ASSERT_TRUE
(
t1
==
pBufPage1
);
ASSERT_TRUE
(
pageId
==
1
);
ASSERT_TRUE
(
pageId
==
1
);
tFilePage
*
pBufPage2
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage2
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t2
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t2
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t2
==
pBufPage2
);
ASSERT_TRUE
(
t2
==
pBufPage2
);
ASSERT_TRUE
(
pageId
==
2
);
ASSERT_TRUE
(
pageId
==
2
);
tFilePage
*
pBufPage3
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage3
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t3
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t3
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t3
==
pBufPage3
);
ASSERT_TRUE
(
t3
==
pBufPage3
);
ASSERT_TRUE
(
pageId
==
3
);
ASSERT_TRUE
(
pageId
==
3
);
tFilePage
*
pBufPage4
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage4
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t4
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t4
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t4
==
pBufPage4
);
ASSERT_TRUE
(
t4
==
pBufPage4
);
ASSERT_TRUE
(
pageId
==
4
);
ASSERT_TRUE
(
pageId
==
4
);
release
Res
BufPage
(
pResultBuf
,
t4
);
releaseBufPage
(
pResultBuf
,
t4
);
tFilePage
*
pBufPage5
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage5
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t5
=
get
Res
BufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t5
=
getBufPage
(
pResultBuf
,
pageId
);
ASSERT_TRUE
(
t5
==
pBufPage5
);
ASSERT_TRUE
(
t5
==
pBufPage5
);
ASSERT_TRUE
(
pageId
==
5
);
ASSERT_TRUE
(
pageId
==
5
);
// flush the written page to disk, and read it out again
// flush the written page to disk, and read it out again
tFilePage
*
pBufPagex
=
get
Res
BufPage
(
pResultBuf
,
writePageId
);
tFilePage
*
pBufPagex
=
getBufPage
(
pResultBuf
,
writePageId
);
*
(
int32_t
*
)(
pBufPagex
->
data
)
=
nx
;
*
(
int32_t
*
)(
pBufPagex
->
data
)
=
nx
;
writePageId
=
pageId
;
// update the data
writePageId
=
pageId
;
// update the data
release
Res
BufPage
(
pResultBuf
,
pBufPagex
);
releaseBufPage
(
pResultBuf
,
pBufPagex
);
tFilePage
*
pBufPagex1
=
get
Res
BufPage
(
pResultBuf
,
1
);
tFilePage
*
pBufPagex1
=
getBufPage
(
pResultBuf
,
1
);
SArray
*
pa
=
getDataBufPagesIdList
(
pResultBuf
,
groupId
);
SArray
*
pa
=
getDataBufPagesIdList
(
pResultBuf
,
groupId
);
ASSERT_EQ
(
taosArrayGetSize
(
pa
),
6
);
ASSERT_EQ
(
taosArrayGetSize
(
pa
),
6
);
...
...
include/common/common.h
浏览文件 @
2ef7bf1c
...
@@ -16,6 +16,11 @@
...
@@ -16,6 +16,11 @@
#ifndef TDENGINE_COMMON_H
#ifndef TDENGINE_COMMON_H
#define TDENGINE_COMMON_H
#define TDENGINE_COMMON_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include "taosdef.h"
#include "taosdef.h"
#include "tarray.h"
#include "tarray.h"
#include "tmsg.h"
#include "tmsg.h"
...
@@ -44,8 +49,8 @@
...
@@ -44,8 +49,8 @@
typedef
struct
{
typedef
struct
{
uint32_t
numOfTables
;
uint32_t
numOfTables
;
SArray
*
pGroupList
;
SArray
*
pGroupList
;
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
}
STableGroupInfo
;
}
STableGroupInfo
;
typedef
struct
SColumnDataAgg
{
typedef
struct
SColumnDataAgg
{
...
@@ -74,18 +79,28 @@ typedef struct SConstantItem {
...
@@ -74,18 +79,28 @@ typedef struct SConstantItem {
// info.numOfCols = taosArrayGetSize(pDataBlock) + taosArrayGetSize(pConstantList);
// info.numOfCols = taosArrayGetSize(pDataBlock) + taosArrayGetSize(pConstantList);
typedef
struct
SSDataBlock
{
typedef
struct
SSDataBlock
{
SColumnDataAgg
*
pBlockAgg
;
SColumnDataAgg
*
pBlockAgg
;
SArray
*
pDataBlock
;
// SArray<SColumnInfoData>
SArray
*
pDataBlock
;
// SArray<SColumnInfoData>
SArray
*
pConstantList
;
// SArray<SConstantItem>, it is a constant/tags value of the corresponding result value.
SArray
*
pConstantList
;
// SArray<SConstantItem>, it is a constant/tags value of the corresponding result value.
SDataBlockInfo
info
;
SDataBlockInfo
info
;
}
SSDataBlock
;
}
SSDataBlock
;
typedef
struct
SVarColAttr
{
int32_t
*
offset
;
// start position for each entry in the list
uint32_t
length
;
// used buffer size that contain the valid data
uint32_t
allocLen
;
// allocated buffer size
}
SVarColAttr
;
// pBlockAgg->numOfNull == info.rows, all data are null
// pBlockAgg->numOfNull == info.rows, all data are null
// pBlockAgg->numOfNull == 0, no data are null.
// pBlockAgg->numOfNull == 0, no data are null.
typedef
struct
SColumnInfoData
{
typedef
struct
SColumnInfoData
{
SColumnInfo
info
;
// TODO filter info needs to be removed
SColumnInfo
info
;
// TODO filter info needs to be removed
char
*
nullbitmap
;
//
bool
hasNull
;
// if current column data has null value.
char
*
pData
;
// the corresponding block data in memory
char
*
pData
;
// the corresponding block data in memory
union
{
char
*
nullbitmap
;
// bitmap, one bit for each item in the list
SVarColAttr
varmeta
;
};
}
SColumnInfoData
;
}
SColumnInfoData
;
static
FORCE_INLINE
int32_t
tEncodeDataBlock
(
void
**
buf
,
const
SSDataBlock
*
pBlock
)
{
static
FORCE_INLINE
int32_t
tEncodeDataBlock
(
void
**
buf
,
const
SSDataBlock
*
pBlock
)
{
...
@@ -235,11 +250,11 @@ typedef struct SSqlExpr {
...
@@ -235,11 +250,11 @@ typedef struct SSqlExpr {
char
token
[
TSDB_COL_NAME_LEN
];
// original token
char
token
[
TSDB_COL_NAME_LEN
];
// original token
SSchema
resSchema
;
SSchema
resSchema
;
int32_t
numOfCols
;
int32_t
numOfCols
;
SColumn
*
pColumns
;
// data columns that are required by query
SColumn
*
pColumns
;
// data columns that are required by query
int32_t
interBytes
;
// inter result buffer size
int32_t
interBytes
;
// inter result buffer size
int16_t
numOfParams
;
// argument value of each function
int16_t
numOfParams
;
// argument value of each function
SVariant
param
[
3
];
// parameters are not more than 3
SVariant
param
[
3
];
// parameters are not more than 3
}
SSqlExpr
;
}
SSqlExpr
;
typedef
struct
SExprInfo
{
typedef
struct
SExprInfo
{
...
@@ -261,4 +276,8 @@ typedef struct SSessionWindow {
...
@@ -261,4 +276,8 @@ typedef struct SSessionWindow {
#define GET_FORWARD_DIRECTION_FACTOR(ord) (((ord) == TSDB_ORDER_ASC) ? QUERY_ASC_FORWARD_STEP : QUERY_DESC_FORWARD_STEP)
#define GET_FORWARD_DIRECTION_FACTOR(ord) (((ord) == TSDB_ORDER_ASC) ? QUERY_ASC_FORWARD_STEP : QUERY_DESC_FORWARD_STEP)
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_COMMON_H
#endif // TDENGINE_COMMON_H
include/common/tep.h
浏览文件 @
2ef7bf1c
...
@@ -7,12 +7,22 @@ extern "C" {
...
@@ -7,12 +7,22 @@ extern "C" {
#include "os.h"
#include "os.h"
#include "tmsg.h"
#include "tmsg.h"
#include "common.h"
typedef
struct
SCorEpSet
{
typedef
struct
SCorEpSet
{
int32_t
version
;
int32_t
version
;
SEpSet
epSet
;
SEpSet
epSet
;
}
SCorEpSet
;
}
SCorEpSet
;
typedef
struct
SBlockOrderInfo
{
int32_t
order
;
int32_t
colIndex
;
SColumnInfoData
*
pColData
;
// int32_t type;
// int32_t bytes;
// bool hasNull;
}
SBlockOrderInfo
;
int
taosGetFqdnPortFromEp
(
const
char
*
ep
,
SEp
*
pEp
);
int
taosGetFqdnPortFromEp
(
const
char
*
ep
,
SEp
*
pEp
);
void
addEpIntoEpSet
(
SEpSet
*
pEpSet
,
const
char
*
fqdn
,
uint16_t
port
);
void
addEpIntoEpSet
(
SEpSet
*
pEpSet
,
const
char
*
fqdn
,
uint16_t
port
);
...
@@ -21,6 +31,77 @@ bool isEpsetEqual(const SEpSet *s1, const SEpSet *s2);
...
@@ -21,6 +31,77 @@ bool isEpsetEqual(const SEpSet *s1, const SEpSet *s2);
void
updateEpSet_s
(
SCorEpSet
*
pEpSet
,
SEpSet
*
pNewEpSet
);
void
updateEpSet_s
(
SCorEpSet
*
pEpSet
,
SEpSet
*
pNewEpSet
);
SEpSet
getEpSet_s
(
SCorEpSet
*
pEpSet
);
SEpSet
getEpSet_s
(
SCorEpSet
*
pEpSet
);
#define NBIT (3u)
#define BitPos(_n) ((_n) & ((1 << NBIT) - 1))
#define BMCharPos(bm_, r_) ((bm_)[(r_) >> NBIT])
#define colDataIsNull_f(bm_, r_) ((BMCharPos(bm_, r_) & (1u << (7u - BitPos(r_)))) == (1u << (7u - BitPos(r_))))
#define colDataSetNull_f(bm_, r_) \
do { \
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
} while (0)
static
FORCE_INLINE
bool
colDataIsNull
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
totalRows
,
uint32_t
row
,
SColumnDataAgg
*
pColAgg
)
{
if
(
!
pColumnInfoData
->
hasNull
)
{
return
false
;
}
if
(
pColAgg
!=
NULL
)
{
if
(
pColAgg
->
numOfNull
==
totalRows
)
{
ASSERT
(
pColumnInfoData
->
nullbitmap
==
NULL
);
return
true
;
}
else
if
(
pColAgg
->
numOfNull
==
0
)
{
ASSERT
(
pColumnInfoData
->
nullbitmap
==
NULL
);
return
false
;
}
}
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
return
pColumnInfoData
->
varmeta
.
offset
[
row
]
==
-
1
;
}
else
{
if
(
pColumnInfoData
->
nullbitmap
==
NULL
)
{
return
false
;
}
return
colDataIsNull_f
(
pColumnInfoData
->
nullbitmap
,
row
);
}
}
#define colDataGet(p1_, r_) \
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? (p1_)->pData + (p1_)->varmeta.offset[(r_)] \
: (p1_)->pData + ((r_) * (p1_)->info.bytes));
int32_t
colDataAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
);
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
numOfRow1
,
const
SColumnInfoData
*
pSource
,
uint32_t
numOfRow2
);
int32_t
blockDataUpdateTsWindow
(
SSDataBlock
*
pDataBlock
);
int32_t
colDataGetSize
(
const
SColumnInfoData
*
pColumnInfoData
,
int32_t
numOfRows
);
void
colDataTrim
(
SColumnInfoData
*
pColumnInfoData
);
size_t
colDataGetNumOfCols
(
const
SSDataBlock
*
pBlock
);
size_t
colDataGetNumOfRows
(
const
SSDataBlock
*
pBlock
);
int32_t
blockDataMerge
(
SSDataBlock
*
pDest
,
const
SSDataBlock
*
pSrc
);
int32_t
blockDataSplitRows
(
SSDataBlock
*
pBlock
,
bool
hasVarCol
,
int32_t
startIndex
,
int32_t
*
stopIndex
,
int32_t
pageSize
);
SSDataBlock
*
blockDataExtractBlock
(
SSDataBlock
*
pBlock
,
int32_t
startIndex
,
int32_t
rowCount
);
int32_t
blockDataToBuf
(
char
*
buf
,
const
SSDataBlock
*
pBlock
);
int32_t
blockDataFromBuf
(
SSDataBlock
*
pBlock
,
const
char
*
buf
);
size_t
blockDataGetSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetRowSize
(
const
SSDataBlock
*
pBlock
);
double
blockDataGetSerialRowSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetSerialMetaSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataNumOfRowsForSerialize
(
const
SSDataBlock
*
pBlock
,
int32_t
blockSize
);
int32_t
blockDataSort
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
,
bool
nullFirst
);
int32_t
blockDataSort_rv
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
,
bool
nullFirst
);
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
);
void
blockDataClearup
(
SSDataBlock
*
pDataBlock
,
bool
hasVarCol
);
void
*
blockDataDestroy
(
SSDataBlock
*
pBlock
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/common/tmsg.h
浏览文件 @
2ef7bf1c
...
@@ -234,9 +234,9 @@ typedef struct {
...
@@ -234,9 +234,9 @@ typedef struct {
void
*
pMsg
;
void
*
pMsg
;
}
SSubmitMsgIter
;
}
SSubmitMsgIter
;
int
tInitSubmitMsgIter
(
SSubmitMsg
*
pMsg
,
SSubmitMsgIter
*
pIter
);
int
32_t
tInitSubmitMsgIter
(
SSubmitMsg
*
pMsg
,
SSubmitMsgIter
*
pIter
);
int
tGetSubmitMsgNext
(
SSubmitMsgIter
*
pIter
,
SSubmitBlk
**
pPBlock
);
int
32_t
tGetSubmitMsgNext
(
SSubmitMsgIter
*
pIter
,
SSubmitBlk
**
pPBlock
);
int
tInitSubmitBlkIter
(
SSubmitBlk
*
pBlock
,
SSubmitBlkIter
*
pIter
);
int
32_t
tInitSubmitBlkIter
(
SSubmitBlk
*
pBlock
,
SSubmitBlkIter
*
pIter
);
STSRow
*
tGetSubmitBlkNext
(
SSubmitBlkIter
*
pIter
);
STSRow
*
tGetSubmitBlkNext
(
SSubmitBlkIter
*
pIter
);
typedef
struct
{
typedef
struct
{
...
@@ -272,8 +272,8 @@ typedef struct {
...
@@ -272,8 +272,8 @@ typedef struct {
char
comment
[
TSDB_STB_COMMENT_LEN
];
char
comment
[
TSDB_STB_COMMENT_LEN
];
}
SMCreateStbReq
;
}
SMCreateStbReq
;
int32_t
tSerializeSMCreateStbReq
(
void
*
*
buf
,
SMCreateStbReq
*
pReq
);
int32_t
tSerializeSMCreateStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateStbReq
*
pReq
);
void
*
tDeserializeSMCreateStbReq
(
void
*
buf
,
SMCreateStbReq
*
pReq
);
int32_t
tDeserializeSMCreateStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateStbReq
*
pReq
);
void
tFreeSMCreateStbReq
(
SMCreateStbReq
*
pReq
);
void
tFreeSMCreateStbReq
(
SMCreateStbReq
*
pReq
);
typedef
struct
{
typedef
struct
{
...
@@ -281,8 +281,8 @@ typedef struct {
...
@@ -281,8 +281,8 @@ typedef struct {
int8_t
igNotExists
;
int8_t
igNotExists
;
}
SMDropStbReq
;
}
SMDropStbReq
;
int32_t
tSerializeSMDropStbReq
(
void
*
*
buf
,
SMDropStbReq
*
pReq
);
int32_t
tSerializeSMDropStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropStbReq
*
pReq
);
void
*
tDeserializeSMDropStbReq
(
void
*
buf
,
SMDropStbReq
*
pReq
);
int32_t
tDeserializeSMDropStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropStbReq
*
pReq
);
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
...
@@ -291,15 +291,9 @@ typedef struct {
...
@@ -291,15 +291,9 @@ typedef struct {
SArray
*
pFields
;
SArray
*
pFields
;
}
SMAltertbReq
;
}
SMAltertbReq
;
int32_t
tSerializeSMAlterStbReq
(
void
**
buf
,
SMAltertbReq
*
pReq
);
int32_t
tSerializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAltertbReq
*
pReq
);
void
*
tDeserializeSMAlterStbReq
(
void
*
buf
,
SMAltertbReq
*
pReq
);
int32_t
tDeserializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAltertbReq
*
pReq
);
void
tFreeSMAltertbReq
(
SMAltertbReq
*
pReq
);
typedef
struct
{
int32_t
pid
;
char
app
[
TSDB_APP_NAME_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
int64_t
startTime
;
}
SConnectReq
;
typedef
struct
SEpSet
{
typedef
struct
SEpSet
{
int8_t
inUse
;
int8_t
inUse
;
...
@@ -307,56 +301,33 @@ typedef struct SEpSet {
...
@@ -307,56 +301,33 @@ typedef struct SEpSet {
SEp
eps
[
TSDB_MAX_REPLICA
];
SEp
eps
[
TSDB_MAX_REPLICA
];
}
SEpSet
;
}
SEpSet
;
static
FORCE_INLINE
int
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
)
{
int32_t
tEncodeSEpSet
(
SCoder
*
pEncoder
,
const
SEpSet
*
pEp
);
int
tlen
=
0
;
int32_t
tDecodeSEpSet
(
SCoder
*
pDecoder
,
SEpSet
*
pEp
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pEp
->
inUse
);
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pEp
->
numOfEps
);
void
*
taosDecodeSEpSet
(
void
*
buf
,
SEpSet
*
pEp
);
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
tlen
+=
taosEncodeFixedU16
(
buf
,
pEp
->
eps
[
i
].
port
);
tlen
+=
taosEncodeString
(
buf
,
pEp
->
eps
[
i
].
fqdn
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSEpSet
(
void
*
buf
,
SEpSet
*
pEp
)
{
typedef
struct
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pEp
->
inUse
);
int32_t
pid
;
buf
=
taosDecodeFixedI8
(
buf
,
&
pEp
->
numOfEps
);
char
app
[
TSDB_APP_NAME_LEN
];
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
char
db
[
TSDB_DB_NAME_LEN
];
buf
=
taosDecodeFixedU16
(
buf
,
&
pEp
->
eps
[
i
].
port
);
int64_t
startTime
;
buf
=
taosDecodeStringTo
(
buf
,
pEp
->
eps
[
i
].
fqdn
);
}
SConnectReq
;
}
return
buf
;
}
static
FORCE_INLINE
int32_t
tEncodeSEpSet
(
SCoder
*
pEncoder
,
const
SEpSet
*
pEp
)
{
if
(
tEncodeI8
(
pEncoder
,
pEp
->
inUse
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pEp
->
numOfEps
)
<
0
)
return
-
1
;
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
if
(
tEncodeU16
(
pEncoder
,
pEp
->
eps
[
i
].
port
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pEp
->
eps
[
i
].
fqdn
)
<
0
)
return
-
1
;
}
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeSEpSet
(
SCoder
*
pDecoder
,
SEpSet
*
pEp
)
{
int32_t
tSerializeSConnectReq
(
void
*
buf
,
int32_t
bufLen
,
SConnectReq
*
pReq
);
if
(
tDecodeI8
(
pDecoder
,
&
pEp
->
inUse
)
<
0
)
return
-
1
;
int32_t
tDeserializeSConnectReq
(
void
*
buf
,
int32_t
bufLen
,
SConnectReq
*
pReq
);
if
(
tDecodeI8
(
pDecoder
,
&
pEp
->
numOfEps
)
<
0
)
return
-
1
;
for
(
int
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
i
++
)
{
if
(
tDecodeU16
(
pDecoder
,
&
pEp
->
eps
[
i
].
port
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pEp
->
eps
[
i
].
fqdn
)
<
0
)
return
-
1
;
}
return
0
;
}
typedef
struct
{
typedef
struct
{
int32_t
acctId
;
int32_t
acctId
;
int64_t
clusterId
;
int64_t
clusterId
;
int32_t
connId
;
int32_t
connId
;
int8_t
superUser
;
int8_t
superUser
;
int8_t
align
[
3
];
SEpSet
epSet
;
SEpSet
epSet
;
char
sVersion
[
128
];
char
sVersion
[
128
];
}
SConnectRsp
;
}
SConnectRsp
;
int32_t
tSerializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
);
int32_t
tDeserializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
);
typedef
struct
{
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
...
@@ -803,6 +774,9 @@ typedef struct {
...
@@ -803,6 +774,9 @@ typedef struct {
char
tbName
[
TSDB_TABLE_NAME_LEN
];
char
tbName
[
TSDB_TABLE_NAME_LEN
];
}
STableInfoReq
;
}
STableInfoReq
;
int32_t
tSerializeSTableInfoReq
(
void
*
buf
,
int32_t
bufLen
,
STableInfoReq
*
pReq
);
int32_t
tDeserializeSTableInfoReq
(
void
*
buf
,
int32_t
bufLen
,
STableInfoReq
*
pReq
);
typedef
struct
{
typedef
struct
{
int8_t
metaClone
;
// create local clone of the cached table meta
int8_t
metaClone
;
// create local clone of the cached table meta
int32_t
numOfVgroups
;
int32_t
numOfVgroups
;
...
@@ -839,9 +813,21 @@ typedef struct {
...
@@ -839,9 +813,21 @@ typedef struct {
uint64_t
suid
;
uint64_t
suid
;
uint64_t
tuid
;
uint64_t
tuid
;
int32_t
vgId
;
int32_t
vgId
;
SSchema
pSchema
[]
;
SSchema
*
pSchemas
;
}
STableMetaRsp
;
}
STableMetaRsp
;
int32_t
tSerializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
);
int32_t
tDeserializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
);
void
tFreeSTableMetaRsp
(
STableMetaRsp
*
pRsp
);
typedef
struct
{
SArray
*
pArray
;
// Array of STableMetaRsp
}
STableMetaBatchRsp
;
int32_t
tSerializeSTableMetaBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaBatchRsp
*
pRsp
);
int32_t
tDeserializeSTableMetaBatchRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaBatchRsp
*
pRsp
);
void
tFreeSTableMetaBatchRsp
(
STableMetaBatchRsp
*
pRsp
);
typedef
struct
{
typedef
struct
{
int32_t
numOfTables
;
int32_t
numOfTables
;
int32_t
numOfVgroup
;
int32_t
numOfVgroup
;
...
@@ -875,18 +861,15 @@ int32_t tSerializeSShowReq(void* buf, int32_t bufLen, SShowReq* pReq);
...
@@ -875,18 +861,15 @@ int32_t tSerializeSShowReq(void* buf, int32_t bufLen, SShowReq* pReq);
int32_t
tDeserializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
);
int32_t
tDeserializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
);
void
tFreeSShowReq
(
SShowReq
*
pReq
);
void
tFreeSShowReq
(
SShowReq
*
pReq
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
int32_t
numOfVgroup
;
int32_t
vgid
[];
}
SCompactReq
;
typedef
struct
{
typedef
struct
{
int64_t
showId
;
int64_t
showId
;
STableMetaRsp
tableMeta
;
STableMetaRsp
tableMeta
;
}
SShowRsp
;
}
SShowRsp
,
SVShowTablesRsp
;
int32_t
tSerializeSShowRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowRsp
*
pRsp
);
int32_t
tDeserializeSShowRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowRsp
*
pRsp
);
void
tFreeSShowRsp
(
SShowRsp
*
pRsp
);
// todo: the show handle should be replaced with id
typedef
struct
{
typedef
struct
{
int64_t
showId
;
int64_t
showId
;
int8_t
free
;
int8_t
free
;
...
@@ -1103,41 +1086,17 @@ typedef struct {
...
@@ -1103,41 +1086,17 @@ typedef struct {
char
*
sql
;
char
*
sql
;
char
*
physicalPlan
;
char
*
physicalPlan
;
char
*
logicalPlan
;
char
*
logicalPlan
;
}
S
C
MCreateTopicReq
;
}
SMCreateTopicReq
;
static
FORCE_INLINE
int
tSerializeSCMCreateTopicReq
(
void
**
buf
,
const
SCMCreateTopicReq
*
pReq
)
{
int32_t
tSerializeMCreateTopicReq
(
void
**
buf
,
const
SMCreateTopicReq
*
pReq
);
int
tlen
=
0
;
void
*
tDeserializeSMCreateTopicReq
(
void
*
buf
,
SMCreateTopicReq
*
pReq
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
igExists
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
name
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
sql
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
physicalPlan
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
logicalPlan
);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDeserializeSCMCreateTopicReq
(
void
*
buf
,
SCMCreateTopicReq
*
pReq
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
igExists
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
name
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
sql
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
physicalPlan
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
logicalPlan
));
return
buf
;
}
typedef
struct
{
typedef
struct
{
int64_t
topicId
;
int64_t
topicId
;
}
S
C
MCreateTopicRsp
;
}
SMCreateTopicRsp
;
static
FORCE_INLINE
int
tSerializeSCMCreateTopicRsp
(
void
**
buf
,
const
SCMCreateTopicRsp
*
pRsp
)
{
int32_t
tSerializeSMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SMCreateTopicRsp
*
pRsp
);
int
tlen
=
0
;
int32_t
tDeserializeSMCreateTopicRsp
(
void
*
buf
,
int32_t
bufLen
,
SMCreateTopicRsp
*
pRsp
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pRsp
->
topicId
);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDeserializeSCMCreateTopicRsp
(
void
*
buf
,
SCMCreateTopicRsp
*
pRsp
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pRsp
->
topicId
);
return
buf
;
}
typedef
struct
{
typedef
struct
{
int32_t
topicNum
;
int32_t
topicNum
;
...
@@ -1284,19 +1243,13 @@ typedef struct {
...
@@ -1284,19 +1243,13 @@ typedef struct {
int64_t
status
;
int64_t
status
;
}
SMVSubscribeRsp
;
}
SMVSubscribeRsp
;
typedef
struct
{
char
name
[
TSDB_TOPIC_NAME_LEN
];
int8_t
igExists
;
int32_t
execLen
;
void
*
executor
;
int32_t
sqlLen
;
char
*
sql
;
}
SCreateTopicReq
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
igNotExists
;
int8_t
igNotExists
;
}
SDropTopicReq
;
}
SMDropTopicReq
;
int32_t
tSerializeSMDropTopicReqq
(
void
*
buf
,
int32_t
bufLen
,
SMDropTopicReq
*
pReq
);
int32_t
tDeserializeSMDropTopicReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropTopicReq
*
pReq
);
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
...
@@ -1398,11 +1351,6 @@ typedef struct {
...
@@ -1398,11 +1351,6 @@ typedef struct {
SMsgHead
head
;
SMsgHead
head
;
}
SVShowTablesReq
;
}
SVShowTablesReq
;
typedef
struct
{
int64_t
id
;
STableMetaRsp
metaInfo
;
}
SVShowTablesRsp
;
typedef
struct
{
typedef
struct
{
SMsgHead
head
;
SMsgHead
head
;
int32_t
id
;
int32_t
id
;
...
@@ -1607,7 +1555,7 @@ int32_t tDeserializeSClientHbBatchRsp(void* buf, int32_t bufLen, SClientHbBatchR
...
@@ -1607,7 +1555,7 @@ int32_t tDeserializeSClientHbBatchRsp(void* buf, int32_t bufLen, SClientHbBatchR
static
FORCE_INLINE
int32_t
tEncodeSKv
(
SCoder
*
pEncoder
,
const
SKv
*
pKv
)
{
static
FORCE_INLINE
int32_t
tEncodeSKv
(
SCoder
*
pEncoder
,
const
SKv
*
pKv
)
{
if
(
tEncodeI32
(
pEncoder
,
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pKv
->
key
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
if
(
tEncode
CStrWithLen
(
pEncoder
,
(
const
char
*
)
pKv
->
value
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
if
(
tEncode
Binary
(
pEncoder
,
(
const
char
*
)
pKv
->
value
,
pKv
->
valueLen
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
...
@@ -1803,7 +1751,7 @@ typedef struct {
...
@@ -1803,7 +1751,7 @@ typedef struct {
SSchema
*
pSchema
;
SSchema
*
pSchema
;
}
SSchemaWrapper
;
}
SSchemaWrapper
;
static
FORCE_INLINE
int32_t
tEncodeSSchema
(
void
**
buf
,
const
SSchema
*
pSchema
)
{
static
FORCE_INLINE
int32_t
t
aos
EncodeSSchema
(
void
**
buf
,
const
SSchema
*
pSchema
)
{
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pSchema
->
type
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pSchema
->
type
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pSchema
->
bytes
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pSchema
->
bytes
);
...
@@ -1812,7 +1760,7 @@ static FORCE_INLINE int32_t tEncodeSSchema(void** buf, const SSchema* pSchema) {
...
@@ -1812,7 +1760,7 @@ static FORCE_INLINE int32_t tEncodeSSchema(void** buf, const SSchema* pSchema) {
return
tlen
;
return
tlen
;
}
}
static
FORCE_INLINE
void
*
tDecodeSSchema
(
void
*
buf
,
SSchema
*
pSchema
)
{
static
FORCE_INLINE
void
*
t
aos
DecodeSSchema
(
void
*
buf
,
SSchema
*
pSchema
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pSchema
->
type
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pSchema
->
type
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSchema
->
bytes
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSchema
->
bytes
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSchema
->
colId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSchema
->
colId
);
...
@@ -1820,11 +1768,27 @@ static FORCE_INLINE void* tDecodeSSchema(void* buf, SSchema* pSchema) {
...
@@ -1820,11 +1768,27 @@ static FORCE_INLINE void* tDecodeSSchema(void* buf, SSchema* pSchema) {
return
buf
;
return
buf
;
}
}
static
FORCE_INLINE
int32_t
tEncodeSSchema
(
SCoder
*
pEncoder
,
const
SSchema
*
pSchema
)
{
if
(
tEncodeI8
(
pEncoder
,
pSchema
->
type
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pSchema
->
bytes
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pSchema
->
colId
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pSchema
->
name
)
<
0
)
return
-
1
;
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeSSchema
(
SCoder
*
pDecoder
,
SSchema
*
pSchema
)
{
if
(
tDecodeI8
(
pDecoder
,
&
pSchema
->
type
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pSchema
->
bytes
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pSchema
->
colId
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pSchema
->
name
)
<
0
)
return
-
1
;
return
0
;
}
static
FORCE_INLINE
int32_t
tEncodeSSchemaWrapper
(
void
**
buf
,
const
SSchemaWrapper
*
pSW
)
{
static
FORCE_INLINE
int32_t
tEncodeSSchemaWrapper
(
void
**
buf
,
const
SSchemaWrapper
*
pSW
)
{
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedU32
(
buf
,
pSW
->
nCols
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pSW
->
nCols
);
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
tlen
+=
tEncodeSSchema
(
buf
,
&
pSW
->
pSchema
[
i
]);
tlen
+=
t
aos
EncodeSSchema
(
buf
,
&
pSW
->
pSchema
[
i
]);
}
}
return
tlen
;
return
tlen
;
}
}
...
@@ -1835,8 +1799,9 @@ static FORCE_INLINE void* tDecodeSSchemaWrapper(void* buf, SSchemaWrapper* pSW)
...
@@ -1835,8 +1799,9 @@ static FORCE_INLINE void* tDecodeSSchemaWrapper(void* buf, SSchemaWrapper* pSW)
if
(
pSW
->
pSchema
==
NULL
)
{
if
(
pSW
->
pSchema
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
buf
=
tDecodeSSchema
(
buf
,
&
pSW
->
pSchema
[
i
]);
buf
=
t
aos
DecodeSSchema
(
buf
,
&
pSW
->
pSchema
[
i
]);
}
}
return
buf
;
return
buf
;
}
}
...
...
include/common/tmsgdef.h
浏览文件 @
2ef7bf1c
...
@@ -139,7 +139,7 @@ enum {
...
@@ -139,7 +139,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_TRANS
,
"mnode-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TRANS
,
"mnode-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"mnode-grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"mnode-grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"mnode-auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"mnode-auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"mnode-create-topic"
,
S
CMCreateTopicReq
,
SC
MCreateTopicRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"mnode-create-topic"
,
S
MCreateTopicReq
,
S
MCreateTopicRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_TOPIC
,
"mnode-alter-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_TOPIC
,
"mnode-alter-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_TOPIC
,
"mnode-drop-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_TOPIC
,
"mnode-drop-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SUBSCRIBE
,
"mnode-subscribe"
,
SCMSubscribeReq
,
SCMSubscribeRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SUBSCRIBE
,
"mnode-subscribe"
,
SCMSubscribeReq
,
SCMSubscribeRsp
)
...
...
include/common/trow.h
浏览文件 @
2ef7bf1c
...
@@ -473,7 +473,7 @@ static int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
...
@@ -473,7 +473,7 @@ static int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) {
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
return
terrno
;
}
}
TD_ROW_SET_TYPE
(
pBuilder
->
pBuf
,
pBuilder
->
rowType
);
TD_ROW_SET_TYPE
(
pBuilder
->
pBuf
,
pBuilder
->
rowType
);
uint32_t
len
=
0
;
uint32_t
len
=
0
;
...
...
include/libs/nodes/querynodes.h
浏览文件 @
2ef7bf1c
...
@@ -113,13 +113,13 @@ typedef enum ELogicConditionType {
...
@@ -113,13 +113,13 @@ typedef enum ELogicConditionType {
}
ELogicConditionType
;
}
ELogicConditionType
;
typedef
struct
SLogicConditionNode
{
typedef
struct
SLogicConditionNode
{
ENodeType
typ
e
;
// QUERY_NODE_LOGIC_CONDITION
SExprNode
nod
e
;
// QUERY_NODE_LOGIC_CONDITION
ELogicConditionType
condType
;
ELogicConditionType
condType
;
SNodeList
*
pParameterList
;
SNodeList
*
pParameterList
;
}
SLogicConditionNode
;
}
SLogicConditionNode
;
typedef
struct
SIsNullCondNode
{
typedef
struct
SIsNullCondNode
{
ENodeType
typ
e
;
// QUERY_NODE_IS_NULL_CONDITION
SExprNode
nod
e
;
// QUERY_NODE_IS_NULL_CONDITION
SNode
*
pExpr
;
SNode
*
pExpr
;
bool
isNull
;
bool
isNull
;
}
SIsNullCondNode
;
}
SIsNullCondNode
;
...
...
include/libs/planner/plannerOp.h
浏览文件 @
2ef7bf1c
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#endif
#endif
OP_ENUM_MACRO
(
StreamScan
)
OP_ENUM_MACRO
(
StreamScan
)
OP_ENUM_MACRO
(
DataBlocksOpt
Scan
)
OP_ENUM_MACRO
(
Table
Scan
)
OP_ENUM_MACRO
(
TableSeqScan
)
OP_ENUM_MACRO
(
TableSeqScan
)
OP_ENUM_MACRO
(
TagScan
)
OP_ENUM_MACRO
(
TagScan
)
OP_ENUM_MACRO
(
SystemTableScan
)
OP_ENUM_MACRO
(
SystemTableScan
)
...
...
include/util/tlosertree.h
浏览文件 @
2ef7bf1c
...
@@ -22,28 +22,31 @@ extern "C" {
...
@@ -22,28 +22,31 @@ extern "C" {
typedef
int
(
*
__merge_compare_fn_t
)(
const
void
*
,
const
void
*
,
void
*
param
);
typedef
int
(
*
__merge_compare_fn_t
)(
const
void
*
,
const
void
*
,
void
*
param
);
typedef
struct
S
Loser
TreeNode
{
typedef
struct
STreeNode
{
int32_t
index
;
int32_t
index
;
void
*
pData
;
void
*
pData
;
// TODO remove it?
}
S
Loser
TreeNode
;
}
STreeNode
;
typedef
struct
S
Loser
TreeInfo
{
typedef
struct
S
MultiwayMerge
TreeInfo
{
int32_t
numOf
Entri
es
;
int32_t
numOf
Sourc
es
;
int32_t
total
Entri
es
;
int32_t
total
Sourc
es
;
__merge_compare_fn_t
comparFn
;
__merge_compare_fn_t
comparFn
;
void
*
param
;
void
*
param
;
SLoserTreeNode
*
pNode
;
struct
STreeNode
*
pNode
;
}
S
Loser
TreeInfo
;
}
S
MultiwayMerge
TreeInfo
;
uint32_t
tLoserTreeCreate
(
SLoserTreeInfo
**
pTree
,
int32_t
numOfEntries
,
void
*
param
,
__merge_compare_fn_t
compareFn
);
#define tMergeTreeGetChosenIndex(t_) ((t_)->pNode[0].index)
#define tMergeTreeGetAdjustIndex(t_) (tMergeTreeGetChosenIndex(t_) + (t_)->numOfSources)
void
tLoserTreeInit
(
SLoserTreeInfo
*
pTree
);
int32_t
tMergeTreeCreate
(
SMultiwayMergeTreeInfo
**
pTree
,
uint32_t
numOfEntries
,
void
*
param
,
__merge_compare_fn_t
compareFn
);
void
t
LoserTreeAdjust
(
SLoserTreeInfo
*
pTree
,
int32_t
idx
);
void
t
MergeTreeDestroy
(
SMultiwayMergeTreeInfo
*
pTree
);
void
t
LoserTreeRebuild
(
SLoserTreeInfo
*
pTree
);
void
t
MergeTreeAdjust
(
SMultiwayMergeTreeInfo
*
pTree
,
int32_t
idx
);
void
tLoserTreeDisplay
(
SLoserTreeInfo
*
pTree
);
void
tMergeTreeRebuild
(
SMultiwayMergeTreeInfo
*
pTree
);
void
tMergeTreePrint
(
const
SMultiwayMergeTreeInfo
*
pTree
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tpaged
file
.h
→
include/util/tpaged
buf
.h
浏览文件 @
2ef7bf1c
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#ifndef TDENGINE_TPAGED
FILE
_H
#ifndef TDENGINE_TPAGED
BUF
_H
#define TDENGINE_TPAGED
FILE
_H
#define TDENGINE_TPAGED
BUF
_H
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -26,57 +26,10 @@ extern "C" {
...
@@ -26,57 +26,10 @@ extern "C" {
#include "tlockfree.h"
#include "tlockfree.h"
typedef
struct
SArray
*
SIDList
;
typedef
struct
SArray
*
SIDList
;
typedef
struct
SPageInfo
SPageInfo
;
typedef
struct
SPageDiskInfo
{
typedef
struct
SDiskbasedBuf
SDiskbasedBuf
;
int32_t
offset
;
int32_t
length
;
}
SPageDiskInfo
;
typedef
struct
SPageInfo
{
SListNode
*
pn
;
// point to list node
int32_t
pageId
;
SPageDiskInfo
info
;
void
*
pData
;
bool
used
;
// set current page is in used
}
SPageInfo
;
typedef
struct
SFreeListItem
{
int32_t
offset
;
int32_t
len
;
}
SFreeListItem
;
typedef
struct
SResultBufStatis
{
int32_t
flushBytes
;
int32_t
loadBytes
;
int32_t
getPages
;
int32_t
releasePages
;
int32_t
flushPages
;
}
SResultBufStatis
;
typedef
struct
SDiskbasedResultBuf
{
int32_t
numOfPages
;
int64_t
totalBufSize
;
int64_t
fileSize
;
// disk file size
FILE
*
file
;
int32_t
allocateId
;
// allocated page id
char
*
path
;
// file path
int32_t
pageSize
;
// current used page size
int32_t
inMemPages
;
// numOfPages that are allocated in memory
SHashObj
*
groupSet
;
// id hash table
SHashObj
*
all
;
SList
*
lruList
;
void
*
emptyDummyIdList
;
// dummy id list
void
*
assistBuf
;
// assistant buffer for compress/decompress data
SArray
*
pFree
;
// free area in file
bool
comp
;
// compressed before flushed to disk
int32_t
nextPos
;
// next page flush position
uint64_t
qId
;
// for debug purpose
SResultBufStatis
statis
;
}
SDiskbasedResultBuf
;
#define DEFAULT_INTERN_BUF_PAGE_SIZE (1024L) // in bytes
#define DEFAULT_INTERN_BUF_PAGE_SIZE (1024L) // in bytes
#define PAGE_INFO_INITIALIZER (SPageDiskInfo){-1, -1}
#define DEFAULT_PAGE_SIZE (16384L)
#define DEFAULT_PAGE_SIZE (16384L)
typedef
struct
SFilePage
{
typedef
struct
SFilePage
{
...
@@ -84,76 +37,84 @@ typedef struct SFilePage {
...
@@ -84,76 +37,84 @@ typedef struct SFilePage {
char
data
[];
char
data
[];
}
SFilePage
;
}
SFilePage
;
typedef
struct
SDiskbasedBufStatis
{
int64_t
flushBytes
;
int64_t
loadBytes
;
int32_t
loadPages
;
int32_t
getPages
;
int32_t
releasePages
;
int32_t
flushPages
;
}
SDiskbasedBufStatis
;
/**
/**
* create disk-based result buffer
* create disk-based result buffer
* @param p
Result
Buf
* @param pBuf
* @param rowSize
* @param rowSize
* @param pagesize
* @param pagesize
* @param inMemPages
* @param inMemPages
* @param handle
* @param handle
* @return
* @return
*/
*/
int32_t
createDiskbased
ResultBuffer
(
SDiskbasedResultBuf
**
pResult
Buf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
uint64_t
qId
,
const
char
*
dir
);
int32_t
createDiskbased
Buffer
(
SDiskbasedBuf
**
p
Buf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
uint64_t
qId
,
const
char
*
dir
);
/**
/**
*
*
* @param p
Result
Buf
* @param pBuf
* @param groupId
* @param groupId
* @param pageId
* @param pageId
* @return
* @return
*/
*/
SFilePage
*
getNewDataBuf
(
SDiskbased
ResultBuf
*
pResult
Buf
,
int32_t
groupId
,
int32_t
*
pageId
);
SFilePage
*
getNewDataBuf
(
SDiskbased
Buf
*
p
Buf
,
int32_t
groupId
,
int32_t
*
pageId
);
/**
/**
*
*
* @param p
Result
Buf
* @param pBuf
* @param groupId
* @param groupId
* @return
* @return
*/
*/
SIDList
getDataBufPagesIdList
(
SDiskbased
ResultBuf
*
pResult
Buf
,
int32_t
groupId
);
SIDList
getDataBufPagesIdList
(
SDiskbased
Buf
*
p
Buf
,
int32_t
groupId
);
/**
/**
* get the specified buffer page by id
* get the specified buffer page by id
* @param p
Result
Buf
* @param pBuf
* @param id
* @param id
* @return
* @return
*/
*/
SFilePage
*
get
ResBufPage
(
SDiskbasedResultBuf
*
pResult
Buf
,
int32_t
id
);
SFilePage
*
get
BufPage
(
SDiskbasedBuf
*
p
Buf
,
int32_t
id
);
/**
/**
* release the referenced buf pages
* release the referenced buf pages
* @param p
Result
Buf
* @param pBuf
* @param page
* @param page
*/
*/
void
release
ResBufPage
(
SDiskbasedResultBuf
*
pResult
Buf
,
void
*
page
);
void
release
BufPage
(
SDiskbasedBuf
*
p
Buf
,
void
*
page
);
/**
/**
*
*
* @param p
Result
Buf
* @param pBuf
* @param pi
* @param pi
*/
*/
void
releaseResBufPageInfo
(
SDiskbasedResultBuf
*
pResultBuf
,
SPageInfo
*
pi
);
void
releaseBufPageInfo
(
SDiskbasedBuf
*
pBuf
,
struct
SPageInfo
*
pi
);
/**
/**
* get the total buffer size in the format of disk file
* get the total buffer size in the format of disk file
* @param p
Result
Buf
* @param pBuf
* @return
* @return
*/
*/
size_t
get
ResBufSize
(
const
SDiskbasedResultBuf
*
pResult
Buf
);
size_t
get
TotalBufSize
(
const
SDiskbasedBuf
*
p
Buf
);
/**
/**
* get the number of groups in the result buffer
* get the number of groups in the result buffer
* @param p
Result
Buf
* @param pBuf
* @return
* @return
*/
*/
size_t
getNumOfResultBufGroupId
(
const
SDiskbased
ResultBuf
*
pResult
Buf
);
size_t
getNumOfResultBufGroupId
(
const
SDiskbased
Buf
*
p
Buf
);
/**
/**
* destroy result buffer
* destroy result buffer
* @param p
Result
Buf
* @param pBuf
*/
*/
void
destroyResultBuf
(
SDiskbased
ResultBuf
*
pResult
Buf
);
void
destroyResultBuf
(
SDiskbased
Buf
*
p
Buf
);
/**
/**
*
*
...
@@ -162,8 +123,49 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf);
...
@@ -162,8 +123,49 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf);
*/
*/
SPageInfo
*
getLastPageInfo
(
SIDList
pList
);
SPageInfo
*
getLastPageInfo
(
SIDList
pList
);
/**
*
* @param pPgInfo
* @return
*/
int32_t
getPageId
(
const
SPageInfo
*
pPgInfo
);
/**
* Return the buffer page size.
* @param pBuf
* @return
*/
int32_t
getBufPageSize
(
const
SDiskbasedBuf
*
pBuf
);
int32_t
getNumOfInMemBufPages
(
const
SDiskbasedBuf
*
pBuf
);
/**
*
* @param pBuf
* @return
*/
bool
isAllDataInMemBuf
(
const
SDiskbasedBuf
*
pBuf
);
/**
* Set the buffer page is dirty, and needs to be flushed to disk when swap out.
* @param pPageInfo
* @param dirty
*/
void
setBufPageDirty
(
SFilePage
*
pPageInfo
,
bool
dirty
);
/**
* Print the statistics when closing this buffer
* @param pBuf
*/
void
printStatisBeforeClose
(
SDiskbasedBuf
*
pBuf
);
/**
* return buf statistics.
*/
SDiskbasedBufStatis
getDBufStatis
(
const
SDiskbasedBuf
*
pBuf
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
#endif // TDENGINE_TPAGED
FILE
_H
#endif // TDENGINE_TPAGED
BUF
_H
source/client/src/clientHb.c
浏览文件 @
2ef7bf1c
...
@@ -70,62 +70,42 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
...
@@ -70,62 +70,42 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
}
}
}
}
tFreeSUseDbBatchRsp
(
&
batchUseRsp
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
hbProcessStbInfoRsp
(
void
*
value
,
int32_t
valueLen
,
struct
SCatalog
*
pCatalog
)
{
static
int32_t
hbProcessStbInfoRsp
(
void
*
value
,
int32_t
valueLen
,
struct
SCatalog
*
pCatalog
)
{
int32_t
msgLen
=
0
;
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
schemaNum
=
0
;
while
(
msgLen
<
valueLen
)
{
STableMetaRsp
*
rsp
=
(
STableMetaRsp
*
)((
char
*
)
value
+
msgLen
);
rsp
->
numOfColumns
=
ntohl
(
rsp
->
numOfColumns
);
STableMetaBatchRsp
batchMetaRsp
=
{
0
};
rsp
->
suid
=
be64toh
(
rsp
->
suid
);
if
(
tDeserializeSTableMetaBatchRsp
(
value
,
valueLen
,
&
batchMetaRsp
)
!=
0
)
{
rsp
->
dbId
=
be64toh
(
rsp
->
dbId
);
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
int32_t
numOfBatchs
=
taosArrayGetSize
(
batchMetaRsp
.
pArray
);
for
(
int32_t
i
=
0
;
i
<
numOfBatchs
;
++
i
)
{
STableMetaRsp
*
rsp
=
taosArrayGet
(
batchMetaRsp
.
pArray
,
i
);
if
(
rsp
->
numOfColumns
<
0
)
{
if
(
rsp
->
numOfColumns
<
0
)
{
schemaNum
=
0
;
tscDebug
(
"hb remove stb, db:%s, stb:%s"
,
rsp
->
dbFName
,
rsp
->
stbName
);
tscDebug
(
"hb remove stb, db:%s, stb:%s"
,
rsp
->
dbFName
,
rsp
->
stbName
);
catalogRemoveStbMeta
(
pCatalog
,
rsp
->
dbFName
,
rsp
->
dbId
,
rsp
->
stbName
,
rsp
->
suid
);
catalogRemoveStbMeta
(
pCatalog
,
rsp
->
dbFName
,
rsp
->
dbId
,
rsp
->
stbName
,
rsp
->
suid
);
}
else
{
}
else
{
tscDebug
(
"hb update stb, db:%s, stb:%s"
,
rsp
->
dbFName
,
rsp
->
stbName
);
tscDebug
(
"hb update stb, db:%s, stb:%s"
,
rsp
->
dbFName
,
rsp
->
stbName
);
if
(
rsp
->
pSchemas
[
0
].
colId
!=
PRIMARYKEY_TIMESTAMP_COL_ID
)
{
rsp
->
numOfTags
=
ntohl
(
rsp
->
numOfTags
);
tscError
(
"invalid colId[%d] for the first column in table meta rsp msg"
,
rsp
->
pSchemas
[
0
].
colId
);
rsp
->
sversion
=
ntohl
(
rsp
->
sversion
);
tFreeSTableMetaBatchRsp
(
&
batchMetaRsp
);
rsp
->
tversion
=
ntohl
(
rsp
->
tversion
);
rsp
->
tuid
=
be64toh
(
rsp
->
tuid
);
rsp
->
vgId
=
ntohl
(
rsp
->
vgId
);
SSchema
*
pSchema
=
rsp
->
pSchema
;
schemaNum
=
rsp
->
numOfColumns
+
rsp
->
numOfTags
;
for
(
int
i
=
0
;
i
<
schemaNum
;
++
i
)
{
pSchema
->
bytes
=
ntohl
(
pSchema
->
bytes
);
pSchema
->
colId
=
ntohl
(
pSchema
->
colId
);
pSchema
++
;
}
if
(
rsp
->
pSchema
[
0
].
colId
!=
PRIMARYKEY_TIMESTAMP_COL_ID
)
{
tscError
(
"invalid colId[%d] for the first column in table meta rsp msg"
,
rsp
->
pSchema
[
0
].
colId
);
return
TSDB_CODE_TSC_INVALID_VALUE
;
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
}
catalogUpdateSTableMeta
(
pCatalog
,
rsp
);
catalogUpdateSTableMeta
(
pCatalog
,
rsp
);
}
}
msgLen
+=
sizeof
(
STableMetaRsp
)
+
schemaNum
*
sizeof
(
SSchema
);
}
}
tFreeSTableMetaBatchRsp
(
&
batchMetaRsp
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
hbQueryHbRspHandle
(
struct
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
)
{
static
int32_t
hbQueryHbRspHandle
(
struct
SAppHbMgr
*
pAppHbMgr
,
SClientHbRsp
*
pRsp
)
{
SHbConnInfo
*
info
=
taosHashGet
(
pAppHbMgr
->
connInfo
,
&
pRsp
->
connKey
,
sizeof
(
SClientHbKey
));
SHbConnInfo
*
info
=
taosHashGet
(
pAppHbMgr
->
connInfo
,
&
pRsp
->
connKey
,
sizeof
(
SClientHbKey
));
if
(
NULL
==
info
)
{
if
(
NULL
==
info
)
{
...
...
source/client/src/clientImpl.c
浏览文件 @
2ef7bf1c
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include "tglobal.h"
#include "tglobal.h"
#include "tmsgtype.h"
#include "tmsgtype.h"
#include "tnote.h"
#include "tnote.h"
#include "tpaged
file
.h"
#include "tpaged
buf
.h"
#include "tref.h"
#include "tref.h"
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
...
@@ -357,40 +357,38 @@ STscObj* taosConnectImpl(const char *user, const char *auth, const char *db, __t
...
@@ -357,40 +357,38 @@ STscObj* taosConnectImpl(const char *user, const char *auth, const char *db, __t
return
pTscObj
;
return
pTscObj
;
}
}
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
)
{
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
)
{
SMsgSendInfo
*
pMsgSendInfo
=
calloc
(
1
,
sizeof
(
SMsgSendInfo
));
SMsgSendInfo
*
pMsgSendInfo
=
calloc
(
1
,
sizeof
(
SMsgSendInfo
));
if
(
pMsgSendInfo
==
NULL
)
{
if
(
pMsgSendInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
NULL
;
return
NULL
;
}
}
pMsgSendInfo
->
msgType
=
TDMT_MND_CONNECT
;
pMsgSendInfo
->
msgType
=
TDMT_MND_CONNECT
;
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SConnectReq
);
pMsgSendInfo
->
requestObjRefId
=
pRequest
->
self
;
pMsgSendInfo
->
requestObjRefId
=
pRequest
->
self
;
pMsgSendInfo
->
requestId
=
pRequest
->
requestId
;
pMsgSendInfo
->
requestId
=
pRequest
->
requestId
;
pMsgSendInfo
->
fp
=
handleRequestRspFp
[
TMSG_INDEX
(
pMsgSendInfo
->
msgType
)];
pMsgSendInfo
->
fp
=
handleRequestRspFp
[
TMSG_INDEX
(
pMsgSendInfo
->
msgType
)];
pMsgSendInfo
->
param
=
pRequest
;
pMsgSendInfo
->
param
=
pRequest
;
SConnectReq
*
pConnect
=
calloc
(
1
,
sizeof
(
SConnectReq
));
SConnectReq
connectReq
=
{
0
};
if
(
pConnect
==
NULL
)
{
STscObj
*
pObj
=
pRequest
->
pTscObj
;
tfree
(
pMsgSendInfo
);
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
NULL
;
}
STscObj
*
pObj
=
pRequest
->
pTscObj
;
char
*
db
=
getDbOfConnection
(
pObj
);
char
*
db
=
getDbOfConnection
(
pObj
);
if
(
db
!=
NULL
)
{
if
(
db
!=
NULL
)
{
tstrncpy
(
pConnect
->
db
,
db
,
sizeof
(
pConnect
->
db
));
tstrncpy
(
connectReq
.
db
,
db
,
sizeof
(
connectReq
.
db
));
}
}
tfree
(
db
);
tfree
(
db
);
pConnect
->
pid
=
htonl
(
appInfo
.
pid
);
connectReq
.
pid
=
htonl
(
appInfo
.
pid
);
pConnect
->
startTime
=
htobe64
(
appInfo
.
startTime
);
connectReq
.
startTime
=
htobe64
(
appInfo
.
startTime
);
tstrncpy
(
pConnect
->
app
,
appInfo
.
appName
,
tListLen
(
pConnect
->
app
));
tstrncpy
(
connectReq
.
app
,
appInfo
.
appName
,
sizeof
(
connectReq
.
app
));
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
void
*
pReq
=
malloc
(
contLen
);
tSerializeSConnectReq
(
pReq
,
contLen
,
&
connectReq
);
pMsgSendInfo
->
msgInfo
.
pData
=
pConnect
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
pMsgSendInfo
->
msgInfo
.
pData
=
pReq
;
return
pMsgSendInfo
;
return
pMsgSendInfo
;
}
}
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
2ef7bf1c
...
@@ -20,14 +20,14 @@
...
@@ -20,14 +20,14 @@
#include "clientLog.h"
#include "clientLog.h"
#include "catalog.h"
#include "catalog.h"
int
(
*
handleRequestRspFp
[
TDMT_MAX
])(
void
*
,
const
SDataBuf
*
pMsg
,
int32_t
code
);
int
32_t
(
*
handleRequestRspFp
[
TDMT_MAX
])(
void
*
,
const
SDataBuf
*
pMsg
,
int32_t
code
);
static
void
setErrno
(
SRequestObj
*
pRequest
,
int32_t
code
)
{
static
void
setErrno
(
SRequestObj
*
pRequest
,
int32_t
code
)
{
pRequest
->
code
=
code
;
pRequest
->
code
=
code
;
terrno
=
code
;
terrno
=
code
;
}
}
int
genericRspCallback
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int
32_t
genericRspCallback
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SRequestObj
*
pRequest
=
param
;
SRequestObj
*
pRequest
=
param
;
setErrno
(
pRequest
,
code
);
setErrno
(
pRequest
,
code
);
...
@@ -36,7 +36,7 @@ int genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -36,7 +36,7 @@ int genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
return
code
;
}
}
int
processConnectRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int
32_t
processConnectRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SRequestObj
*
pRequest
=
param
;
SRequestObj
*
pRequest
=
param
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
free
(
pMsg
->
pData
);
free
(
pMsg
->
pData
);
...
@@ -45,41 +45,35 @@ int processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -45,41 +45,35 @@ int processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
return
code
;
}
}
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SConnectRsp
*
pConnect
=
(
SConnectRsp
*
)
pMsg
->
pData
;
SConnectRsp
connectRsp
=
{
0
};
pConnect
->
acctId
=
htonl
(
pConnect
->
acctId
);
tDeserializeSConnectRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
connectRsp
);
pConnect
->
connId
=
htonl
(
pConnect
->
connId
);
assert
(
connectRsp
.
epSet
.
numOfEps
>
0
);
pConnect
->
clusterId
=
htobe64
(
pConnect
->
clusterId
);
assert
(
pConnect
->
epSet
.
numOfEps
>
0
);
if
(
!
isEpsetEqual
(
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
connectRsp
.
epSet
))
{
for
(
int32_t
i
=
0
;
i
<
pConnect
->
epSet
.
numOfEps
;
++
i
)
{
updateEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
,
&
connectRsp
.
epSet
);
pConnect
->
epSet
.
eps
[
i
].
port
=
htons
(
pConnect
->
epSet
.
eps
[
i
].
port
);
}
}
if
(
!
isEpsetEqual
(
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
pConnect
->
epSet
))
{
for
(
int32_t
i
=
0
;
i
<
connectRsp
.
epSet
.
numOfEps
;
++
i
)
{
updateEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
,
&
pConnect
->
epSet
);
tscDebug
(
"0x%"
PRIx64
" epSet.fqdn[%d]:%s port:%d, connObj:0x%"
PRIx64
,
pRequest
->
requestId
,
i
,
connectRsp
.
epSet
.
eps
[
i
].
fqdn
,
connectRsp
.
epSet
.
eps
[
i
].
port
,
pTscObj
->
id
);
}
}
for
(
int
i
=
0
;
i
<
pConnect
->
epSet
.
numOfEps
;
++
i
)
{
pTscObj
->
connId
=
connectRsp
.
connId
;
tscDebug
(
"0x%"
PRIx64
" epSet.fqdn[%d]:%s port:%d, connObj:0x%"
PRIx64
,
pRequest
->
requestId
,
i
,
pConnect
->
epSet
.
eps
[
i
].
fqdn
,
pTscObj
->
acctId
=
connectRsp
.
acctId
;
pConnect
->
epSet
.
eps
[
i
].
port
,
pTscObj
->
id
);
tstrncpy
(
pTscObj
->
ver
,
connectRsp
.
sVersion
,
tListLen
(
pTscObj
->
ver
));
}
pTscObj
->
connId
=
pConnect
->
connId
;
pTscObj
->
acctId
=
pConnect
->
acctId
;
tstrncpy
(
pTscObj
->
ver
,
pConnect
->
sVersion
,
tListLen
(
pTscObj
->
ver
));
// update the appInstInfo
// update the appInstInfo
pTscObj
->
pAppInfo
->
clusterId
=
pConnect
->
clusterId
;
pTscObj
->
pAppInfo
->
clusterId
=
connectRsp
.
clusterId
;
atomic_add_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
atomic_add_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
pTscObj
->
connType
=
HEARTBEAT_TYPE_QUERY
;
pTscObj
->
connType
=
HEARTBEAT_TYPE_QUERY
;
hbRegisterConn
(
pTscObj
->
pAppInfo
->
pAppHbMgr
,
pConnect
->
connId
,
pConnect
->
clusterId
,
HEARTBEAT_TYPE_QUERY
);
hbRegisterConn
(
pTscObj
->
pAppInfo
->
pAppHbMgr
,
connectRsp
.
connId
,
connectRsp
.
clusterId
,
HEARTBEAT_TYPE_QUERY
);
// pRequest->body.resInfo.pRspMsg = pMsg->pData;
// pRequest->body.resInfo.pRspMsg = pMsg->pData;
tscDebug
(
"0x%"
PRIx64
" clusterId:%"
PRId64
", totalConn:%"
PRId64
,
pRequest
->
requestId
,
pConnect
->
clusterId
,
tscDebug
(
"0x%"
PRIx64
" clusterId:%"
PRId64
", totalConn:%"
PRId64
,
pRequest
->
requestId
,
connectRsp
.
clusterId
,
pTscObj
->
pAppInfo
->
numOfConns
);
pTscObj
->
pAppInfo
->
numOfConns
);
free
(
pMsg
->
pData
);
free
(
pMsg
->
pData
);
...
@@ -135,39 +129,29 @@ int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -135,39 +129,29 @@ int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
return
code
;
}
}
SShowRsp
*
pShow
=
(
SShowRsp
*
)
pMsg
->
pData
;
SShowRsp
showRsp
=
{
0
};
pShow
->
showId
=
htobe64
(
pShow
->
showId
);
tDeserializeSShowRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
showRsp
);
STableMetaRsp
*
pMetaMsg
=
&
showRsp
.
tableMeta
;
STableMetaRsp
*
pMetaMsg
=
&
(
pShow
->
tableMeta
);
pMetaMsg
->
numOfColumns
=
htonl
(
pMetaMsg
->
numOfColumns
);
SSchema
*
pSchema
=
pMetaMsg
->
pSchema
;
pMetaMsg
->
tuid
=
htobe64
(
pMetaMsg
->
tuid
);
for
(
int
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
pSchema
->
colId
=
htonl
(
pSchema
->
colId
);
pSchema
++
;
}
pSchema
=
pMetaMsg
->
pSchema
;
tfree
(
pRequest
->
body
.
resInfo
.
pRspMsg
);
tfree
(
pRequest
->
body
.
resInfo
.
pRspMsg
);
pRequest
->
body
.
resInfo
.
pRspMsg
=
pMsg
->
pData
;
pRequest
->
body
.
resInfo
.
pRspMsg
=
pMsg
->
pData
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
if
(
pResInfo
->
fields
==
NULL
)
{
if
(
pResInfo
->
fields
==
NULL
)
{
TAOS_FIELD
*
pFields
=
calloc
(
pMetaMsg
->
numOfColumns
,
sizeof
(
TAOS_FIELD
));
TAOS_FIELD
*
pFields
=
calloc
(
pMetaMsg
->
numOfColumns
,
sizeof
(
TAOS_FIELD
));
for
(
int32_t
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
tstrncpy
(
pFields
[
i
].
name
,
pSchema
[
i
].
name
,
tListLen
(
pFields
[
i
].
name
));
SSchema
*
pSchema
=
&
pMetaMsg
->
pSchemas
[
i
];
pFields
[
i
].
type
=
pSchema
[
i
].
type
;
tstrncpy
(
pFields
[
i
].
name
,
pSchema
->
name
,
tListLen
(
pFields
[
i
].
name
));
pFields
[
i
].
bytes
=
pSchema
[
i
].
bytes
;
pFields
[
i
].
type
=
pSchema
->
type
;
pFields
[
i
].
bytes
=
pSchema
->
bytes
;
}
}
pResInfo
->
fields
=
pFields
;
pResInfo
->
fields
=
pFields
;
}
}
pResInfo
->
numOfCols
=
pMetaMsg
->
numOfColumns
;
pResInfo
->
numOfCols
=
pMetaMsg
->
numOfColumns
;
pRequest
->
body
.
showInfo
.
execId
=
pShow
->
showId
;
pRequest
->
body
.
showInfo
.
execId
=
showRsp
.
showId
;
tFreeSShowRsp
(
&
showRsp
);
// todo
// todo
if
(
pRequest
->
type
==
TDMT_VND_SHOW_TABLES
)
{
if
(
pRequest
->
type
==
TDMT_VND_SHOW_TABLES
)
{
...
...
source/client/src/tmq.c
浏览文件 @
2ef7bf1c
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#include "tglobal.h"
#include "tglobal.h"
#include "tmsgtype.h"
#include "tmsgtype.h"
#include "tnote.h"
#include "tnote.h"
#include "tpaged
file
.h"
#include "tpaged
buf
.h"
#include "tref.h"
#include "tref.h"
struct
tmq_list_t
{
struct
tmq_list_t
{
...
@@ -381,7 +381,7 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
...
@@ -381,7 +381,7 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
char
topicFname
[
TSDB_TOPIC_FNAME_LEN
]
=
{
0
};
char
topicFname
[
TSDB_TOPIC_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
name
,
topicFname
);
tNameExtractFullName
(
&
name
,
topicFname
);
S
C
MCreateTopicReq
req
=
{
SMCreateTopicReq
req
=
{
.
name
=
(
char
*
)
topicFname
,
.
name
=
(
char
*
)
topicFname
,
.
igExists
=
1
,
.
igExists
=
1
,
.
physicalPlan
=
(
char
*
)
pStr
,
.
physicalPlan
=
(
char
*
)
pStr
,
...
@@ -389,14 +389,14 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
...
@@ -389,14 +389,14 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
.
logicalPlan
=
(
char
*
)
"no logic plan"
,
.
logicalPlan
=
(
char
*
)
"no logic plan"
,
};
};
int
tlen
=
tSerialize
SC
MCreateTopicReq
(
NULL
,
&
req
);
int
tlen
=
tSerializeMCreateTopicReq
(
NULL
,
&
req
);
void
*
buf
=
malloc
(
tlen
);
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
goto
_return
;
goto
_return
;
}
}
void
*
abuf
=
buf
;
void
*
abuf
=
buf
;
tSerialize
SC
MCreateTopicReq
(
&
abuf
,
&
req
);
tSerializeMCreateTopicReq
(
&
abuf
,
&
req
);
/*printf("formatted: %s\n", dagStr);*/
/*printf("formatted: %s\n", dagStr);*/
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
buf
,
.
len
=
tlen
};
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){.
pData
=
buf
,
.
len
=
tlen
};
...
...
source/common/src/tep.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/common/src/tmsg.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/common/src/tname.c
浏览文件 @
2ef7bf1c
#include <common.h>
#include "os.h"
#include "os.h"
#include "tutil.h"
#include "tutil.h"
...
@@ -268,4 +269,5 @@ SSchema createSchema(uint8_t type, int32_t bytes, int32_t colId, const char* nam
...
@@ -268,4 +269,5 @@ SSchema createSchema(uint8_t type, int32_t bytes, int32_t colId, const char* nam
tstrncpy
(
s
.
name
,
name
,
tListLen
(
s
.
name
));
tstrncpy
(
s
.
name
,
name
,
tListLen
(
s
.
name
));
return
s
;
return
s
;
}
}
\ No newline at end of file
source/common/src/ttszip.c
浏览文件 @
2ef7bf1c
...
@@ -344,8 +344,8 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) {
...
@@ -344,8 +344,8 @@ STSBlock* readDataFromDisk(STSBuf* pTSBuf, int32_t order, bool decomp) {
UNUSED
(
ret
);
UNUSED
(
ret
);
}
}
fread
(
&
pBlock
->
tag
.
nType
,
sizeof
(
pBlock
->
tag
.
nType
),
1
,
pTSBuf
->
f
);
int32_t
ret
=
fread
(
&
pBlock
->
tag
.
nType
,
sizeof
(
pBlock
->
tag
.
nType
),
1
,
pTSBuf
->
f
);
fread
(
&
pBlock
->
tag
.
nLen
,
sizeof
(
pBlock
->
tag
.
nLen
),
1
,
pTSBuf
->
f
);
ret
=
fread
(
&
pBlock
->
tag
.
nLen
,
sizeof
(
pBlock
->
tag
.
nLen
),
1
,
pTSBuf
->
f
);
// NOTE: mix types tags are not supported
// NOTE: mix types tags are not supported
size_t
sz
=
0
;
size_t
sz
=
0
;
...
...
source/common/test/commonTests.cpp
浏览文件 @
2ef7bf1c
#include <common.h>
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#include <tep.h>
#include <iostream>
#include <iostream>
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "os.h"
#include "os.h"
...
@@ -96,4 +97,199 @@ TEST(testCase, toInteger_test) {
...
@@ -96,4 +97,199 @@ TEST(testCase, toInteger_test) {
ASSERT_EQ
(
ret
,
-
1
);
ASSERT_EQ
(
ret
,
-
1
);
}
}
TEST
(
testCase
,
Datablock_test
)
{
SSDataBlock
*
b
=
static_cast
<
SSDataBlock
*>
(
calloc
(
1
,
sizeof
(
SSDataBlock
)));
b
->
info
.
numOfCols
=
2
;
b
->
pDataBlock
=
taosArrayInit
(
4
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
bytes
=
4
;
infoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
infoData
.
info
.
colId
=
1
;
infoData
.
pData
=
(
char
*
)
calloc
(
40
,
infoData
.
info
.
bytes
);
infoData
.
nullbitmap
=
(
char
*
)
calloc
(
1
,
sizeof
(
char
)
*
(
40
/
8
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData
);
SColumnInfoData
infoData1
=
{
0
};
infoData1
.
info
.
bytes
=
40
;
infoData1
.
info
.
type
=
TSDB_DATA_TYPE_BINARY
;
infoData1
.
info
.
colId
=
2
;
infoData1
.
varmeta
.
offset
=
(
int32_t
*
)
calloc
(
40
,
sizeof
(
uint32_t
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData1
);
char
*
str
=
"the value of: %d"
;
char
buf
[
128
]
=
{
0
};
char
varbuf
[
128
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
40
;
++
i
)
{
SColumnInfoData
*
p0
=
(
SColumnInfoData
*
)
taosArrayGet
(
b
->
pDataBlock
,
0
);
SColumnInfoData
*
p1
=
(
SColumnInfoData
*
)
taosArrayGet
(
b
->
pDataBlock
,
1
);
if
(
i
&
0x01
)
{
int32_t
len
=
sprintf
(
buf
,
str
,
i
);
STR_TO_VARSTR
(
varbuf
,
buf
)
colDataAppend
(
p0
,
i
,
(
const
char
*
)
&
i
,
false
);
colDataAppend
(
p1
,
i
,
(
const
char
*
)
varbuf
,
false
);
memset
(
varbuf
,
0
,
sizeof
(
varbuf
));
memset
(
buf
,
0
,
sizeof
(
buf
));
}
else
{
colDataAppend
(
p0
,
i
,
(
const
char
*
)
&
i
,
true
);
colDataAppend
(
p1
,
i
,
(
const
char
*
)
varbuf
,
true
);
}
b
->
info
.
rows
++
;
}
SColumnInfoData
*
p0
=
(
SColumnInfoData
*
)
taosArrayGet
(
b
->
pDataBlock
,
0
);
SColumnInfoData
*
p1
=
(
SColumnInfoData
*
)
taosArrayGet
(
b
->
pDataBlock
,
1
);
for
(
int32_t
i
=
0
;
i
<
40
;
++
i
)
{
if
(
i
&
0x01
)
{
ASSERT_EQ
(
colDataIsNull_f
(
p0
->
nullbitmap
,
i
),
false
);
ASSERT_EQ
(
colDataIsNull
(
p1
,
b
->
info
.
rows
,
i
,
nullptr
),
false
);
}
else
{
ASSERT_EQ
(
colDataIsNull_f
(
p0
->
nullbitmap
,
i
),
true
);
ASSERT_EQ
(
colDataIsNull
(
p0
,
b
->
info
.
rows
,
i
,
nullptr
),
true
);
ASSERT_EQ
(
colDataIsNull
(
p1
,
b
->
info
.
rows
,
i
,
nullptr
),
true
);
}
}
printf
(
"binary column length:%d
\n
"
,
*
(
int32_t
*
)
p1
->
pData
);
ASSERT_EQ
(
colDataGetNumOfCols
(
b
),
2
);
ASSERT_EQ
(
colDataGetNumOfRows
(
b
),
40
);
char
*
pData
=
colDataGet
(
p1
,
3
);
printf
(
"the second row of binary:%s, length:%d
\n
"
,
(
char
*
)
varDataVal
(
pData
),
varDataLen
(
pData
));
SArray
*
pOrderInfo
=
taosArrayInit
(
3
,
sizeof
(
SBlockOrderInfo
));
SBlockOrderInfo
order
=
{.
order
=
TSDB_ORDER_ASC
,
.
colIndex
=
0
};
taosArrayPush
(
pOrderInfo
,
&
order
);
blockDataSort
(
b
,
pOrderInfo
,
true
);
blockDataDestroy
(
b
);
taosArrayDestroy
(
pOrderInfo
);
}
#if 0
TEST(testCase, non_var_dataBlock_split_test) {
SSDataBlock* b = static_cast<SSDataBlock*>(calloc(1, sizeof(SSDataBlock)));
b->info.numOfCols = 2;
b->pDataBlock = taosArrayInit(4, sizeof(SColumnInfoData));
SColumnInfoData infoData = {0};
infoData.info.bytes = 4;
infoData.info.type = TSDB_DATA_TYPE_INT;
infoData.info.colId = 1;
int32_t numOfRows = 1000000;
infoData.pData = (char*) calloc(numOfRows, infoData.info.bytes);
infoData.nullbitmap = (char*) calloc(1, sizeof(char) * (numOfRows/8));
taosArrayPush(b->pDataBlock, &infoData);
SColumnInfoData infoData1 = {0};
infoData1.info.bytes = 1;
infoData1.info.type = TSDB_DATA_TYPE_TINYINT;
infoData1.info.colId = 2;
infoData1.pData = (char*) calloc(numOfRows, infoData.info.bytes);
infoData1.nullbitmap = (char*) calloc(1, sizeof(char) * (numOfRows/8));
taosArrayPush(b->pDataBlock, &infoData1);
for(int32_t i = 0; i < numOfRows; ++i) {
SColumnInfoData* p0 = (SColumnInfoData*)taosArrayGet(b->pDataBlock, 0);
SColumnInfoData* p1 = (SColumnInfoData*)taosArrayGet(b->pDataBlock, 1);
int8_t v = i;
colDataAppend(p0, i, (const char*)&i, false);
colDataAppend(p1, i, (const char*)&v, false);
b->info.rows++;
}
int32_t pageSize = 64 * 1024;
int32_t startIndex= 0;
int32_t stopIndex = 0;
int32_t count = 1;
while(1) {
blockDataSplitRows(b, false, startIndex, &stopIndex, pageSize);
printf("the %d split, from: %d to %d\n", count++, startIndex, stopIndex);
if (stopIndex == numOfRows - 1) {
break;
}
startIndex = stopIndex + 1;
}
}
#endif
TEST
(
testCase
,
var_dataBlock_split_test
)
{
SSDataBlock
*
b
=
static_cast
<
SSDataBlock
*>
(
calloc
(
1
,
sizeof
(
SSDataBlock
)));
b
->
info
.
numOfCols
=
2
;
b
->
pDataBlock
=
taosArrayInit
(
4
,
sizeof
(
SColumnInfoData
));
int32_t
numOfRows
=
1000000
;
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
bytes
=
4
;
infoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
infoData
.
info
.
colId
=
1
;
infoData
.
pData
=
(
char
*
)
calloc
(
numOfRows
,
infoData
.
info
.
bytes
);
infoData
.
nullbitmap
=
(
char
*
)
calloc
(
1
,
sizeof
(
char
)
*
(
numOfRows
/
8
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData
);
SColumnInfoData
infoData1
=
{
0
};
infoData1
.
info
.
bytes
=
40
;
infoData1
.
info
.
type
=
TSDB_DATA_TYPE_BINARY
;
infoData1
.
info
.
colId
=
2
;
infoData1
.
varmeta
.
offset
=
(
int32_t
*
)
calloc
(
numOfRows
,
sizeof
(
uint32_t
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData1
);
char
buf
[
41
]
=
{
0
};
char
buf1
[
100
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
SColumnInfoData
*
p0
=
(
SColumnInfoData
*
)
taosArrayGet
(
b
->
pDataBlock
,
0
);
SColumnInfoData
*
p1
=
(
SColumnInfoData
*
)
taosArrayGet
(
b
->
pDataBlock
,
1
);
int8_t
v
=
i
;
colDataAppend
(
p0
,
i
,
(
const
char
*
)
&
i
,
false
);
sprintf
(
buf
,
"the number of row:%d"
,
i
);
int32_t
len
=
sprintf
(
buf1
,
buf
,
i
);
STR_TO_VARSTR
(
buf1
,
buf
)
colDataAppend
(
p1
,
i
,
buf1
,
false
);
b
->
info
.
rows
++
;
memset
(
buf
,
0
,
sizeof
(
buf
));
memset
(
buf1
,
0
,
sizeof
(
buf1
));
}
int32_t
pageSize
=
64
*
1024
;
int32_t
startIndex
=
0
;
int32_t
stopIndex
=
0
;
int32_t
count
=
1
;
while
(
1
)
{
blockDataSplitRows
(
b
,
true
,
startIndex
,
&
stopIndex
,
pageSize
);
printf
(
"the %d split, from: %d to %d
\n
"
,
count
++
,
startIndex
,
stopIndex
);
if
(
stopIndex
==
numOfRows
-
1
)
{
break
;
}
startIndex
=
stopIndex
+
1
;
}
}
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
\ No newline at end of file
source/dnode/mgmt/impl/test/sut/inc/sut.h
浏览文件 @
2ef7bf1c
...
@@ -74,7 +74,7 @@ class Testbase {
...
@@ -74,7 +74,7 @@ class Testbase {
private:
private:
int64_t
showId
;
int64_t
showId
;
STableMetaRsp
*
pMeta
;
STableMetaRsp
metaRsp
;
SRetrieveTableRsp
*
pRetrieveRsp
;
SRetrieveTableRsp
*
pRetrieveRsp
;
char
*
pData
;
char
*
pData
;
int32_t
pos
;
int32_t
pos
;
...
...
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
2ef7bf1c
...
@@ -56,9 +56,16 @@ void Testbase::Init(const char* path, int16_t port) {
...
@@ -56,9 +56,16 @@ void Testbase::Init(const char* path, int16_t port) {
server
.
Start
(
path
,
fqdn
,
port
,
firstEp
);
server
.
Start
(
path
,
fqdn
,
port
,
firstEp
);
client
.
Init
(
"root"
,
"taosdata"
,
fqdn
,
port
);
client
.
Init
(
"root"
,
"taosdata"
,
fqdn
,
port
);
taosMsleep
(
1100
);
taosMsleep
(
1100
);
tFreeSTableMetaRsp
(
&
metaRsp
);
showId
=
0
;
pData
=
0
;
pos
=
0
;
pRetrieveRsp
=
NULL
;
}
}
void
Testbase
::
Cleanup
()
{
void
Testbase
::
Cleanup
()
{
tFreeSTableMetaRsp
(
&
metaRsp
);
server
.
Stop
();
server
.
Stop
();
client
.
Cleanup
();
client
.
Cleanup
();
dndCleanup
();
dndCleanup
();
...
@@ -85,51 +92,43 @@ void Testbase::SendShowMetaReq(int8_t showType, const char* db) {
...
@@ -85,51 +92,43 @@ void Testbase::SendShowMetaReq(int8_t showType, const char* db) {
strcpy
(
showReq
.
db
,
db
);
strcpy
(
showReq
.
db
,
db
);
int32_t
contLen
=
tSerializeSShowReq
(
NULL
,
0
,
&
showReq
);
int32_t
contLen
=
tSerializeSShowReq
(
NULL
,
0
,
&
showReq
);
char
*
pReq
=
(
char
*
)
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSShowReq
(
pReq
,
contLen
,
&
showReq
);
tSerializeSShowReq
(
pReq
,
contLen
,
&
showReq
);
tFreeSShowReq
(
&
showReq
);
tFreeSShowReq
(
&
showReq
);
SRpcMsg
*
pRsp
=
SendReq
(
TDMT_MND_SHOW
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
SendReq
(
TDMT_MND_SHOW
,
pReq
,
contLen
);
SShowRsp
*
pShowRsp
=
(
SShowRsp
*
)
pRsp
->
pCont
;
ASSERT
(
pRsp
->
pCont
!=
nullptr
);
ASSERT
(
pShowRsp
!=
nullptr
);
pShowRsp
->
showId
=
htobe64
(
pShowRsp
->
showId
);
pMeta
=
&
pShowRsp
->
tableMeta
;
pMeta
->
numOfTags
=
htonl
(
pMeta
->
numOfTags
);
pMeta
->
numOfColumns
=
htonl
(
pMeta
->
numOfColumns
);
pMeta
->
sversion
=
htonl
(
pMeta
->
sversion
);
pMeta
->
tversion
=
htonl
(
pMeta
->
tversion
);
pMeta
->
tuid
=
htobe64
(
pMeta
->
tuid
);
pMeta
->
suid
=
htobe64
(
pMeta
->
suid
);
showId
=
pShowRsp
->
showId
;
SShowRsp
showRsp
=
{
0
};
tDeserializeSShowRsp
(
pRsp
->
pCont
,
pRsp
->
contLen
,
&
showRsp
);
tFreeSTableMetaRsp
(
&
metaRsp
);
metaRsp
=
showRsp
.
tableMeta
;
showId
=
showRsp
.
showId
;
}
}
int32_t
Testbase
::
GetMetaColId
(
int32_t
index
)
{
int32_t
Testbase
::
GetMetaColId
(
int32_t
index
)
{
SSchema
*
pSchema
=
&
pMeta
->
pSchema
[
index
];
SSchema
*
pSchema
=
&
metaRsp
.
pSchemas
[
index
];
pSchema
->
colId
=
htonl
(
pSchema
->
colId
);
return
pSchema
->
colId
;
return
pSchema
->
colId
;
}
}
int8_t
Testbase
::
GetMetaType
(
int32_t
index
)
{
int8_t
Testbase
::
GetMetaType
(
int32_t
index
)
{
SSchema
*
pSchema
=
&
pMeta
->
pSchema
[
index
];
SSchema
*
pSchema
=
&
metaRsp
.
pSchemas
[
index
];
return
pSchema
->
type
;
return
pSchema
->
type
;
}
}
int32_t
Testbase
::
GetMetaBytes
(
int32_t
index
)
{
int32_t
Testbase
::
GetMetaBytes
(
int32_t
index
)
{
SSchema
*
pSchema
=
&
pMeta
->
pSchema
[
index
];
SSchema
*
pSchema
=
&
metaRsp
.
pSchemas
[
index
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
return
pSchema
->
bytes
;
return
pSchema
->
bytes
;
}
}
const
char
*
Testbase
::
GetMetaName
(
int32_t
index
)
{
const
char
*
Testbase
::
GetMetaName
(
int32_t
index
)
{
SSchema
*
pSchema
=
&
pMeta
->
pSchema
[
index
];
SSchema
*
pSchema
=
&
metaRsp
.
pSchemas
[
index
];
return
pSchema
->
name
;
return
pSchema
->
name
;
}
}
int32_t
Testbase
::
GetMetaNum
()
{
return
pMeta
->
numOfColumns
;
}
int32_t
Testbase
::
GetMetaNum
()
{
return
metaRsp
.
numOfColumns
;
}
const
char
*
Testbase
::
GetMetaTbName
()
{
return
pMeta
->
tbName
;
}
const
char
*
Testbase
::
GetMetaTbName
()
{
return
metaRsp
.
tbName
;
}
void
Testbase
::
SendShowRetrieveReq
()
{
void
Testbase
::
SendShowRetrieveReq
()
{
SRetrieveTableReq
retrieveReq
=
{
0
};
SRetrieveTableReq
retrieveReq
=
{
0
};
...
@@ -150,7 +149,7 @@ void Testbase::SendShowRetrieveReq() {
...
@@ -150,7 +149,7 @@ void Testbase::SendShowRetrieveReq() {
pos
=
0
;
pos
=
0
;
}
}
const
char
*
Testbase
::
GetShowName
()
{
return
pMeta
->
tbName
;
}
const
char
*
Testbase
::
GetShowName
()
{
return
metaRsp
.
tbName
;
}
int8_t
Testbase
::
GetShowInt8
()
{
int8_t
Testbase
::
GetShowInt8
()
{
int8_t
data
=
*
((
int8_t
*
)(
pData
+
pos
));
int8_t
data
=
*
((
int8_t
*
)(
pData
+
pos
));
...
@@ -191,6 +190,6 @@ const char* Testbase::GetShowBinary(int32_t len) {
...
@@ -191,6 +190,6 @@ const char* Testbase::GetShowBinary(int32_t len) {
int32_t
Testbase
::
GetShowRows
()
{
return
pRetrieveRsp
->
numOfRows
;
}
int32_t
Testbase
::
GetShowRows
()
{
return
pRetrieveRsp
->
numOfRows
;
}
STableMetaRsp
*
Testbase
::
GetShowMeta
()
{
return
pMeta
;
}
STableMetaRsp
*
Testbase
::
GetShowMeta
()
{
return
&
metaRsp
;
}
SRetrieveTableRsp
*
Testbase
::
GetRetrieveRsp
()
{
return
pRetrieveRsp
;
}
SRetrieveTableRsp
*
Testbase
::
GetRetrieveRsp
()
{
return
pRetrieveRsp
;
}
\ No newline at end of file
source/dnode/mnode/impl/inc/mndAuth.h
浏览文件 @
2ef7bf1c
...
@@ -36,6 +36,9 @@ int32_t mndCheckCreateDbAuth(SUserObj *pOperUser);
...
@@ -36,6 +36,9 @@ int32_t mndCheckCreateDbAuth(SUserObj *pOperUser);
int32_t
mndCheckAlterDropCompactSyncDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckAlterDropCompactSyncDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckWriteAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckReadAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/inc/mndDb.h
浏览文件 @
2ef7bf1c
...
@@ -24,7 +24,7 @@ extern "C" {
...
@@ -24,7 +24,7 @@ extern "C" {
int32_t
mndInitDb
(
SMnode
*
pMnode
);
int32_t
mndInitDb
(
SMnode
*
pMnode
);
void
mndCleanupDb
(
SMnode
*
pMnode
);
void
mndCleanupDb
(
SMnode
*
pMnode
);
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
char
*
db
);
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
c
onst
c
har
*
db
);
void
mndReleaseDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
);
void
mndReleaseDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
);
int32_t
mndValidateDbInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
pDbs
,
int32_t
numOfDbs
,
void
**
ppRsp
,
int32_t
*
pRspLen
);
int32_t
mndValidateDbInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
pDbs
,
int32_t
numOfDbs
,
void
**
ppRsp
,
int32_t
*
pRspLen
);
...
...
source/dnode/mnode/impl/inc/mndStb.h
浏览文件 @
2ef7bf1c
...
@@ -22,14 +22,13 @@
...
@@ -22,14 +22,13 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
int32_t
mndInitStb
(
SMnode
*
pMnode
);
int32_t
mndInitStb
(
SMnode
*
pMnode
);
void
mndCleanupStb
(
SMnode
*
pMnode
);
void
mndCleanupStb
(
SMnode
*
pMnode
);
SStbObj
*
mndAcquireStb
(
SMnode
*
pMnode
,
char
*
stbName
);
SStbObj
*
mndAcquireStb
(
SMnode
*
pMnode
,
char
*
stbName
);
void
mndReleaseStb
(
SMnode
*
pMnode
,
SStbObj
*
pStb
);
void
mndReleaseStb
(
SMnode
*
pMnode
,
SStbObj
*
pStb
);
SSdbRaw
*
mndStbActionEncode
(
SStbObj
*
pStb
);
int32_t
mndValidateStbInfo
(
SMnode
*
pMnode
,
SSTableMetaVersion
*
stbs
,
int32_t
num
,
void
**
rsp
,
int32_t
*
rspLen
);
int32_t
mndValidateStbInfo
(
SMnode
*
pMnode
,
SSTableMetaVersion
*
pStbs
,
int32_t
numOfStbs
,
void
**
ppRsp
,
int32_t
*
pRspLen
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
2ef7bf1c
...
@@ -141,3 +141,29 @@ int32_t mndCheckAlterDropCompactSyncDbAuth(SUserObj *pOperUser, SDbObj *pDb) {
...
@@ -141,3 +141,29 @@ int32_t mndCheckAlterDropCompactSyncDbAuth(SUserObj *pOperUser, SDbObj *pDb) {
}
}
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
return
0
;
}
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
return
0
;
}
int32_t
mndCheckWriteAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
if
(
pOperUser
->
superUser
||
strcmp
(
pOperUser
->
user
,
pDb
->
createUser
)
==
0
)
{
return
0
;
}
if
(
taosHashGet
(
pOperUser
->
writeDbs
,
pDb
->
name
,
strlen
(
pDb
->
name
)
+
1
)
!=
NULL
)
{
return
0
;
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
int32_t
mndCheckReadAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
if
(
pOperUser
->
superUser
||
strcmp
(
pOperUser
->
user
,
pDb
->
createUser
)
==
0
)
{
return
0
;
}
if
(
taosHashGet
(
pOperUser
->
readDbs
,
pDb
->
name
,
strlen
(
pDb
->
name
)
+
1
)
!=
NULL
)
{
return
0
;
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
2ef7bf1c
...
@@ -433,27 +433,27 @@ static int32_t mndGetBnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
...
@@ -433,27 +433,27 @@ static int32_t mndGetBnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
2ef7bf1c
...
@@ -165,27 +165,27 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
...
@@ -165,27 +165,27 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BIGINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BIGINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
strcpy
(
pMeta
->
tbName
,
mndShowStr
(
pShow
->
type
));
strcpy
(
pMeta
->
tbName
,
mndShowStr
(
pShow
->
type
));
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
2ef7bf1c
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
*/
*/
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "mndConsumer.h"
#include "mndConsumer.h"
#include "mndAuth.h"
#include "mndDb.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndMnode.h"
#include "mndMnode.h"
...
@@ -53,13 +53,14 @@ int32_t mndInitConsumer(SMnode *pMnode) {
...
@@ -53,13 +53,14 @@ int32_t mndInitConsumer(SMnode *pMnode) {
void
mndCleanupConsumer
(
SMnode
*
pMnode
)
{}
void
mndCleanupConsumer
(
SMnode
*
pMnode
)
{}
SMqConsumerObj
*
mndCreateConsumer
(
int64_t
consumerId
,
const
char
*
cgroup
)
{
SMqConsumerObj
*
mndCreateConsumer
(
int64_t
consumerId
,
const
char
*
cgroup
)
{
SMqConsumerObj
*
pConsumer
=
malloc
(
sizeof
(
SMqConsumerObj
));
SMqConsumerObj
*
pConsumer
=
calloc
(
1
,
sizeof
(
SMqConsumerObj
));
if
(
pConsumer
==
NULL
)
{
if
(
pConsumer
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
return
NULL
;
}
}
pConsumer
->
recentRemovedTopics
=
taosArrayInit
(
0
,
sizeof
(
char
*
));
pConsumer
->
recentRemovedTopics
=
taosArrayInit
(
1
,
sizeof
(
char
*
));
pConsumer
->
epoch
=
1
;
pConsumer
->
epoch
=
1
;
pConsumer
->
consumerId
=
consumerId
;
pConsumer
->
consumerId
=
consumerId
;
atomic_store_32
(
&
pConsumer
->
status
,
MQ_CONSUMER_STATUS__INIT
);
atomic_store_32
(
&
pConsumer
->
status
,
MQ_CONSUMER_STATUS__INIT
);
...
@@ -70,7 +71,8 @@ SMqConsumerObj* mndCreateConsumer(int64_t consumerId, const char* cgroup) {
...
@@ -70,7 +71,8 @@ SMqConsumerObj* mndCreateConsumer(int64_t consumerId, const char* cgroup) {
SSdbRaw
*
mndConsumerActionEncode
(
SMqConsumerObj
*
pConsumer
)
{
SSdbRaw
*
mndConsumerActionEncode
(
SMqConsumerObj
*
pConsumer
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
void
*
buf
=
NULL
;
void
*
buf
=
NULL
;
int32_t
tlen
=
tEncodeSMqConsumerObj
(
NULL
,
pConsumer
);
int32_t
tlen
=
tEncodeSMqConsumerObj
(
NULL
,
pConsumer
);
int32_t
size
=
sizeof
(
int32_t
)
+
tlen
+
MND_CONSUMER_RESERVE_SIZE
;
int32_t
size
=
sizeof
(
int32_t
)
+
tlen
+
MND_CONSUMER_RESERVE_SIZE
;
...
@@ -105,7 +107,7 @@ CM_ENCODE_OVER:
...
@@ -105,7 +107,7 @@ CM_ENCODE_OVER:
SSdbRow
*
mndConsumerActionDecode
(
SSdbRaw
*
pRaw
)
{
SSdbRow
*
mndConsumerActionDecode
(
SSdbRaw
*
pRaw
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
void
*
buf
=
NULL
;
void
*
buf
=
NULL
;
int8_t
sver
=
0
;
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
CM_DECODE_OVER
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
CM_DECODE_OVER
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
2ef7bf1c
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "mndAuth.h"
#include "mndAuth.h"
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndStb.h"
#include "mndTrans.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndUser.h"
#include "mndVgroup.h"
#include "mndVgroup.h"
...
@@ -194,7 +195,7 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
...
@@ -194,7 +195,7 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
return
0
;
return
0
;
}
}
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
char
*
db
)
{
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
c
onst
c
har
*
db
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDbObj
*
pDb
=
sdbAcquire
(
pSdb
,
SDB_DB
,
db
);
SDbObj
*
pDb
=
sdbAcquire
(
pSdb
,
SDB_DB
,
db
);
if
(
pDb
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
if
(
pDb
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
...
@@ -722,6 +723,24 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
...
@@ -722,6 +723,24 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
sdbRelease
(
pSdb
,
pVgroup
);
sdbRelease
(
pSdb
,
pVgroup
);
}
}
while
(
1
)
{
SStbObj
*
pStb
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_STB
,
pIter
,
(
void
**
)
&
pStb
);
if
(
pIter
==
NULL
)
break
;
if
(
pStb
->
dbUid
==
pDb
->
uid
)
{
SSdbRaw
*
pStbRaw
=
mndStbActionEncode
(
pStb
);
if
(
pStbRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pStbRaw
)
!=
0
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pStbRaw
);
return
-
1
;
}
sdbSetRawStatus
(
pStbRaw
,
SDB_STATUS_DROPPED
);
}
sdbRelease
(
pSdb
,
pStb
);
}
return
0
;
return
0
;
}
}
...
@@ -1111,117 +1130,117 @@ static int32_t mndGetDbMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMe
...
@@ -1111,117 +1130,117 @@ static int32_t mndGetDbMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMe
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
(
TSDB_DB_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
(
TSDB_DB_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"vgroups"
);
strcpy
(
pSchema
[
cols
].
name
,
"vgroups"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"ntables"
);
strcpy
(
pSchema
[
cols
].
name
,
"ntables"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"replica"
);
strcpy
(
pSchema
[
cols
].
name
,
"replica"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"quorum"
);
strcpy
(
pSchema
[
cols
].
name
,
"quorum"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"days"
);
strcpy
(
pSchema
[
cols
].
name
,
"days"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
24
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
24
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"keep0,keep1,keep2"
);
strcpy
(
pSchema
[
cols
].
name
,
"keep0,keep1,keep2"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"cache"
);
strcpy
(
pSchema
[
cols
].
name
,
"cache"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"blocks"
);
strcpy
(
pSchema
[
cols
].
name
,
"blocks"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"minrows"
);
strcpy
(
pSchema
[
cols
].
name
,
"minrows"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"maxrows"
);
strcpy
(
pSchema
[
cols
].
name
,
"maxrows"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"wallevel"
);
strcpy
(
pSchema
[
cols
].
name
,
"wallevel"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"fsync"
);
strcpy
(
pSchema
[
cols
].
name
,
"fsync"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"comp"
);
strcpy
(
pSchema
[
cols
].
name
,
"comp"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"cachelast"
);
strcpy
(
pSchema
[
cols
].
name
,
"cachelast"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
3
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
3
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"precision"
);
strcpy
(
pSchema
[
cols
].
name
,
"precision"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
[
cols
].
name
,
"update"
);
strcpy
(
pSchema
[
cols
].
name
,
"update"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
2ef7bf1c
...
@@ -628,21 +628,21 @@ static int32_t mndProcessConfigDnodeRsp(SMnodeMsg *pRsp) {
...
@@ -628,21 +628,21 @@ static int32_t mndProcessConfigDnodeRsp(SMnodeMsg *pRsp) {
static
int32_t
mndGetConfigMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
static
int32_t
mndGetConfigMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
pSchema
[
cols
].
name
,
"name"
,
sizeof
(
pSchema
[
cols
].
name
));
tstrncpy
(
pSchema
[
cols
].
name
,
"name"
,
sizeof
(
pSchema
[
cols
].
name
));
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_CONIIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_CONIIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
pSchema
[
cols
].
name
,
"value"
,
sizeof
(
pSchema
[
cols
].
name
));
tstrncpy
(
pSchema
[
cols
].
name
,
"value"
,
sizeof
(
pSchema
[
cols
].
name
));
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
@@ -705,51 +705,51 @@ static int32_t mndGetDnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
...
@@ -705,51 +705,51 @@ static int32_t mndGetDnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"vnodes"
);
strcpy
(
pSchema
[
cols
].
name
,
"vnodes"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"support_vnodes"
);
strcpy
(
pSchema
[
cols
].
name
,
"support_vnodes"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
10
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
10
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
24
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
24
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"offline_reason"
);
strcpy
(
pSchema
[
cols
].
name
,
"offline_reason"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
2ef7bf1c
...
@@ -468,51 +468,51 @@ static int32_t mndGetFuncMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *p
...
@@ -468,51 +468,51 @@ static int32_t mndGetFuncMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *p
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
TSDB_FUNC_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_FUNC_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
PATH_MAX
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
PATH_MAX
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"comment"
);
strcpy
(
pSchema
[
cols
].
name
,
"comment"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"aggregate"
);
strcpy
(
pSchema
[
cols
].
name
,
"aggregate"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_TYPE_STR_MAX_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_TYPE_STR_MAX_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"outputtype"
);
strcpy
(
pSchema
[
cols
].
name
,
"outputtype"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"code_len"
);
strcpy
(
pSchema
[
cols
].
name
,
"code_len"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"bufsize"
);
strcpy
(
pSchema
[
cols
].
name
,
"bufsize"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
2ef7bf1c
...
@@ -243,7 +243,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
...
@@ -243,7 +243,7 @@ void mndGetMnodeEpSet(SMnode *pMnode, SEpSet *pEpSet) {
pEpSet
->
inUse
=
pEpSet
->
numOfEps
;
pEpSet
->
inUse
=
pEpSet
->
numOfEps
;
}
}
addEpIntoEpSet
(
pEpSet
,
pObj
->
pDnode
->
fqdn
,
htons
(
pObj
->
pDnode
->
port
)
);
addEpIntoEpSet
(
pEpSet
,
pObj
->
pDnode
->
fqdn
,
pObj
->
pDnode
->
port
);
sdbRelease
(
pSdb
,
pObj
);
sdbRelease
(
pSdb
,
pObj
);
}
}
}
}
...
@@ -620,39 +620,39 @@ static int32_t mndGetMnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
...
@@ -620,39 +620,39 @@ static int32_t mndGetMnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
12
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
12
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"role"
);
strcpy
(
pSchema
[
cols
].
name
,
"role"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"role_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"role_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
2ef7bf1c
...
@@ -184,15 +184,17 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter) {
...
@@ -184,15 +184,17 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter) {
}
}
static
int32_t
mndProcessConnectReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessConnectReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SUserObj
*
pUser
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SConnObj
*
pConn
=
NULL
;
SConnObj
*
pConn
=
NULL
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SConnectReq
connReq
=
{
0
};
SConnectReq
*
pConnReq
=
pReq
->
rpcMsg
.
pCont
;
pConnReq
->
pid
=
htonl
(
pConnReq
->
pid
);
if
(
tDeserializeSConnectReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
connReq
)
!=
0
)
{
pConnReq
->
startTime
=
htobe64
(
pConnReq
->
startTime
);
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CONN_OVER
;
}
SRpcConnInfo
info
=
{
0
};
SRpcConnInfo
info
=
{
0
};
if
(
rpcGetConnInfo
(
pReq
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
if
(
rpcGetConnInfo
(
pReq
->
rpcMsg
.
handle
,
&
info
)
!=
0
)
{
...
@@ -209,41 +211,42 @@ static int32_t mndProcessConnectReq(SMnodeMsg *pReq) {
...
@@ -209,41 +211,42 @@ static int32_t mndProcessConnectReq(SMnodeMsg *pReq) {
goto
CONN_OVER
;
goto
CONN_OVER
;
}
}
if
(
pConnReq
->
db
[
0
])
{
if
(
connReq
.
db
[
0
])
{
snprintf
(
pReq
->
db
,
TSDB_DB_FNAME_LEN
,
"%d%s%s"
,
pUser
->
acctId
,
TS_PATH_DELIMITER
,
pConnReq
->
db
);
snprintf
(
pReq
->
db
,
TSDB_DB_FNAME_LEN
,
"%d%s%s"
,
pUser
->
acctId
,
TS_PATH_DELIMITER
,
connReq
.
db
);
pDb
=
mndAcquireDb
(
pMnode
,
pReq
->
db
);
pDb
=
mndAcquireDb
(
pMnode
,
pReq
->
db
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB
;
terrno
=
TSDB_CODE_MND_INVALID_DB
;
mError
(
"user:%s, failed to login from %s while use db:%s since %s"
,
pReq
->
user
,
ip
,
pConnReq
->
db
,
terrstr
());
mError
(
"user:%s, failed to login from %s while use db:%s since %s"
,
pReq
->
user
,
ip
,
connReq
.
db
,
terrstr
());
goto
CONN_OVER
;
goto
CONN_OVER
;
}
}
}
}
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
pConnReq
->
pid
,
pConnReq
->
app
,
pConnReq
->
startTime
);
pConn
=
mndCreateConn
(
pMnode
,
&
info
,
connReq
.
pid
,
connReq
.
app
,
connReq
.
startTime
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pReq
->
user
,
ip
,
terrstr
());
mError
(
"user:%s, failed to login from %s while create connection since %s"
,
pReq
->
user
,
ip
,
terrstr
());
goto
CONN_OVER
;
goto
CONN_OVER
;
}
}
SConnectRsp
*
pRsp
=
rpcMallocCont
(
sizeof
(
SConnectRsp
));
SConnectRsp
connectRsp
=
{
0
};
if
(
pRsp
==
NULL
)
{
connectRsp
.
acctId
=
pUser
->
acctId
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
connectRsp
.
superUser
=
pUser
->
superUser
;
mError
(
"user:%s, failed to login from %s while create rsp since %s"
,
pReq
->
user
,
ip
,
terrstr
());
connectRsp
.
clusterId
=
pMnode
->
clusterId
;
goto
CONN_OVER
;
connectRsp
.
connId
=
pConn
->
id
;
}
pRsp
->
acctId
=
htonl
(
pUser
->
acctId
);
snprintf
(
connectRsp
.
sVersion
,
sizeof
(
connectRsp
.
sVersion
),
"ver:%s
\n
build:%s
\n
gitinfo:%s"
,
version
,
buildinfo
,
pRsp
->
superUser
=
pUser
->
superUser
;
gitinfo
);
pRsp
->
clusterId
=
htobe64
(
pMnode
->
clusterId
);
mndGetMnodeEpSet
(
pMnode
,
&
connectRsp
.
epSet
);
pRsp
->
connId
=
htonl
(
pConn
->
id
);
snprintf
(
pRsp
->
sVersion
,
tListLen
(
pRsp
->
sVersion
),
"ver:%s
\n
build:%s
\n
gitinfo:%s"
,
version
,
buildinfo
,
gitinfo
);
int32_t
contLen
=
tSerializeSConnectRsp
(
NULL
,
0
,
&
connectRsp
);
mndGetMnodeEpSet
(
pMnode
,
&
pRsp
->
epSet
);
if
(
contLen
<
0
)
goto
CONN_OVER
;
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
goto
CONN_OVER
;
tSerializeSConnectRsp
(
pRsp
,
contLen
,
&
connectRsp
);
pReq
->
contLen
=
sizeof
(
SConnectRsp
)
;
pReq
->
contLen
=
contLen
;
pReq
->
pCont
=
pRsp
;
pReq
->
pCont
=
pRsp
;
mDebug
(
"user:%s, login from %s, conn:%d, app:%s"
,
info
.
user
,
ip
,
pConn
->
id
,
pConnReq
->
app
);
mDebug
(
"user:%s, login from %s, conn:%d, app:%s"
,
info
.
user
,
ip
,
pConn
->
id
,
connReq
.
app
);
code
=
0
;
code
=
0
;
...
@@ -578,53 +581,53 @@ static int32_t mndGetConnsMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
...
@@ -578,53 +581,53 @@ static int32_t mndGetConnsMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
mndReleaseUser
(
pMnode
,
pUser
);
mndReleaseUser
(
pMnode
,
pUser
);
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"connId"
);
strcpy
(
pSchema
[
cols
].
name
,
"connId"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"user"
);
strcpy
(
pSchema
[
cols
].
name
,
"user"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
// app name
// app name
pShow
->
bytes
[
cols
]
=
TSDB_APP_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_APP_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"program"
);
strcpy
(
pSchema
[
cols
].
name
,
"program"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
// app pid
// app pid
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"pid"
);
strcpy
(
pSchema
[
cols
].
name
,
"pid"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"ip:port"
);
strcpy
(
pSchema
[
cols
].
name
,
"ip:port"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"login_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"login_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"last_access"
);
strcpy
(
pSchema
[
cols
].
name
,
"last_access"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
@@ -707,93 +710,93 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
...
@@ -707,93 +710,93 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
mndReleaseUser
(
pMnode
,
pUser
);
mndReleaseUser
(
pMnode
,
pUser
);
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"queryId"
);
strcpy
(
pSchema
[
cols
].
name
,
"queryId"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"connId"
);
strcpy
(
pSchema
[
cols
].
name
,
"connId"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"user"
);
strcpy
(
pSchema
[
cols
].
name
,
"user"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"ip:port"
);
strcpy
(
pSchema
[
cols
].
name
,
"ip:port"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
22
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
22
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"qid"
);
strcpy
(
pSchema
[
cols
].
name
,
"qid"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"created_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"created_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BIGINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BIGINT
;
strcpy
(
pSchema
[
cols
].
name
,
"time"
);
strcpy
(
pSchema
[
cols
].
name
,
"time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
QUERY_OBJ_ID_SIZE
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
QUERY_OBJ_ID_SIZE
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sql_obj_id"
);
strcpy
(
pSchema
[
cols
].
name
,
"sql_obj_id"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"pid"
);
strcpy
(
pSchema
[
cols
].
name
,
"pid"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"ep"
);
strcpy
(
pSchema
[
cols
].
name
,
"ep"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
1
;
pShow
->
bytes
[
cols
]
=
1
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BOOL
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BOOL
;
strcpy
(
pSchema
[
cols
].
name
,
"stable_query"
);
strcpy
(
pSchema
[
cols
].
name
,
"stable_query"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"sub_queries"
);
strcpy
(
pSchema
[
cols
].
name
,
"sub_queries"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SUBQUERY_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SUBQUERY_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sub_query_info"
);
strcpy
(
pSchema
[
cols
].
name
,
"sub_query_info"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sql"
);
strcpy
(
pSchema
[
cols
].
name
,
"sql"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
2ef7bf1c
...
@@ -433,27 +433,27 @@ static int32_t mndGetQnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
...
@@ -433,27 +433,27 @@ static int32_t mndGetQnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
2ef7bf1c
...
@@ -120,6 +120,7 @@ static int32_t mndProcessShowReq(SMnodeMsg *pReq) {
...
@@ -120,6 +120,7 @@ static int32_t mndProcessShowReq(SMnodeMsg *pReq) {
SShowMgmt
*
pMgmt
=
&
pMnode
->
showMgmt
;
SShowMgmt
*
pMgmt
=
&
pMnode
->
showMgmt
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SShowReq
showReq
=
{
0
};
SShowReq
showReq
=
{
0
};
SShowRsp
showRsp
=
{
0
};
if
(
tDeserializeSShowReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
showReq
)
!=
0
)
{
if
(
tDeserializeSShowReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
showReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
...
@@ -142,25 +143,26 @@ static int32_t mndProcessShowReq(SMnodeMsg *pReq) {
...
@@ -142,25 +143,26 @@ static int32_t mndProcessShowReq(SMnodeMsg *pReq) {
goto
SHOW_OVER
;
goto
SHOW_OVER
;
}
}
int32_t
size
=
sizeof
(
SShowRsp
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
+
TSDB_EXTRA_PAYLOAD_SIZE
;
showRsp
.
showId
=
pShow
->
id
;
SShowRsp
*
pRsp
=
rpcMallocCont
(
size
);
showRsp
.
tableMeta
.
pSchemas
=
calloc
(
TSDB_MAX_COLUMNS
,
sizeof
(
SSchema
)
);
if
(
pRsp
==
NULL
)
{
if
(
showRsp
.
tableMeta
.
pSchemas
==
NULL
)
{
mndReleaseShowObj
(
pShow
,
true
);
mndReleaseShowObj
(
pShow
,
true
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
SHOW_OVER
;
goto
SHOW_OVER
;
}
}
code
=
(
*
metaFp
)(
pReq
,
pShow
,
&
pRsp
->
tableMeta
);
code
=
(
*
metaFp
)(
pReq
,
pShow
,
&
showRsp
.
tableMeta
);
mDebug
(
"show:0x%"
PRIx64
", get meta finished, numOfRows:%d cols:%d showReq.type:%s, result:%s"
,
pShow
->
id
,
mDebug
(
"show:0x%"
PRIx64
", get meta finished, numOfRows:%d cols:%d showReq.type:%s, result:%s"
,
pShow
->
id
,
pShow
->
numOfRows
,
pShow
->
numOfColumns
,
mndShowStr
(
showReq
.
type
),
tstrerror
(
code
));
pShow
->
numOfRows
,
pShow
->
numOfColumns
,
mndShowStr
(
showReq
.
type
),
tstrerror
(
code
));
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
0
)
{
pReq
->
contLen
=
sizeof
(
SShowRsp
)
+
sizeof
(
SSchema
)
*
pShow
->
numOfColumns
;
int32_t
bufLen
=
tSerializeSShowRsp
(
NULL
,
0
,
&
showRsp
);
pReq
->
pCont
=
pRsp
;
void
*
pBuf
=
rpcMallocCont
(
bufLen
);
pRsp
->
showId
=
htobe64
(
pShow
->
id
);
tSerializeSShowRsp
(
pBuf
,
bufLen
,
&
showRsp
);
pReq
->
contLen
=
bufLen
;
pReq
->
pCont
=
pBuf
;
mndReleaseShowObj
(
pShow
,
false
);
mndReleaseShowObj
(
pShow
,
false
);
}
else
{
}
else
{
rpcFreeCont
(
pRsp
);
mndReleaseShowObj
(
pShow
,
true
);
mndReleaseShowObj
(
pShow
,
true
);
}
}
...
@@ -170,6 +172,7 @@ SHOW_OVER:
...
@@ -170,6 +172,7 @@ SHOW_OVER:
}
}
tFreeSShowReq
(
&
showReq
);
tFreeSShowReq
(
&
showReq
);
tFreeSShowRsp
(
&
showRsp
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
2ef7bf1c
...
@@ -436,27 +436,27 @@ static int32_t mndGetSnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
...
@@ -436,27 +436,27 @@ static int32_t mndGetSnodeMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
2
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
2ef7bf1c
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "mndStb.h"
#include "mndStb.h"
#include "mndAuth.h"
#include "mndDb.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndMnode.h"
#include "mndMnode.h"
...
@@ -27,7 +28,6 @@
...
@@ -27,7 +28,6 @@
#define TSDB_STB_VER_NUMBER 1
#define TSDB_STB_VER_NUMBER 1
#define TSDB_STB_RESERVE_SIZE 64
#define TSDB_STB_RESERVE_SIZE 64
static
SSdbRaw
*
mndStbActionEncode
(
SStbObj
*
pStb
);
static
SSdbRow
*
mndStbActionDecode
(
SSdbRaw
*
pRaw
);
static
SSdbRow
*
mndStbActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndStbActionInsert
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionInsert
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
...
@@ -69,7 +69,7 @@ int32_t mndInitStb(SMnode *pMnode) {
...
@@ -69,7 +69,7 @@ int32_t mndInitStb(SMnode *pMnode) {
void
mndCleanupStb
(
SMnode
*
pMnode
)
{}
void
mndCleanupStb
(
SMnode
*
pMnode
)
{}
static
SSdbRaw
*
mndStbActionEncode
(
SStbObj
*
pStb
)
{
SSdbRaw
*
mndStbActionEncode
(
SStbObj
*
pStb
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
int32_t
size
=
sizeof
(
SStbObj
)
+
(
pStb
->
numOfColumns
+
pStb
->
numOfTags
)
*
sizeof
(
SSchema
)
+
TSDB_STB_RESERVE_SIZE
;
int32_t
size
=
sizeof
(
SStbObj
)
+
(
pStb
->
numOfColumns
+
pStb
->
numOfTags
)
*
sizeof
(
SSchema
)
+
TSDB_STB_RESERVE_SIZE
;
...
@@ -343,7 +343,7 @@ static int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
...
@@ -343,7 +343,7 @@ static int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
return
-
1
;
return
-
1
;
}
}
SField
*
pField
=
taosArrayGet
(
pCreate
->
pColumns
,
0
)
;
SField
*
pField
=
taosArrayGet
(
pCreate
->
pColumns
,
0
);
if
(
pField
->
type
!=
TSDB_DATA_TYPE_TIMESTAMP
)
{
if
(
pField
->
type
!=
TSDB_DATA_TYPE_TIMESTAMP
)
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
return
-
1
;
...
@@ -549,12 +549,19 @@ static int32_t mndProcessMCreateStbReq(SMnodeMsg *pReq) {
...
@@ -549,12 +549,19 @@ static int32_t mndProcessMCreateStbReq(SMnodeMsg *pReq) {
SStbObj
*
pTopicStb
=
NULL
;
SStbObj
*
pTopicStb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateStbReq
createReq
=
{
0
};
SMCreateStbReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateStbReq
(
pReq
->
rpcMsg
.
pCont
,
&
createReq
)
==
NULL
)
goto
CREATE_STB_OVER
;
if
(
tDeserializeSMCreateStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_STB_OVER
;
}
mDebug
(
"stb:%s, start to create"
,
createReq
.
name
);
mDebug
(
"stb:%s, start to create"
,
createReq
.
name
);
if
(
mndCheckCreateStbReq
(
&
createReq
)
!=
0
)
goto
CREATE_STB_OVER
;
if
(
mndCheckCreateStbReq
(
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_STB_OVER
;
}
pStb
=
mndAcquireStb
(
pMnode
,
createReq
.
name
);
pStb
=
mndAcquireStb
(
pMnode
,
createReq
.
name
);
if
(
pStb
!=
NULL
)
{
if
(
pStb
!=
NULL
)
{
...
@@ -582,6 +589,15 @@ static int32_t mndProcessMCreateStbReq(SMnodeMsg *pReq) {
...
@@ -582,6 +589,15 @@ static int32_t mndProcessMCreateStbReq(SMnodeMsg *pReq) {
goto
CREATE_STB_OVER
;
goto
CREATE_STB_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
CREATE_STB_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
CREATE_STB_OVER
;
}
code
=
mndCreateStb
(
pMnode
,
pReq
,
&
createReq
,
pDb
);
code
=
mndCreateStb
(
pMnode
,
pReq
,
&
createReq
,
pDb
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
...
@@ -593,8 +609,8 @@ CREATE_STB_OVER:
...
@@ -593,8 +609,8 @@ CREATE_STB_OVER:
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseStb
(
pMnode
,
pTopicStb
);
mndReleaseStb
(
pMnode
,
pTopicStb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
taosArrayDestroy
(
createReq
.
pColumns
);
mndReleaseUser
(
pMnode
,
pUser
);
t
aosArrayDestroy
(
createReq
.
pTags
);
t
FreeSMCreateStbReq
(
&
createReq
);
return
code
;
return
code
;
}
}
...
@@ -965,7 +981,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SMnodeMsg *pReq, const SMAltertbReq *
...
@@ -965,7 +981,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SMnodeMsg *pReq, const SMAltertbReq *
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
NULL
;
STrans
*
pTrans
=
NULL
;
SField
*
pField0
=
taosArrayGet
(
pAlter
->
pFields
,
0
);
SField
*
pField0
=
taosArrayGet
(
pAlter
->
pFields
,
0
);
switch
(
pAlter
->
alterType
)
{
switch
(
pAlter
->
alterType
)
{
case
TSDB_ALTER_TABLE_ADD_TAG
:
case
TSDB_ALTER_TABLE_ADD_TAG
:
code
=
mndAddSuperTableTag
(
pOld
,
&
stbObj
,
pAlter
->
pFields
,
pAlter
->
numOfFields
);
code
=
mndAddSuperTableTag
(
pOld
,
&
stbObj
,
pAlter
->
pFields
,
pAlter
->
numOfFields
);
...
@@ -1020,9 +1036,13 @@ static int32_t mndProcessMAlterStbReq(SMnodeMsg *pReq) {
...
@@ -1020,9 +1036,13 @@ static int32_t mndProcessMAlterStbReq(SMnodeMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMAltertbReq
alterReq
=
{
0
};
SMAltertbReq
alterReq
=
{
0
};
if
(
tDeserializeSMAlterStbReq
(
pReq
->
rpcMsg
.
pCont
,
&
alterReq
)
==
NULL
)
goto
ALTER_STB_OVER
;
if
(
tDeserializeSMAlterStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
ALTER_STB_OVER
;
}
mDebug
(
"stb:%s, start to alter"
,
alterReq
.
name
);
mDebug
(
"stb:%s, start to alter"
,
alterReq
.
name
);
if
(
mndCheckAlterStbReq
(
&
alterReq
)
!=
0
)
goto
ALTER_STB_OVER
;
if
(
mndCheckAlterStbReq
(
&
alterReq
)
!=
0
)
goto
ALTER_STB_OVER
;
...
@@ -1039,6 +1059,15 @@ static int32_t mndProcessMAlterStbReq(SMnodeMsg *pReq) {
...
@@ -1039,6 +1059,15 @@ static int32_t mndProcessMAlterStbReq(SMnodeMsg *pReq) {
goto
ALTER_STB_OVER
;
goto
ALTER_STB_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
ALTER_STB_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
ALTER_STB_OVER
;
}
code
=
mndAlterStb
(
pMnode
,
pReq
,
&
alterReq
,
pDb
,
pStb
);
code
=
mndAlterStb
(
pMnode
,
pReq
,
&
alterReq
,
pDb
,
pStb
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
...
@@ -1049,6 +1078,7 @@ ALTER_STB_OVER:
...
@@ -1049,6 +1078,7 @@ ALTER_STB_OVER:
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
taosArrayDestroy
(
alterReq
.
pFields
);
taosArrayDestroy
(
alterReq
.
pFields
);
return
code
;
return
code
;
...
@@ -1135,43 +1165,60 @@ DROP_STB_OVER:
...
@@ -1135,43 +1165,60 @@ DROP_STB_OVER:
}
}
static
int32_t
mndProcessMDropStbReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessMDropStbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SMDropStbReq
dropReq
=
{
0
};
SMDropStbReq
dropReq
=
{
0
};
tDeserializeSMDropStbReq
(
pReq
->
rpcMsg
.
pCont
,
&
dropReq
);
if
(
tDeserializeSMDropStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_STB_OVER
;
}
mDebug
(
"stb:%s, start to drop"
,
dropReq
.
name
);
mDebug
(
"stb:%s, start to drop"
,
dropReq
.
name
);
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
dropReq
.
name
);
pStb
=
mndAcquireStb
(
pMnode
,
dropReq
.
name
);
if
(
pStb
==
NULL
)
{
if
(
pStb
==
NULL
)
{
if
(
dropReq
.
igNotExists
)
{
if
(
dropReq
.
igNotExists
)
{
mDebug
(
"stb:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
mDebug
(
"stb:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
return
0
;
code
=
0
;
goto
DROP_STB_OVER
;
}
else
{
}
else
{
terrno
=
TSDB_CODE_MND_STB_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_STB_NOT_EXIST
;
mError
(
"stb:%s, failed to drop since %s"
,
dropReq
.
name
,
terrstr
());
goto
DROP_STB_OVER
;
return
-
1
;
}
}
}
}
SDbObj
*
pDb
=
mndAcquireDbByStb
(
pMnode
,
dropReq
.
name
);
pDb
=
mndAcquireDbByStb
(
pMnode
,
dropReq
.
name
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
mndReleaseStb
(
pMnode
,
pStb
);
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
mError
(
"stb:%s, failed to drop since %s"
,
dropReq
.
name
,
terrstr
());
goto
DROP_STB_OVER
;
return
-
1
;
}
}
int32_t
code
=
mndDropStb
(
pMnode
,
pReq
,
pDb
,
pStb
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
mndReleaseDb
(
pMnode
,
pDb
);
if
(
pUser
==
NULL
)
{
mndReleaseStb
(
pMnode
,
pStb
);
goto
DROP_STB_OVER
;
}
if
(
code
!=
0
)
{
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
DROP_STB_OVER
;
}
code
=
mndDropStb
(
pMnode
,
pReq
,
pDb
,
pStb
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_STB_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"stb:%s, failed to drop since %s"
,
dropReq
.
name
,
terrstr
());
mError
(
"stb:%s, failed to drop since %s"
,
dropReq
.
name
,
terrstr
());
return
-
1
;
}
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
}
static
int32_t
mndProcessVDropStbRsp
(
SMnodeMsg
*
pRsp
)
{
static
int32_t
mndProcessVDropStbRsp
(
SMnodeMsg
*
pRsp
)
{
...
@@ -1179,195 +1226,163 @@ static int32_t mndProcessVDropStbRsp(SMnodeMsg *pRsp) {
...
@@ -1179,195 +1226,163 @@ static int32_t mndProcessVDropStbRsp(SMnodeMsg *pRsp) {
return
0
;
return
0
;
}
}
static
int32_t
mndProcessStbMetaReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndBuildStbSchemaImp
(
SDbObj
*
pDb
,
SStbObj
*
pStb
,
const
char
*
tbName
,
STableMetaRsp
*
pRsp
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
STableInfoReq
*
pInfo
=
pReq
->
rpcMsg
.
pCont
;
char
tbFName
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
snprintf
(
tbFName
,
sizeof
(
tbFName
),
"%s.%s"
,
pInfo
->
dbFName
,
pInfo
->
tbName
);
mDebug
(
"stb:%s, start to retrieve meta"
,
tbFName
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pInfo
->
dbFName
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
mError
(
"stb:%s, failed to retrieve meta since %s"
,
tbFName
,
terrstr
());
return
-
1
;
}
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
tbFName
);
if
(
pStb
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
terrno
=
TSDB_CODE_MND_INVALID_STB
;
mError
(
"stb:%s, failed to get meta since %s"
,
tbFName
,
terrstr
());
return
-
1
;
}
taosRLockLatch
(
&
pStb
->
lock
);
taosRLockLatch
(
&
pStb
->
lock
);
int32_t
totalCols
=
pStb
->
numOfColumns
+
pStb
->
numOfTags
;
int32_t
contLen
=
sizeof
(
STableMetaRsp
)
+
totalCols
*
sizeof
(
SSchema
);
STableMetaRsp
*
pMeta
=
rpcMallocCont
(
contLen
);
int32_t
totalCols
=
pStb
->
numOfColumns
+
pStb
->
numOfTags
;
if
(
pMeta
==
NULL
)
{
pRsp
->
pSchemas
=
calloc
(
totalCols
,
sizeof
(
SSchema
));
if
(
pRsp
->
pSchemas
==
NULL
)
{
taosRUnLockLatch
(
&
pStb
->
lock
);
taosRUnLockLatch
(
&
pStb
->
lock
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseStb
(
pMnode
,
pStb
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"stb:%s, failed to get meta since %s"
,
tbFName
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
strcpy
(
p
Meta
->
dbFName
,
pStb
->
db
);
strcpy
(
p
Rsp
->
dbFName
,
pStb
->
db
);
strcpy
(
p
Meta
->
tbName
,
pInfo
->
tbName
);
strcpy
(
p
Rsp
->
tbName
,
tbName
);
strcpy
(
p
Meta
->
stbName
,
pInfo
->
tbName
);
strcpy
(
p
Rsp
->
stbName
,
tbName
);
p
Meta
->
dbId
=
htobe64
(
pDb
->
uid
)
;
p
Rsp
->
dbId
=
pDb
->
uid
;
p
Meta
->
numOfTags
=
htonl
(
pStb
->
numOfTags
)
;
p
Rsp
->
numOfTags
=
pStb
->
numOfTags
;
p
Meta
->
numOfColumns
=
htonl
(
pStb
->
numOfColumns
)
;
p
Rsp
->
numOfColumns
=
pStb
->
numOfColumns
;
p
Meta
->
precision
=
pDb
->
cfg
.
precision
;
p
Rsp
->
precision
=
pDb
->
cfg
.
precision
;
p
Meta
->
tableType
=
TSDB_SUPER_TABLE
;
p
Rsp
->
tableType
=
TSDB_SUPER_TABLE
;
p
Meta
->
update
=
pDb
->
cfg
.
update
;
p
Rsp
->
update
=
pDb
->
cfg
.
update
;
p
Meta
->
sversion
=
htonl
(
pStb
->
version
)
;
p
Rsp
->
sversion
=
pStb
->
version
;
p
Meta
->
suid
=
htobe64
(
pStb
->
uid
)
;
p
Rsp
->
suid
=
pStb
->
uid
;
p
Meta
->
tuid
=
htobe64
(
pStb
->
uid
)
;
p
Rsp
->
tuid
=
pStb
->
uid
;
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfColumns
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfColumns
;
++
i
)
{
SSchema
*
pSchema
=
&
p
Meta
->
pSchema
[
i
];
SSchema
*
pSchema
=
&
p
Rsp
->
pSchemas
[
i
];
SSchema
*
pSrcSchema
=
&
pStb
->
pColumns
[
i
];
SSchema
*
pSrcSchema
=
&
pStb
->
pColumns
[
i
];
memcpy
(
pSchema
->
name
,
pSrcSchema
->
name
,
TSDB_COL_NAME_LEN
);
memcpy
(
pSchema
->
name
,
pSrcSchema
->
name
,
TSDB_COL_NAME_LEN
);
pSchema
->
type
=
pSrcSchema
->
type
;
pSchema
->
type
=
pSrcSchema
->
type
;
pSchema
->
colId
=
htonl
(
pSrcSchema
->
colId
)
;
pSchema
->
colId
=
pSrcSchema
->
colId
;
pSchema
->
bytes
=
htonl
(
pSrcSchema
->
bytes
)
;
pSchema
->
bytes
=
pSrcSchema
->
bytes
;
}
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfTags
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
&
p
Meta
->
pSchema
[
i
+
pStb
->
numOfColumns
];
SSchema
*
pSchema
=
&
p
Rsp
->
pSchemas
[
i
+
pStb
->
numOfColumns
];
SSchema
*
pSrcSchema
=
&
pStb
->
pTags
[
i
];
SSchema
*
pSrcSchema
=
&
pStb
->
pTags
[
i
];
memcpy
(
pSchema
->
name
,
pSrcSchema
->
name
,
TSDB_COL_NAME_LEN
);
memcpy
(
pSchema
->
name
,
pSrcSchema
->
name
,
TSDB_COL_NAME_LEN
);
pSchema
->
type
=
pSrcSchema
->
type
;
pSchema
->
type
=
pSrcSchema
->
type
;
pSchema
->
colId
=
htonl
(
pSrcSchema
->
colId
)
;
pSchema
->
colId
=
pSrcSchema
->
colId
;
pSchema
->
bytes
=
htonl
(
pSrcSchema
->
bytes
)
;
pSchema
->
bytes
=
pSrcSchema
->
bytes
;
}
}
taosRUnLockLatch
(
&
pStb
->
lock
);
taosRUnLockLatch
(
&
pStb
->
lock
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseStb
(
pMnode
,
pStb
);
pReq
->
pCont
=
pMeta
;
pReq
->
contLen
=
contLen
;
mDebug
(
"stb:%s, meta is retrieved, cols:%d tags:%d"
,
tbFName
,
pStb
->
numOfColumns
,
pStb
->
numOfTags
);
return
0
;
return
0
;
}
}
int32_t
mndValidateStbInfo
(
SMnode
*
pMnode
,
SSTableMetaVersion
*
stbs
,
int32_t
num
,
void
**
rsp
,
int32_t
*
rspLen
)
{
static
int32_t
mndBuildStbSchema
(
SMnode
*
pMnode
,
const
char
*
dbFName
,
const
char
*
tbName
,
STableMetaRsp
*
pRsp
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
char
tbFName
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
int32_t
bufSize
=
num
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
snprintf
(
tbFName
,
sizeof
(
tbFName
),
"%s.%s"
,
dbFName
,
tbName
);
void
*
buf
=
malloc
(
bufSize
);
int32_t
len
=
0
;
int32_t
contLen
=
0
;
STableMetaRsp
*
pRsp
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SSTableMetaVersion
*
stb
=
&
stbs
[
i
];
stb
->
suid
=
be64toh
(
stb
->
suid
);
stb
->
sversion
=
ntohs
(
stb
->
sversion
);
stb
->
tversion
=
ntohs
(
stb
->
tversion
);
if
((
contLen
+
sizeof
(
STableMetaRsp
))
>
bufSize
)
{
bufSize
=
contLen
+
(
num
-
i
)
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
buf
=
realloc
(
buf
,
bufSize
);
}
pRsp
=
(
STableMetaRsp
*
)((
char
*
)
buf
+
contLen
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
dbFName
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
return
-
1
;
}
strcpy
(
pRsp
->
dbFName
,
stb
->
dbFName
);
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
tbFName
);
strcpy
(
pRsp
->
tbName
,
stb
->
stbName
);
if
(
pStb
==
NULL
)
{
strcpy
(
pRsp
->
stbName
,
stb
->
stbName
);
mndReleaseDb
(
pMnode
,
pDb
);
terrno
=
TSDB_CODE_MND_INVALID_STB
;
return
-
1
;
}
mDebug
(
"start to retrieve meta, db:%s, stb:%s"
,
stb
->
dbFName
,
stb
->
stbName
);
int32_t
code
=
mndBuildStbSchemaImp
(
pDb
,
pStb
,
tbName
,
pRsp
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseStb
(
pMnode
,
pStb
);
return
code
;
}
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
stb
->
dbFName
);
static
int32_t
mndProcessStbMetaReq
(
SMnodeMsg
*
pReq
)
{
if
(
pDb
==
NULL
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
pRsp
->
numOfColumns
=
-
1
;
int32_t
code
=
-
1
;
pRsp
->
suid
=
htobe64
(
stb
->
suid
);
STableInfoReq
infoReq
=
{
0
};
contLen
+=
sizeof
(
STableMetaRsp
);
STableMetaRsp
metaRsp
=
{
0
};
mWarn
(
"db:%s, failed to require db since %s"
,
stb
->
dbFName
,
terrstr
());
continue
;
}
char
tbFName
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
if
(
tDeserializeSTableInfoReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
infoReq
)
!=
0
)
{
snprintf
(
tbFName
,
sizeof
(
tbFName
),
"%s.%s"
,
stb
->
dbFName
,
stb
->
stbName
);
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
RETRIEVE_META_OVER
;
}
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
tbFName
);
mDebug
(
"stb:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
if
(
pStb
==
NULL
)
{
if
(
mndBuildStbSchema
(
pMnode
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
&
metaRsp
)
!=
0
)
{
mndReleaseDb
(
pMnode
,
pDb
);
goto
RETRIEVE_META_OVER
;
pRsp
->
numOfColumns
=
-
1
;
}
pRsp
->
suid
=
htobe64
(
stb
->
suid
);
contLen
+=
sizeof
(
STableMetaRsp
);
mWarn
(
"stb:%s, failed to get meta since %s"
,
tbFName
,
terrstr
());
continue
;
}
taosRLockLatch
(
&
pStb
->
lock
);
int32_t
rspLen
=
tSerializeSTableMetaRsp
(
NULL
,
0
,
&
metaRsp
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
RETRIEVE_META_OVER
;
}
if
(
stb
->
suid
==
pStb
->
uid
&&
stb
->
sversion
==
pStb
->
version
)
{
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
taosRUnLockLatch
(
&
pStb
->
lock
);
if
(
pRsp
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mndReleaseStb
(
pMnode
,
pStb
);
goto
RETRIEVE_META_OVER
;
continue
;
}
}
int32_t
totalCols
=
pStb
->
numOfColumns
+
pStb
->
numOfTags
;
tSerializeSTableMetaRsp
(
pRsp
,
rspLen
,
&
metaRsp
);
int32_t
len
=
totalCols
*
sizeof
(
SSchema
);
pReq
->
pCont
=
pRsp
;
pReq
->
contLen
=
rspLen
;
code
=
0
;
contLen
+=
sizeof
(
STableMetaRsp
)
+
len
;
mDebug
(
"stb:%s.%s, meta is retrieved"
,
infoReq
.
dbFName
,
infoReq
.
tbName
)
;
if
(
contLen
>
bufSize
)
{
RETRIEVE_META_OVER:
bufSize
=
contLen
+
(
num
-
i
-
1
)
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
if
(
code
!=
0
)
{
buf
=
realloc
(
buf
,
bufSize
);
mError
(
"stb:%s.%s, failed to retrieve meta since %s"
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
terrstr
()
);
}
}
pRsp
->
numOfTags
=
htonl
(
pStb
->
numOfTags
);
tFreeSTableMetaRsp
(
&
metaRsp
);
pRsp
->
numOfColumns
=
htonl
(
pStb
->
numOfColumns
);
return
code
;
pRsp
->
precision
=
pDb
->
cfg
.
precision
;
}
pRsp
->
tableType
=
TSDB_SUPER_TABLE
;
pRsp
->
update
=
pDb
->
cfg
.
update
;
int32_t
mndValidateStbInfo
(
SMnode
*
pMnode
,
SSTableMetaVersion
*
pStbVersions
,
int32_t
numOfStbs
,
void
**
ppRsp
,
pRsp
->
sversion
=
htonl
(
pStb
->
version
);
int32_t
*
pRspLen
)
{
pRsp
->
suid
=
htobe64
(
pStb
->
uid
);
STableMetaBatchRsp
batchMetaRsp
=
{
0
};
pRsp
->
tuid
=
htobe64
(
pStb
->
uid
);
batchMetaRsp
.
pArray
=
taosArrayInit
(
numOfStbs
,
sizeof
(
STableMetaRsp
));
if
(
batchMetaRsp
.
pArray
==
NULL
)
{
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfColumns
;
++
i
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
SSchema
*
pSchema
=
&
pRsp
->
pSchema
[
i
];
return
-
1
;
SSchema
*
pSrcSchema
=
&
pStb
->
pColumns
[
i
];
}
memcpy
(
pSchema
->
name
,
pSrcSchema
->
name
,
TSDB_COL_NAME_LEN
);
pSchema
->
type
=
pSrcSchema
->
type
;
for
(
int32_t
i
=
0
;
i
<
numOfStbs
;
++
i
)
{
pSchema
->
colId
=
htonl
(
pSrcSchema
->
colId
);
SSTableMetaVersion
*
pStbVersion
=
&
pStbVersions
[
i
];
pSchema
->
bytes
=
htonl
(
pSrcSchema
->
bytes
);
pStbVersion
->
suid
=
be64toh
(
pStbVersion
->
suid
);
pStbVersion
->
sversion
=
ntohs
(
pStbVersion
->
sversion
);
pStbVersion
->
tversion
=
ntohs
(
pStbVersion
->
tversion
);
STableMetaRsp
metaRsp
=
{
0
};
mDebug
(
"stb:%s.%s, start to retrieve meta"
,
pStbVersion
->
dbFName
,
pStbVersion
->
stbName
);
if
(
mndBuildStbSchema
(
pMnode
,
pStbVersion
->
dbFName
,
pStbVersion
->
stbName
,
&
metaRsp
)
!=
0
)
{
metaRsp
.
numOfColumns
=
-
1
;
metaRsp
.
suid
=
pStbVersion
->
suid
;
}
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfTags
;
++
i
)
{
if
(
pStbVersion
->
sversion
!=
metaRsp
.
sversion
)
{
SSchema
*
pSchema
=
&
pRsp
->
pSchema
[
i
+
pStb
->
numOfColumns
];
taosArrayPush
(
batchMetaRsp
.
pArray
,
&
metaRsp
);
SSchema
*
pSrcSchema
=
&
pStb
->
pTags
[
i
];
memcpy
(
pSchema
->
name
,
pSrcSchema
->
name
,
TSDB_COL_NAME_LEN
);
pSchema
->
type
=
pSrcSchema
->
type
;
pSchema
->
colId
=
htonl
(
pSrcSchema
->
colId
);
pSchema
->
bytes
=
htonl
(
pSrcSchema
->
bytes
);
}
}
}
taosRUnLockLatch
(
&
pStb
->
lock
);
int32_t
rspLen
=
tSerializeSTableMetaBatchRsp
(
NULL
,
0
,
&
batchMetaRsp
);
mndReleaseDb
(
pMnode
,
pDb
);
if
(
rspLen
<
0
)
{
mndReleaseStb
(
pMnode
,
pStb
);
tFreeSTableMetaBatchRsp
(
&
batchMetaRsp
);
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
}
if
(
contLen
>
0
)
{
void
*
pRsp
=
malloc
(
rspLen
);
*
rsp
=
buf
;
if
(
pRsp
==
NULL
)
{
*
rspLen
=
contLen
;
tFreeSTableMetaBatchRsp
(
&
batchMetaRsp
);
}
else
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
*
rsp
=
NULL
;
return
-
1
;
tfree
(
buf
);
*
rspLen
=
0
;
}
}
tSerializeSTableMetaBatchRsp
(
pRsp
,
rspLen
,
&
batchMetaRsp
);
*
ppRsp
=
pRsp
;
*
pRspLen
=
rspLen
;
return
0
;
return
0
;
}
}
...
@@ -1407,33 +1422,33 @@ static int32_t mndGetStbMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pM
...
@@ -1407,33 +1422,33 @@ static int32_t mndGetStbMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pM
}
}
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"columns"
);
strcpy
(
pSchema
[
cols
].
name
,
"columns"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"tags"
);
strcpy
(
pSchema
[
cols
].
name
,
"tags"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
@@ -1482,7 +1497,7 @@ static int32_t mndRetrieveStb(SMnodeMsg *pReq, SShowObj *pShow, char *data, int3
...
@@ -1482,7 +1497,7 @@ static int32_t mndRetrieveStb(SMnodeMsg *pReq, SShowObj *pShow, char *data, int3
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
pStb
->
dbUid
!=
pDb
->
uid
)
{
if
(
pStb
->
dbUid
!=
pDb
->
uid
)
{
if
(
strncmp
(
pStb
->
db
,
pDb
->
name
,
tListLen
(
pStb
->
db
)
)
==
0
)
{
if
(
strncmp
(
pStb
->
db
,
pDb
->
name
,
prefixLen
)
==
0
)
{
mError
(
"Inconsistent table data, name:%s, db:%s, dbUid:%"
PRIu64
,
pStb
->
name
,
pDb
->
name
,
pDb
->
uid
);
mError
(
"Inconsistent table data, name:%s, db:%s, dbUid:%"
PRIu64
,
pStb
->
name
,
pDb
->
name
,
pDb
->
uid
);
}
}
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
2ef7bf1c
...
@@ -302,7 +302,10 @@ static int32_t mndProcessCreateUserReq(SMnodeMsg *pReq) {
...
@@ -302,7 +302,10 @@ static int32_t mndProcessCreateUserReq(SMnodeMsg *pReq) {
SUserObj
*
pOperUser
=
NULL
;
SUserObj
*
pOperUser
=
NULL
;
SCreateUserReq
createReq
=
{
0
};
SCreateUserReq
createReq
=
{
0
};
if
(
tDeserializeSCreateUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
goto
CREATE_USER_OVER
;
if
(
tDeserializeSCreateUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_USER_OVER
;
}
mDebug
(
"user:%s, start to create"
,
createReq
.
user
);
mDebug
(
"user:%s, start to create"
,
createReq
.
user
);
...
@@ -402,7 +405,10 @@ static int32_t mndProcessAlterUserReq(SMnodeMsg *pReq) {
...
@@ -402,7 +405,10 @@ static int32_t mndProcessAlterUserReq(SMnodeMsg *pReq) {
SUserObj
newUser
=
{
0
};
SUserObj
newUser
=
{
0
};
SAlterUserReq
alterReq
=
{
0
};
SAlterUserReq
alterReq
=
{
0
};
if
(
tDeserializeSAlterUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
goto
ALTER_USER_OVER
;
if
(
tDeserializeSAlterUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
ALTER_USER_OVER
;
}
mDebug
(
"user:%s, start to alter"
,
alterReq
.
user
);
mDebug
(
"user:%s, start to alter"
,
alterReq
.
user
);
...
@@ -537,7 +543,10 @@ static int32_t mndProcessDropUserReq(SMnodeMsg *pReq) {
...
@@ -537,7 +543,10 @@ static int32_t mndProcessDropUserReq(SMnodeMsg *pReq) {
SUserObj
*
pOperUser
=
NULL
;
SUserObj
*
pOperUser
=
NULL
;
SDropUserReq
dropReq
=
{
0
};
SDropUserReq
dropReq
=
{
0
};
if
(
tDeserializeSDropUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
goto
DROP_USER_OVER
;
if
(
tDeserializeSDropUserReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_USER_OVER
;
}
mDebug
(
"user:%s, start to drop"
,
dropReq
.
user
);
mDebug
(
"user:%s, start to drop"
,
dropReq
.
user
);
...
@@ -583,7 +592,10 @@ static int32_t mndProcessGetUserAuthReq(SMnodeMsg *pReq) {
...
@@ -583,7 +592,10 @@ static int32_t mndProcessGetUserAuthReq(SMnodeMsg *pReq) {
SGetUserAuthReq
authReq
=
{
0
};
SGetUserAuthReq
authReq
=
{
0
};
SGetUserAuthRsp
authRsp
=
{
0
};
SGetUserAuthRsp
authRsp
=
{
0
};
if
(
tDeserializeSGetUserAuthReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
authReq
)
!=
0
)
goto
GET_AUTH_OVER
;
if
(
tDeserializeSGetUserAuthReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
authReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
GET_AUTH_OVER
;
}
mTrace
(
"user:%s, start to get auth"
,
authReq
.
user
);
mTrace
(
"user:%s, start to get auth"
,
authReq
.
user
);
...
@@ -640,33 +652,33 @@ static int32_t mndGetUserMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *p
...
@@ -640,33 +652,33 @@ static int32_t mndGetUserMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *p
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
s
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
10
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
10
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"privilege"
);
strcpy
(
pSchema
[
cols
].
name
,
"privilege"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"account"
);
strcpy
(
pSchema
[
cols
].
name
,
"account"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
])
;
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
]
;
cols
++
;
cols
++
;
pMeta
->
numOfColumns
=
htonl
(
cols
)
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
pShow
->
offset
[
0
]
=
0
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/show/show.cpp
浏览文件 @
2ef7bf1c
...
@@ -54,12 +54,14 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) {
...
@@ -54,12 +54,14 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) {
}
}
TEST_F
(
MndTestShow
,
03
_ShowMsg_Conn
)
{
TEST_F
(
MndTestShow
,
03
_ShowMsg_Conn
)
{
int32_t
contLen
=
sizeof
(
SConnectReq
);
SConnectReq
connectReq
=
{
0
};
connectReq
.
pid
=
1234
;
strcpy
(
connectReq
.
app
,
"mnode_test_show"
);
strcpy
(
connectReq
.
db
,
""
);
SConnectReq
*
pReq
=
(
SConnectReq
*
)
rpcMallocCont
(
contLen
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
pReq
->
pid
=
htonl
(
1234
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
app
,
"mnode_test_show"
);
tSerializeSConnectReq
(
pReq
,
contLen
,
&
connectReq
);
strcpy
(
pReq
->
db
,
""
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CONNECT
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_CONNECT
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tq.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/catalog/src/catalog.c
浏览文件 @
2ef7bf1c
...
@@ -1440,7 +1440,7 @@ int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTransporter, const SEpSet* pMgm
...
@@ -1440,7 +1440,7 @@ int32_t ctgRefreshTblMeta(SCatalog* pCtg, void *pTransporter, const SEpSet* pMgm
SCtgUpdateTblMsg
*
msg
=
NULL
;
SCtgUpdateTblMsg
*
msg
=
NULL
;
STableMetaOutput
moutput
=
{
0
};
STableMetaOutput
moutput
=
{
0
};
STableMetaOutput
*
output
=
malloc
(
sizeof
(
STableMetaOutput
));
STableMetaOutput
*
output
=
calloc
(
1
,
sizeof
(
STableMetaOutput
));
if
(
NULL
==
output
)
{
if
(
NULL
==
output
)
{
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
STableMetaOutput
));
ctgError
(
"malloc %d failed"
,
(
int32_t
)
sizeof
(
STableMetaOutput
));
CTG_ERR_RET
(
TSDB_CODE_CTG_MEM_ERROR
);
CTG_ERR_RET
(
TSDB_CODE_CTG_MEM_ERROR
);
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/executor/inc/executil.h
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/executor/inc/executorimpl.h
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/executor/src/executil.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/executor/src/executorimpl.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/executor/test/executorTests.cpp
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/function/inc/thistogram.h
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/function/inc/tpercentile.h
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/function/src/thistogram.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/function/src/tpercentile.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/parser/inc/new_sql.y
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/parser/src/astToMsg.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/parser/src/new_sql.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/parser/src/parserImpl.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/parser/test/newParserTest.cpp
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/planner/src/physicalPlan.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/planner/src/physicalPlanJson.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/qcom/src/querymsg.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/qworker/src/qworkerMsg.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/util/src/tlosertree.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/util/src/tpaged
file
.c
→
source/util/src/tpaged
buf
.c
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
source/util/test/pageBufferTest.cpp
0 → 100644
浏览文件 @
2ef7bf1c
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录