Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bffdb7a8
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
bffdb7a8
编写于
2月 17, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into feature/qnode
上级
75ede63c
2b38bed1
变更
146
展开全部
隐藏空白更改
内联
并排
Showing
146 changed file
with
10856 addition
and
5854 deletion
+10856
-5854
.clang-format
.clang-format
+1
-1
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
example/src/tmq.c
example/src/tmq.c
+75
-49
include/client/taos.h
include/client/taos.h
+89
-86
include/common/common.h
include/common/common.h
+71
-53
include/common/taosdef.h
include/common/taosdef.h
+7
-7
include/common/tep.h
include/common/tep.h
+81
-0
include/common/tmsg.h
include/common/tmsg.h
+271
-328
include/common/tmsgdef.h
include/common/tmsgdef.h
+5
-3
include/common/trow.h
include/common/trow.h
+1
-1
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+1
-4
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+8
-3
include/libs/nodes/nodesShowStmts.h
include/libs/nodes/nodesShowStmts.h
+0
-0
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+14
-11
include/libs/parser/parsenodes.h
include/libs/parser/parsenodes.h
+1
-1
include/libs/planner/plannerOp.h
include/libs/planner/plannerOp.h
+1
-1
include/util/taoserror.h
include/util/taoserror.h
+1
-0
include/util/tcoding.h
include/util/tcoding.h
+25
-27
include/util/tlosertree.h
include/util/tlosertree.h
+16
-13
include/util/tpagedbuf.h
include/util/tpagedbuf.h
+171
-0
source/CMakeLists.txt
source/CMakeLists.txt
+1
-2
source/client/src/clientHb.c
source/client/src/clientHb.c
+32
-60
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+19
-21
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+45
-58
source/client/src/tmq.c
source/client/src/tmq.c
+57
-18
source/common/src/tep.c
source/common/src/tep.c
+979
-36
source/common/src/tmsg.c
source/common/src/tmsg.c
+1192
-193
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/src/dndBnode.c
source/dnode/mgmt/impl/src/dndBnode.c
+14
-8
source/dnode/mgmt/impl/src/dndMgmt.c
source/dnode/mgmt/impl/src/dndMgmt.c
+5
-8
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+20
-19
source/dnode/mgmt/impl/src/dndQnode.c
source/dnode/mgmt/impl/src/dndQnode.c
+14
-8
source/dnode/mgmt/impl/src/dndSnode.c
source/dnode/mgmt/impl/src/dndSnode.c
+14
-8
source/dnode/mgmt/impl/src/dndTransport.c
source/dnode/mgmt/impl/src/dndTransport.c
+15
-12
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+58
-96
source/dnode/mgmt/impl/test/bnode/dbnode.cpp
source/dnode/mgmt/impl/test/bnode/dbnode.cpp
+45
-28
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
+95
-74
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
+45
-27
source/dnode/mgmt/impl/test/snode/dsnode.cpp
source/dnode/mgmt/impl/test/snode/dsnode.cpp
+45
-27
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
+38
-31
source/dnode/mgmt/impl/test/vnode/vnode.cpp
source/dnode/mgmt/impl/test/vnode/vnode.cpp
+105
-97
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
+2
-2
source/dnode/mnode/impl/inc/mndStb.h
source/dnode/mnode/impl/inc/mndStb.h
+6
-7
source/dnode/mnode/impl/inc/mndVgroup.h
source/dnode/mnode/impl/inc/mndVgroup.h
+2
-2
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+42
-6
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+26
-14
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
+350
-212
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+24
-24
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
+35
-44
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+98
-90
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+26
-14
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+44
-33
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+27
-15
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+196
-181
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+42
-40
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+171
-105
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+7
-1
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
+73
-56
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+19
-4
source/dnode/mnode/impl/test/CMakeLists.txt
source/dnode/mnode/impl/test/CMakeLists.txt
+1
-0
source/dnode/mnode/impl/test/acct/acct.cpp
source/dnode/mnode/impl/test/acct/acct.cpp
+6
-3
source/dnode/mnode/impl/test/db/db.cpp
source/dnode/mnode/impl/test/db/db.cpp
+104
-95
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+78
-72
source/dnode/mnode/impl/test/show/show.cpp
source/dnode/mnode/impl/test/show/show.cpp
+20
-14
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+79
-90
source/dnode/mnode/impl/test/topic/CMakeLists.txt
source/dnode/mnode/impl/test/topic/CMakeLists.txt
+11
-0
source/dnode/mnode/impl/test/topic/topic.cpp
source/dnode/mnode/impl/test/topic/topic.cpp
+177
-0
source/dnode/mnode/impl/test/user/user.cpp
source/dnode/mnode/impl/test/user/user.cpp
+25
-23
source/dnode/vnode/inc/tq.h
source/dnode/vnode/inc/tq.h
+1
-1
source/dnode/vnode/inc/tsdb.h
source/dnode/vnode/inc/tsdb.h
+1
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+10
-10
source/dnode/vnode/src/inc/tqInt.h
source/dnode/vnode/src/inc/tqInt.h
+12
-8
source/dnode/vnode/src/inc/tqMetaStore.h
source/dnode/vnode/src/inc/tqMetaStore.h
+2
-2
source/dnode/vnode/src/inc/tqOffset.h
source/dnode/vnode/src/inc/tqOffset.h
+40
-0
source/dnode/vnode/src/inc/tsdbMemTable.h
source/dnode/vnode/src/inc/tsdbMemTable.h
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+250
-193
source/dnode/vnode/src/tq/tqMetaStore.c
source/dnode/vnode/src/tq/tqMetaStore.c
+15
-17
source/dnode/vnode/src/tq/tqOffset.c
source/dnode/vnode/src/tq/tqOffset.c
+24
-2
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+160
-0
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+35
-34
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+6
-6
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+8
-8
source/dnode/vnode/src/tsdb/tsdbWrite.c
source/dnode/vnode/src/tsdb/tsdbWrite.c
+1
-1
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+40
-27
source/dnode/vnode/src/vnd/vnodeWrite.c
source/dnode/vnode/src/vnd/vnodeWrite.c
+7
-20
source/libs/CMakeLists.txt
source/libs/CMakeLists.txt
+1
-0
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
+202
-189
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/functionMgt.c
source/libs/function/src/functionMgt.c
+13
-8
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/nodes/CMakeLists.txt
source/libs/nodes/CMakeLists.txt
+1
-1
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+191
-0
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+0
-1
source/libs/nodes/src/nodesEqualFuncs.c
source/libs/nodes/src/nodesEqualFuncs.c
+0
-8
source/libs/nodes/src/nodesTraverseFuncs.c
source/libs/nodes/src/nodesTraverseFuncs.c
+0
-6
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+0
-2
source/libs/nodes/test/CMakeLists.txt
source/libs/nodes/test/CMakeLists.txt
+0
-0
source/libs/nodes/test/nodesTest.cpp
source/libs/nodes/test/nodesTest.cpp
+0
-0
source/libs/parser/inc/astCreateFuncs.h
source/libs/parser/inc/astCreateFuncs.h
+0
-1
source/libs/parser/inc/astToMsg.h
source/libs/parser/inc/astToMsg.h
+21
-7
source/libs/parser/inc/dataBlockMgt.h
source/libs/parser/inc/dataBlockMgt.h
+2
-2
source/libs/parser/inc/new_sql.y
source/libs/parser/inc/new_sql.y
+62
-15
source/libs/parser/inc/parserImpl.h
source/libs/parser/inc/parserImpl.h
+11
-4
source/libs/parser/src/astCreateFuncs.c
source/libs/parser/src/astCreateFuncs.c
+9
-9
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+183
-59
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+22
-113
source/libs/parser/src/dataBlockMgt.c
source/libs/parser/src/dataBlockMgt.c
+1
-1
source/libs/parser/src/insertParser.c
source/libs/parser/src/insertParser.c
+2
-2
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
+86
-33
source/libs/parser/test/insertParserTest.cpp
source/libs/parser/test/insertParserTest.cpp
+2
-2
source/libs/parser/test/newParserTest.cpp
source/libs/parser/test/newParserTest.cpp
+40
-1
source/libs/planner/CMakeLists.txt
source/libs/planner/CMakeLists.txt
+1
-1
source/libs/planner/inc/plannerImpl.h
source/libs/planner/inc/plannerImpl.h
+27
-0
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/planner/src/plannerImpl.c
source/libs/planner/src/plannerImpl.c
+187
-2
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+116
-150
source/libs/qworker/src/qworkerMsg.c
source/libs/qworker/src/qworkerMsg.c
+25
-16
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+1
-1
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+1
-1
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+1
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+68
-50
source/libs/transport/test/rclient.c
source/libs/transport/test/rclient.c
+1
-1
source/util/src/terror.c
source/util/src/terror.c
+1
-1
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
未找到文件。
.clang-format
浏览文件 @
bffdb7a8
...
@@ -5,6 +5,7 @@ AccessModifierOffset: -1
...
@@ -5,6 +5,7 @@ AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignEscapedNewlinesLeft: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignOperands: true
AlignTrailingComments: true
AlignTrailingComments: true
...
@@ -86,6 +87,5 @@ SpacesInSquareBrackets: false
...
@@ -86,6 +87,5 @@ SpacesInSquareBrackets: false
Standard: Auto
Standard: Auto
TabWidth: 8
TabWidth: 8
UseTab: Never
UseTab: Never
AlignConsecutiveDeclarations: true
...
...
2.0/src/query/inc/qExecutor.h
浏览文件 @
bffdb7a8
...
@@ -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
浏览文件 @
bffdb7a8
...
@@ -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
浏览文件 @
bffdb7a8
...
@@ -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
);
...
...
example/src/tmq.c
浏览文件 @
bffdb7a8
...
@@ -13,16 +13,14 @@
...
@@ -13,16 +13,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <assert.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <time.h>
#include "taos.h"
#include "taos.h"
static
int
running
=
1
;
static
int
running
=
1
;
static
void
msg_process
(
tmq_message_t
*
message
)
{
static
void
msg_process
(
tmq_message_t
*
message
)
{
tmqShowMsg
(
message
);
}
tmqShowMsg
(
message
);
}
int32_t
init_env
()
{
int32_t
init_env
()
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
...
@@ -44,29 +42,28 @@ int32_t init_env() {
...
@@ -44,29 +42,28 @@ int32_t init_env() {
}
}
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
/*pRes = taos_query(pConn, "create stable if not exists st1 (ts timestamp, k int) tags(a int)");*/
pRes
=
taos_query
(
pConn
,
"create stable if not exists st1 (ts timestamp, k int) tags(a int)"
);
/*if (taos_errno(pRes) != 0) {*/
if
(
taos_errno
(
pRes
)
!=
0
)
{
/*printf("failed to create super table 123_$^), reason:%s\n", taos_errstr(pRes));*/
printf
(
"failed to create super table 123_$^), reason:%s
\n
"
,
taos_errstr
(
pRes
));
/*return -1;*/
return
-
1
;
/*}*/
}
/*taos_free_result(pRes);*/
taos_free_result
(
pRes
);
/*pRes = taos_query(pConn, "create table if not exists tu using st1 tags(1)");*/
pRes
=
taos_query
(
pConn
,
"create table if not exists tu1 using st1 tags(1)"
);
/*if (taos_errno(pRes) != 0) {*/
if
(
taos_errno
(
pRes
)
!=
0
)
{
/*printf("failed to create child table tu, reason:%s\n", taos_errstr(pRes));*/
printf
(
"failed to create child table tu1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
/*return -1;*/
return
-
1
;
/*}*/
}
/*taos_free_result(pRes);*/
taos_free_result
(
pRes
);
/*pRes = taos_query(pConn, "create table if not exists tu2 using st1 tags(2)");*/
pRes
=
taos_query
(
pConn
,
"create table if not exists tu2 using st1 tags(2)"
);
/*if (taos_errno(pRes) != 0) {*/
if
(
taos_errno
(
pRes
)
!=
0
)
{
/*printf("failed to create child table tu2, reason:%s\n", taos_errstr(pRes));*/
printf
(
"failed to create child table tu2, reason:%s
\n
"
,
taos_errstr
(
pRes
));
/*return -1;*/
return
-
1
;
/*}*/
}
/*taos_free_result(pRes);*/
taos_free_result
(
pRes
);
const
char
*
sql
=
"select * from tu1"
;
const
char
*
sql
=
"select * from st1"
;
pRes
=
tmq_create_topic
(
pConn
,
"test_stb_topic_1"
,
sql
,
strlen
(
sql
));
pRes
=
tmq_create_topic
(
pConn
,
"test_stb_topic_1"
,
sql
,
strlen
(
sql
));
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create topic test_stb_topic_1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to create topic test_stb_topic_1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
...
@@ -91,11 +88,6 @@ tmq_t* build_consumer() {
...
@@ -91,11 +88,6 @@ tmq_t* build_consumer() {
tmq_conf_set
(
conf
,
"group.id"
,
"tg2"
);
tmq_conf_set
(
conf
,
"group.id"
,
"tg2"
);
tmq_t
*
tmq
=
tmq_consumer_new
(
pConn
,
conf
,
NULL
,
0
);
tmq_t
*
tmq
=
tmq_consumer_new
(
pConn
,
conf
,
NULL
,
0
);
return
tmq
;
return
tmq
;
tmq_list_t
*
topic_list
=
tmq_list_new
();
tmq_list_append
(
topic_list
,
"test_stb_topic_1"
);
tmq_subscribe
(
tmq
,
topic_list
);
return
NULL
;
}
}
tmq_list_t
*
build_topic_list
()
{
tmq_list_t
*
build_topic_list
()
{
...
@@ -104,8 +96,7 @@ tmq_list_t* build_topic_list() {
...
@@ -104,8 +96,7 @@ tmq_list_t* build_topic_list() {
return
topic_list
;
return
topic_list
;
}
}
void
basic_consume_loop
(
tmq_t
*
tmq
,
void
basic_consume_loop
(
tmq_t
*
tmq
,
tmq_list_t
*
topics
)
{
tmq_list_t
*
topics
)
{
tmq_resp_err_t
err
;
tmq_resp_err_t
err
;
if
((
err
=
tmq_subscribe
(
tmq
,
topics
)))
{
if
((
err
=
tmq_subscribe
(
tmq
,
topics
)))
{
...
@@ -113,15 +104,15 @@ void basic_consume_loop(tmq_t *tmq,
...
@@ -113,15 +104,15 @@ void basic_consume_loop(tmq_t *tmq,
printf
(
"subscribe err
\n
"
);
printf
(
"subscribe err
\n
"
);
return
;
return
;
}
}
int32_t
cnt
=
0
;
/*int32_t cnt = 0;*/
/*clock_t startTime = clock();*/
/*clock_t startTime = clock();*/
while
(
running
)
{
while
(
running
)
{
tmq_message_t
*
tmqmessage
=
tmq_consumer_poll
(
tmq
,
500
);
tmq_message_t
*
tmqmessage
=
tmq_consumer_poll
(
tmq
,
500
);
if
(
tmqmessage
)
{
if
(
tmqmessage
)
{
cnt
++
;
/*cnt++;*/
msg_process
(
tmqmessage
);
msg_process
(
tmqmessage
);
tmq_message_destroy
(
tmqmessage
);
tmq_message_destroy
(
tmqmessage
);
/*} else {*/
/*} else {*/
/*break;*/
/*break;*/
}
}
}
}
...
@@ -135,11 +126,10 @@ void basic_consume_loop(tmq_t *tmq,
...
@@ -135,11 +126,10 @@ void basic_consume_loop(tmq_t *tmq,
fprintf
(
stderr
,
"%% Consumer closed
\n
"
);
fprintf
(
stderr
,
"%% Consumer closed
\n
"
);
}
}
void
sync_consume_loop
(
tmq_t
*
tmq
,
void
sync_consume_loop
(
tmq_t
*
tmq
,
tmq_list_t
*
topics
)
{
tmq_list_t
*
topics
)
{
static
const
int
MIN_COMMIT_COUNT
=
1000
;
static
const
int
MIN_COMMIT_COUNT
=
1000
;
int
msg_count
=
0
;
int
msg_count
=
0
;
tmq_resp_err_t
err
;
tmq_resp_err_t
err
;
if
((
err
=
tmq_subscribe
(
tmq
,
topics
)))
{
if
((
err
=
tmq_subscribe
(
tmq
,
topics
)))
{
...
@@ -148,15 +138,14 @@ void sync_consume_loop(tmq_t *tmq,
...
@@ -148,15 +138,14 @@ void sync_consume_loop(tmq_t *tmq,
}
}
while
(
running
)
{
while
(
running
)
{
tmq_message_t
*
tmqmessage
=
tmq_consumer_poll
(
tmq
,
500
);
tmq_message_t
*
tmqmessage
=
tmq_consumer_poll
(
tmq
,
500
);
if
(
tmqmessage
)
{
if
(
tmqmessage
)
{
msg_process
(
tmqmessage
);
msg_process
(
tmqmessage
);
tmq_message_destroy
(
tmqmessage
);
tmq_message_destroy
(
tmqmessage
);
if
((
++
msg_count
%
MIN_COMMIT_COUNT
)
==
0
)
if
((
++
msg_count
%
MIN_COMMIT_COUNT
)
==
0
)
tmq_commit
(
tmq
,
NULL
,
0
);
tmq_commit
(
tmq
,
NULL
,
0
);
}
}
}
}
err
=
tmq_consumer_close
(
tmq
);
err
=
tmq_consumer_close
(
tmq
);
if
(
err
)
if
(
err
)
...
@@ -165,11 +154,48 @@ void sync_consume_loop(tmq_t *tmq,
...
@@ -165,11 +154,48 @@ void sync_consume_loop(tmq_t *tmq,
fprintf
(
stderr
,
"%% Consumer closed
\n
"
);
fprintf
(
stderr
,
"%% Consumer closed
\n
"
);
}
}
int
main
()
{
void
perf_loop
(
tmq_t
*
tmq
,
tmq_list_t
*
topics
)
{
tmq_resp_err_t
err
;
if
((
err
=
tmq_subscribe
(
tmq
,
topics
)))
{
fprintf
(
stderr
,
"%% Failed to start consuming topics: %s
\n
"
,
tmq_err2str
(
err
));
printf
(
"subscribe err
\n
"
);
return
;
}
int32_t
batchCnt
=
0
;
int32_t
skipLogNum
=
0
;
clock_t
startTime
=
clock
();
while
(
running
)
{
tmq_message_t
*
tmqmessage
=
tmq_consumer_poll
(
tmq
,
500
);
if
(
tmqmessage
)
{
batchCnt
++
;
skipLogNum
+=
tmqGetSkipLogNum
(
tmqmessage
);
/*msg_process(tmqmessage);*/
tmq_message_destroy
(
tmqmessage
);
}
else
{
break
;
}
}
clock_t
endTime
=
clock
();
printf
(
"log batch cnt: %d, skip log cnt: %d, time used:%f s
\n
"
,
batchCnt
,
skipLogNum
,
(
double
)(
endTime
-
startTime
)
/
CLOCKS_PER_SEC
);
err
=
tmq_consumer_close
(
tmq
);
if
(
err
)
fprintf
(
stderr
,
"%% Failed to close consumer: %s
\n
"
,
tmq_err2str
(
err
));
else
fprintf
(
stderr
,
"%% Consumer closed
\n
"
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
code
;
int
code
;
code
=
init_env
();
if
(
argc
>
1
)
{
tmq_t
*
tmq
=
build_consumer
();
printf
(
"env init
\n
"
);
code
=
init_env
();
}
tmq_t
*
tmq
=
build_consumer
();
tmq_list_t
*
topic_list
=
build_topic_list
();
tmq_list_t
*
topic_list
=
build_topic_list
();
/*perf_loop(tmq, topic_list);*/
basic_consume_loop
(
tmq
,
topic_list
);
basic_consume_loop
(
tmq
,
topic_list
);
/*sync_consume_loop(tmq, topic_list);*/
/*sync_consume_loop(tmq, topic_list);*/
}
}
include/client/taos.h
浏览文件 @
bffdb7a8
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
#ifndef TDENGINE_TAOS_H
#ifndef TDENGINE_TAOS_H
#define TDENGINE_TAOS_H
#define TDENGINE_TAOS_H
#include <stdint.h>
#include <stdbool.h>
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -31,26 +31,26 @@ typedef void TAOS_SUB;
...
@@ -31,26 +31,26 @@ typedef void TAOS_SUB;
typedef
void
**
TAOS_ROW
;
typedef
void
**
TAOS_ROW
;
// Data type definition
// Data type definition
#define TSDB_DATA_TYPE_NULL
0
// 1 bytes
#define TSDB_DATA_TYPE_NULL
0
// 1 bytes
#define TSDB_DATA_TYPE_BOOL
1
// 1 bytes
#define TSDB_DATA_TYPE_BOOL
1
// 1 bytes
#define TSDB_DATA_TYPE_TINYINT
2
// 1 byte
#define TSDB_DATA_TYPE_TINYINT
2
// 1 byte
#define TSDB_DATA_TYPE_SMALLINT
3
// 2 bytes
#define TSDB_DATA_TYPE_SMALLINT
3
// 2 bytes
#define TSDB_DATA_TYPE_INT
4
// 4 bytes
#define TSDB_DATA_TYPE_INT
4
// 4 bytes
#define TSDB_DATA_TYPE_BIGINT
5
// 8 bytes
#define TSDB_DATA_TYPE_BIGINT
5
// 8 bytes
#define TSDB_DATA_TYPE_FLOAT
6
// 4 bytes
#define TSDB_DATA_TYPE_FLOAT
6
// 4 bytes
#define TSDB_DATA_TYPE_DOUBLE
7
// 8 bytes
#define TSDB_DATA_TYPE_DOUBLE
7
// 8 bytes
#define TSDB_DATA_TYPE_BINARY
8
// string, alias for varchar
#define TSDB_DATA_TYPE_BINARY
8
// string, alias for varchar
#define TSDB_DATA_TYPE_TIMESTAMP
9
// 8 bytes
#define TSDB_DATA_TYPE_TIMESTAMP
9
// 8 bytes
#define TSDB_DATA_TYPE_NCHAR
10
// unicode string
#define TSDB_DATA_TYPE_NCHAR
10
// unicode string
#define TSDB_DATA_TYPE_UTINYINT
11
// 1 byte
#define TSDB_DATA_TYPE_UTINYINT
11
// 1 byte
#define TSDB_DATA_TYPE_USMALLINT
12
// 2 bytes
#define TSDB_DATA_TYPE_USMALLINT
12
// 2 bytes
#define TSDB_DATA_TYPE_UINT
13
// 4 bytes
#define TSDB_DATA_TYPE_UINT
13
// 4 bytes
#define TSDB_DATA_TYPE_UBIGINT
14
// 8 bytes
#define TSDB_DATA_TYPE_UBIGINT
14
// 8 bytes
#define TSDB_DATA_TYPE_VARCHAR
15
// string
#define TSDB_DATA_TYPE_VARCHAR
15
// string
#define TSDB_DATA_TYPE_VARBINARY
16
// binary
#define TSDB_DATA_TYPE_VARBINARY
16
// binary
#define TSDB_DATA_TYPE_JSON
17
// json
#define TSDB_DATA_TYPE_JSON
17
// json
#define TSDB_DATA_TYPE_DECIMAL
18
// decimal
#define TSDB_DATA_TYPE_DECIMAL
18
// decimal
#define TSDB_DATA_TYPE_BLOB
19
// binary
#define TSDB_DATA_TYPE_BLOB
19
// binary
typedef
enum
{
typedef
enum
{
TSDB_OPTION_LOCALE
,
TSDB_OPTION_LOCALE
,
...
@@ -63,9 +63,9 @@ typedef enum {
...
@@ -63,9 +63,9 @@ typedef enum {
typedef
enum
{
typedef
enum
{
TSDB_SML_UNKNOWN_PROTOCOL
=
0
,
TSDB_SML_UNKNOWN_PROTOCOL
=
0
,
TSDB_SML_LINE_PROTOCOL
=
1
,
TSDB_SML_LINE_PROTOCOL
=
1
,
TSDB_SML_TELNET_PROTOCOL
=
2
,
TSDB_SML_TELNET_PROTOCOL
=
2
,
TSDB_SML_JSON_PROTOCOL
=
3
,
TSDB_SML_JSON_PROTOCOL
=
3
,
}
TSDB_SML_PROTOCOL_TYPE
;
}
TSDB_SML_PROTOCOL_TYPE
;
typedef
enum
{
typedef
enum
{
...
@@ -79,28 +79,28 @@ typedef enum {
...
@@ -79,28 +79,28 @@ typedef enum {
}
TSDB_SML_TIMESTAMP_TYPE
;
}
TSDB_SML_TIMESTAMP_TYPE
;
typedef
struct
taosField
{
typedef
struct
taosField
{
char
name
[
65
];
char
name
[
65
];
int8_t
type
;
int8_t
type
;
int32_t
bytes
;
int32_t
bytes
;
}
TAOS_FIELD
;
}
TAOS_FIELD
;
#ifdef _TD_GO_DLL_
#ifdef _TD_GO_DLL_
#define DLL_EXPORT
__declspec(dllexport)
#define DLL_EXPORT
__declspec(dllexport)
#else
#else
#define DLL_EXPORT
#define DLL_EXPORT
#endif
#endif
typedef
void
(
*
__taos_async_fn_t
)(
void
*
param
,
TAOS_RES
*
,
int
code
);
typedef
void
(
*
__taos_async_fn_t
)(
void
*
param
,
TAOS_RES
*
,
int
code
);
typedef
struct
TAOS_BIND
{
typedef
struct
TAOS_BIND
{
int
buffer_type
;
int
buffer_type
;
void
*
buffer
;
void
*
buffer
;
uintptr_t
buffer_length
;
// unused
uintptr_t
buffer_length
;
// unused
uintptr_t
*
length
;
uintptr_t
*
length
;
int
*
is_null
;
int
*
is_null
;
int
is_unsigned
;
// unused
int
is_unsigned
;
// unused
int
*
error
;
// unused
int
*
error
;
// unused
union
{
union
{
int64_t
ts
;
int64_t
ts
;
int8_t
b
;
int8_t
b
;
...
@@ -113,22 +113,23 @@ typedef struct TAOS_BIND {
...
@@ -113,22 +113,23 @@ typedef struct TAOS_BIND {
unsigned
char
*
bin
;
unsigned
char
*
bin
;
char
*
nchar
;
char
*
nchar
;
}
u
;
}
u
;
unsigned
int
allocated
;
unsigned
int
allocated
;
}
TAOS_BIND
;
}
TAOS_BIND
;
typedef
struct
TAOS_MULTI_BIND
{
typedef
struct
TAOS_MULTI_BIND
{
int
buffer_type
;
int
buffer_type
;
void
*
buffer
;
void
*
buffer
;
uintptr_t
buffer_length
;
uintptr_t
buffer_length
;
int32_t
*
length
;
int32_t
*
length
;
char
*
is_null
;
char
*
is_null
;
int
num
;
int
num
;
}
TAOS_MULTI_BIND
;
}
TAOS_MULTI_BIND
;
DLL_EXPORT
void
taos_cleanup
(
void
);
DLL_EXPORT
void
taos_cleanup
(
void
);
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_l
(
const
char
*
ip
,
int
ipLen
,
const
char
*
user
,
int
userLen
,
const
char
*
pass
,
int
passLen
,
const
char
*
db
,
int
dbLen
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_l
(
const
char
*
ip
,
int
ipLen
,
const
char
*
user
,
int
userLen
,
const
char
*
pass
,
int
passLen
,
const
char
*
db
,
int
dbLen
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_auth
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_auth
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
void
taos_close
(
TAOS
*
taos
);
DLL_EXPORT
void
taos_close
(
TAOS
*
taos
);
...
@@ -136,62 +137,63 @@ const char *taos_data_type(int type);
...
@@ -136,62 +137,63 @@ const char *taos_data_type(int type);
DLL_EXPORT
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
DLL_EXPORT
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
DLL_EXPORT
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
DLL_EXPORT
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
DLL_EXPORT
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
);
DLL_EXPORT
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
);
DLL_EXPORT
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
DLL_EXPORT
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
DLL_EXPORT
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
DLL_EXPORT
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
DLL_EXPORT
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
DLL_EXPORT
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
DLL_EXPORT
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
DLL_EXPORT
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
DLL_EXPORT
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_result_precision
(
TAOS_RES
*
res
);
// get the time precision of result
DLL_EXPORT
int
taos_result_precision
(
TAOS_RES
*
res
);
// get the time precision of result
DLL_EXPORT
void
taos_free_result
(
TAOS_RES
*
res
);
DLL_EXPORT
void
taos_free_result
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_field_count
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_field_count
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_num_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_num_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_affected_rows
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_affected_rows
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_select_db
(
TAOS
*
taos
,
const
char
*
db
);
DLL_EXPORT
int
taos_select_db
(
TAOS
*
taos
,
const
char
*
db
);
DLL_EXPORT
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
);
DLL_EXPORT
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
);
DLL_EXPORT
void
taos_stop_query
(
TAOS_RES
*
res
);
DLL_EXPORT
void
taos_stop_query
(
TAOS_RES
*
res
);
DLL_EXPORT
bool
taos_is_null
(
TAOS_RES
*
res
,
int32_t
row
,
int32_t
col
);
DLL_EXPORT
bool
taos_is_null
(
TAOS_RES
*
res
,
int32_t
row
,
int32_t
col
);
DLL_EXPORT
int
taos_fetch_block
(
TAOS_RES
*
res
,
TAOS_ROW
*
rows
);
DLL_EXPORT
int
taos_fetch_block
(
TAOS_RES
*
res
,
TAOS_ROW
*
rows
);
DLL_EXPORT
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
int
*
taos_fetch_lengths
(
TAOS_RES
*
res
);
DLL_EXPORT
int
*
taos_fetch_lengths
(
TAOS_RES
*
res
);
DLL_EXPORT
const
char
*
taos_get_server_info
(
TAOS
*
taos
);
DLL_EXPORT
const
char
*
taos_get_server_info
(
TAOS
*
taos
);
DLL_EXPORT
const
char
*
taos_get_client_info
();
DLL_EXPORT
const
char
*
taos_get_client_info
();
DLL_EXPORT
const
char
*
taos_errstr
(
TAOS_RES
*
tres
);
DLL_EXPORT
const
char
*
taos_errstr
(
TAOS_RES
*
tres
);
DLL_EXPORT
int
taos_errno
(
TAOS_RES
*
tres
);
DLL_EXPORT
int
taos_errno
(
TAOS_RES
*
tres
);
DLL_EXPORT
void
taos_query_a
(
TAOS
*
taos
,
const
char
*
sql
,
__taos_async_fn_t
fp
,
void
*
param
);
DLL_EXPORT
void
taos_query_a
(
TAOS
*
taos
,
const
char
*
sql
,
__taos_async_fn_t
fp
,
void
*
param
);
DLL_EXPORT
void
taos_fetch_rows_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
);
DLL_EXPORT
void
taos_fetch_rows_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
);
typedef
void
(
*
__taos_sub_fn_t
)(
TAOS_SUB
*
tsub
,
TAOS_RES
*
res
,
void
*
param
,
int
code
);
typedef
void
(
*
__taos_sub_fn_t
)(
TAOS_SUB
*
tsub
,
TAOS_RES
*
res
,
void
*
param
,
int
code
);
DLL_EXPORT
TAOS_SUB
*
taos_subscribe
(
TAOS
*
taos
,
int
restart
,
const
char
*
topic
,
const
char
*
sql
,
__taos_sub_fn_t
fp
,
void
*
param
,
int
interval
);
DLL_EXPORT
TAOS_SUB
*
taos_subscribe
(
TAOS
*
taos
,
int
restart
,
const
char
*
topic
,
const
char
*
sql
,
__taos_sub_fn_t
fp
,
void
*
param
,
int
interval
);
DLL_EXPORT
TAOS_RES
*
taos_consume
(
TAOS_SUB
*
tsub
);
DLL_EXPORT
TAOS_RES
*
taos_consume
(
TAOS_SUB
*
tsub
);
DLL_EXPORT
void
taos_unsubscribe
(
TAOS_SUB
*
tsub
,
int
keepProgress
);
DLL_EXPORT
void
taos_unsubscribe
(
TAOS_SUB
*
tsub
,
int
keepProgress
);
DLL_EXPORT
TAOS_STREAM
*
taos_open_stream
(
TAOS
*
taos
,
const
char
*
sql
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
DLL_EXPORT
TAOS_STREAM
*
taos_open_stream
(
TAOS
*
taos
,
const
char
*
sql
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
int64_t
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
));
int64_t
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
));
DLL_EXPORT
void
taos_close_stream
(
TAOS_STREAM
*
tstr
);
DLL_EXPORT
void
taos_close_stream
(
TAOS_STREAM
*
tstr
);
DLL_EXPORT
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
);
DLL_EXPORT
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
);
/* --------------------------TMQ INTERFACE------------------------------- */
/* --------------------------TMQ INTERFACE------------------------------- */
...
@@ -215,10 +217,10 @@ typedef void(tmq_commit_cb(tmq_t *, tmq_resp_err_t, tmq_topic_vgroup_list_t *, v
...
@@ -215,10 +217,10 @@ typedef void(tmq_commit_cb(tmq_t *, tmq_resp_err_t, tmq_topic_vgroup_list_t *, v
DLL_EXPORT
tmq_list_t
*
tmq_list_new
();
DLL_EXPORT
tmq_list_t
*
tmq_list_new
();
DLL_EXPORT
int32_t
tmq_list_append
(
tmq_list_t
*
,
const
char
*
);
DLL_EXPORT
int32_t
tmq_list_append
(
tmq_list_t
*
,
const
char
*
);
DLL_EXPORT
TAOS_RES
*
tmq_create_topic
(
TAOS
*
taos
,
const
char
*
name
,
const
char
*
sql
,
int
sqlLen
);
DLL_EXPORT
TAOS_RES
*
tmq_create_topic
(
TAOS
*
taos
,
const
char
*
name
,
const
char
*
sql
,
int
sqlLen
);
DLL_EXPORT
tmq_t
*
tmq_consumer_new
(
void
*
conn
,
tmq_conf_t
*
conf
,
char
*
errstr
,
int32_t
errstrLen
);
DLL_EXPORT
tmq_t
*
tmq_consumer_new
(
void
*
conn
,
tmq_conf_t
*
conf
,
char
*
errstr
,
int32_t
errstrLen
);
DLL_EXPORT
void
tmq_message_destroy
(
tmq_message_t
*
tmq_message
);
DLL_EXPORT
void
tmq_message_destroy
(
tmq_message_t
*
tmq_message
);
DLL_EXPORT
const
char
*
tmq_err2str
(
tmq_resp_err_t
);
DLL_EXPORT
const
char
*
tmq_err2str
(
tmq_resp_err_t
);
/* ------------------------TMQ CONSUMER INTERFACE------------------------ */
/* ------------------------TMQ CONSUMER INTERFACE------------------------ */
DLL_EXPORT
tmq_resp_err_t
tmq_subscribe
(
tmq_t
*
tmq
,
tmq_list_t
*
topic_list
);
DLL_EXPORT
tmq_resp_err_t
tmq_subscribe
(
tmq_t
*
tmq
,
tmq_list_t
*
topic_list
);
...
@@ -227,7 +229,7 @@ DLL_EXPORT tmq_resp_err_t tmq_unsubscribe(tmq_t* tmq);
...
@@ -227,7 +229,7 @@ DLL_EXPORT tmq_resp_err_t tmq_unsubscribe(tmq_t* tmq);
DLL_EXPORT tmq_resp_err_t tmq_subscription(tmq_t* tmq, tmq_topic_vgroup_list_t** topics);
DLL_EXPORT tmq_resp_err_t tmq_subscription(tmq_t* tmq, tmq_topic_vgroup_list_t** topics);
#endif
#endif
DLL_EXPORT
tmq_message_t
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
blocking_time
);
DLL_EXPORT
tmq_message_t
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
blocking_time
);
DLL_EXPORT
tmq_resp_err_t
tmq_consumer_close
(
tmq_t
*
tmq
);
DLL_EXPORT
tmq_resp_err_t
tmq_consumer_close
(
tmq_t
*
tmq
);
#if 0
#if 0
DLL_EXPORT tmq_resp_err_t tmq_assign(tmq_t* tmq, const tmq_topic_vgroup_list_t* vgroups);
DLL_EXPORT tmq_resp_err_t tmq_assign(tmq_t* tmq, const tmq_topic_vgroup_list_t* vgroups);
DLL_EXPORT tmq_resp_err_t tmq_assignment(tmq_t* tmq, tmq_topic_vgroup_list_t** vgroups);
DLL_EXPORT tmq_resp_err_t tmq_assignment(tmq_t* tmq, tmq_topic_vgroup_list_t** vgroups);
...
@@ -251,8 +253,9 @@ DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
...
@@ -251,8 +253,9 @@ DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
DLL_EXPORT
tmq_conf_res_t
tmq_conf_set
(
tmq_conf_t
*
conf
,
const
char
*
key
,
const
char
*
value
);
DLL_EXPORT
tmq_conf_res_t
tmq_conf_set
(
tmq_conf_t
*
conf
,
const
char
*
key
,
const
char
*
value
);
DLL_EXPORT
void
tmq_conf_set_offset_commit_cb
(
tmq_conf_t
*
conf
,
tmq_commit_cb
*
cb
);
DLL_EXPORT
void
tmq_conf_set_offset_commit_cb
(
tmq_conf_t
*
conf
,
tmq_commit_cb
*
cb
);
//temporary used function for demo only
// temporary used function for demo only
void
tmqShowMsg
(
tmq_message_t
*
tmq_message
);
void
tmqShowMsg
(
tmq_message_t
*
tmq_message
);
int32_t
tmqGetSkipLogNum
(
tmq_message_t
*
tmq_message
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/common/common.h
浏览文件 @
bffdb7a8
...
@@ -16,30 +16,35 @@
...
@@ -16,30 +16,35 @@
#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 "tmsg.h"
#include "tarray.h"
#include "tarray.h"
#include "tmsg.h"
#include "tvariant.h"
#include "tvariant.h"
//typedef struct STimeWindow {
//
typedef struct STimeWindow {
// TSKEY skey;
//
TSKEY skey;
// TSKEY ekey;
//
TSKEY ekey;
//} STimeWindow;
//
} STimeWindow;
//typedef struct {
//
typedef struct {
// int32_t dataLen;
//
int32_t dataLen;
// char name[TSDB_TABLE_FNAME_LEN];
//
char name[TSDB_TABLE_FNAME_LEN];
// char *data;
//
char *data;
//} STagData;
//
} STagData;
//typedef struct SSchema {
//
typedef struct SSchema {
// uint8_t type;
//
uint8_t type;
// char name[TSDB_COL_NAME_LEN];
//
char name[TSDB_COL_NAME_LEN];
// int16_t colId;
//
int16_t colId;
// int16_t bytes;
//
int16_t bytes;
//} SSchema;
//
} SSchema;
#define TMQ_REQ_TYPE_COMMIT_ONLY
0
#define TMQ_REQ_TYPE_COMMIT_ONLY 0
#define TMQ_REQ_TYPE_CONSUME_ONLY
1
#define TMQ_REQ_TYPE_CONSUME_ONLY 1
#define TMQ_REQ_TYPE_CONSUME_AND_COMMIT 2
#define TMQ_REQ_TYPE_CONSUME_AND_COMMIT 2
typedef
struct
{
typedef
struct
{
...
@@ -67,7 +72,7 @@ typedef struct SDataBlockInfo {
...
@@ -67,7 +72,7 @@ typedef struct SDataBlockInfo {
typedef
struct
SConstantItem
{
typedef
struct
SConstantItem
{
SColumnInfo
info
;
SColumnInfo
info
;
int32_t
startRow
;
// run-length-encoding to save the space for multiple rows
int32_t
startRow
;
// run-length-encoding to save the space for multiple rows
int32_t
endRow
;
int32_t
endRow
;
SVariant
value
;
SVariant
value
;
}
SConstantItem
;
}
SConstantItem
;
...
@@ -80,12 +85,22 @@ typedef struct SSDataBlock {
...
@@ -80,12 +85,22 @@ typedef struct SSDataBlock {
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
)
{
...
@@ -110,7 +125,7 @@ static FORCE_INLINE int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlo
...
@@ -110,7 +125,7 @@ static FORCE_INLINE int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlo
return
tlen
;
return
tlen
;
}
}
static
FORCE_INLINE
void
*
tDecodeDataBlock
(
void
*
buf
,
SSDataBlock
*
pBlock
)
{
static
FORCE_INLINE
void
*
tDecodeDataBlock
(
const
void
*
buf
,
SSDataBlock
*
pBlock
)
{
int32_t
sz
;
int32_t
sz
;
buf
=
taosDecodeFixedI64
(
buf
,
&
pBlock
->
info
.
uid
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pBlock
->
info
.
uid
);
...
@@ -127,7 +142,7 @@ static FORCE_INLINE void* tDecodeDataBlock(void* buf, SSDataBlock* pBlock) {
...
@@ -127,7 +142,7 @@ static FORCE_INLINE void* tDecodeDataBlock(void* buf, SSDataBlock* pBlock) {
buf
=
taosDecodeBinary
(
buf
,
(
void
**
)
&
data
.
pData
,
colSz
);
buf
=
taosDecodeBinary
(
buf
,
(
void
**
)
&
data
.
pData
,
colSz
);
taosArrayPush
(
pBlock
->
pDataBlock
,
&
data
);
taosArrayPush
(
pBlock
->
pDataBlock
,
&
data
);
}
}
return
buf
;
return
(
void
*
)
buf
;
}
}
static
FORCE_INLINE
int32_t
tEncodeSMqConsumeRsp
(
void
**
buf
,
const
SMqConsumeRsp
*
pRsp
)
{
static
FORCE_INLINE
int32_t
tEncodeSMqConsumeRsp
(
void
**
buf
,
const
SMqConsumeRsp
*
pRsp
)
{
...
@@ -146,7 +161,7 @@ static FORCE_INLINE int32_t tEncodeSMqConsumeRsp(void** buf, const SMqConsumeRsp
...
@@ -146,7 +161,7 @@ static FORCE_INLINE int32_t tEncodeSMqConsumeRsp(void** buf, const SMqConsumeRsp
}
}
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SSDataBlock
*
pBlock
=
(
SSDataBlock
*
)
taosArrayGet
(
pRsp
->
pBlockData
,
i
);
SSDataBlock
*
pBlock
=
(
SSDataBlock
*
)
taosArrayGet
(
pRsp
->
pBlockData
,
i
);
tlen
+=
tEncodeDataBlock
(
buf
,
pBlock
);
tlen
+=
tEncodeDataBlock
(
buf
,
pBlock
);
}
}
return
tlen
;
return
tlen
;
...
@@ -179,19 +194,18 @@ static FORCE_INLINE void tDeleteSSDataBlock(SSDataBlock* pBlock) {
...
@@ -179,19 +194,18 @@ static FORCE_INLINE void tDeleteSSDataBlock(SSDataBlock* pBlock) {
return
;
return
;
}
}
//int32_t numOfOutput = pBlock->info.numOfCols;
//
int32_t numOfOutput = pBlock->info.numOfCols;
int32_t
sz
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
int32_t
sz
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
sz
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
sz
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pColInfoData
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
tfree
(
pColInfoData
->
pData
);
tfree
(
pColInfoData
->
pData
);
}
}
taosArrayDestroy
(
pBlock
->
pDataBlock
);
taosArrayDestroy
(
pBlock
->
pDataBlock
);
tfree
(
pBlock
->
pBlockAgg
);
tfree
(
pBlock
->
pBlockAgg
);
//tfree(pBlock);
//
tfree(pBlock);
}
}
static
FORCE_INLINE
void
tDeleteSMqConsumeRsp
(
SMqConsumeRsp
*
pRsp
)
{
static
FORCE_INLINE
void
tDeleteSMqConsumeRsp
(
SMqConsumeRsp
*
pRsp
)
{
if
(
pRsp
->
schemas
)
{
if
(
pRsp
->
schemas
)
{
if
(
pRsp
->
schemas
->
nCols
)
{
if
(
pRsp
->
schemas
->
nCols
)
{
...
@@ -199,42 +213,42 @@ static FORCE_INLINE void tDeleteSMqConsumeRsp(SMqConsumeRsp* pRsp) {
...
@@ -199,42 +213,42 @@ static FORCE_INLINE void tDeleteSMqConsumeRsp(SMqConsumeRsp* pRsp) {
}
}
free
(
pRsp
->
schemas
);
free
(
pRsp
->
schemas
);
}
}
taosArrayDestroyEx
(
pRsp
->
pBlockData
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
taosArrayDestroyEx
(
pRsp
->
pBlockData
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
pRsp
->
pBlockData
=
NULL
;
pRsp
->
pBlockData
=
NULL
;
//for (int i = 0; i < taosArrayGetSize(pRsp->pBlockData); i++) {
//
for (int i = 0; i < taosArrayGetSize(pRsp->pBlockData); i++) {
//
SSDataBlock* pDataBlock = (SSDataBlock*)taosArrayGet(pRsp->pBlockData, i);
//
SSDataBlock* pDataBlock = (SSDataBlock*)taosArrayGet(pRsp->pBlockData, i);
//
tDeleteSSDataBlock(pDataBlock);
//
tDeleteSSDataBlock(pDataBlock);
//}
//}
}
}
//======================================================================================================================
//======================================================================================================================
// the following structure shared by parser and executor
// the following structure shared by parser and executor
typedef
struct
SColumn
{
typedef
struct
SColumn
{
uint64_t
uid
;
uint64_t
uid
;
char
name
[
TSDB_COL_NAME_LEN
];
char
name
[
TSDB_COL_NAME_LEN
];
int8_t
flag
;
// column type: normal column, tag, or user-input column (integer/float/string)
int8_t
flag
;
// column type: normal column, tag, or user-input column (integer/float/string)
SColumnInfo
info
;
SColumnInfo
info
;
}
SColumn
;
}
SColumn
;
typedef
struct
SLimit
{
typedef
struct
SLimit
{
int64_t
limit
;
int64_t
limit
;
int64_t
offset
;
int64_t
offset
;
}
SLimit
;
}
SLimit
;
typedef
struct
SOrder
{
typedef
struct
SOrder
{
uint32_t
order
;
uint32_t
order
;
SColumn
col
;
SColumn
col
;
}
SOrder
;
}
SOrder
;
typedef
struct
SGroupbyExpr
{
typedef
struct
SGroupbyExpr
{
SArray
*
columnInfo
;
// SArray<SColIndex>, group by columns information
SArray
*
columnInfo
;
// SArray<SColIndex>, group by columns information
bool
groupbyTag
;
// group by tag or column
bool
groupbyTag
;
// group by tag or column
}
SGroupbyExpr
;
}
SGroupbyExpr
;
// the structure for sql function in select clause
// the structure for sql function in select clause
typedef
struct
SSqlExpr
{
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
...
@@ -244,8 +258,8 @@ typedef struct SSqlExpr {
...
@@ -244,8 +258,8 @@ typedef struct SSqlExpr {
}
SSqlExpr
;
}
SSqlExpr
;
typedef
struct
SExprInfo
{
typedef
struct
SExprInfo
{
struct
SSqlExpr
base
;
struct
SSqlExpr
base
;
struct
tExprNode
*
pExpr
;
struct
tExprNode
*
pExpr
;
}
SExprInfo
;
}
SExprInfo
;
typedef
struct
SStateWindow
{
typedef
struct
SStateWindow
{
...
@@ -253,13 +267,17 @@ typedef struct SStateWindow {
...
@@ -253,13 +267,17 @@ typedef struct SStateWindow {
}
SStateWindow
;
}
SStateWindow
;
typedef
struct
SSessionWindow
{
typedef
struct
SSessionWindow
{
int64_t
gap
;
// gap between two session window(in microseconds)
int64_t
gap
;
// gap between two session window(in microseconds)
SColumn
col
;
SColumn
col
;
}
SSessionWindow
;
}
SSessionWindow
;
#define QUERY_ASC_FORWARD_STEP
1
#define QUERY_ASC_FORWARD_STEP 1
#define QUERY_DESC_FORWARD_STEP -1
#define QUERY_DESC_FORWARD_STEP -1
#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/taosdef.h
浏览文件 @
bffdb7a8
...
@@ -23,7 +23,7 @@ extern "C" {
...
@@ -23,7 +23,7 @@ extern "C" {
#include "taos.h"
#include "taos.h"
#include "tdef.h"
#include "tdef.h"
typedef
u
int64_t
tb_uid_t
;
typedef
int64_t
tb_uid_t
;
#define TSWINDOW_INITIALIZER ((STimeWindow){INT64_MIN, INT64_MAX})
#define TSWINDOW_INITIALIZER ((STimeWindow){INT64_MIN, INT64_MAX})
#define TSWINDOW_DESC_INITIALIZER ((STimeWindow){INT64_MAX, INT64_MIN})
#define TSWINDOW_DESC_INITIALIZER ((STimeWindow){INT64_MAX, INT64_MIN})
...
@@ -38,12 +38,12 @@ typedef enum {
...
@@ -38,12 +38,12 @@ typedef enum {
}
EQType
;
}
EQType
;
typedef
enum
{
typedef
enum
{
TSDB_SUPER_TABLE
=
1
,
// super table
TSDB_SUPER_TABLE
=
1
,
// super table
TSDB_CHILD_TABLE
=
2
,
// table created from super table
TSDB_CHILD_TABLE
=
2
,
// table created from super table
TSDB_NORMAL_TABLE
=
3
,
// ordinary table
TSDB_NORMAL_TABLE
=
3
,
// ordinary table
TSDB_STREAM_TABLE
=
4
,
// table created from stream computing
TSDB_STREAM_TABLE
=
4
,
// table created from stream computing
TSDB_TEMP_TABLE
=
5
,
// temp table created by nest query
TSDB_TEMP_TABLE
=
5
,
// temp table created by nest query
TSDB_TABLE_MAX
=
6
TSDB_TABLE_MAX
=
6
}
ETableType
;
}
ETableType
;
typedef
enum
{
typedef
enum
{
...
...
include/common/tep.h
浏览文件 @
bffdb7a8
...
@@ -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
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
include/common/tmsgdef.h
浏览文件 @
bffdb7a8
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +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/>.
*/
*/
// clang-format off
#if 0
#if 0
#undef TD_MSG_INFO_
#undef TD_MSG_INFO_
#undef TD_MSG_NUMBER_
#undef TD_MSG_NUMBER_
...
@@ -82,7 +84,6 @@ enum {
...
@@ -82,7 +84,6 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_VNODE
,
"dnode-create-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_VNODE
,
"dnode-create-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_ALTER_VNODE
,
"dnode-alter-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_ALTER_VNODE
,
"dnode-alter-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_VNODE
,
"dnode-drop-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_VNODE
,
"dnode-drop-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_AUTH_VNODE
,
"dnode-auth-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_SYNC_VNODE
,
"dnode-sync-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_SYNC_VNODE
,
"dnode-sync-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_COMPACT_VNODE
,
"dnode-compact-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_COMPACT_VNODE
,
"dnode-compact-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CONFIG_DNODE
,
"dnode-config-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CONFIG_DNODE
,
"dnode-config-dnode"
,
NULL
,
NULL
)
...
@@ -137,12 +138,12 @@ enum {
...
@@ -137,12 +138,12 @@ 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
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_SUB_EP
,
"mnode-get-sub-ep"
,
SMqCMGetSubEpReq
,
SMqCMGetSubEpRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_SUB_EP
,
"mnode-get-sub-ep"
,
SMqCMGetSubEpReq
,
SMqCMGetSubEpRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_TIMER
,
"mnode-mq-timer"
,
SM
qTmrMsg
,
SMqTmrMsg
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_TIMER
,
"mnode-mq-timer"
,
SM
TimerReq
,
SMTimerReq
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DO_REBALANCE
,
"mnode-mq-do-rebalance"
,
SMqDoRebalanceMsg
,
SMqDoRebalanceMsg
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DO_REBALANCE
,
"mnode-mq-do-rebalance"
,
SMqDoRebalanceMsg
,
SMqDoRebalanceMsg
)
// Requests handled by VNODE
// Requests handled by VNODE
...
@@ -191,3 +192,4 @@ enum {
...
@@ -191,3 +192,4 @@ enum {
TDMT_MAX
TDMT_MAX
#endif
#endif
};
};
// clang-format on
include/common/trow.h
浏览文件 @
bffdb7a8
...
@@ -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/function/functionMgt.h
浏览文件 @
bffdb7a8
...
@@ -105,7 +105,6 @@ typedef struct SFuncExecEnv {
...
@@ -105,7 +105,6 @@ typedef struct SFuncExecEnv {
int32_t
calcMemSize
;
int32_t
calcMemSize
;
}
SFuncExecEnv
;
}
SFuncExecEnv
;
typedef
void
*
FuncMgtHandle
;
typedef
bool
(
*
FExecGetEnv
)(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
typedef
bool
(
*
FExecGetEnv
)(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
typedef
bool
(
*
FExecInit
)(
struct
SqlFunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
typedef
bool
(
*
FExecInit
)(
struct
SqlFunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
typedef
void
(
*
FExecProcess
)(
struct
SqlFunctionCtx
*
pCtx
);
typedef
void
(
*
FExecProcess
)(
struct
SqlFunctionCtx
*
pCtx
);
...
@@ -127,9 +126,7 @@ typedef struct SScalarFuncExecFuncs {
...
@@ -127,9 +126,7 @@ typedef struct SScalarFuncExecFuncs {
int32_t
fmFuncMgtInit
();
int32_t
fmFuncMgtInit
();
int32_t
fmGetHandle
(
FuncMgtHandle
*
pHandle
);
int32_t
fmGetFuncInfo
(
const
char
*
pFuncName
,
int32_t
*
pFuncId
,
int32_t
*
pFuncType
);
int32_t
fmGetFuncInfo
(
FuncMgtHandle
handle
,
const
char
*
pFuncName
,
int32_t
*
pFuncId
,
int32_t
*
pFuncType
);
int32_t
fmGetFuncResultType
(
SFunctionNode
*
pFunc
);
int32_t
fmGetFuncResultType
(
SFunctionNode
*
pFunc
);
...
...
include/nodes/nodes.h
→
include/
libs/
nodes/nodes.h
浏览文件 @
bffdb7a8
...
@@ -49,7 +49,6 @@ typedef enum ENodeType {
...
@@ -49,7 +49,6 @@ typedef enum ENodeType {
QUERY_NODE_VALUE
,
QUERY_NODE_VALUE
,
QUERY_NODE_OPERATOR
,
QUERY_NODE_OPERATOR
,
QUERY_NODE_LOGIC_CONDITION
,
QUERY_NODE_LOGIC_CONDITION
,
QUERY_NODE_IS_NULL_CONDITION
,
QUERY_NODE_FUNCTION
,
QUERY_NODE_FUNCTION
,
QUERY_NODE_REAL_TABLE
,
QUERY_NODE_REAL_TABLE
,
QUERY_NODE_TEMP_TABLE
,
QUERY_NODE_TEMP_TABLE
,
...
@@ -62,6 +61,7 @@ typedef enum ENodeType {
...
@@ -62,6 +61,7 @@ typedef enum ENodeType {
QUERY_NODE_INTERVAL_WINDOW
,
QUERY_NODE_INTERVAL_WINDOW
,
QUERY_NODE_NODE_LIST
,
QUERY_NODE_NODE_LIST
,
QUERY_NODE_FILL
,
QUERY_NODE_FILL
,
QUERY_NODE_COLUMN_REF
,
// Only be used in parser module.
// Only be used in parser module.
QUERY_NODE_RAW_EXPR
,
QUERY_NODE_RAW_EXPR
,
...
@@ -69,7 +69,11 @@ typedef enum ENodeType {
...
@@ -69,7 +69,11 @@ typedef enum ENodeType {
// Statement nodes are used in parser and planner module.
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR
,
QUERY_NODE_SET_OPERATOR
,
QUERY_NODE_SELECT_STMT
,
QUERY_NODE_SELECT_STMT
,
QUERY_NODE_SHOW_STMT
QUERY_NODE_SHOW_STMT
,
QUERY_NODE_LOGIC_PLAN_SCAN
,
QUERY_NODE_LOGIC_PLAN_FILTER
,
QUERY_NODE_LOGIC_PLAN_AGG
}
ENodeType
;
}
ENodeType
;
/**
/**
...
@@ -122,7 +126,8 @@ void nodesRewriteListPostOrder(SNodeList* pList, FNodeRewriter rewriter, void* p
...
@@ -122,7 +126,8 @@ void nodesRewriteListPostOrder(SNodeList* pList, FNodeRewriter rewriter, void* p
bool
nodesEqualNode
(
const
SNode
*
a
,
const
SNode
*
b
);
bool
nodesEqualNode
(
const
SNode
*
a
,
const
SNode
*
b
);
void
nodesCloneNode
(
const
SNode
*
pNode
);
SNode
*
nodesCloneNode
(
const
SNode
*
pNode
);
SNodeList
*
nodesCloneList
(
const
SNodeList
*
pList
);
int32_t
nodesNodeToString
(
const
SNode
*
pNode
,
char
**
pStr
,
int32_t
*
pLen
);
int32_t
nodesNodeToString
(
const
SNode
*
pNode
,
char
**
pStr
,
int32_t
*
pLen
);
int32_t
nodesStringToNode
(
const
char
*
pStr
,
SNode
**
pNode
);
int32_t
nodesStringToNode
(
const
char
*
pStr
,
SNode
**
pNode
);
...
...
include/nodes/nodesShowStmts.h
→
include/
libs/
nodes/nodesShowStmts.h
浏览文件 @
bffdb7a8
文件已移动
include/nodes/querynodes.h
→
include/
libs/
nodes/querynodes.h
浏览文件 @
bffdb7a8
...
@@ -37,7 +37,7 @@ typedef struct SDataType {
...
@@ -37,7 +37,7 @@ typedef struct SDataType {
}
SDataType
;
}
SDataType
;
typedef
struct
SExprNode
{
typedef
struct
SExprNode
{
ENodeType
nodeT
ype
;
ENodeType
t
ype
;
SDataType
resType
;
SDataType
resType
;
char
aliasName
[
TSDB_COL_NAME_LEN
];
char
aliasName
[
TSDB_COL_NAME_LEN
];
SNodeList
*
pAssociationList
;
SNodeList
*
pAssociationList
;
...
@@ -59,6 +59,11 @@ typedef struct SColumnNode {
...
@@ -59,6 +59,11 @@ typedef struct SColumnNode {
SNode
*
pProjectRef
;
SNode
*
pProjectRef
;
}
SColumnNode
;
}
SColumnNode
;
typedef
struct
SColumnRef
{
ENodeType
type
;
int32_t
slotId
;
}
SColumnRef
;
typedef
struct
SValueNode
{
typedef
struct
SValueNode
{
SExprNode
node
;
// QUERY_NODE_VALUE
SExprNode
node
;
// QUERY_NODE_VALUE
char
*
literal
;
char
*
literal
;
...
@@ -80,6 +85,10 @@ typedef enum EOperatorType {
...
@@ -80,6 +85,10 @@ typedef enum EOperatorType {
OP_TYPE_DIV
,
OP_TYPE_DIV
,
OP_TYPE_MOD
,
OP_TYPE_MOD
,
// bit operator
OP_TYPE_BIT_AND
,
OP_TYPE_BIT_OR
,
// comparison operator
// comparison operator
OP_TYPE_GREATER_THAN
,
OP_TYPE_GREATER_THAN
,
OP_TYPE_GREATER_EQUAL
,
OP_TYPE_GREATER_EQUAL
,
...
@@ -93,8 +102,8 @@ typedef enum EOperatorType {
...
@@ -93,8 +102,8 @@ typedef enum EOperatorType {
OP_TYPE_NOT_LIKE
,
OP_TYPE_NOT_LIKE
,
OP_TYPE_MATCH
,
OP_TYPE_MATCH
,
OP_TYPE_NMATCH
,
OP_TYPE_NMATCH
,
OP_TYPE_ISNULL
,
OP_TYPE_IS
_
NULL
,
OP_TYPE_
NOT
NULL
,
OP_TYPE_
IS_NOT_
NULL
,
OP_TYPE_BIT_AND
,
OP_TYPE_BIT_AND
,
OP_TYPE_BIT_OR
,
OP_TYPE_BIT_OR
,
...
@@ -117,17 +126,11 @@ typedef enum ELogicConditionType {
...
@@ -117,17 +126,11 @@ 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
{
ENodeType
type
;
// QUERY_NODE_IS_NULL_CONDITION
SNode
*
pExpr
;
bool
isNull
;
}
SIsNullCondNode
;
typedef
struct
SNodeListNode
{
typedef
struct
SNodeListNode
{
ENodeType
type
;
// QUERY_NODE_NODE_LIST
ENodeType
type
;
// QUERY_NODE_NODE_LIST
SNodeList
*
pNodeList
;
SNodeList
*
pNodeList
;
...
@@ -142,7 +145,7 @@ typedef struct SFunctionNode {
...
@@ -142,7 +145,7 @@ typedef struct SFunctionNode {
}
SFunctionNode
;
}
SFunctionNode
;
typedef
struct
STableNode
{
typedef
struct
STableNode
{
ENodeType
typ
e
;
SExprNode
nod
e
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
char
tableAlias
[
TSDB_TABLE_NAME_LEN
];
char
tableAlias
[
TSDB_TABLE_NAME_LEN
];
...
...
include/libs/parser/parsenodes.h
浏览文件 @
bffdb7a8
...
@@ -135,7 +135,7 @@ typedef struct SVgDataBlocks {
...
@@ -135,7 +135,7 @@ typedef struct SVgDataBlocks {
SVgroupInfo
vg
;
SVgroupInfo
vg
;
int32_t
numOfTables
;
// number of tables in current submit block
int32_t
numOfTables
;
// number of tables in current submit block
uint32_t
size
;
uint32_t
size
;
char
*
pData
;
// SMsgDesc + SSubmit
Msg
+ SSubmitBlk + ...
char
*
pData
;
// SMsgDesc + SSubmit
Req
+ SSubmitBlk + ...
}
SVgDataBlocks
;
}
SVgDataBlocks
;
typedef
struct
SVnodeModifOpStmtInfo
{
typedef
struct
SVnodeModifOpStmtInfo
{
...
...
include/libs/planner/plannerOp.h
浏览文件 @
bffdb7a8
...
@@ -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/taoserror.h
浏览文件 @
bffdb7a8
...
@@ -459,6 +459,7 @@ int32_t* taosGetErrno();
...
@@ -459,6 +459,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260A) //Not a GROUP BY expression
#define TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260A) //Not a GROUP BY expression
#define TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260B) //Not SELECTed expression
#define TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260B) //Not SELECTed expression
#define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C) //Not a single-group group function
#define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C) //Not a single-group group function
#define TSDB_CODE_PAR_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x260D) //Out of memory
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tcoding.h
浏览文件 @
bffdb7a8
...
@@ -37,7 +37,7 @@ static FORCE_INLINE int taosEncodeFixedU8(void **buf, uint8_t value) {
...
@@ -37,7 +37,7 @@ static FORCE_INLINE int taosEncodeFixedU8(void **buf, uint8_t value) {
return
(
int
)
sizeof
(
value
);
return
(
int
)
sizeof
(
value
);
}
}
static
FORCE_INLINE
void
*
taosDecodeFixedU8
(
void
*
buf
,
uint8_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedU8
(
const
void
*
buf
,
uint8_t
*
value
)
{
*
value
=
((
uint8_t
*
)
buf
)[
0
];
*
value
=
((
uint8_t
*
)
buf
)[
0
];
return
POINTER_SHIFT
(
buf
,
sizeof
(
*
value
));
return
POINTER_SHIFT
(
buf
,
sizeof
(
*
value
));
}
}
...
@@ -51,7 +51,7 @@ static FORCE_INLINE int taosEncodeFixedI8(void **buf, int8_t value) {
...
@@ -51,7 +51,7 @@ static FORCE_INLINE int taosEncodeFixedI8(void **buf, int8_t value) {
return
(
int
)
sizeof
(
value
);
return
(
int
)
sizeof
(
value
);
}
}
static
FORCE_INLINE
void
*
taosDecodeFixedI8
(
void
*
buf
,
int8_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedI8
(
const
void
*
buf
,
int8_t
*
value
)
{
*
value
=
((
int8_t
*
)
buf
)[
0
];
*
value
=
((
int8_t
*
)
buf
)[
0
];
return
POINTER_SHIFT
(
buf
,
sizeof
(
*
value
));
return
POINTER_SHIFT
(
buf
,
sizeof
(
*
value
));
}
}
...
@@ -71,7 +71,7 @@ static FORCE_INLINE int taosEncodeFixedU16(void **buf, uint16_t value) {
...
@@ -71,7 +71,7 @@ static FORCE_INLINE int taosEncodeFixedU16(void **buf, uint16_t value) {
return
(
int
)
sizeof
(
value
);
return
(
int
)
sizeof
(
value
);
}
}
static
FORCE_INLINE
void
*
taosDecodeFixedU16
(
void
*
buf
,
uint16_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedU16
(
const
void
*
buf
,
uint16_t
*
value
)
{
if
(
IS_LITTLE_ENDIAN
())
{
if
(
IS_LITTLE_ENDIAN
())
{
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
}
else
{
}
else
{
...
@@ -87,9 +87,9 @@ static FORCE_INLINE int taosEncodeFixedI16(void **buf, int16_t value) {
...
@@ -87,9 +87,9 @@ static FORCE_INLINE int taosEncodeFixedI16(void **buf, int16_t value) {
return
taosEncodeFixedU16
(
buf
,
ZIGZAGE
(
int16_t
,
value
));
return
taosEncodeFixedU16
(
buf
,
ZIGZAGE
(
int16_t
,
value
));
}
}
static
FORCE_INLINE
void
*
taosDecodeFixedI16
(
void
*
buf
,
int16_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedI16
(
const
void
*
buf
,
int16_t
*
value
)
{
uint16_t
tvalue
=
0
;
uint16_t
tvalue
=
0
;
void
*
ret
=
taosDecodeFixedU16
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeFixedU16
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int16_t
,
tvalue
);
*
value
=
ZIGZAGD
(
int16_t
,
tvalue
);
return
ret
;
return
ret
;
}
}
...
@@ -111,7 +111,7 @@ static FORCE_INLINE int taosEncodeFixedU32(void **buf, uint32_t value) {
...
@@ -111,7 +111,7 @@ static FORCE_INLINE int taosEncodeFixedU32(void **buf, uint32_t value) {
return
(
int
)
sizeof
(
value
);
return
(
int
)
sizeof
(
value
);
}
}
static
FORCE_INLINE
void
*
taosDecodeFixedU32
(
void
*
buf
,
uint32_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedU32
(
const
void
*
buf
,
uint32_t
*
value
)
{
if
(
IS_LITTLE_ENDIAN
())
{
if
(
IS_LITTLE_ENDIAN
())
{
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
}
else
{
}
else
{
...
@@ -129,9 +129,9 @@ static FORCE_INLINE int taosEncodeFixedI32(void **buf, int32_t value) {
...
@@ -129,9 +129,9 @@ static FORCE_INLINE int taosEncodeFixedI32(void **buf, int32_t value) {
return
taosEncodeFixedU32
(
buf
,
ZIGZAGE
(
int32_t
,
value
));
return
taosEncodeFixedU32
(
buf
,
ZIGZAGE
(
int32_t
,
value
));
}
}
static
FORCE_INLINE
void
*
taosDecodeFixedI32
(
void
*
buf
,
int32_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedI32
(
const
void
*
buf
,
int32_t
*
value
)
{
uint32_t
tvalue
=
0
;
uint32_t
tvalue
=
0
;
void
*
ret
=
taosDecodeFixedU32
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeFixedU32
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int32_t
,
tvalue
);
*
value
=
ZIGZAGD
(
int32_t
,
tvalue
);
return
ret
;
return
ret
;
}
}
...
@@ -158,7 +158,7 @@ static FORCE_INLINE int taosEncodeFixedU64(void **buf, uint64_t value) {
...
@@ -158,7 +158,7 @@ static FORCE_INLINE int taosEncodeFixedU64(void **buf, uint64_t value) {
return
(
int
)
sizeof
(
value
);
return
(
int
)
sizeof
(
value
);
}
}
static
FORCE_INLINE
void
*
taosDecodeFixedU64
(
void
*
buf
,
uint64_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedU64
(
const
void
*
buf
,
uint64_t
*
value
)
{
if
(
IS_LITTLE_ENDIAN
())
{
if
(
IS_LITTLE_ENDIAN
())
{
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
memcpy
(
value
,
buf
,
sizeof
(
*
value
));
}
else
{
}
else
{
...
@@ -180,9 +180,9 @@ static FORCE_INLINE int taosEncodeFixedI64(void **buf, int64_t value) {
...
@@ -180,9 +180,9 @@ static FORCE_INLINE int taosEncodeFixedI64(void **buf, int64_t value) {
return
taosEncodeFixedU64
(
buf
,
ZIGZAGE
(
int64_t
,
value
));
return
taosEncodeFixedU64
(
buf
,
ZIGZAGE
(
int64_t
,
value
));
}
}
static
FORCE_INLINE
void
*
taosDecodeFixedI64
(
void
*
buf
,
int64_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeFixedI64
(
const
void
*
buf
,
int64_t
*
value
)
{
uint64_t
tvalue
=
0
;
uint64_t
tvalue
=
0
;
void
*
ret
=
taosDecodeFixedU64
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeFixedU64
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int64_t
,
tvalue
);
*
value
=
ZIGZAGD
(
int64_t
,
tvalue
);
return
ret
;
return
ret
;
}
}
...
@@ -205,7 +205,7 @@ static FORCE_INLINE int taosEncodeVariantU16(void **buf, uint16_t value) {
...
@@ -205,7 +205,7 @@ static FORCE_INLINE int taosEncodeVariantU16(void **buf, uint16_t value) {
return
i
+
1
;
return
i
+
1
;
}
}
static
FORCE_INLINE
void
*
taosDecodeVariantU16
(
void
*
buf
,
uint16_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantU16
(
const
void
*
buf
,
uint16_t
*
value
)
{
int
i
=
0
;
int
i
=
0
;
uint16_t
tval
=
0
;
uint16_t
tval
=
0
;
*
value
=
0
;
*
value
=
0
;
...
@@ -228,9 +228,9 @@ static FORCE_INLINE int taosEncodeVariantI16(void **buf, int16_t value) {
...
@@ -228,9 +228,9 @@ static FORCE_INLINE int taosEncodeVariantI16(void **buf, int16_t value) {
return
taosEncodeVariantU16
(
buf
,
ZIGZAGE
(
int16_t
,
value
));
return
taosEncodeVariantU16
(
buf
,
ZIGZAGE
(
int16_t
,
value
));
}
}
static
FORCE_INLINE
void
*
taosDecodeVariantI16
(
void
*
buf
,
int16_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantI16
(
const
void
*
buf
,
int16_t
*
value
)
{
uint16_t
tvalue
=
0
;
uint16_t
tvalue
=
0
;
void
*
ret
=
taosDecodeVariantU16
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeVariantU16
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int16_t
,
tvalue
);
*
value
=
ZIGZAGD
(
int16_t
,
tvalue
);
return
ret
;
return
ret
;
}
}
...
@@ -253,7 +253,7 @@ static FORCE_INLINE int taosEncodeVariantU32(void **buf, uint32_t value) {
...
@@ -253,7 +253,7 @@ static FORCE_INLINE int taosEncodeVariantU32(void **buf, uint32_t value) {
return
i
+
1
;
return
i
+
1
;
}
}
static
FORCE_INLINE
void
*
taosDecodeVariantU32
(
void
*
buf
,
uint32_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantU32
(
const
void
*
buf
,
uint32_t
*
value
)
{
int
i
=
0
;
int
i
=
0
;
uint32_t
tval
=
0
;
uint32_t
tval
=
0
;
*
value
=
0
;
*
value
=
0
;
...
@@ -276,9 +276,9 @@ static FORCE_INLINE int taosEncodeVariantI32(void **buf, int32_t value) {
...
@@ -276,9 +276,9 @@ static FORCE_INLINE int taosEncodeVariantI32(void **buf, int32_t value) {
return
taosEncodeVariantU32
(
buf
,
ZIGZAGE
(
int32_t
,
value
));
return
taosEncodeVariantU32
(
buf
,
ZIGZAGE
(
int32_t
,
value
));
}
}
static
FORCE_INLINE
void
*
taosDecodeVariantI32
(
void
*
buf
,
int32_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantI32
(
const
void
*
buf
,
int32_t
*
value
)
{
uint32_t
tvalue
=
0
;
uint32_t
tvalue
=
0
;
void
*
ret
=
taosDecodeVariantU32
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeVariantU32
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int32_t
,
tvalue
);
*
value
=
ZIGZAGD
(
int32_t
,
tvalue
);
return
ret
;
return
ret
;
}
}
...
@@ -301,7 +301,7 @@ static FORCE_INLINE int taosEncodeVariantU64(void **buf, uint64_t value) {
...
@@ -301,7 +301,7 @@ static FORCE_INLINE int taosEncodeVariantU64(void **buf, uint64_t value) {
return
i
+
1
;
return
i
+
1
;
}
}
static
FORCE_INLINE
void
*
taosDecodeVariantU64
(
void
*
buf
,
uint64_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantU64
(
const
void
*
buf
,
uint64_t
*
value
)
{
int
i
=
0
;
int
i
=
0
;
uint64_t
tval
=
0
;
uint64_t
tval
=
0
;
*
value
=
0
;
*
value
=
0
;
...
@@ -324,9 +324,9 @@ static FORCE_INLINE int taosEncodeVariantI64(void **buf, int64_t value) {
...
@@ -324,9 +324,9 @@ static FORCE_INLINE int taosEncodeVariantI64(void **buf, int64_t value) {
return
taosEncodeVariantU64
(
buf
,
ZIGZAGE
(
int64_t
,
value
));
return
taosEncodeVariantU64
(
buf
,
ZIGZAGE
(
int64_t
,
value
));
}
}
static
FORCE_INLINE
void
*
taosDecodeVariantI64
(
void
*
buf
,
int64_t
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeVariantI64
(
const
void
*
buf
,
int64_t
*
value
)
{
uint64_t
tvalue
=
0
;
uint64_t
tvalue
=
0
;
void
*
ret
=
taosDecodeVariantU64
(
buf
,
&
tvalue
);
void
*
ret
=
taosDecodeVariantU64
(
buf
,
&
tvalue
);
*
value
=
ZIGZAGD
(
int64_t
,
tvalue
);
*
value
=
ZIGZAGD
(
int64_t
,
tvalue
);
return
ret
;
return
ret
;
}
}
...
@@ -346,7 +346,7 @@ static FORCE_INLINE int taosEncodeString(void **buf, const char *value) {
...
@@ -346,7 +346,7 @@ static FORCE_INLINE int taosEncodeString(void **buf, const char *value) {
return
tlen
;
return
tlen
;
}
}
static
FORCE_INLINE
void
*
taosDecodeString
(
void
*
buf
,
char
**
value
)
{
static
FORCE_INLINE
void
*
taosDecodeString
(
const
void
*
buf
,
char
**
value
)
{
uint64_t
size
=
0
;
uint64_t
size
=
0
;
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
...
@@ -360,7 +360,7 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
...
@@ -360,7 +360,7 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
return
POINTER_SHIFT
(
buf
,
size
);
return
POINTER_SHIFT
(
buf
,
size
);
}
}
static
FORCE_INLINE
void
*
taosDecodeStringTo
(
void
*
buf
,
char
*
value
)
{
static
FORCE_INLINE
void
*
taosDecodeStringTo
(
const
void
*
buf
,
char
*
value
)
{
uint64_t
size
=
0
;
uint64_t
size
=
0
;
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
...
@@ -373,7 +373,7 @@ static FORCE_INLINE void *taosDecodeStringTo(void *buf, char *value) {
...
@@ -373,7 +373,7 @@ static FORCE_INLINE void *taosDecodeStringTo(void *buf, char *value) {
// ---- binary
// ---- binary
static
FORCE_INLINE
int
taosEncodeBinary
(
void
**
buf
,
const
void
*
value
,
int32_t
valueLen
)
{
static
FORCE_INLINE
int
taosEncodeBinary
(
void
**
buf
,
const
void
*
value
,
int32_t
valueLen
)
{
int
tlen
=
0
;
int
tlen
=
0
;
if
(
buf
!=
NULL
)
{
if
(
buf
!=
NULL
)
{
memcpy
(
*
buf
,
value
,
valueLen
);
memcpy
(
*
buf
,
value
,
valueLen
);
...
@@ -384,8 +384,7 @@ static FORCE_INLINE int taosEncodeBinary(void **buf, const void *value, int32_t
...
@@ -384,8 +384,7 @@ static FORCE_INLINE int taosEncodeBinary(void **buf, const void *value, int32_t
return
tlen
;
return
tlen
;
}
}
static
FORCE_INLINE
void
*
taosDecodeBinary
(
void
*
buf
,
void
**
value
,
int32_t
valueLen
)
{
static
FORCE_INLINE
void
*
taosDecodeBinary
(
const
void
*
buf
,
void
**
value
,
int32_t
valueLen
)
{
*
value
=
malloc
((
size_t
)
valueLen
);
*
value
=
malloc
((
size_t
)
valueLen
);
if
(
*
value
==
NULL
)
return
NULL
;
if
(
*
value
==
NULL
)
return
NULL
;
memcpy
(
*
value
,
buf
,
(
size_t
)
valueLen
);
memcpy
(
*
value
,
buf
,
(
size_t
)
valueLen
);
...
@@ -393,8 +392,7 @@ static FORCE_INLINE void *taosDecodeBinary(void *buf, void **value, int32_t valu
...
@@ -393,8 +392,7 @@ static FORCE_INLINE void *taosDecodeBinary(void *buf, void **value, int32_t valu
return
POINTER_SHIFT
(
buf
,
valueLen
);
return
POINTER_SHIFT
(
buf
,
valueLen
);
}
}
static
FORCE_INLINE
void
*
taosDecodeBinaryTo
(
void
*
buf
,
void
*
value
,
int32_t
valueLen
)
{
static
FORCE_INLINE
void
*
taosDecodeBinaryTo
(
const
void
*
buf
,
void
*
value
,
int32_t
valueLen
)
{
memcpy
(
value
,
buf
,
(
size_t
)
valueLen
);
memcpy
(
value
,
buf
,
(
size_t
)
valueLen
);
return
POINTER_SHIFT
(
buf
,
valueLen
);
return
POINTER_SHIFT
(
buf
,
valueLen
);
}
}
...
...
include/util/tlosertree.h
浏览文件 @
bffdb7a8
...
@@ -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
浏览文件 @
bffdb7a8
...
@@ -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/CMakeLists.txt
浏览文件 @
bffdb7a8
...
@@ -3,5 +3,4 @@ add_subdirectory(util)
...
@@ -3,5 +3,4 @@ add_subdirectory(util)
add_subdirectory
(
common
)
add_subdirectory
(
common
)
add_subdirectory
(
libs
)
add_subdirectory
(
libs
)
add_subdirectory
(
client
)
add_subdirectory
(
client
)
add_subdirectory
(
dnode
)
add_subdirectory
(
dnode
)
add_subdirectory
(
nodes
)
\ No newline at end of file
\ No newline at end of file
source/client/src/clientHb.c
浏览文件 @
bffdb7a8
...
@@ -28,16 +28,17 @@ static int32_t hbMqHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp* pRsp)
...
@@ -28,16 +28,17 @@ static int32_t hbMqHbRspHandle(struct SAppHbMgr *pAppHbMgr, SClientHbRsp* pRsp)
}
}
static
int32_t
hbProcessDBInfoRsp
(
void
*
value
,
int32_t
valueLen
,
struct
SCatalog
*
pCatalog
)
{
static
int32_t
hbProcessDBInfoRsp
(
void
*
value
,
int32_t
valueLen
,
struct
SCatalog
*
pCatalog
)
{
int32_t
msgLen
=
0
;
int32_t
code
=
0
;
int32_t
code
=
0
;
while
(
msgLen
<
valueLen
)
{
SUseDbRsp
*
rsp
=
(
SUseDbRsp
*
)((
char
*
)
value
+
msgLen
);
rsp
->
vgVersion
=
ntohl
(
rsp
->
vgVersion
);
SUseDbBatchRsp
batchUseRsp
=
{
0
};
rsp
->
vgNum
=
ntohl
(
rsp
->
vgNum
);
if
(
tDeserializeSUseDbBatchRsp
(
value
,
valueLen
,
&
batchUseRsp
)
!=
0
)
{
rsp
->
uid
=
be64toh
(
rsp
->
uid
);
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
int32_t
numOfBatchs
=
taosArrayGetSize
(
batchUseRsp
.
pArray
);
for
(
int32_t
i
=
0
;
i
<
numOfBatchs
;
++
i
)
{
SUseDbRsp
*
rsp
=
taosArrayGet
(
batchUseRsp
.
pArray
,
i
);
tscDebug
(
"hb db rsp, db:%s, vgVersion:%d, uid:%"
PRIx64
,
rsp
->
db
,
rsp
->
vgVersion
,
rsp
->
uid
);
tscDebug
(
"hb db rsp, db:%s, vgVersion:%d, uid:%"
PRIx64
,
rsp
->
db
,
rsp
->
vgVersion
,
rsp
->
uid
);
if
(
rsp
->
vgVersion
<
0
)
{
if
(
rsp
->
vgVersion
<
0
)
{
...
@@ -52,16 +53,9 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
...
@@ -52,16 +53,9 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
for
(
int32_t
i
=
0
;
i
<
rsp
->
vgNum
;
++
i
)
{
for
(
int32_t
j
=
0
;
j
<
rsp
->
vgNum
;
++
j
)
{
rsp
->
vgroupInfo
[
i
].
vgId
=
ntohl
(
rsp
->
vgroupInfo
[
i
].
vgId
);
SVgroupInfo
*
pInfo
=
taosArrayGet
(
rsp
->
pVgroupInfos
,
j
);
rsp
->
vgroupInfo
[
i
].
hashBegin
=
ntohl
(
rsp
->
vgroupInfo
[
i
].
hashBegin
);
if
(
taosHashPut
(
vgInfo
.
vgHash
,
&
pInfo
->
vgId
,
sizeof
(
int32_t
),
pInfo
,
sizeof
(
SVgroupInfo
))
!=
0
)
{
rsp
->
vgroupInfo
[
i
].
hashEnd
=
ntohl
(
rsp
->
vgroupInfo
[
i
].
hashEnd
);
for
(
int32_t
n
=
0
;
n
<
rsp
->
vgroupInfo
[
i
].
epset
.
numOfEps
;
++
n
)
{
rsp
->
vgroupInfo
[
i
].
epset
.
eps
[
n
].
port
=
ntohs
(
rsp
->
vgroupInfo
[
i
].
epset
.
eps
[
n
].
port
);
}
if
(
0
!=
taosHashPut
(
vgInfo
.
vgHash
,
&
rsp
->
vgroupInfo
[
i
].
vgId
,
sizeof
(
rsp
->
vgroupInfo
[
i
].
vgId
),
&
rsp
->
vgroupInfo
[
i
],
sizeof
(
rsp
->
vgroupInfo
[
i
])))
{
tscError
(
"hash push failed, errno:%d"
,
errno
);
tscError
(
"hash push failed, errno:%d"
,
errno
);
taosHashCleanup
(
vgInfo
.
vgHash
);
taosHashCleanup
(
vgInfo
.
vgHash
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
@@ -74,66 +68,44 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
...
@@ -74,66 +68,44 @@ static int32_t hbProcessDBInfoRsp(void *value, int32_t valueLen, struct SCatalog
if
(
code
)
{
if
(
code
)
{
return
code
;
return
code
;
}
}
msgLen
+=
sizeof
(
SUseDbRsp
)
+
rsp
->
vgNum
*
sizeof
(
SVgroupInfo
);
}
}
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
)
{
...
@@ -199,9 +171,10 @@ static int32_t hbMqAsyncCallBack(void* param, const SDataBuf* pMsg, int32_t code
...
@@ -199,9 +171,10 @@ static int32_t hbMqAsyncCallBack(void* param, const SDataBuf* pMsg, int32_t code
tfree
(
param
);
tfree
(
param
);
return
-
1
;
return
-
1
;
}
}
char
*
key
=
(
char
*
)
param
;
char
*
key
=
(
char
*
)
param
;
SClientHbBatchRsp
pRsp
=
{
0
};
SClientHbBatchRsp
pRsp
=
{
0
};
tDeserializeSClientHbBatchRsp
(
pMsg
->
pData
,
&
pRsp
);
tDeserializeSClientHbBatchRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
pRsp
);
int32_t
rspNum
=
taosArrayGetSize
(
pRsp
.
rsps
);
int32_t
rspNum
=
taosArrayGetSize
(
pRsp
.
rsps
);
...
@@ -342,7 +315,7 @@ void hbFreeReq(void *req) {
...
@@ -342,7 +315,7 @@ void hbFreeReq(void *req) {
SClientHbBatchReq
*
hbGatherAllInfo
(
SAppHbMgr
*
pAppHbMgr
)
{
SClientHbBatchReq
*
hbGatherAllInfo
(
SAppHbMgr
*
pAppHbMgr
)
{
SClientHbBatchReq
*
pBatchReq
=
malloc
(
sizeof
(
SClientHbBatchReq
));
SClientHbBatchReq
*
pBatchReq
=
calloc
(
1
,
sizeof
(
SClientHbBatchReq
));
if
(
pBatchReq
==
NULL
)
{
if
(
pBatchReq
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
NULL
;
return
NULL
;
...
@@ -414,7 +387,7 @@ static void* hbThreadFunc(void* param) {
...
@@ -414,7 +387,7 @@ static void* hbThreadFunc(void* param) {
if
(
pReq
==
NULL
)
{
if
(
pReq
==
NULL
)
{
continue
;
continue
;
}
}
int
tlen
=
tSerializeSClientHbBatchReq
(
NULL
,
pReq
);
int
tlen
=
tSerializeSClientHbBatchReq
(
NULL
,
0
,
pReq
);
void
*
buf
=
malloc
(
tlen
);
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
@@ -422,8 +395,7 @@ static void* hbThreadFunc(void* param) {
...
@@ -422,8 +395,7 @@ static void* hbThreadFunc(void* param) {
hbClearReqInfo
(
pAppHbMgr
);
hbClearReqInfo
(
pAppHbMgr
);
break
;
break
;
}
}
void
*
abuf
=
buf
;
tSerializeSClientHbBatchReq
(
buf
,
tlen
,
pReq
);
tSerializeSClientHbBatchReq
(
&
abuf
,
pReq
);
SMsgSendInfo
*
pInfo
=
malloc
(
sizeof
(
SMsgSendInfo
));
SMsgSendInfo
*
pInfo
=
malloc
(
sizeof
(
SMsgSendInfo
));
if
(
pInfo
==
NULL
)
{
if
(
pInfo
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
...
source/client/src/clientImpl.c
浏览文件 @
bffdb7a8
...
@@ -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
浏览文件 @
bffdb7a8
...
@@ -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
);
...
@@ -97,14 +91,15 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) {
...
@@ -97,14 +91,15 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) {
if
(
pRequest
->
type
==
TDMT_MND_SHOW_RETRIEVE
||
pRequest
->
type
==
TDMT_VND_SHOW_TABLES_FETCH
)
{
if
(
pRequest
->
type
==
TDMT_MND_SHOW_RETRIEVE
||
pRequest
->
type
==
TDMT_VND_SHOW_TABLES_FETCH
)
{
if
(
pRequest
->
type
==
TDMT_MND_SHOW_RETRIEVE
)
{
if
(
pRequest
->
type
==
TDMT_MND_SHOW_RETRIEVE
)
{
SRetrieveTableReq
*
pRetrieveMsg
=
calloc
(
1
,
sizeof
(
SRetrieveTableReq
));
SRetrieveTableReq
retrieveReq
=
{
0
};
if
(
pRetrieveMsg
==
NULL
)
{
retrieveReq
.
showId
=
pRequest
->
body
.
showInfo
.
execId
;
return
NULL
;
}
int32_t
contLen
=
tSerializeSRetrieveTableReq
(
NULL
,
0
,
&
retrieveReq
);
void
*
pReq
=
malloc
(
contLen
);
tSerializeSRetrieveTableReq
(
pReq
,
contLen
,
&
retrieveReq
);
pRetrieveMsg
->
showId
=
htobe64
(
pRequest
->
body
.
showInfo
.
execId
);
pMsgSendInfo
->
msgInfo
.
pData
=
pReq
;
pMsgSendInfo
->
msgInfo
.
pData
=
pRetrieveMsg
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SRetrieveTableReq
);
}
else
{
}
else
{
SVShowTablesFetchReq
*
pFetchMsg
=
calloc
(
1
,
sizeof
(
SVShowTablesFetchReq
));
SVShowTablesFetchReq
*
pFetchMsg
=
calloc
(
1
,
sizeof
(
SVShowTablesFetchReq
));
if
(
pFetchMsg
==
NULL
)
{
if
(
pFetchMsg
==
NULL
)
{
...
@@ -134,39 +129,29 @@ int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -134,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
)
{
...
@@ -264,9 +249,13 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -264,9 +249,13 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
return
code
;
}
}
SUseDbRsp
*
pUseDbRsp
=
(
SUseDbRsp
*
)
pMsg
->
pData
;
SUseDbRsp
usedbRsp
=
{
0
};
tDeserializeSUseDbRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
usedbRsp
);
SName
name
=
{
0
};
SName
name
=
{
0
};
tNameFromString
(
&
name
,
pUseDbRsp
->
db
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameFromString
(
&
name
,
usedbRsp
.
db
,
T_NAME_ACCT
|
T_NAME_DB
);
tFreeSUsedbRsp
(
&
usedbRsp
);
char
db
[
TSDB_DB_NAME_LEN
]
=
{
0
};
char
db
[
TSDB_DB_NAME_LEN
]
=
{
0
};
tNameGetDbName
(
&
name
,
db
);
tNameGetDbName
(
&
name
,
db
);
...
@@ -300,14 +289,12 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -300,14 +289,12 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
return
code
;
}
}
SDropDbRsp
*
rsp
=
(
SDropDbRsp
*
)
pMsg
->
pData
;
SDropDbRsp
dropdbRsp
=
{
0
};
tDeserializeSDropDbRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
dropdbRsp
);
struct
SCatalog
*
pCatalog
=
NULL
;
rsp
->
uid
=
be64toh
(
rsp
->
uid
);
struct
SCatalog
*
pCatalog
=
NULL
;
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
catalogRemoveDB
(
pCatalog
,
dropdbRsp
.
db
,
dropdbRsp
.
uid
);
catalogRemoveDB
(
pCatalog
,
rsp
->
db
,
rsp
->
uid
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
tsem_post
(
&
pRequest
->
body
.
rspSem
);
return
code
;
return
code
;
...
...
source/client/src/tmq.c
浏览文件 @
bffdb7a8
...
@@ -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
{
...
@@ -33,6 +33,7 @@ struct tmq_list_t {
...
@@ -33,6 +33,7 @@ struct tmq_list_t {
int32_t
tot
;
int32_t
tot
;
char
*
elems
[];
char
*
elems
[];
};
};
struct
tmq_topic_vgroup_t
{
struct
tmq_topic_vgroup_t
{
char
*
topic
;
char
*
topic
;
int32_t
vgId
;
int32_t
vgId
;
...
@@ -48,14 +49,17 @@ struct tmq_topic_vgroup_list_t {
...
@@ -48,14 +49,17 @@ struct tmq_topic_vgroup_list_t {
struct
tmq_conf_t
{
struct
tmq_conf_t
{
char
clientId
[
256
];
char
clientId
[
256
];
char
groupId
[
256
];
char
groupId
[
256
];
bool
auto_commit
;
/*char* ip;*/
/*char* ip;*/
/*uint16_t port;*/
/*uint16_t port;*/
tmq_commit_cb
*
commit_cb
;
tmq_commit_cb
*
commit_cb
;
};
};
struct
tmq_t
{
struct
tmq_t
{
// conf
char
groupId
[
256
];
char
groupId
[
256
];
char
clientId
[
256
];
char
clientId
[
256
];
bool
autoCommit
;
SRWLatch
lock
;
SRWLatch
lock
;
int64_t
consumerId
;
int64_t
consumerId
;
int32_t
epoch
;
int32_t
epoch
;
...
@@ -94,25 +98,25 @@ typedef struct SMqClientTopic {
...
@@ -94,25 +98,25 @@ typedef struct SMqClientTopic {
SArray
*
vgs
;
// SArray<SMqClientVg>
SArray
*
vgs
;
// SArray<SMqClientVg>
}
SMqClientTopic
;
}
SMqClientTopic
;
typedef
struct
SMqSubscribeCbParam
{
typedef
struct
{
tmq_t
*
tmq
;
tmq_t
*
tmq
;
tsem_t
rspSem
;
tsem_t
rspSem
;
tmq_resp_err_t
rspErr
;
tmq_resp_err_t
rspErr
;
}
SMqSubscribeCbParam
;
}
SMqSubscribeCbParam
;
typedef
struct
SMqAskEpCbParam
{
typedef
struct
{
tmq_t
*
tmq
;
tmq_t
*
tmq
;
int32_t
wait
;
int32_t
wait
;
}
SMqAskEpCbParam
;
}
SMqAskEpCbParam
;
typedef
struct
SMqConsumeCbParam
{
typedef
struct
{
tmq_t
*
tmq
;
tmq_t
*
tmq
;
SMqClientVg
*
pVg
;
SMqClientVg
*
pVg
;
tmq_message_t
**
retMsg
;
tmq_message_t
**
retMsg
;
tsem_t
rspSem
;
tsem_t
rspSem
;
}
SMqConsumeCbParam
;
}
SMqConsumeCbParam
;
typedef
struct
SMqCommitCbParam
{
typedef
struct
{
tmq_t
*
tmq
;
tmq_t
*
tmq
;
SMqClientVg
*
pVg
;
SMqClientVg
*
pVg
;
int32_t
async
;
int32_t
async
;
...
@@ -121,6 +125,7 @@ typedef struct SMqCommitCbParam {
...
@@ -121,6 +125,7 @@ typedef struct SMqCommitCbParam {
tmq_conf_t
*
tmq_conf_new
()
{
tmq_conf_t
*
tmq_conf_new
()
{
tmq_conf_t
*
conf
=
calloc
(
1
,
sizeof
(
tmq_conf_t
));
tmq_conf_t
*
conf
=
calloc
(
1
,
sizeof
(
tmq_conf_t
));
conf
->
auto_commit
=
false
;
return
conf
;
return
conf
;
}
}
...
@@ -131,11 +136,24 @@ void tmq_conf_destroy(tmq_conf_t* conf) {
...
@@ -131,11 +136,24 @@ void tmq_conf_destroy(tmq_conf_t* conf) {
tmq_conf_res_t
tmq_conf_set
(
tmq_conf_t
*
conf
,
const
char
*
key
,
const
char
*
value
)
{
tmq_conf_res_t
tmq_conf_set
(
tmq_conf_t
*
conf
,
const
char
*
key
,
const
char
*
value
)
{
if
(
strcmp
(
key
,
"group.id"
)
==
0
)
{
if
(
strcmp
(
key
,
"group.id"
)
==
0
)
{
strcpy
(
conf
->
groupId
,
value
);
strcpy
(
conf
->
groupId
,
value
);
return
TMQ_CONF_OK
;
}
}
if
(
strcmp
(
key
,
"client.id"
)
==
0
)
{
if
(
strcmp
(
key
,
"client.id"
)
==
0
)
{
strcpy
(
conf
->
clientId
,
value
);
strcpy
(
conf
->
clientId
,
value
);
return
TMQ_CONF_OK
;
}
if
(
strcmp
(
key
,
"enable.auto.commit"
)
==
0
)
{
if
(
strcmp
(
value
,
"true"
)
==
0
)
{
conf
->
auto_commit
=
true
;
return
TMQ_CONF_OK
;
}
else
if
(
strcmp
(
value
,
"false"
)
==
0
)
{
conf
->
auto_commit
=
false
;
return
TMQ_CONF_OK
;
}
else
{
return
TMQ_CONF_INVALID
;
}
}
}
return
TMQ_CONF_
OK
;
return
TMQ_CONF_
UNKNOWN
;
}
}
tmq_list_t
*
tmq_list_new
()
{
tmq_list_t
*
tmq_list_new
()
{
...
@@ -155,6 +173,12 @@ int32_t tmq_list_append(tmq_list_t* ptr, const char* src) {
...
@@ -155,6 +173,12 @@ int32_t tmq_list_append(tmq_list_t* ptr, const char* src) {
return
0
;
return
0
;
}
}
tmq_resp_err_t
tmq_reset_offset
(
tmq_t
*
tmq
,
const
tmq_topic_vgroup_list_t
*
offsets
)
{
// build msg
// send to mnode
return
TMQ_RESP_ERR__SUCCESS
;
}
int32_t
tmqSubscribeCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int32_t
tmqSubscribeCb
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SMqSubscribeCbParam
*
pParam
=
(
SMqSubscribeCbParam
*
)
param
;
SMqSubscribeCbParam
*
pParam
=
(
SMqSubscribeCbParam
*
)
param
;
pParam
->
rspErr
=
code
;
pParam
->
rspErr
=
code
;
...
@@ -182,11 +206,14 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs
...
@@ -182,11 +206,14 @@ tmq_t* tmq_consumer_new(void* conn, tmq_conf_t* conf, char* errstr, int32_t errs
pTmq
->
pollCnt
=
0
;
pTmq
->
pollCnt
=
0
;
pTmq
->
epoch
=
0
;
pTmq
->
epoch
=
0
;
taosInitRWLatch
(
&
pTmq
->
lock
);
taosInitRWLatch
(
&
pTmq
->
lock
);
// set conf
strcpy
(
pTmq
->
clientId
,
conf
->
clientId
);
strcpy
(
pTmq
->
clientId
,
conf
->
clientId
);
strcpy
(
pTmq
->
groupId
,
conf
->
groupId
);
strcpy
(
pTmq
->
groupId
,
conf
->
groupId
);
pTmq
->
autoCommit
=
conf
->
auto_commit
;
pTmq
->
commit_cb
=
conf
->
commit_cb
;
pTmq
->
commit_cb
=
conf
->
commit_cb
;
tsem_init
(
&
pTmq
->
rspSem
,
0
,
0
);
tsem_init
(
&
pTmq
->
rspSem
,
0
,
0
);
pTmq
->
consumerId
=
generateRequestId
()
&
((
uint64_t
)
-
1
>>
1
);
pTmq
->
consumerId
=
generateRequestId
()
&
((
(
uint64_t
)
-
1
)
>>
1
);
pTmq
->
clientTopics
=
taosArrayInit
(
0
,
sizeof
(
SMqClientTopic
));
pTmq
->
clientTopics
=
taosArrayInit
(
0
,
sizeof
(
SMqClientTopic
));
return
pTmq
;
return
pTmq
;
}
}
...
@@ -357,25 +384,21 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
...
@@ -357,25 +384,21 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
tNameFromString
(
&
name
,
dbName
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameFromString
(
&
name
,
dbName
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameFromString
(
&
name
,
topicName
,
T_NAME_TABLE
);
tNameFromString
(
&
name
,
topicName
,
T_NAME_TABLE
);
char
topicFname
[
TSDB_TOPIC_FNAME_LEN
]
=
{
0
};
SMCreateTopicReq
req
=
{
tNameExtractFullName
(
&
name
,
topicFname
);
SCMCreateTopicReq
req
=
{
.
name
=
(
char
*
)
topicFname
,
.
igExists
=
1
,
.
igExists
=
1
,
.
physicalPlan
=
(
char
*
)
pStr
,
.
physicalPlan
=
(
char
*
)
pStr
,
.
sql
=
(
char
*
)
sql
,
.
sql
=
(
char
*
)
sql
,
.
logicalPlan
=
(
char
*
)
"no logic plan"
,
.
logicalPlan
=
(
char
*
)
"no logic plan"
,
};
};
tNameExtractFullName
(
&
name
,
req
.
name
);
int
tlen
=
tSerialize
SCMCreateTopicReq
(
NULL
,
&
req
);
int
tlen
=
tSerialize
MCreateTopicReq
(
NULL
,
0
,
&
req
);
void
*
buf
=
malloc
(
tlen
);
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
if
(
buf
==
NULL
)
{
goto
_return
;
goto
_return
;
}
}
void
*
abuf
=
buf
;
tSerializeMCreateTopicReq
(
buf
,
tlen
,
&
req
);
tSerializeSCMCreateTopicReq
(
&
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
};
...
@@ -452,6 +475,12 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
...
@@ -452,6 +475,12 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
return
buf
;
return
buf
;
}
}
int32_t
tmqGetSkipLogNum
(
tmq_message_t
*
tmq_message
)
{
if
(
tmq_message
==
NULL
)
return
0
;
SMqConsumeRsp
*
pRsp
=
(
SMqConsumeRsp
*
)
tmq_message
;
return
pRsp
->
skipLogNum
;
}
void
tmqShowMsg
(
tmq_message_t
*
tmq_message
)
{
void
tmqShowMsg
(
tmq_message_t
*
tmq_message
)
{
if
(
tmq_message
==
NULL
)
return
;
if
(
tmq_message
==
NULL
)
return
;
...
@@ -557,8 +586,15 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -557,8 +586,15 @@ int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) {
topic
.
vgs
=
taosArrayInit
(
vgSz
,
sizeof
(
SMqClientVg
));
topic
.
vgs
=
taosArrayInit
(
vgSz
,
sizeof
(
SMqClientVg
));
for
(
int32_t
j
=
0
;
j
<
vgSz
;
j
++
)
{
for
(
int32_t
j
=
0
;
j
<
vgSz
;
j
++
)
{
SMqSubVgEp
*
pVgEp
=
taosArrayGet
(
pTopicEp
->
vgs
,
j
);
SMqSubVgEp
*
pVgEp
=
taosArrayGet
(
pTopicEp
->
vgs
,
j
);
// clang-format off
SMqClientVg
clientVg
=
{
SMqClientVg
clientVg
=
{
.
pollCnt
=
0
,
.
committedOffset
=
-
1
,
.
currentOffset
=
-
1
,
.
vgId
=
pVgEp
->
vgId
,
.
epSet
=
pVgEp
->
epSet
};
.
pollCnt
=
0
,
.
committedOffset
=
-
1
,
.
currentOffset
=
-
1
,
.
vgId
=
pVgEp
->
vgId
,
.
epSet
=
pVgEp
->
epSet
};
// clang-format on
taosArrayPush
(
topic
.
vgs
,
&
clientVg
);
taosArrayPush
(
topic
.
vgs
,
&
clientVg
);
set
=
true
;
set
=
true
;
}
}
...
@@ -649,17 +685,19 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
...
@@ -649,17 +685,19 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
int64_t
status
=
atomic_load_64
(
&
tmq
->
status
);
int64_t
status
=
atomic_load_64
(
&
tmq
->
status
);
tmqAskEp
(
tmq
,
status
==
0
);
tmqAskEp
(
tmq
,
status
==
0
);
if
(
blocking_time
<
0
)
blocking_time
=
1
;
if
(
blocking_time
<
=
0
)
blocking_time
=
1
;
if
(
blocking_time
>
1000
)
blocking_time
=
1000
;
if
(
blocking_time
>
1000
)
blocking_time
=
1000
;
/*blocking_time = 1;*/
/*blocking_time = 1;*/
if
(
taosArrayGetSize
(
tmq
->
clientTopics
)
==
0
)
{
if
(
taosArrayGetSize
(
tmq
->
clientTopics
)
==
0
)
{
tscDebug
(
"consumer:%ld poll but not assigned"
,
tmq
->
consumerId
);
tscDebug
(
"consumer:%ld poll but not assigned"
,
tmq
->
consumerId
);
printf
(
"over1
\n
"
);
usleep
(
blocking_time
*
1000
);
usleep
(
blocking_time
*
1000
);
return
NULL
;
return
NULL
;
}
}
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
tmq
->
nextTopicIdx
);
SMqClientTopic
*
pTopic
=
taosArrayGet
(
tmq
->
clientTopics
,
tmq
->
nextTopicIdx
);
if
(
taosArrayGetSize
(
pTopic
->
vgs
)
==
0
)
{
if
(
taosArrayGetSize
(
pTopic
->
vgs
)
==
0
)
{
printf
(
"over2
\n
"
);
usleep
(
blocking_time
*
1000
);
usleep
(
blocking_time
*
1000
);
return
NULL
;
return
NULL
;
}
}
...
@@ -670,7 +708,8 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
...
@@ -670,7 +708,8 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
pTopic
->
nextVgIdx
=
(
pTopic
->
nextVgIdx
+
1
)
%
taosArrayGetSize
(
pTopic
->
vgs
);
pTopic
->
nextVgIdx
=
(
pTopic
->
nextVgIdx
+
1
)
%
taosArrayGetSize
(
pTopic
->
vgs
);
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
pTopic
->
nextVgIdx
);
SMqClientVg
*
pVg
=
taosArrayGet
(
pTopic
->
vgs
,
pTopic
->
nextVgIdx
);
/*printf("consume vg %d, offset %ld\n", pVg->vgId, pVg->currentOffset);*/
/*printf("consume vg %d, offset %ld\n", pVg->vgId, pVg->currentOffset);*/
SMqConsumeReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blocking_time
,
TMQ_REQ_TYPE_CONSUME_ONLY
,
pTopic
,
pVg
);
int32_t
reqType
=
tmq
->
autoCommit
?
TMQ_REQ_TYPE_CONSUME_AND_COMMIT
:
TMQ_REQ_TYPE_CONSUME_ONLY
;
SMqConsumeReq
*
pReq
=
tmqBuildConsumeReqImpl
(
tmq
,
blocking_time
,
reqType
,
pTopic
,
pVg
);
if
(
pReq
==
NULL
)
{
if
(
pReq
==
NULL
)
{
ASSERT
(
false
);
ASSERT
(
false
);
usleep
(
blocking_time
*
1000
);
usleep
(
blocking_time
*
1000
);
...
...
source/common/src/tep.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/common/src/tmsg.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/common/src/tname.c
浏览文件 @
bffdb7a8
#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
浏览文件 @
bffdb7a8
...
@@ -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
浏览文件 @
bffdb7a8
#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/src/dndBnode.c
浏览文件 @
bffdb7a8
...
@@ -258,11 +258,14 @@ static int32_t dndDropBnode(SDnode *pDnode) {
...
@@ -258,11 +258,14 @@ static int32_t dndDropBnode(SDnode *pDnode) {
return
0
;
return
0
;
}
}
int32_t
dndProcessCreateBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
int32_t
dndProcessCreateBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDCreateBnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
SDCreateBnodeReq
createReq
=
{
0
};
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
createReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_BNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_BNODE_INVALID_OPTION
;
dError
(
"failed to create bnode since %s"
,
terrstr
());
dError
(
"failed to create bnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -271,11 +274,14 @@ int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
...
@@ -271,11 +274,14 @@ int32_t dndProcessCreateBnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
}
}
}
int32_t
dndProcessDropBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
int32_t
dndProcessDropBnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDDropBnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
SDDropBnodeReq
dropReq
=
{
0
};
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
dropReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_BNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_BNODE_INVALID_OPTION
;
dError
(
"failed to drop bnode since %s"
,
terrstr
());
dError
(
"failed to drop bnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mgmt/impl/src/dndMgmt.c
浏览文件 @
bffdb7a8
...
@@ -379,10 +379,9 @@ void dndSendStatusReq(SDnode *pDnode) {
...
@@ -379,10 +379,9 @@ void dndSendStatusReq(SDnode *pDnode) {
req
.
pVloads
=
taosArrayInit
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeLoad
));
req
.
pVloads
=
taosArrayInit
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeLoad
));
dndGetVnodeLoads
(
pDnode
,
req
.
pVloads
);
dndGetVnodeLoads
(
pDnode
,
req
.
pVloads
);
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
&
req
);
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
0
,
&
req
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
void
*
pBuf
=
pHead
;
tSerializeSStatusReq
(
pHead
,
contLen
,
&
req
);
tSerializeSStatusReq
(
&
pBuf
,
&
req
);
taosArrayDestroy
(
req
.
pVloads
);
taosArrayDestroy
(
req
.
pVloads
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pHead
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_STATUS
,
.
ahandle
=
(
void
*
)
9527
};
SRpcMsg
rpcMsg
=
{.
pCont
=
pHead
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_STATUS
,
.
ahandle
=
(
void
*
)
9527
};
...
@@ -395,7 +394,7 @@ void dndSendStatusReq(SDnode *pDnode) {
...
@@ -395,7 +394,7 @@ void dndSendStatusReq(SDnode *pDnode) {
static
void
dndUpdateDnodeCfg
(
SDnode
*
pDnode
,
SDnodeCfg
*
pCfg
)
{
static
void
dndUpdateDnodeCfg
(
SDnode
*
pDnode
,
SDnodeCfg
*
pCfg
)
{
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
if
(
pMgmt
->
dnodeId
==
0
)
{
if
(
pMgmt
->
dnodeId
==
0
)
{
dInfo
(
"set dnodeId:%d clusterId:
0x
%"
PRId64
,
pCfg
->
dnodeId
,
pCfg
->
clusterId
);
dInfo
(
"set dnodeId:%d clusterId:%"
PRId64
,
pCfg
->
dnodeId
,
pCfg
->
clusterId
);
taosWLockLatch
(
&
pMgmt
->
latch
);
taosWLockLatch
(
&
pMgmt
->
latch
);
pMgmt
->
dnodeId
=
pCfg
->
dnodeId
;
pMgmt
->
dnodeId
=
pCfg
->
dnodeId
;
pMgmt
->
clusterId
=
pCfg
->
clusterId
;
pMgmt
->
clusterId
=
pCfg
->
clusterId
;
...
@@ -437,7 +436,8 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp) {
...
@@ -437,7 +436,8 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp) {
}
}
}
else
{
}
else
{
SStatusRsp
statusRsp
=
{
0
};
SStatusRsp
statusRsp
=
{
0
};
if
(
pRsp
->
pCont
!=
NULL
&&
pRsp
->
contLen
!=
0
&&
tDeserializeSStatusRsp
(
pRsp
->
pCont
,
&
statusRsp
)
!=
NULL
)
{
if
(
pRsp
->
pCont
!=
NULL
&&
pRsp
->
contLen
!=
0
&&
tDeserializeSStatusRsp
(
pRsp
->
pCont
,
pRsp
->
contLen
,
&
statusRsp
)
==
0
)
{
pMgmt
->
dver
=
statusRsp
.
dver
;
pMgmt
->
dver
=
statusRsp
.
dver
;
dndUpdateDnodeCfg
(
pDnode
,
&
statusRsp
.
dnodeCfg
);
dndUpdateDnodeCfg
(
pDnode
,
&
statusRsp
.
dnodeCfg
);
dndUpdateDnodeEps
(
pDnode
,
statusRsp
.
pDnodeEps
);
dndUpdateDnodeEps
(
pDnode
,
statusRsp
.
pDnodeEps
);
...
@@ -652,9 +652,6 @@ static void dndProcessMgmtQueue(SDnode *pDnode, SRpcMsg *pMsg) {
...
@@ -652,9 +652,6 @@ static void dndProcessMgmtQueue(SDnode *pDnode, SRpcMsg *pMsg) {
case
TDMT_DND_DROP_VNODE
:
case
TDMT_DND_DROP_VNODE
:
code
=
dndProcessDropVnodeReq
(
pDnode
,
pMsg
);
code
=
dndProcessDropVnodeReq
(
pDnode
,
pMsg
);
break
;
break
;
case
TDMT_DND_AUTH_VNODE
:
code
=
dndProcessAuthVnodeReq
(
pDnode
,
pMsg
);
break
;
case
TDMT_DND_SYNC_VNODE
:
case
TDMT_DND_SYNC_VNODE
:
code
=
dndProcessSyncVnodeReq
(
pDnode
,
pMsg
);
code
=
dndProcessSyncVnodeReq
(
pDnode
,
pMsg
);
break
;
break
;
...
...
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
bffdb7a8
...
@@ -424,28 +424,22 @@ static int32_t dndDropMnode(SDnode *pDnode) {
...
@@ -424,28 +424,22 @@ static int32_t dndDropMnode(SDnode *pDnode) {
return
0
;
return
0
;
}
}
static
SDCreateMnodeReq
*
dndParseCreateMnodeReq
(
SRpcMsg
*
pReq
)
{
SDCreateMnodeReq
*
pCreate
=
pReq
->
pCont
;
pCreate
->
dnodeId
=
htonl
(
pCreate
->
dnodeId
);
for
(
int32_t
i
=
0
;
i
<
pCreate
->
replica
;
++
i
)
{
pCreate
->
replicas
[
i
].
id
=
htonl
(
pCreate
->
replicas
[
i
].
id
);
pCreate
->
replicas
[
i
].
port
=
htons
(
pCreate
->
replicas
[
i
].
port
);
}
return
pCreate
;
}
int32_t
dndProcessCreateMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
int32_t
dndProcessCreateMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDCreateMnodeReq
*
pCreate
=
dndParseCreateMnodeReq
(
pReq
);
SDCreateMnodeReq
createReq
=
{
0
};
if
(
tDeserializeSDCreateMnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pCreate
->
replica
<=
1
||
pCreate
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
createReq
.
replica
<=
1
||
createReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to create mnode since %s"
,
terrstr
());
dError
(
"failed to create mnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
SMnodeOpt
option
=
{
0
};
SMnodeOpt
option
=
{
0
};
if
(
dndBuildMnodeOptionFromReq
(
pDnode
,
&
option
,
pCreate
)
!=
0
)
{
if
(
dndBuildMnodeOptionFromReq
(
pDnode
,
&
option
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to create mnode since %s"
,
terrstr
());
dError
(
"failed to create mnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -464,16 +458,20 @@ int32_t dndProcessCreateMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
...
@@ -464,16 +458,20 @@ int32_t dndProcessCreateMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
}
int32_t
dndProcessAlterMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
int32_t
dndProcessAlterMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDAlterMnodeReq
*
pAlter
=
dndParseCreateMnodeReq
(
pReq
);
SDAlterMnodeReq
alterReq
=
{
0
};
if
(
tDeserializeSDCreateMnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pAlter
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
alterReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to alter mnode since %s"
,
terrstr
());
dError
(
"failed to alter mnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
SMnodeOpt
option
=
{
0
};
SMnodeOpt
option
=
{
0
};
if
(
dndBuildMnodeOptionFromReq
(
pDnode
,
&
option
,
pAlter
)
!=
0
)
{
if
(
dndBuildMnodeOptionFromReq
(
pDnode
,
&
option
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to alter mnode since %s"
,
terrstr
());
dError
(
"failed to alter mnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -494,10 +492,13 @@ int32_t dndProcessAlterMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
...
@@ -494,10 +492,13 @@ int32_t dndProcessAlterMnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
}
}
int32_t
dndProcessDropMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
int32_t
dndProcessDropMnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDDropMnodeReq
*
pDrop
=
pReq
->
pCont
;
SDDropMnodeReq
dropReq
=
{
0
};
pDrop
->
dnodeId
=
htonl
(
pDrop
->
dnodeId
);
if
(
tDeserializeSMCreateDropMnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pDrop
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
dropReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_MNODE_INVALID_OPTION
;
dError
(
"failed to drop mnode since %s"
,
terrstr
());
dError
(
"failed to drop mnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mgmt/impl/src/dndQnode.c
浏览文件 @
bffdb7a8
...
@@ -264,11 +264,14 @@ static int32_t dndDropQnode(SDnode *pDnode) {
...
@@ -264,11 +264,14 @@ static int32_t dndDropQnode(SDnode *pDnode) {
return
0
;
return
0
;
}
}
int32_t
dndProcessCreateQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
int32_t
dndProcessCreateQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDCreateQnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
SDCreateQnodeReq
createReq
=
{
0
};
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
createReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_QNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_QNODE_INVALID_OPTION
;
dError
(
"failed to create qnode since %s"
,
terrstr
());
dError
(
"failed to create qnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -277,11 +280,14 @@ int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
...
@@ -277,11 +280,14 @@ int32_t dndProcessCreateQnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
}
}
}
int32_t
dndProcessDropQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
int32_t
dndProcessDropQnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDDropQnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
SDDropQnodeReq
dropReq
=
{
0
};
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
dropReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_QNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_QNODE_INVALID_OPTION
;
dError
(
"failed to drop qnode since %s"
,
terrstr
());
dError
(
"failed to drop qnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mgmt/impl/src/dndSnode.c
浏览文件 @
bffdb7a8
...
@@ -258,11 +258,14 @@ static int32_t dndDropSnode(SDnode *pDnode) {
...
@@ -258,11 +258,14 @@ static int32_t dndDropSnode(SDnode *pDnode) {
return
0
;
return
0
;
}
}
int32_t
dndProcessCreateSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
int32_t
dndProcessCreateSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDCreateSnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
SDCreateSnodeReq
createReq
=
{
0
};
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
createReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_SNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_SNODE_INVALID_OPTION
;
dError
(
"failed to create snode since %s"
,
terrstr
());
dError
(
"failed to create snode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -271,11 +274,14 @@ int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
...
@@ -271,11 +274,14 @@ int32_t dndProcessCreateSnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
}
}
}
}
int32_t
dndProcessDropSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
)
{
int32_t
dndProcessDropSnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
SDDropSnodeReq
*
pMsg
=
pRpcMsg
->
pCont
;
SDDropSnodeReq
dropReq
=
{
0
};
pMsg
->
dnodeId
=
htonl
(
pMsg
->
dnodeId
);
if
(
tDeserializeSMCreateDropQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
pMsg
->
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
if
(
dropReq
.
dnodeId
!=
dndGetDnodeId
(
pDnode
))
{
terrno
=
TSDB_CODE_DND_SNODE_INVALID_OPTION
;
terrno
=
TSDB_CODE_DND_SNODE_INVALID_OPTION
;
dError
(
"failed to drop snode since %s"
,
terrstr
());
dError
(
"failed to drop snode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mgmt/impl/src/dndTransport.c
浏览文件 @
bffdb7a8
...
@@ -57,8 +57,6 @@ static void dndInitMsgFp(STransMgmt *pMgmt) {
...
@@ -57,8 +57,6 @@ static void dndInitMsgFp(STransMgmt *pMgmt) {
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_DROP_VNODE_RSP
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_DROP_VNODE_RSP
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_SYNC_VNODE
)]
=
dndProcessMgmtMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_SYNC_VNODE
)]
=
dndProcessMgmtMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_SYNC_VNODE_RSP
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_SYNC_VNODE_RSP
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_AUTH_VNODE
)]
=
dndProcessMgmtMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_AUTH_VNODE_RSP
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_COMPACT_VNODE
)]
=
dndProcessMgmtMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_COMPACT_VNODE
)]
=
dndProcessMgmtMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_COMPACT_VNODE_RSP
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_COMPACT_VNODE_RSP
)]
=
dndProcessMnodeWriteMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_CONFIG_DNODE
)]
=
dndProcessMgmtMsg
;
pMgmt
->
msgFp
[
TMSG_INDEX
(
TDMT_DND_CONFIG_DNODE
)]
=
dndProcessMgmtMsg
;
...
@@ -310,24 +308,29 @@ static int32_t dndRetrieveUserAuthInfo(void *parent, char *user, char *spi, char
...
@@ -310,24 +308,29 @@ static int32_t dndRetrieveUserAuthInfo(void *parent, char *user, char *spi, char
return
-
1
;
return
-
1
;
}
}
SAuthReq
*
pReq
=
rpcMallocCont
(
sizeof
(
SAuthReq
));
SAuthReq
authReq
=
{
0
};
tstrncpy
(
pReq
->
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
authReq
.
user
,
user
,
TSDB_USER_LEN
);
int32_t
contLen
=
tSerializeSAuthReq
(
NULL
,
0
,
&
authReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSAuthReq
(
pReq
,
contLen
,
&
authReq
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pReq
,
.
contLen
=
sizeof
(
SAuthReq
)
,
.
msgType
=
TDMT_MND_AUTH
,
.
ahandle
=
(
void
*
)
9528
};
SRpcMsg
rpcMsg
=
{.
pCont
=
pReq
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_AUTH
,
.
ahandle
=
(
void
*
)
9528
};
SRpcMsg
rpcRsp
=
{
0
};
SRpcMsg
rpcRsp
=
{
0
};
dTrace
(
"user:%s, send user auth req to other mnodes, spi:%d encrypt:%d"
,
user
,
pReq
->
spi
,
pReq
->
encrypt
);
dTrace
(
"user:%s, send user auth req to other mnodes, spi:%d encrypt:%d"
,
user
,
authReq
.
spi
,
authReq
.
encrypt
);
dndSendMsgToMnodeRecv
(
pDnode
,
&
rpcMsg
,
&
rpcRsp
);
dndSendMsgToMnodeRecv
(
pDnode
,
&
rpcMsg
,
&
rpcRsp
);
if
(
rpcRsp
.
code
!=
0
)
{
if
(
rpcRsp
.
code
!=
0
)
{
terrno
=
rpcRsp
.
code
;
terrno
=
rpcRsp
.
code
;
dError
(
"user:%s, failed to get user auth from other mnodes since %s"
,
user
,
terrstr
());
dError
(
"user:%s, failed to get user auth from other mnodes since %s"
,
user
,
terrstr
());
}
else
{
}
else
{
SAuthRsp
*
pRsp
=
rpcRsp
.
pCont
;
SAuthRsp
authRsp
=
{
0
};
memcpy
(
secret
,
pRsp
->
secret
,
TSDB_PASSWORD_LEN
);
tDeserializeSAuthReq
(
rpcRsp
.
pCont
,
rpcRsp
.
contLen
,
&
authRsp
);
memcpy
(
ckey
,
pRsp
->
ckey
,
TSDB_PASSWORD_LEN
);
memcpy
(
secret
,
authRsp
.
secret
,
TSDB_PASSWORD_LEN
);
*
spi
=
pRsp
->
spi
;
memcpy
(
ckey
,
authRsp
.
ckey
,
TSDB_PASSWORD_LEN
);
*
encrypt
=
pRsp
->
encrypt
;
*
spi
=
authRsp
.
spi
;
dTrace
(
"user:%s, success to get user auth from other mnodes, spi:%d encrypt:%d"
,
user
,
pRsp
->
spi
,
pRsp
->
encrypt
);
*
encrypt
=
authRsp
.
encrypt
;
dTrace
(
"user:%s, success to get user auth from other mnodes, spi:%d encrypt:%d"
,
user
,
authRsp
.
spi
,
authRsp
.
encrypt
);
}
}
rpcFreeCont
(
rpcRsp
.
pCont
);
rpcFreeCont
(
rpcRsp
.
pCont
);
...
...
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mgmt/impl/test/bnode/dbnode.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mgmt/impl/test/mnode/dmnode.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mgmt/impl/test/qnode/dqnode.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mgmt/impl/test/snode/dsnode.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mgmt/impl/test/sut/inc/sut.h
浏览文件 @
bffdb7a8
...
@@ -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
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mgmt/impl/test/vnode/vnode.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/inc/mndAuth.h
浏览文件 @
bffdb7a8
...
@@ -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
浏览文件 @
bffdb7a8
...
@@ -24,9 +24,9 @@ extern "C" {
...
@@ -24,9 +24,9 @@ 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
mndValidateD
BInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
dbs
,
int32_t
num
,
void
**
rsp
,
int32_t
*
r
spLen
);
int32_t
mndValidateD
bInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
pDbs
,
int32_t
numOfDbs
,
void
**
ppRsp
,
int32_t
*
pR
spLen
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/impl/inc/mndStb.h
浏览文件 @
bffdb7a8
...
@@ -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/inc/mndVgroup.h
浏览文件 @
bffdb7a8
...
@@ -31,8 +31,8 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups);
...
@@ -31,8 +31,8 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups);
SEpSet
mndGetVgroupEpset
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
);
SEpSet
mndGetVgroupEpset
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
);
int32_t
mndGetVnodesNum
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
int32_t
mndGetVnodesNum
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
SCreateVnodeReq
*
mndBuildCreateVnodeReq
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
void
*
mndBuildCreateVnodeReq
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
);
SDropVnodeReq
*
mndBuildDropVnodeReq
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
void
*
mndBuildDropVnodeReq
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
int32_t
*
pContLen
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/CMakeLists.txt
浏览文件 @
bffdb7a8
...
@@ -13,3 +13,4 @@ add_subdirectory(mnode)
...
@@ -13,3 +13,4 @@ add_subdirectory(mnode)
add_subdirectory
(
db
)
add_subdirectory
(
db
)
add_subdirectory
(
stb
)
add_subdirectory
(
stb
)
add_subdirectory
(
func
)
add_subdirectory
(
func
)
add_subdirectory
(
topic
)
source/dnode/mnode/impl/test/acct/acct.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/db/db.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/show/show.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/topic/CMakeLists.txt
0 → 100644
浏览文件 @
bffdb7a8
aux_source_directory
(
. TOPIC_SRC
)
add_executable
(
mnode_test_topic
${
TOPIC_SRC
}
)
target_link_libraries
(
mnode_test_topic
PUBLIC sut
)
add_test
(
NAME mnode_test_topic
COMMAND mnode_test_topic
)
source/dnode/mnode/impl/test/topic/topic.cpp
0 → 100644
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/user/user.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/inc/tq.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/inc/tsdb.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/inc/vnode.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/inc/tqInt.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/inc/tqMetaStore.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/inc/tqOffset.h
0 → 100644
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/inc/tsdbMemTable.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tq.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqMetaStore.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/
nodes/src/nodesCloneFuncs
.c
→
source/
dnode/vnode/src/tq/tqOffset
.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqRead.c
0 → 100644
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbWrite.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeWrite.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/CMakeLists.txt
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/catalog/src/catalog.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/executor/inc/executil.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/executor/inc/executorimpl.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/executor/src/executil.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/executor/src/executorimpl.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/executor/test/executorTests.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/function/inc/thistogram.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/function/inc/tpercentile.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/function/src/functionMgt.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/function/src/thistogram.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/function/src/tpercentile.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/nodes/CMakeLists.txt
→
source/
libs/
nodes/CMakeLists.txt
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCloneFuncs.c
0 → 100644
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/nodes/src/nodesCodeFuncs.c
→
source/
libs/
nodes/src/nodesCodeFuncs.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/nodes/src/nodesEqualFuncs.c
→
source/
libs/
nodes/src/nodesEqualFuncs.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/nodes/src/nodesTraverseFuncs.c
→
source/
libs/
nodes/src/nodesTraverseFuncs.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/nodes/src/nodesUtilFuncs.c
→
source/
libs/
nodes/src/nodesUtilFuncs.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/nodes/test/CMakeLists.txt
→
source/
libs/
nodes/test/CMakeLists.txt
浏览文件 @
bffdb7a8
文件已移动
source/nodes/test/nodesTest.cpp
→
source/
libs/
nodes/test/nodesTest.cpp
浏览文件 @
bffdb7a8
文件已移动
source/libs/parser/inc/astCreateFuncs.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/inc/astToMsg.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/inc/dataBlockMgt.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/inc/new_sql.y
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/inc/parserImpl.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/src/astCreateFuncs.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/src/astToMsg.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/src/dataBlockMgt.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/src/insertParser.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/src/new_sql.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/src/parserImpl.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/test/insertParserTest.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/parser/test/newParserTest.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/planner/CMakeLists.txt
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/planner/inc/plannerImpl.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/planner/src/physicalPlan.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/planner/src/physicalPlanJson.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/planner/src/plannerImpl.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/qcom/src/querymsg.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/qworker/src/qworkerMsg.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/scheduler/src/scheduler.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/transport/inc/transComm.h
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/libs/transport/test/rclient.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/util/src/tlosertree.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/util/src/tpaged
file
.c
→
source/util/src/tpaged
buf
.c
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
source/util/test/pageBufferTest.cpp
0 → 100644
浏览文件 @
bffdb7a8
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录