Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
54283f87
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
54283f87
编写于
6月 24, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
fix(query): fix memory leak.
上级
6c49aecb
91d714e6
变更
160
展开全部
隐藏空白更改
内联
并排
Showing
160 changed file
with
7665 addition
and
4819 deletion
+7665
-4819
Jenkinsfile2
Jenkinsfile2
+68
-37
examples/c/stream_demo.c
examples/c/stream_demo.c
+12
-5
include/client/taos.h
include/client/taos.h
+0
-1
include/common/tdatablock.h
include/common/tdatablock.h
+5
-3
include/common/tglobal.h
include/common/tglobal.h
+1
-0
include/common/tmsg.h
include/common/tmsg.h
+42
-2
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
include/common/tname.h
include/common/tname.h
+2
-0
include/common/ttokendef.h
include/common/ttokendef.h
+103
-101
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+3
-1
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+17
-13
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+2
-0
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+13
-0
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+8
-8
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+2
-0
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+6
-9
include/libs/parser/parser.h
include/libs/parser/parser.h
+2
-0
include/libs/planner/planner.h
include/libs/planner/planner.h
+13
-12
include/libs/qcom/query.h
include/libs/qcom/query.h
+3
-3
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+2
-0
include/libs/sync/sync.h
include/libs/sync/sync.h
+4
-3
include/util/tconfig.h
include/util/tconfig.h
+2
-1
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+17
-3
source/client/src/clientHb.c
source/client/src/clientHb.c
+3
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+315
-54
source/client/src/clientMain.c
source/client/src/clientMain.c
+79
-86
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+101
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+52
-20
source/common/src/tglobal.c
source/common/src/tglobal.c
+370
-3
source/common/src/tmsg.c
source/common/src/tmsg.c
+156
-12
source/common/src/tname.c
source/common/src/tname.c
+14
-0
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+9
-2
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+3
-1
source/dnode/mgmt/node_util/src/dmFile.c
source/dnode/mgmt/node_util/src/dmFile.c
+13
-3
source/dnode/mnode/impl/inc/mndScheduler.h
source/dnode/mnode/impl/inc/mndScheduler.h
+1
-3
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+87
-10
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+28
-2
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+49
-3
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+42
-56
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+2
-2
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+50
-104
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+6
-1
source/dnode/mnode/impl/test/db/CMakeLists.txt
source/dnode/mnode/impl/test/db/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/func/CMakeLists.txt
source/dnode/mnode/impl/test/func/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/profile/CMakeLists.txt
source/dnode/mnode/impl/test/profile/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/show/CMakeLists.txt
source/dnode/mnode/impl/test/show/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/sma/CMakeLists.txt
source/dnode/mnode/impl/test/sma/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/stb/CMakeLists.txt
source/dnode/mnode/impl/test/stb/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/user/CMakeLists.txt
source/dnode/mnode/impl/test/user/CMakeLists.txt
+4
-6
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+3
-0
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+1
-0
source/dnode/vnode/src/tq/tqOffset.c
source/dnode/vnode/src/tq/tqOffset.c
+2
-2
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+8
-8
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+4
-0
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+4
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+18
-2
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+65
-6
source/libs/catalog/src/ctgDbg.c
source/libs/catalog/src/ctgDbg.c
+1
-1
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+49
-0
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+29
-80
source/libs/command/src/command.c
source/libs/command/src/command.c
+11
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+0
-1
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+4
-11
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+98
-24
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+8
-10
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+5
-1
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+34
-19
source/libs/function/inc/builtinsimpl.h
source/libs/function/inc/builtinsimpl.h
+4
-0
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+63
-10
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+56
-2
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+3
-2
source/libs/monitor/src/monMain.c
source/libs/monitor/src/monMain.c
+25
-0
source/libs/monitor/src/monMsg.c
source/libs/monitor/src/monMsg.c
+36
-0
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+207
-170
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+63
-57
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+21
-1
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+2
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+9
-3
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+3
-2
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+14
-0
source/libs/parser/src/parCalcConst.c
source/libs/parser/src/parCalcConst.c
+23
-1
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+13
-2
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+2
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+54
-9
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+4
-4
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2489
-2472
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+66
-35
source/libs/parser/test/mockCatalogService.cpp
source/libs/parser/test/mockCatalogService.cpp
+11
-6
source/libs/parser/test/parSelectTest.cpp
source/libs/parser/test/parSelectTest.cpp
+13
-5
source/libs/parser/test/parShowToUse.cpp
source/libs/parser/test/parShowToUse.cpp
+18
-0
source/libs/parser/test/parTestUtil.h
source/libs/parser/test/parTestUtil.h
+0
-6
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+32
-59
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+1
-2
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+9
-5
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+1
-0
source/libs/planner/test/CMakeLists.txt
source/libs/planner/test/CMakeLists.txt
+4
-6
source/libs/planner/test/planBasicTest.cpp
source/libs/planner/test/planBasicTest.cpp
+0
-7
source/libs/planner/test/planOrderByTest.cpp
source/libs/planner/test/planOrderByTest.cpp
+2
-0
source/libs/planner/test/planSetOpTest.cpp
source/libs/planner/test/planSetOpTest.cpp
+16
-0
source/libs/planner/test/planSubqueryTest.cpp
source/libs/planner/test/planSubqueryTest.cpp
+3
-1
source/libs/planner/test/planTestMain.cpp
source/libs/planner/test/planTestMain.cpp
+8
-1
source/libs/planner/test/planTestUtil.cpp
source/libs/planner/test/planTestUtil.cpp
+19
-8
source/libs/planner/test/planTestUtil.h
source/libs/planner/test/planTestUtil.h
+1
-1
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+39
-0
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+27
-19
source/libs/stream/inc/streamInc.h
source/libs/stream/inc/streamInc.h
+1
-1
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+8
-6
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+25
-20
source/libs/sync/inc/syncEnv.h
source/libs/sync/inc/syncEnv.h
+6
-6
source/libs/sync/inc/syncRaftLog.h
source/libs/sync/inc/syncRaftLog.h
+5
-3
source/libs/sync/src/syncAppendEntries.c
source/libs/sync/src/syncAppendEntries.c
+29
-42
source/libs/sync/src/syncAppendEntriesReply.c
source/libs/sync/src/syncAppendEntriesReply.c
+19
-23
source/libs/sync/src/syncElection.c
source/libs/sync/src/syncElection.c
+8
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+79
-23
source/libs/sync/src/syncRaftCfg.c
source/libs/sync/src/syncRaftCfg.c
+21
-17
source/libs/sync/src/syncRaftLog.c
source/libs/sync/src/syncRaftLog.c
+190
-55
source/libs/sync/src/syncReplication.c
source/libs/sync/src/syncReplication.c
+11
-0
source/libs/sync/src/syncRequestVote.c
source/libs/sync/src/syncRequestVote.c
+25
-8
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+2
-1
source/libs/sync/test/syncRaftLogTest2.cpp
source/libs/sync/test/syncRaftLogTest2.cpp
+29
-4
source/libs/sync/test/syncRaftLogTest3.cpp
source/libs/sync/test/syncRaftLogTest3.cpp
+3
-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
+25
-20
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+13
-2
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+11
-2
source/util/src/tlog.c
source/util/src/tlog.c
+1
-1
tests/parallel_test/run.sh
tests/parallel_test/run.sh
+85
-27
tests/pytest/util/cluster.py
tests/pytest/util/cluster.py
+26
-236
tests/pytest/util/sqlset.py
tests/pytest/util/sqlset.py
+1
-1
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-0
tests/script/sh/cfg.bat
tests/script/sh/cfg.bat
+2
-2
tests/script/sh/copy_udf.bat
tests/script/sh/copy_udf.bat
+1
-1
tests/script/sh/deploy.bat
tests/script/sh/deploy.bat
+2
-2
tests/script/sh/exec.bat
tests/script/sh/exec.bat
+2
-2
tests/script/tmp/monitor.sim
tests/script/tmp/monitor.sim
+2
-0
tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim
...t/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim
+22
-11
tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim
...ipt/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim
+31
-11
tests/script/tsim/mnode/basic5.sim
tests/script/tsim/mnode/basic5.sim
+0
-1
tests/script/tsim/stream/partitionby1.sim
tests/script/tsim/stream/partitionby1.sim
+124
-0
tests/script/tsim/sync/3Replica1VgElect.sim
tests/script/tsim/sync/3Replica1VgElect.sim
+4
-4
tests/script/tsim/sync/3Replica5VgElect.sim
tests/script/tsim/sync/3Replica5VgElect.sim
+4
-4
tests/script/tsim/sync/oneReplica5VgElect.sim
tests/script/tsim/sync/oneReplica5VgElect.sim
+4
-4
tests/script/tsim/tmq/consume.bat
tests/script/tsim/tmq/consume.bat
+67
-0
tests/script/wtest.bat
tests/script/wtest.bat
+2
-2
tests/system-test/0-others/taosShell.py
tests/system-test/0-others/taosShell.py
+3
-3
tests/system-test/2-query/Now.py
tests/system-test/2-query/Now.py
+80
-422
tests/system-test/2-query/To_unixtimestamp.py
tests/system-test/2-query/To_unixtimestamp.py
+30
-0
tests/system-test/2-query/first.py
tests/system-test/2-query/first.py
+10
-10
tests/system-test/2-query/function_null.py
tests/system-test/2-query/function_null.py
+254
-0
tests/system-test/2-query/irate.py
tests/system-test/2-query/irate.py
+279
-0
tests/system-test/2-query/timezone.py
tests/system-test/2-query/timezone.py
+87
-119
tests/system-test/6-cluster/5dnode3mnodeStop.py
tests/system-test/6-cluster/5dnode3mnodeStop.py
+1
-10
tests/system-test/7-tmq/tmq3mnodeSwitch.py
tests/system-test/7-tmq/tmq3mnodeSwitch.py
+272
-0
tests/system-test/7-tmq/tmqCommon.py
tests/system-test/7-tmq/tmqCommon.py
+81
-16
tests/system-test/7-tmq/tmqConsumerGroup.py
tests/system-test/7-tmq/tmqConsumerGroup.py
+170
-0
tests/system-test/7-tmq/tmqUdf.py
tests/system-test/7-tmq/tmqUdf.py
+1
-1
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+6
-1
tests/system-test/simpletest.bat
tests/system-test/simpletest.bat
+4
-4
tests/system-test/test.py
tests/system-test/test.py
+12
-6
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+42
-12
未找到文件。
Jenkinsfile2
浏览文件 @
54283f87
...
...
@@ -43,10 +43,8 @@ def pre_test(){
sh '''
cd ${WK}
git reset --hard
git fetch || git fetch
cd ${WKC}
git reset --hard
git fetch || git fetch
'''
script {
if (env.CHANGE_TARGET == 'master') {
...
...
@@ -82,6 +80,7 @@ def pre_test(){
if (env.CHANGE_URL =~ /\/TDengine\//) {
sh '''
cd ${WKC}
git remote prune origin
git pull >/dev/null
git log -5
echo "`date "+%Y%m%d-%H%M%S"` ${JOB_NAME}:${BRANCH_NAME}:${BUILD_ID}:${CHANGE_TARGET}" >>${WKDIR}/jenkins.log
...
...
@@ -107,6 +106,7 @@ def pre_test(){
git log -5
echo "tdinternal log merged: `git log -5`" >>${WKDIR}/jenkins.log
cd ${WKC}
git remote prune origin
git pull >/dev/null
git log -5
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
...
...
@@ -137,53 +137,51 @@ def pre_test_win(){
set
date /t
time /t
rd /s /Q
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug || exit 0
rd /s /Q
%WIN_INTERNAL_ROOT%
\\debug || exit 0
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git reset --hard
git fetch || git fetch
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git reset --hard
git fetch || git fetch
'''
script {
if (env.CHANGE_TARGET == 'master') {
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout master
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout master
'''
} else if(env.CHANGE_TARGET == '2.0') {
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout 2.0
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout 2.0
'''
} else if(env.CHANGE_TARGET == '3.0') {
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout 3.0
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout 3.0
'''
} else {
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout develop
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout develop
'''
}
...
...
@@ -191,36 +189,38 @@ def pre_test_win(){
script {
if (env.CHANGE_URL =~ /\/TDengine\//) {
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git pull
'''
bat '''
cd C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
git pull
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git fetch origin +refs/pull/%CHANGE_ID%/merge
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout -qf FETCH_HEAD
'''
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git pull
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git fetch origin +refs/pull/%CHANGE_ID%/merge
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout -qf FETCH_HEAD
'''
bat '''
cd C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
git pull
'''
} else {
...
...
@@ -230,27 +230,27 @@ def pre_test_win(){
}
}
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git branch
git log -5
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git branch
git log -5
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git submodule update --init --recursive
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
git branch
git reset --hard
git pull
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
git log -5
'''
}
...
...
@@ -258,7 +258,7 @@ def pre_test_build_win() {
bat '''
echo "building ..."
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
mkdir debug
cd debug
time /t
...
...
@@ -273,9 +273,9 @@ def pre_test_build_win() {
time /t
'''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
python -m pip install .
xcopy /e/y/i/f
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
xcopy /e/y/i/f
%WIN_INTERNAL_ROOT%
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
'''
return 1
}
...
...
@@ -283,7 +283,7 @@ def run_win_ctest() {
bat '''
echo "windows ctest ..."
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug
cd
%WIN_INTERNAL_ROOT%
\\debug
ctest -j 1 || exit 7
time /t
'''
...
...
@@ -292,12 +292,12 @@ def run_win_test() {
echo "LINUX NODE: ${linux_node_ip} - ${linux_node_pass}"
bat '''
echo "windows test ..."
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
python -m pip install .
xcopy /e/y/i/f
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
xcopy /e/y/i/f
%WIN_INTERNAL_ROOT%
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
ls -l C:\\Windows\\System32\\taos.dll
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community\\tests\\system-test
cd
%WIN_SYSTEM_TEST_ROOT%
echo "node: ''' + linux_node_ip + ''':''' + linux_node_pass + '''"
echo "testing ..."
test-all.bat "{\\\"host\\\":\\\"''' + linux_node_ip + '''\\\",\\\"port\\\":22,\\\"user\\\":\\\"root\\\",\\\"password\\\":\\\"''' + linux_node_pass + '''\\\",\\\"path\\\":\\\"/var/lib/jenkins/workspace/TDinternal\\\"}"
...
...
@@ -319,6 +319,12 @@ pipeline {
parallel {
stage('windows test') {
agent{label " windows10_01 || windows10_02 || windows10_03 || windows10_04 "}
environment{
WIN_INTERNAL_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal"
WIN_COMMUNITY_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal\\community"
WIN_SYSTEM_TEST_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal\\community\\tests\\system-test"
WIN_CONNECTOR_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\taos-connector-python"
}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 55, unit: 'MINUTES'){
...
...
@@ -357,7 +363,7 @@ pipeline {
echo "${linux_node_ip}:${linux_node_pass}"
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time:
4
0, unit: 'MINUTES'){
timeout(time:
12
0, unit: 'MINUTES'){
pre_test()
script {
sh '''
...
...
@@ -368,11 +374,36 @@ pipeline {
rm -f /tmp/cases.task
./collect_cases.sh -e
'''
def extra_param = ""
def log_server_file = "/home/log_server.json"
def timeout_cmd = ""
if (fileExists(log_server_file)) {
def log_server_enabled = sh (
script: 'jq .enabled ' + log_server_file,
returnStdout: true
).trim()
def timeout_param = sh (
script: 'jq .timeout ' + log_server_file,
returnStdout: true
).trim()
if (timeout_param != "null"
&&
timeout_param != "0") {
timeout_cmd = "timeout " + timeout_param
}
if (log_server_enabled == "1") {
def log_server = sh (
script: 'jq .server ' + log_server_file + ' | sed "s/\\\"//g"',
returnStdout: true
).trim()
if (log_server != "null"
&&
log_server != "") {
extra_param = "-w " + log_server
}
}
}
sh '''
cd ${WKC}/tests/parallel_test
export DEFAULT_RETRY_TIME=2
date
timeout 2100 time ./run.sh -e -m /home/m.json -t /tmp/cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480
''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t /tmp/cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480 ''' + extra_param + '''
'''
}
}
...
...
examples/c/stream_demo.c
浏览文件 @
54283f87
...
...
@@ -25,7 +25,7 @@ int32_t init_env() {
return
-
1
;
}
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database if not exists abc1 vgroups
1
"
);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"create database if not exists abc1 vgroups
2
"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in create db, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
...
...
@@ -68,6 +68,14 @@ int32_t init_env() {
return
-
1
;
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create table if not exists tu3 using st1 tags(3)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create child table tu3, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
}
taos_free_result
(
pRes
);
return
0
;
}
...
...
@@ -90,10 +98,9 @@ int32_t create_stream() {
/*const char* sql = "select min(k), max(k), sum(k) as sum_of_k from st1";*/
/*const char* sql = "select sum(k) from tu1 interval(10m)";*/
/*pRes = tmq_create_stream(pConn, "stream1", "out1", sql);*/
pRes
=
taos_query
(
pConn
,
"create stream stream1 trigger window_close watermark 10s into outstb as select _wstartts, sum(k) from st1 "
"interval(10s) "
);
pRes
=
taos_query
(
pConn
,
"create stream stream1 trigger at_once into outstb as select _wstartts, sum(k) from st1 "
"partition by tbname interval(10s) "
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create stream stream1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
...
...
include/client/taos.h
浏览文件 @
54283f87
...
...
@@ -128,7 +128,6 @@ typedef struct setConfRet {
DLL_EXPORT
void
taos_cleanup
(
void
);
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
setConfRet
taos_set_config
(
const
char
*
config
);
DLL_EXPORT
int
taos_init
(
void
);
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_auth
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
...
...
include/common/tdatablock.h
浏览文件 @
54283f87
...
...
@@ -71,8 +71,8 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
#define colDataGetData(p1_, r_) \
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) : colDataGetNumData(p1_, r_))
#define IS_JSON_NULL(type, data)
((type) == TSDB_DATA_TYPE_JSON &&
\
(*(data) == TSDB_DATA_TYPE_NULL || tTagIsJsonNull(data)))
#define IS_JSON_NULL(type, data) \
((type) == TSDB_DATA_TYPE_JSON &&
(*(data) == TSDB_DATA_TYPE_NULL || tTagIsJsonNull(data)))
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
if
(
!
pColumnInfoData
->
hasNull
)
{
...
...
@@ -186,7 +186,8 @@ int32_t getJsonValueLen(const char* data);
int32_t
colDataAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
);
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
numOfRow1
,
uint32_t
*
capacity
,
const
SColumnInfoData
*
pSource
,
uint32_t
numOfRow2
);
int32_t
colDataAssign
(
SColumnInfoData
*
pColumnInfoData
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRows
,
const
SDataBlockInfo
*
pBlockInfo
);
int32_t
colDataAssign
(
SColumnInfoData
*
pColumnInfoData
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRows
,
const
SDataBlockInfo
*
pBlockInfo
);
int32_t
blockDataUpdateTsWindow
(
SSDataBlock
*
pDataBlock
,
int32_t
tsColumnIndex
);
int32_t
colDataGetLength
(
const
SColumnInfoData
*
pColumnInfoData
,
int32_t
numOfRows
);
...
...
@@ -222,6 +223,7 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
int32_t
blockDataTrimFirstNRows
(
SSDataBlock
*
pBlock
,
size_t
n
);
int32_t
assignOneDataBlock
(
SSDataBlock
*
dst
,
const
SSDataBlock
*
src
);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
);
SSDataBlock
*
createDataBlock
();
int32_t
blockDataAppendColInfo
(
SSDataBlock
*
pBlock
,
SColumnInfoData
*
pColInfoData
);
...
...
include/common/tglobal.h
浏览文件 @
54283f87
...
...
@@ -151,6 +151,7 @@ void taosCfgDynamicOptions(const char *option, const char *value);
void
taosAddDataDir
(
int32_t
index
,
char
*
v1
,
int32_t
level
,
int32_t
primary
);
struct
SConfig
*
taosGetCfg
();
int32_t
taosSetCfg
(
SConfig
*
pCfg
,
char
*
name
);
#ifdef __cplusplus
}
...
...
include/common/tmsg.h
浏览文件 @
54283f87
...
...
@@ -510,7 +510,8 @@ typedef struct {
int8_t
superUser
;
int8_t
connType
;
SEpSet
epSet
;
char
sVersion
[
128
];
char
sVer
[
TSDB_VERSION_LEN
];
char
sDetailVer
[
128
];
}
SConnectRsp
;
int32_t
tSerializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
);
...
...
@@ -836,6 +837,20 @@ typedef struct {
int32_t
tSerializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
int32_t
tDeserializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
typedef
struct
{
int32_t
useless
;
// useless
}
SServerVerReq
;
int32_t
tSerializeSServerVerReq
(
void
*
buf
,
int32_t
bufLen
,
SServerVerReq
*
pReq
);
int32_t
tDeserializeSServerVerReq
(
void
*
buf
,
int32_t
bufLen
,
SServerVerReq
*
pReq
);
typedef
struct
{
char
ver
[
TSDB_VERSION_LEN
];
}
SServerVerRsp
;
int32_t
tSerializeSServerVerRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerVerRsp
*
pRsp
);
int32_t
tDeserializeSServerVerRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerVerRsp
*
pRsp
);
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
...
...
@@ -1229,6 +1244,21 @@ typedef struct {
int32_t
tSerializeSShowVariablesReq
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesReq
*
pReq
);
int32_t
tDeserializeSShowVariablesReq
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesReq
*
pReq
);
typedef
struct
{
char
name
[
TSDB_CONFIG_OPTION_LEN
+
1
];
char
value
[
TSDB_CONFIG_VALUE_LEN
+
1
];
}
SVariablesInfo
;
typedef
struct
{
SArray
*
variables
;
//SArray<SVariablesInfo>
}
SShowVariablesRsp
;
int32_t
tSerializeSShowVariablesRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesRsp
*
pReq
);
int32_t
tDeserializeSShowVariablesRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesRsp
*
pReq
);
void
tFreeSShowVariablesRsp
(
SShowVariablesRsp
*
pRsp
);
/*
* sql: show tables like '%a_%'
* payload is the query condition, e.g., '%a_%'
...
...
@@ -1341,11 +1371,19 @@ typedef struct {
int32_t
dnodeId
;
char
config
[
TSDB_DNODE_CONFIG_LEN
];
char
value
[
TSDB_DNODE_VALUE_LEN
];
}
SMCfgDnodeReq
,
SDCfgDnodeReq
;
}
SMCfgDnodeReq
;
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
int32_t
tDeserializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
typedef
struct
{
char
config
[
TSDB_DNODE_CONFIG_LEN
];
char
value
[
TSDB_DNODE_VALUE_LEN
];
}
SDCfgDnodeReq
;
int32_t
tSerializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
);
int32_t
tDeserializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
,
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
...
...
@@ -2455,6 +2493,8 @@ typedef struct {
int64_t
interval
;
int64_t
offset
;
int64_t
sliding
;
int64_t
maxDelay
;
int64_t
watermark
;
int32_t
exprLen
;
// strlen + 1
int32_t
tagsFilterLen
;
// strlen + 1
int32_t
sqlLen
;
// strlen + 1
...
...
include/common/tmsgdef.h
浏览文件 @
54283f87
...
...
@@ -163,6 +163,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_REDISTRIBUTE_VGROUP
,
"redistribute-vgroup"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SPLIT_VGROUP
,
"split-vgroup"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW_VARIABLES
,
"show-variables"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SERVER_VERSION
,
"server-version"
,
NULL
,
NULL
)
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SUBMIT
,
"submit"
,
SSubmitReq
,
SSubmitRsp
)
...
...
include/common/tname.h
浏览文件 @
54283f87
...
...
@@ -57,6 +57,8 @@ void tNameAssign(SName* dst, const SName* src);
int32_t
tNameSetDbName
(
SName
*
dst
,
int32_t
acctId
,
const
char
*
dbName
,
size_t
nameLen
);
int32_t
tNameAddTbName
(
SName
*
dst
,
const
char
*
tbName
,
size_t
nameLen
);
int32_t
tNameFromString
(
SName
*
dst
,
const
char
*
str
,
uint32_t
type
);
int32_t
tNameSetAcctId
(
SName
*
dst
,
int32_t
acctId
);
...
...
include/common/ttokendef.h
浏览文件 @
54283f87
...
...
@@ -158,107 +158,109 @@
#define TK_CLUSTER 140
#define TK_TRANSACTIONS 141
#define TK_DISTRIBUTED 142
#define TK_LIKE 143
#define TK_INDEX 144
#define TK_FUNCTION 145
#define TK_INTERVAL 146
#define TK_TOPIC 147
#define TK_AS 148
#define TK_WITH 149
#define TK_META 150
#define TK_CONSUMER 151
#define TK_GROUP 152
#define TK_DESC 153
#define TK_DESCRIBE 154
#define TK_RESET 155
#define TK_QUERY 156
#define TK_CACHE 157
#define TK_EXPLAIN 158
#define TK_ANALYZE 159
#define TK_VERBOSE 160
#define TK_NK_BOOL 161
#define TK_RATIO 162
#define TK_NK_FLOAT 163
#define TK_COMPACT 164
#define TK_VNODES 165
#define TK_IN 166
#define TK_OUTPUTTYPE 167
#define TK_AGGREGATE 168
#define TK_BUFSIZE 169
#define TK_STREAM 170
#define TK_INTO 171
#define TK_TRIGGER 172
#define TK_AT_ONCE 173
#define TK_WINDOW_CLOSE 174
#define TK_KILL 175
#define TK_CONNECTION 176
#define TK_TRANSACTION 177
#define TK_BALANCE 178
#define TK_VGROUP 179
#define TK_MERGE 180
#define TK_REDISTRIBUTE 181
#define TK_SPLIT 182
#define TK_SYNCDB 183
#define TK_DELETE 184
#define TK_NULL 185
#define TK_NK_QUESTION 186
#define TK_NK_ARROW 187
#define TK_ROWTS 188
#define TK_TBNAME 189
#define TK_QSTARTTS 190
#define TK_QENDTS 191
#define TK_WSTARTTS 192
#define TK_WENDTS 193
#define TK_WDURATION 194
#define TK_CAST 195
#define TK_NOW 196
#define TK_TODAY 197
#define TK_TIMEZONE 198
#define TK_COUNT 199
#define TK_LAST_ROW 200
#define TK_BETWEEN 201
#define TK_IS 202
#define TK_NK_LT 203
#define TK_NK_GT 204
#define TK_NK_LE 205
#define TK_NK_GE 206
#define TK_NK_NE 207
#define TK_MATCH 208
#define TK_NMATCH 209
#define TK_CONTAINS 210
#define TK_JOIN 211
#define TK_INNER 212
#define TK_SELECT 213
#define TK_DISTINCT 214
#define TK_WHERE 215
#define TK_PARTITION 216
#define TK_BY 217
#define TK_SESSION 218
#define TK_STATE_WINDOW 219
#define TK_SLIDING 220
#define TK_FILL 221
#define TK_VALUE 222
#define TK_NONE 223
#define TK_PREV 224
#define TK_LINEAR 225
#define TK_NEXT 226
#define TK_HAVING 227
#define TK_RANGE 228
#define TK_EVERY 229
#define TK_ORDER 230
#define TK_SLIMIT 231
#define TK_SOFFSET 232
#define TK_LIMIT 233
#define TK_OFFSET 234
#define TK_ASC 235
#define TK_NULLS 236
#define TK_ID 237
#define TK_NK_BITNOT 238
#define TK_INSERT 239
#define TK_VALUES 240
#define TK_IMPORT 241
#define TK_NK_SEMI 242
#define TK_FILE 243
#define TK_CONSUMERS 143
#define TK_SUBSCRIPTIONS 144
#define TK_LIKE 145
#define TK_INDEX 146
#define TK_FUNCTION 147
#define TK_INTERVAL 148
#define TK_TOPIC 149
#define TK_AS 150
#define TK_WITH 151
#define TK_META 152
#define TK_CONSUMER 153
#define TK_GROUP 154
#define TK_DESC 155
#define TK_DESCRIBE 156
#define TK_RESET 157
#define TK_QUERY 158
#define TK_CACHE 159
#define TK_EXPLAIN 160
#define TK_ANALYZE 161
#define TK_VERBOSE 162
#define TK_NK_BOOL 163
#define TK_RATIO 164
#define TK_NK_FLOAT 165
#define TK_COMPACT 166
#define TK_VNODES 167
#define TK_IN 168
#define TK_OUTPUTTYPE 169
#define TK_AGGREGATE 170
#define TK_BUFSIZE 171
#define TK_STREAM 172
#define TK_INTO 173
#define TK_TRIGGER 174
#define TK_AT_ONCE 175
#define TK_WINDOW_CLOSE 176
#define TK_KILL 177
#define TK_CONNECTION 178
#define TK_TRANSACTION 179
#define TK_BALANCE 180
#define TK_VGROUP 181
#define TK_MERGE 182
#define TK_REDISTRIBUTE 183
#define TK_SPLIT 184
#define TK_SYNCDB 185
#define TK_DELETE 186
#define TK_NULL 187
#define TK_NK_QUESTION 188
#define TK_NK_ARROW 189
#define TK_ROWTS 190
#define TK_TBNAME 191
#define TK_QSTARTTS 192
#define TK_QENDTS 193
#define TK_WSTARTTS 194
#define TK_WENDTS 195
#define TK_WDURATION 196
#define TK_CAST 197
#define TK_NOW 198
#define TK_TODAY 199
#define TK_TIMEZONE 200
#define TK_COUNT 201
#define TK_LAST_ROW 202
#define TK_BETWEEN 203
#define TK_IS 204
#define TK_NK_LT 205
#define TK_NK_GT 206
#define TK_NK_LE 207
#define TK_NK_GE 208
#define TK_NK_NE 209
#define TK_MATCH 210
#define TK_NMATCH 211
#define TK_CONTAINS 212
#define TK_JOIN 213
#define TK_INNER 214
#define TK_SELECT 215
#define TK_DISTINCT 216
#define TK_WHERE 217
#define TK_PARTITION 218
#define TK_BY 219
#define TK_SESSION 220
#define TK_STATE_WINDOW 221
#define TK_SLIDING 222
#define TK_FILL 223
#define TK_VALUE 224
#define TK_NONE 225
#define TK_PREV 226
#define TK_LINEAR 227
#define TK_NEXT 228
#define TK_HAVING 229
#define TK_RANGE 230
#define TK_EVERY 231
#define TK_ORDER 232
#define TK_SLIMIT 233
#define TK_SOFFSET 234
#define TK_LIMIT 235
#define TK_OFFSET 236
#define TK_ASC 237
#define TK_NULLS 238
#define TK_ID 239
#define TK_NK_BITNOT 240
#define TK_INSERT 241
#define TK_VALUES 242
#define TK_IMPORT 243
#define TK_NK_SEMI 244
#define TK_FILE 245
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
...
...
include/dnode/mnode/mnode.h
浏览文件 @
54283f87
...
...
@@ -73,10 +73,12 @@ void mndStop(SMnode *pMnode);
* @param pMnode The mnode object.
* @param pCluster
* @param pVgroup
* @param pStbInfo
* @param pGrant
* @return int32_t 0 for success, -1 for failure.
*/
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pCluster
,
SMonVgroupInfo
*
pVgroup
,
SMonGrantInfo
*
pGrant
);
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonStbInfo
*
pStbInfo
,
SMonGrantInfo
*
pGrantInfo
);
/**
* @brief Get mnode loads for status msg.
...
...
include/libs/catalog/catalog.h
浏览文件 @
54283f87
...
...
@@ -71,6 +71,7 @@ typedef struct SCatalogReq {
SArray
*
pTableCfg
;
// element is SNAME
bool
qNodeRequired
;
// valid qnode
bool
dNodeRequired
;
// valid dnode
bool
svrVerRequired
;
bool
forceUpdate
;
}
SCatalogReq
;
...
...
@@ -80,18 +81,19 @@ typedef struct SMetaRes {
}
SMetaRes
;
typedef
struct
SMetaData
{
SArray
*
pDbVgroup
;
// pRes = SArray<SVgroupInfo>*
SArray
*
pDbCfg
;
// pRes = SDbCfgInfo*
SArray
*
pDbInfo
;
// pRes = SDbInfo*
SArray
*
pTableMeta
;
// pRes = STableMeta*
SArray
*
pTableHash
;
// pRes = SVgroupInfo*
SArray
*
pTableIndex
;
// pRes = SArray<STableIndexInfo>*
SArray
*
pUdfList
;
// pRes = SFuncInfo*
SArray
*
pIndex
;
// pRes = SIndexInfo*
SArray
*
pUser
;
// pRes = bool*
SArray
*
pQnodeList
;
// pRes = SArray<SQueryNodeLoad>*
SArray
*
pTableCfg
;
// pRes = STableCfg*
SArray
*
pDnodeList
;
// pRes = SArray<SEpSet>*
SArray
*
pDbVgroup
;
// pRes = SArray<SVgroupInfo>*
SArray
*
pDbCfg
;
// pRes = SDbCfgInfo*
SArray
*
pDbInfo
;
// pRes = SDbInfo*
SArray
*
pTableMeta
;
// pRes = STableMeta*
SArray
*
pTableHash
;
// pRes = SVgroupInfo*
SArray
*
pTableIndex
;
// pRes = SArray<STableIndexInfo>*
SArray
*
pUdfList
;
// pRes = SFuncInfo*
SArray
*
pIndex
;
// pRes = SIndexInfo*
SArray
*
pUser
;
// pRes = bool*
SArray
*
pQnodeList
;
// pRes = SArray<SQueryNodeLoad>*
SArray
*
pTableCfg
;
// pRes = STableCfg*
SArray
*
pDnodeList
;
// pRes = SArray<SEpSet>*
SMetaRes
*
pSvrVer
;
// pRes = char*
}
SMetaData
;
typedef
struct
SCatalogCfg
{
...
...
@@ -268,7 +270,7 @@ int32_t catalogGetTableHashVgroup(SCatalog* pCatalog, SRequestConnInfo* pConn, c
*/
int32_t
catalogGetAllMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
);
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
);
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
);
int32_t
catalogGetQnodeList
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
SArray
*
pQnodeList
);
...
...
@@ -298,6 +300,8 @@ int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);
int32_t
catalogUpdateVgEpSet
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
vgId
,
SEpSet
*
epSet
);
int32_t
catalogGetServerVersion
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
pVersion
);
int32_t
ctgdLaunchAsyncCall
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
bool
forceUpdate
);
int32_t
catalogClearCache
(
void
);
...
...
include/libs/function/functionMgt.h
浏览文件 @
54283f87
...
...
@@ -123,6 +123,8 @@ typedef enum EFunctionType {
FUNCTION_TYPE_SELECT_VALUE
,
FUNCTION_TYPE_BLOCK_DIST
,
// block distribution aggregate function
FUNCTION_TYPE_BLOCK_DIST_INFO
,
// block distribution pseudo column function
FUNCTION_TYPE_TO_COLUMN
,
FUNCTION_TYPE_GROUP_KEY
,
// distributed splitting functions
FUNCTION_TYPE_APERCENTILE_PARTIAL
=
4000
,
...
...
include/libs/monitor/monitor.h
浏览文件 @
54283f87
...
...
@@ -109,6 +109,9 @@ typedef struct {
char
version
[
MON_VER_LEN
];
float
master_uptime
;
// day
int32_t
monitor_interval
;
// sec
int32_t
dbs_total
;
int32_t
stbs_total
;
int64_t
tbs_total
;
int32_t
vgroups_total
;
int32_t
vgroups_alive
;
int32_t
vnodes_total
;
...
...
@@ -135,6 +138,15 @@ typedef struct {
SArray
*
vgroups
;
// array of SMonVgroupDesc
}
SMonVgroupInfo
;
typedef
struct
{
char
stb_name
[
TSDB_TABLE_NAME_LEN
];
char
database_name
[
TSDB_DB_NAME_LEN
];
}
SMonStbDesc
;
typedef
struct
{
SArray
*
stbs
;
// array of SMonStbDesc
}
SMonStbInfo
;
typedef
struct
{
int32_t
expire_time
;
int64_t
timeseries_used
;
...
...
@@ -144,6 +156,7 @@ typedef struct {
typedef
struct
{
SMonClusterInfo
cluster
;
SMonVgroupInfo
vgroup
;
SMonStbInfo
stb
;
SMonGrantInfo
grant
;
SMonSysInfo
sys
;
SMonLogs
log
;
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
54283f87
...
...
@@ -28,19 +28,18 @@ extern "C" {
#define DESCRIBE_RESULT_TYPE_LEN (20 + VARSTR_HEADER_SIZE)
#define DESCRIBE_RESULT_NOTE_LEN (8 + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_DB_RESULT_COLS 2
#define SHOW_CREATE_DB_RESULT_COLS
2
#define SHOW_CREATE_DB_RESULT_FIELD1_LEN (TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_DB_RESULT_FIELD2_LEN (TSDB_MAX_BINARY_LEN + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_TB_RESULT_COLS 2
#define SHOW_CREATE_TB_RESULT_COLS
2
#define SHOW_CREATE_TB_RESULT_FIELD1_LEN (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_TB_RESULT_FIELD2_LEN (TSDB_MAX_BINARY_LEN + VARSTR_HEADER_SIZE)
#define SHOW_LOCAL_VARIABLES_RESULT_COLS 2
#define SHOW_LOCAL_VARIABLES_RESULT_COLS
2
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
#define PRIVILEGE_TYPE_MASK(n) (1 << n)
#define PRIVILEGE_TYPE_ALL PRIVILEGE_TYPE_MASK(0)
...
...
@@ -234,10 +233,10 @@ typedef struct SShowCreateDatabaseStmt {
}
SShowCreateDatabaseStmt
;
typedef
struct
SShowCreateTableStmt
{
ENodeType
type
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
void
*
pCfg
;
// STableCfg
ENodeType
type
;
char
dbName
[
TSDB_DB_NAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
void
*
pCfg
;
// STableCfg
}
SShowCreateTableStmt
;
typedef
struct
SShowTableDistributedStmt
{
...
...
@@ -259,6 +258,7 @@ typedef struct SIndexOptions {
SNode
*
pInterval
;
SNode
*
pOffset
;
SNode
*
pSliding
;
SNode
*
pStreamOptions
;
}
SIndexOptions
;
typedef
struct
SCreateIndexStmt
{
...
...
include/libs/nodes/nodes.h
浏览文件 @
54283f87
...
...
@@ -188,6 +188,7 @@ typedef enum ENodeType {
QUERY_NODE_SHOW_CREATE_STABLE_STMT
,
QUERY_NODE_SHOW_TRANSACTIONS_STMT
,
QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT
,
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT
,
QUERY_NODE_KILL_CONNECTION_STMT
,
QUERY_NODE_KILL_QUERY_STMT
,
QUERY_NODE_KILL_TRANSACTION_STMT
,
...
...
@@ -284,6 +285,7 @@ int32_t nodesListPushFront(SNodeList* pList, SNode* pNode);
SListCell
*
nodesListErase
(
SNodeList
*
pList
,
SListCell
*
pCell
);
void
nodesListInsertList
(
SNodeList
*
pTarget
,
SListCell
*
pPos
,
SNodeList
*
pSrc
);
SNode
*
nodesListGetNode
(
SNodeList
*
pList
,
int32_t
index
);
SListCell
*
nodesListGetCell
(
SNodeList
*
pList
,
int32_t
index
);
void
nodesDestroyList
(
SNodeList
*
pList
);
// Only clear the linked list structure, without releasing the elements inside
void
nodesClearList
(
SNodeList
*
pList
);
...
...
include/libs/nodes/plannodes.h
浏览文件 @
54283f87
...
...
@@ -32,6 +32,8 @@ typedef struct SLogicNode {
struct
SLogicNode
*
pParent
;
int32_t
optimizedFlag
;
uint8_t
precision
;
SNode
*
pLimit
;
SNode
*
pSlimit
;
}
SLogicNode
;
typedef
enum
EScanType
{
...
...
@@ -92,10 +94,6 @@ typedef struct SProjectLogicNode {
SLogicNode
node
;
SNodeList
*
pProjections
;
char
stmtName
[
TSDB_TABLE_NAME_LEN
];
int64_t
limit
;
int64_t
offset
;
int64_t
slimit
;
int64_t
soffset
;
}
SProjectLogicNode
;
typedef
struct
SIndefRowsFuncLogicNode
{
...
...
@@ -248,6 +246,8 @@ typedef struct SPhysiNode {
SNode
*
pConditions
;
SNodeList
*
pChildren
;
struct
SPhysiNode
*
pParent
;
SNode
*
pLimit
;
SNode
*
pSlimit
;
}
SPhysiNode
;
typedef
struct
SScanPhysiNode
{
...
...
@@ -297,10 +297,6 @@ typedef STableScanPhysiNode SStreamScanPhysiNode;
typedef
struct
SProjectPhysiNode
{
SPhysiNode
node
;
SNodeList
*
pProjections
;
int64_t
limit
;
int64_t
offset
;
int64_t
slimit
;
int64_t
soffset
;
}
SProjectPhysiNode
;
typedef
struct
SIndefRowsFuncPhysiNode
{
...
...
@@ -378,7 +374,7 @@ typedef struct SIntervalPhysiNode {
int8_t
slidingUnit
;
}
SIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SMergeIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SMergeIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SMergeAlignedIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamFinalIntervalPhysiNode
;
...
...
@@ -462,6 +458,7 @@ typedef struct SSubplan {
int32_t
msgType
;
// message type for subplan, used to denote the send message type to vnode.
int32_t
level
;
// the execution level of current subplan, starting from 0 in a top-down manner.
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
user
[
TSDB_USER_LEN
];
SQueryNodeAddr
execNode
;
// for the scan/modify subplan, the optional execution node
SQueryNodeStat
execNodeStat
;
// only for scan subplan
SNodeList
*
pChildren
;
// the datasource subplan,from which to fetch the result
...
...
include/libs/parser/parser.h
浏览文件 @
54283f87
...
...
@@ -51,6 +51,8 @@ typedef struct SParseContext {
bool
isSuperUser
;
bool
async
;
int8_t
schemalessType
;
const
char
*
svrVer
;
bool
nodeOffline
;
}
SParseContext
;
int32_t
qParseSql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
...
...
include/libs/planner/planner.h
浏览文件 @
54283f87
...
...
@@ -24,18 +24,19 @@ extern "C" {
#include "taos.h"
typedef
struct
SPlanContext
{
uint64_t
queryId
;
int32_t
acctId
;
SEpSet
mgmtEpSet
;
SNode
*
pAstRoot
;
bool
topicQuery
;
bool
streamQuery
;
bool
rSmaQuery
;
bool
showRewrite
;
int8_t
triggerType
;
int64_t
watermark
;
char
*
pMsg
;
int32_t
msgLen
;
uint64_t
queryId
;
int32_t
acctId
;
SEpSet
mgmtEpSet
;
SNode
*
pAstRoot
;
bool
topicQuery
;
bool
streamQuery
;
bool
rSmaQuery
;
bool
showRewrite
;
int8_t
triggerType
;
int64_t
watermark
;
char
*
pMsg
;
int32_t
msgLen
;
const
char
*
pUser
;
}
SPlanContext
;
// Create the physical plan for the query, according to the AST.
...
...
include/libs/qcom/query.h
浏览文件 @
54283f87
...
...
@@ -266,19 +266,19 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define qDebug(...) \
do { \
if (qDebugFlag & DEBUG_DEBUG) { \
taosPrintLog("QRY ", DEBUG_DEBUG,
tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__);
\
taosPrintLog("QRY ", DEBUG_DEBUG,
qDebugFlag, __VA_ARGS__);
\
} \
} while (0)
#define qTrace(...) \
do { \
if (qDebugFlag & DEBUG_TRACE) { \
taosPrintLog("QRY ", DEBUG_TRACE,
tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__);
\
taosPrintLog("QRY ", DEBUG_TRACE,
qDebugFlag, __VA_ARGS__);
\
} \
} while (0)
#define qDebugL(...) \
do { \
if (qDebugFlag & DEBUG_DEBUG) { \
taosPrintLongString("QRY ", DEBUG_DEBUG,
tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__);
\
taosPrintLongString("QRY ", DEBUG_DEBUG,
qDebugFlag, __VA_ARGS__);
\
} \
} while (0)
...
...
include/libs/stream/tstream.h
浏览文件 @
54283f87
...
...
@@ -344,10 +344,12 @@ static FORCE_INLINE int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBloc
if
(
pTask
->
sinkType
==
TASK_SINK__TABLE
)
{
ASSERT
(
pTask
->
dispatchType
==
TASK_DISPATCH__NONE
);
pTask
->
tbSink
.
tbSinkFunc
(
pTask
,
pTask
->
tbSink
.
vnode
,
0
,
pBlock
->
blocks
);
taosArrayDestroyEx
(
pBlock
->
blocks
,
(
FDelete
)
tDeleteSSDataBlock
);
taosFreeQitem
(
pBlock
);
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__SMA
)
{
ASSERT
(
pTask
->
dispatchType
==
TASK_DISPATCH__NONE
);
pTask
->
smaSink
.
smaSink
(
pTask
->
smaSink
.
vnode
,
pTask
->
smaSink
.
smaId
,
pBlock
->
blocks
);
taosArrayDestroyEx
(
pBlock
->
blocks
,
(
FDelete
)
tDeleteSSDataBlock
);
taosFreeQitem
(
pBlock
);
}
else
{
ASSERT
(
pTask
->
dispatchType
!=
TASK_DISPATCH__NONE
);
...
...
include/libs/sync/sync.h
浏览文件 @
54283f87
...
...
@@ -157,13 +157,13 @@ typedef struct SSyncLogStore {
SyncIndex
(
*
getCommitIndex
)(
struct
SSyncLogStore
*
pLogStore
);
// refactor, log[0 .. n] ==> log[m .. n]
int32_t
(
*
syncLogSetBeginIndex
)(
struct
SSyncLogStore
*
pLogStore
,
SyncIndex
beginIndex
);
int32_t
(
*
syncLogResetBeginIndex
)(
struct
SSyncLogStore
*
pLogStore
);
//
int32_t (*syncLogSetBeginIndex)(struct SSyncLogStore* pLogStore, SyncIndex beginIndex);
SyncIndex
(
*
syncLogBeginIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogEndIndex
)(
struct
SSyncLogStore
*
pLogStore
);
bool
(
*
syncLogIsEmpty
)(
struct
SSyncLogStore
*
pLogStore
);
int32_t
(
*
syncLogEntryCount
)(
struct
SSyncLogStore
*
pLogStore
);
// bool (*syncLogInRange
)(struct SSyncLogStore* pLogStore, SyncIndex index);
int32_t
(
*
syncLogRestoreFromSnapshot
)(
struct
SSyncLogStore
*
pLogStore
,
SyncIndex
index
);
SyncIndex
(
*
syncLogWriteIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogLastIndex
)(
struct
SSyncLogStore
*
pLogStore
);
...
...
@@ -200,6 +200,7 @@ const char* syncGetMyRoleStr(int64_t rid);
SyncTerm
syncGetMyTerm
(
int64_t
rid
);
SyncGroupId
syncGetVgId
(
int64_t
rid
);
void
syncGetEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
void
syncGetRetryEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
int32_t
syncPropose
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
);
bool
syncEnvIsStart
();
const
char
*
syncStr
(
ESyncState
state
);
...
...
include/util/tconfig.h
浏览文件 @
54283f87
...
...
@@ -33,7 +33,8 @@ typedef enum {
CFG_STYPE_ENV_CMD
,
CFG_STYPE_APOLLO_URL
,
CFG_STYPE_ARG_LIST
,
CFG_STYPE_TAOS_OPTIONS
CFG_STYPE_TAOS_OPTIONS
,
CFG_STYPE_ALTER_CMD
,
}
ECfgSrcType
;
typedef
enum
{
...
...
source/client/inc/clientInt.h
浏览文件 @
54283f87
...
...
@@ -54,6 +54,11 @@ enum {
RES_TYPE__TMQ_META
,
};
#define SHOW_VARIABLES_RESULT_COLS 2
#define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
...
...
@@ -104,6 +109,8 @@ typedef struct SHeartBeatInfo {
struct
SAppInstInfo
{
int64_t
numOfConns
;
SCorEpSet
mgmtEp
;
int32_t
totalDnodes
;
int32_t
onlineDnodes
;
TdThreadMutex
qnodeMutex
;
SArray
*
pQnodeList
;
SAppClusterSummary
summary
;
...
...
@@ -127,7 +134,8 @@ typedef struct STscObj {
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
char
ver
[
128
];
char
sVer
[
TSDB_VERSION_LEN
];
char
sDetailVer
[
128
];
int8_t
connType
;
int32_t
acctId
;
uint32_t
connId
;
...
...
@@ -215,6 +223,7 @@ typedef struct SRequestObj {
SQueryExecMetric
metric
;
SRequestSendRecvBody
body
;
bool
stableQuery
;
bool
validateOnly
;
bool
killed
;
uint32_t
prevCode
;
// previous error code: todo refactor, add update flag for catalog
...
...
@@ -235,7 +244,12 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveT
bool
freeAfterUse
);
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SSchema
*
pSchema
,
int32_t
numOfCols
);
void
doFreeReqResultInfo
(
SReqResultInfo
*
pResInfo
);
SRequestObj
*
execQuery
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
);
int32_t
transferTableNameList
(
const
char
*
tbList
,
int32_t
acctId
,
char
*
dbName
,
SArray
**
pReq
);
void
syncCatalogFn
(
SMetaData
*
pResult
,
void
*
param
,
int32_t
code
);
SRequestObj
*
execQuery
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
bool
validateOnly
);
TAOS_RES
*
taosQueryImpl
(
TAOS
*
taos
,
const
char
*
sql
,
bool
validateOnly
);
void
taosAsyncQueryImpl
(
TAOS
*
taos
,
const
char
*
sql
,
__taos_async_fn_t
fp
,
void
*
param
,
bool
validateOnly
);
static
FORCE_INLINE
SReqResultInfo
*
tmqGetCurResInfo
(
TAOS_RES
*
res
)
{
SMqRspObj
*
msg
=
(
SMqRspObj
*
)
res
;
...
...
@@ -301,7 +315,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet);
STscObj
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
,
int
connType
);
SRequestObj
*
launchQuery
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
);
SRequestObj
*
launchQuery
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
bool
validateOnly
);
int32_t
parseSql
(
SRequestObj
*
pRequest
,
bool
topicQuery
,
SQuery
**
pQuery
,
SStmtCallback
*
pStmtCb
);
...
...
source/client/src/clientHb.c
浏览文件 @
54283f87
...
...
@@ -161,6 +161,9 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
updateEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
,
&
pRsp
->
query
->
epSet
);
}
pTscObj
->
pAppInfo
->
totalDnodes
=
pRsp
->
query
->
totalDnodes
;
pTscObj
->
pAppInfo
->
onlineDnodes
=
pRsp
->
query
->
onlineDnodes
;
pTscObj
->
connId
=
pRsp
->
query
->
connId
;
if
(
pRsp
->
query
->
killRid
)
{
...
...
source/client/src/clientImpl.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/client/src/clientMain.c
浏览文件 @
54283f87
...
...
@@ -81,12 +81,6 @@ void taos_cleanup(void) {
taosCloseLog
();
}
setConfRet
taos_set_config
(
const
char
*
config
)
{
// TODO
setConfRet
ret
=
{
SET_CONF_RET_SUCC
,
{
0
}};
return
ret
;
}
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
)
{
tscDebug
(
"try to connect to %s:%u, user:%s db:%s"
,
ip
,
port
,
user
,
db
);
if
(
user
==
NULL
)
{
...
...
@@ -205,51 +199,9 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) {
return
pResInfo
->
userFields
;
}
static
void
syncQueryFn
(
void
*
param
,
void
*
res
,
int32_t
code
)
{
SSyncQueryParam
*
pParam
=
param
;
pParam
->
pRequest
=
res
;
pParam
->
pRequest
->
code
=
code
;
tsem_post
(
&
pParam
->
sem
);
}
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
)
{
if
(
NULL
==
taos
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
NULL
;
}
STscObj
*
pTscObj
=
acquireTscObj
(
*
(
int64_t
*
)
taos
);
if
(
pTscObj
==
NULL
||
sql
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
NULL
;
}
#if SYNC_ON_TOP_OF_ASYNC
SSyncQueryParam
*
param
=
taosMemoryCalloc
(
1
,
sizeof
(
SSyncQueryParam
));
tsem_init
(
&
param
->
sem
,
0
,
0
);
taos_query_a
(
taos
,
sql
,
syncQueryFn
,
param
);
tsem_wait
(
&
param
->
sem
);
releaseTscObj
(
*
(
int64_t
*
)
taos
);
return
param
->
pRequest
;
#else
size_t
sqlLen
=
strlen
(
sql
);
if
(
sqlLen
>
(
size_t
)
TSDB_MAX_ALLOWED_SQL_LEN
)
{
releaseTscObj
(
*
(
int64_t
*
)
taos
);
tscError
(
"sql string exceeds max length:%d"
,
TSDB_MAX_ALLOWED_SQL_LEN
);
terrno
=
TSDB_CODE_TSC_EXCEED_SQL_LIMIT
;
return
NULL
;
}
TAOS_RES
*
pRes
=
execQuery
(
pTscObj
,
sql
,
sqlLen
);
releaseTscObj
(
*
(
int64_t
*
)
taos
);
return
pRes
;
#endif
return
taosQueryImpl
(
taos
,
sql
,
false
);
}
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
)
{
...
...
@@ -641,7 +593,14 @@ int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) {
return
pResInfo
->
pCol
[
columnIndex
].
offset
;
}
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
)
{
return
true
;
}
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
)
{
TAOS_RES
*
pObj
=
taosQueryImpl
(
taos
,
sql
,
true
);
int
code
=
taos_errno
(
pObj
);
taos_free_result
(
pObj
);
return
code
;
}
void
taos_reset_current_db
(
TAOS
*
taos
)
{
STscObj
*
pTscObj
=
acquireTscObj
(
*
(
int64_t
*
)
taos
);
...
...
@@ -664,7 +623,7 @@ const char *taos_get_server_info(TAOS *taos) {
releaseTscObj
(
*
(
int64_t
*
)
taos
);
return
pTscObj
->
v
er
;
return
pTscObj
->
sDetailV
er
;
}
typedef
struct
SqlParseWrapper
{
...
...
@@ -731,38 +690,7 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
}
void
taos_query_a
(
TAOS
*
taos
,
const
char
*
sql
,
__taos_async_fn_t
fp
,
void
*
param
)
{
STscObj
*
pTscObj
=
acquireTscObj
(
*
(
int64_t
*
)
taos
);
if
(
pTscObj
==
NULL
||
sql
==
NULL
||
NULL
==
fp
)
{
terrno
=
TSDB_CODE_INVALID_PARA
;
if
(
pTscObj
)
{
releaseTscObj
(
*
(
int64_t
*
)
taos
);
}
else
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
}
fp
(
param
,
NULL
,
terrno
);
return
;
}
size_t
sqlLen
=
strlen
(
sql
);
if
(
sqlLen
>
(
size_t
)
TSDB_MAX_ALLOWED_SQL_LEN
)
{
tscError
(
"sql string exceeds max length:%d"
,
TSDB_MAX_ALLOWED_SQL_LEN
);
terrno
=
TSDB_CODE_TSC_EXCEED_SQL_LIMIT
;
fp
(
param
,
NULL
,
terrno
);
return
;
}
SRequestObj
*
pRequest
=
NULL
;
int32_t
code
=
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
fp
(
param
,
NULL
,
terrno
);
return
;
}
pRequest
->
body
.
queryFp
=
fp
;
pRequest
->
body
.
param
=
param
;
doAsyncQuery
(
pRequest
,
false
);
taosAsyncQueryImpl
(
taos
,
sql
,
fp
,
param
,
false
);
}
int32_t
createParseContext
(
const
SRequestObj
*
pRequest
,
SParseContext
**
pCxt
)
{
...
...
@@ -838,7 +766,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
.
requestObjRefId
=
pCxt
->
requestRid
,
.
mgmtEps
=
pCxt
->
mgmtEpSet
};
code
=
catalogAsyncGetAllMeta
(
pCxt
->
pCatalog
,
&
conn
,
pRequest
->
requestId
,
&
catalogReq
,
retrieveMetaCallback
,
pWrapper
,
code
=
catalogAsyncGetAllMeta
(
pCxt
->
pCatalog
,
&
conn
,
&
catalogReq
,
retrieveMetaCallback
,
pWrapper
,
&
pRequest
->
body
.
queryJob
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
return
;
...
...
@@ -955,10 +883,75 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
}
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
)
{
// TODO
return
-
1
;
const
int32_t
MAX_TABLE_NAME_LENGTH
=
12
*
1024
*
1024
;
// 12MB list
int32_t
code
=
0
;
SRequestObj
*
pRequest
=
NULL
;
SCatalogReq
catalogReq
=
{
0
};
if
(
NULL
==
tableNameList
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
length
=
(
int32_t
)
strlen
(
tableNameList
);
if
(
0
==
length
)
{
return
TSDB_CODE_SUCCESS
;
}
else
if
(
length
>
MAX_TABLE_NAME_LENGTH
)
{
tscError
(
"tableNameList too long, length:%d, maximum allowed:%d"
,
length
,
MAX_TABLE_NAME_LENGTH
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
STscObj
*
pTscObj
=
acquireTscObj
(
*
(
int64_t
*
)
taos
);
if
(
pTscObj
==
NULL
)
{
terrno
=
TSDB_CODE_TSC_DISCONNECTED
;
return
terrno
;
}
code
=
transferTableNameList
(
tableNameList
,
pTscObj
->
acctId
,
pTscObj
->
db
,
&
catalogReq
.
pTableMeta
);
if
(
code
)
{
goto
_return
;
}
SCatalog
*
pCtg
=
NULL
;
code
=
catalogGetHandle
(
pTscObj
->
pAppInfo
->
clusterId
,
&
pCtg
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_return
;
}
char
*
sql
=
"taos_load_table_info"
;
code
=
buildRequest
(
pTscObj
,
sql
,
strlen
(
sql
),
&
pRequest
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
goto
_return
;
}
SSyncQueryParam
param
=
{
0
};
tsem_init
(
&
param
.
sem
,
0
,
0
);
param
.
pRequest
=
pRequest
;
SRequestConnInfo
conn
=
{.
pTrans
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
requestId
=
pRequest
->
requestId
,
.
requestObjRefId
=
pRequest
->
self
};
conn
.
mgmtEps
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
code
=
catalogAsyncGetAllMeta
(
pCtg
,
&
conn
,
&
catalogReq
,
syncCatalogFn
,
&
param
,
NULL
);
if
(
code
)
{
goto
_return
;
}
tsem_wait
(
&
param
.
sem
);
_return:
taosArrayDestroy
(
catalogReq
.
pTableMeta
);
destroyRequest
(
pRequest
);
releaseTscObj
(
*
(
int64_t
*
)
taos
);
return
code
;
}
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
)
{
STscObj
*
pObj
=
acquireTscObj
(
*
(
int64_t
*
)
taos
);
if
(
NULL
==
pObj
)
{
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
54283f87
...
...
@@ -82,7 +82,8 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
pTscObj
->
connId
=
connectRsp
.
connId
;
pTscObj
->
acctId
=
connectRsp
.
acctId
;
tstrncpy
(
pTscObj
->
ver
,
connectRsp
.
sVersion
,
tListLen
(
pTscObj
->
ver
));
tstrncpy
(
pTscObj
->
sVer
,
connectRsp
.
sVer
,
tListLen
(
pTscObj
->
sVer
));
tstrncpy
(
pTscObj
->
sDetailVer
,
connectRsp
.
sDetailVer
,
tListLen
(
pTscObj
->
sDetailVer
));
// update the appInstInfo
pTscObj
->
pAppInfo
->
clusterId
=
connectRsp
.
clusterId
;
...
...
@@ -287,6 +288,103 @@ int32_t processAlterStbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
}
static
int32_t
buildShowVariablesBlock
(
SArray
*
pVars
,
SSDataBlock
**
block
)
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
info
.
hasVarCol
=
true
;
pBlock
->
pDataBlock
=
taosArrayInit
(
SHOW_VARIABLES_RESULT_COLS
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_VARIABLES_RESULT_FIELD1_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_VARIABLES_RESULT_FIELD2_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
int32_t
numOfCfg
=
taosArrayGetSize
(
pVars
);
blockDataEnsureCapacity
(
pBlock
,
numOfCfg
);
for
(
int32_t
i
=
0
,
c
=
0
;
i
<
numOfCfg
;
++
i
,
c
=
0
)
{
SVariablesInfo
*
pInfo
=
taosArrayGet
(
pVars
,
i
);
char
name
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pInfo
->
name
,
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
name
,
false
);
char
value
[
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
value
,
pInfo
->
value
,
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
value
,
false
);
}
pBlock
->
info
.
rows
=
numOfCfg
;
*
block
=
pBlock
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
buildShowVariablesRsp
(
SArray
*
pVars
,
SRetrieveTableRsp
**
pRsp
)
{
SSDataBlock
*
pBlock
=
NULL
;
int32_t
code
=
buildShowVariablesBlock
(
pVars
,
&
pBlock
);
if
(
code
)
{
return
code
;
}
size_t
rspSize
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
*
pRsp
=
taosMemoryCalloc
(
1
,
rspSize
);
if
(
NULL
==
*
pRsp
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pRsp
)
->
useconds
=
0
;
(
*
pRsp
)
->
completed
=
1
;
(
*
pRsp
)
->
precision
=
0
;
(
*
pRsp
)
->
compressed
=
0
;
(
*
pRsp
)
->
compLen
=
0
;
(
*
pRsp
)
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
(
*
pRsp
)
->
numOfCols
=
htonl
(
SHOW_VARIABLES_RESULT_COLS
);
int32_t
len
=
0
;
blockCompressEncode
(
pBlock
,
(
*
pRsp
)
->
data
,
&
len
,
SHOW_VARIABLES_RESULT_COLS
,
false
);
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
processShowVariablesRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SRequestObj
*
pRequest
=
param
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
setErrno
(
pRequest
,
code
);
}
else
{
SShowVariablesRsp
rsp
=
{
0
};
SRetrieveTableRsp
*
pRes
=
NULL
;
code
=
tDeserializeSShowVariablesRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
rsp
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
buildShowVariablesRsp
(
rsp
.
variables
,
&
pRes
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
pRes
,
false
,
false
);
}
tFreeSShowVariablesRsp
(
&
rsp
);
}
if
(
pRequest
->
body
.
queryFp
!=
NULL
)
{
pRequest
->
body
.
queryFp
(
pRequest
->
body
.
param
,
pRequest
,
code
);
}
else
{
tsem_post
(
&
pRequest
->
body
.
rspSem
);
}
return
code
;
}
__async_send_cb_fn_t
getMsgRspHandle
(
int32_t
msgType
)
{
switch
(
msgType
)
{
case
TDMT_MND_CONNECT
:
...
...
@@ -301,6 +399,8 @@ __async_send_cb_fn_t getMsgRspHandle(int32_t msgType) {
return
processDropDbRsp
;
case
TDMT_MND_ALTER_STB
:
return
processAlterStbRsp
;
case
TDMT_MND_SHOW_VARIABLES
:
return
processShowVariablesRsp
;
default:
return
genericRspCallback
;
}
...
...
source/common/src/tdatablock.c
浏览文件 @
54283f87
...
...
@@ -263,7 +263,7 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, ui
pColumnInfoData
->
varmeta
.
length
=
len
+
oldLen
;
}
else
{
if
(
finalNumOfRows
>
*
capacity
)
{
ASSERT
(
finalNumOfRows
*
pColumnInfoData
->
info
.
bytes
);
ASSERT
(
finalNumOfRows
*
pColumnInfoData
->
info
.
bytes
);
char
*
tmp
=
taosMemoryRealloc
(
pColumnInfoData
->
pData
,
finalNumOfRows
*
pColumnInfoData
->
info
.
bytes
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
...
...
@@ -293,7 +293,8 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, ui
return
numOfRow1
+
numOfRow2
;
}
int32_t
colDataAssign
(
SColumnInfoData
*
pColumnInfoData
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRows
,
const
SDataBlockInfo
*
pBlockInfo
)
{
int32_t
colDataAssign
(
SColumnInfoData
*
pColumnInfoData
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRows
,
const
SDataBlockInfo
*
pBlockInfo
)
{
ASSERT
(
pColumnInfoData
!=
NULL
&&
pSource
!=
NULL
&&
pColumnInfoData
->
info
.
type
==
pSource
->
info
.
type
);
if
(
numOfRows
<=
0
)
{
return
numOfRows
;
...
...
@@ -327,9 +328,7 @@ int32_t colDataAssign(SColumnInfoData* pColumnInfoData, const SColumnInfoData* p
return
0
;
}
size_t
blockDataGetNumOfCols
(
const
SSDataBlock
*
pBlock
)
{
return
taosArrayGetSize
(
pBlock
->
pDataBlock
);
}
size_t
blockDataGetNumOfCols
(
const
SSDataBlock
*
pBlock
)
{
return
taosArrayGetSize
(
pBlock
->
pDataBlock
);
}
size_t
blockDataGetNumOfRows
(
const
SSDataBlock
*
pBlock
)
{
return
pBlock
->
info
.
rows
;
}
...
...
@@ -396,7 +395,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
int32_t
pageSize
)
{
ASSERT
(
pBlock
!=
NULL
&&
stopIndex
!=
NULL
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
int32_t
numOfRows
=
pBlock
->
info
.
rows
;
int32_t
bitmapChar
=
1
;
...
...
@@ -512,7 +511,7 @@ int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) {
// write the number of rows
*
(
uint32_t
*
)
buf
=
pBlock
->
info
.
rows
;
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
int32_t
numOfRows
=
pBlock
->
info
.
rows
;
char
*
pStart
=
buf
+
sizeof
(
uint32_t
);
...
...
@@ -542,7 +541,7 @@ int32_t blockDataToBuf(char* buf, const SSDataBlock* pBlock) {
int32_t
blockDataFromBuf
(
SSDataBlock
*
pBlock
,
const
char
*
buf
)
{
pBlock
->
info
.
rows
=
*
(
int32_t
*
)
buf
;
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
const
char
*
pStart
=
buf
+
sizeof
(
uint32_t
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
...
...
@@ -734,7 +733,7 @@ int32_t dataBlockCompar(const void* p1, const void* p2, const void* param) {
static
int32_t
doAssignOneTuple
(
SColumnInfoData
*
pDstCols
,
int32_t
numOfRows
,
const
SSDataBlock
*
pSrcBlock
,
int32_t
tupleIndex
)
{
int32_t
code
=
0
;
size_t
numOfCols
=
taosArrayGetSize
(
pSrcBlock
->
pDataBlock
);
size_t
numOfCols
=
taosArrayGetSize
(
pSrcBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pDst
=
&
pDstCols
[
i
];
...
...
@@ -794,7 +793,7 @@ static int32_t blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataB
static
SColumnInfoData
*
createHelpColInfoData
(
const
SSDataBlock
*
pDataBlock
)
{
int32_t
rows
=
pDataBlock
->
info
.
rows
;
size_t
numOfCols
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
size_t
numOfCols
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
SColumnInfoData
*
pCols
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
SColumnInfoData
));
if
(
pCols
==
NULL
)
{
...
...
@@ -902,7 +901,6 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
}
else
{
// var data type
}
}
else
if
(
numOfCols
==
2
)
{
}
}
...
...
@@ -1103,14 +1101,14 @@ void blockDataCleanup(SSDataBlock* pDataBlock) {
}
}
static
int32_t
doEnsureCapacity
(
SColumnInfoData
*
pColumn
,
const
SDataBlockInfo
*
pBlockInfo
,
uint32_t
numOfRows
)
{
static
int32_t
doEnsureCapacity
(
SColumnInfoData
*
pColumn
,
const
SDataBlockInfo
*
pBlockInfo
,
uint32_t
numOfRows
)
{
ASSERT
(
numOfRows
>
0
&&
pBlockInfo
->
capacity
>=
pBlockInfo
->
rows
);
if
(
numOfRows
<
pBlockInfo
->
capacity
)
{
return
TSDB_CODE_SUCCESS
;
}
// todo temp disable it
// ASSERT(pColumn->info.bytes != 0);
// ASSERT(pColumn->info.bytes != 0);
int32_t
existedRows
=
pBlockInfo
->
rows
;
...
...
@@ -1141,7 +1139,7 @@ static int32_t doEnsureCapacity(SColumnInfoData* pColumn, const SDataBlockInfo *
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
memset
(
tmp
+
pColumn
->
info
.
bytes
*
existedRows
,
0
,
pColumn
->
info
.
bytes
*
(
numOfRows
-
existedRows
));
pColumn
->
pData
=
tmp
;
}
...
...
@@ -1197,6 +1195,40 @@ void* blockDataDestroy(SSDataBlock* pBlock) {
taosMemoryFreeClear
(
pBlock
);
return
NULL
;
}
int32_t
assignOneDataBlock
(
SSDataBlock
*
dst
,
const
SSDataBlock
*
src
)
{
ASSERT
(
src
!=
NULL
);
dst
->
info
=
src
->
info
;
dst
->
info
.
rows
=
0
;
dst
->
info
.
capacity
=
0
;
size_t
numOfCols
=
taosArrayGetSize
(
src
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
src
->
pDataBlock
,
i
);
SColumnInfoData
colInfo
=
{.
hasNull
=
true
,
.
info
=
p
->
info
};
blockDataAppendColInfo
(
dst
,
&
colInfo
);
}
int32_t
code
=
blockDataEnsureCapacity
(
dst
,
src
->
info
.
rows
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
dst
->
pDataBlock
,
i
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
src
->
pDataBlock
,
i
);
if
(
pSrc
->
pData
==
NULL
)
{
continue
;
}
colDataAssign
(
pDst
,
pSrc
,
src
->
info
.
rows
,
&
src
->
info
);
}
dst
->
info
.
rows
=
src
->
info
.
rows
;
dst
->
info
.
capacity
=
src
->
info
.
rows
;
return
0
;
}
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
)
{
if
(
pDataBlock
==
NULL
)
{
...
...
@@ -1272,7 +1304,7 @@ int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoDat
}
// todo disable it temporarily
// ASSERT(pColInfoData->info.type != 0);
// ASSERT(pColInfoData->info.type != 0);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
pBlock
->
info
.
hasVarCol
=
true
;
}
...
...
@@ -1284,7 +1316,7 @@ int32_t blockDataAppendColInfo(SSDataBlock* pBlock, SColumnInfoData* pColInfoDat
SColumnInfoData
createColumnInfoData
(
int16_t
type
,
int32_t
bytes
,
int16_t
colId
)
{
SColumnInfoData
col
=
{.
hasNull
=
true
};
col
.
info
.
colId
=
colId
;
col
.
info
.
type
=
type
;
col
.
info
.
type
=
type
;
col
.
info
.
bytes
=
bytes
;
return
col
;
...
...
@@ -1552,9 +1584,9 @@ void blockDebugShowData(const SArray* dataBlocks, const char* flag) {
int32_t
sz
=
taosArrayGetSize
(
dataBlocks
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SSDataBlock
*
pDataBlock
=
taosArrayGet
(
dataBlocks
,
i
);
size_t
numOfCols
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
size_t
numOfCols
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
int32_t
rows
=
pDataBlock
->
info
.
rows
;
int32_t
rows
=
pDataBlock
->
info
.
rows
;
printf
(
"%s |block type %d |child id %d|
\n
"
,
flag
,
(
int32_t
)
pDataBlock
->
info
.
type
,
pDataBlock
->
info
.
childId
);
for
(
int32_t
j
=
0
;
j
<
rows
;
j
++
)
{
printf
(
"%s |"
,
flag
);
...
...
@@ -1633,8 +1665,8 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks
SSDataBlock
*
pDataBlock
=
taosArrayGet
(
pDataBlocks
,
i
);
int32_t
colNum
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
);
int32_t
rows
=
pDataBlock
->
info
.
rows
;
// int32_t rowSize = pDataBlock->info.rowSize;
// int64_t groupId = pDataBlock->info.groupId;
// int32_t rowSize = pDataBlock->info.rowSize;
// int64_t groupId = pDataBlock->info.groupId;
if
(
colNum
<=
1
)
{
// invalid if only with TS col
...
...
source/common/src/tglobal.c
浏览文件 @
54283f87
...
...
@@ -636,6 +636,373 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
return
0
;
}
int32_t
taosSetCfg
(
SConfig
*
pCfg
,
char
*
name
)
{
int32_t
len
=
strlen
(
name
);
char
lowcaseName
[
CFG_NAME_MAX_LEN
+
1
]
=
{
0
};
strntolower
(
lowcaseName
,
name
,
TMIN
(
CFG_NAME_MAX_LEN
,
len
));
switch
(
lowcaseName
[
0
])
{
case
'a'
:
{
if
(
strcasecmp
(
"asyncLog"
,
name
)
==
0
)
{
tsAsyncLog
=
cfgGetItem
(
pCfg
,
"asyncLog"
)
->
bval
;
}
break
;
}
case
'b'
:
{
if
(
strcasecmp
(
"bnodeShmSize"
,
name
)
==
0
)
{
tsBnodeShmSize
=
cfgGetItem
(
pCfg
,
"bnodeShmSize"
)
->
i32
;
}
break
;
}
case
'c'
:
{
if
(
strcasecmp
(
"charset"
,
name
)
==
0
)
{
const
char
*
locale
=
cfgGetItem
(
pCfg
,
"locale"
)
->
str
;
const
char
*
charset
=
cfgGetItem
(
pCfg
,
"charset"
)
->
str
;
taosSetSystemLocale
(
locale
,
charset
);
osSetSystemLocale
(
locale
,
charset
);
}
else
if
(
strcasecmp
(
"compressMsgSize"
,
name
)
==
0
)
{
tsCompressMsgSize
=
cfgGetItem
(
pCfg
,
"compressMsgSize"
)
->
i32
;
}
else
if
(
strcasecmp
(
"compressColData"
,
name
)
==
0
)
{
tsCompressColData
=
cfgGetItem
(
pCfg
,
"compressColData"
)
->
i32
;
}
else
if
(
strcasecmp
(
"countAlwaysReturnValue"
,
name
)
==
0
)
{
tsCountAlwaysReturnValue
=
cfgGetItem
(
pCfg
,
"countAlwaysReturnValue"
)
->
i32
;
}
else
if
(
strcasecmp
(
"cDebugFlag"
,
name
)
==
0
)
{
cDebugFlag
=
cfgGetItem
(
pCfg
,
"cDebugFlag"
)
->
i32
;
}
break
;
}
case
'd'
:
{
if
(
strcasecmp
(
"deadLockKillQuery"
,
name
)
==
0
)
{
tsDeadLockKillQuery
=
cfgGetItem
(
pCfg
,
"deadLockKillQuery"
)
->
i32
;
}
else
if
(
strcasecmp
(
"dDebugFlag"
,
name
)
==
0
)
{
dDebugFlag
=
cfgGetItem
(
pCfg
,
"dDebugFlag"
)
->
i32
;
}
break
;
}
case
'e'
:
{
if
(
strcasecmp
(
"enableCoreFile"
,
name
)
==
0
)
{
bool
enableCore
=
cfgGetItem
(
pCfg
,
"enableCoreFile"
)
->
bval
;
taosSetConsoleEcho
(
enableCore
);
}
break
;
}
case
'f'
:
{
if
(
strcasecmp
(
"fqdn"
,
name
)
==
0
)
{
tstrncpy
(
tsLocalFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
TSDB_FQDN_LEN
);
tsServerPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
snprintf
(
tsLocalEp
,
sizeof
(
tsLocalEp
),
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
char
defaultFirstEp
[
TSDB_EP_LEN
]
=
{
0
};
snprintf
(
defaultFirstEp
,
TSDB_EP_LEN
,
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
SConfigItem
*
pFirstEpItem
=
cfgGetItem
(
pCfg
,
"firstEp"
);
SEp
firstEp
=
{
0
};
taosGetFqdnPortFromEp
(
strlen
(
pFirstEpItem
->
str
)
==
0
?
defaultFirstEp
:
pFirstEpItem
->
str
,
&
firstEp
);
snprintf
(
tsFirst
,
sizeof
(
tsFirst
),
"%s:%u"
,
firstEp
.
fqdn
,
firstEp
.
port
);
cfgSetItem
(
pCfg
,
"firstEp"
,
tsFirst
,
pFirstEpItem
->
stype
);
}
else
if
(
strcasecmp
(
"firstEp"
,
name
)
==
0
)
{
tstrncpy
(
tsLocalFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
TSDB_FQDN_LEN
);
tsServerPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
snprintf
(
tsLocalEp
,
sizeof
(
tsLocalEp
),
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
char
defaultFirstEp
[
TSDB_EP_LEN
]
=
{
0
};
snprintf
(
defaultFirstEp
,
TSDB_EP_LEN
,
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
SConfigItem
*
pFirstEpItem
=
cfgGetItem
(
pCfg
,
"firstEp"
);
SEp
firstEp
=
{
0
};
taosGetFqdnPortFromEp
(
strlen
(
pFirstEpItem
->
str
)
==
0
?
defaultFirstEp
:
pFirstEpItem
->
str
,
&
firstEp
);
snprintf
(
tsFirst
,
sizeof
(
tsFirst
),
"%s:%u"
,
firstEp
.
fqdn
,
firstEp
.
port
);
cfgSetItem
(
pCfg
,
"firstEp"
,
tsFirst
,
pFirstEpItem
->
stype
);
}
else
if
(
strcasecmp
(
"fsDebugFlag"
,
name
)
==
0
)
{
fsDebugFlag
=
cfgGetItem
(
pCfg
,
"fsDebugFlag"
)
->
i32
;
}
else
if
(
strcasecmp
(
"fnDebugFlag"
,
name
)
==
0
)
{
fnDebugFlag
=
cfgGetItem
(
pCfg
,
"fnDebugFlag"
)
->
i32
;
}
break
;
}
case
'i'
:
{
if
(
strcasecmp
(
"idxDebugFlag"
,
name
)
==
0
)
{
idxDebugFlag
=
cfgGetItem
(
pCfg
,
"idxDebugFlag"
)
->
i32
;
}
break
;
}
case
'j'
:
{
if
(
strcasecmp
(
"jniDebugFlag"
,
name
)
==
0
)
{
jniDebugFlag
=
cfgGetItem
(
pCfg
,
"jniDebugFlag"
)
->
i32
;
}
break
;
}
case
'k'
:
{
if
(
strcasecmp
(
"keepColumnName"
,
name
)
==
0
)
{
tsKeepOriginalColumnName
=
cfgGetItem
(
pCfg
,
"keepColumnName"
)
->
bval
;
}
break
;
}
case
'l'
:
{
if
(
strcasecmp
(
"locale"
,
name
)
==
0
)
{
const
char
*
locale
=
cfgGetItem
(
pCfg
,
"locale"
)
->
str
;
const
char
*
charset
=
cfgGetItem
(
pCfg
,
"charset"
)
->
str
;
taosSetSystemLocale
(
locale
,
charset
);
osSetSystemLocale
(
locale
,
charset
);
}
else
if
(
strcasecmp
(
"logDir"
,
name
)
==
0
)
{
tstrncpy
(
tsLogDir
,
cfgGetItem
(
pCfg
,
"logDir"
)
->
str
,
PATH_MAX
);
taosExpandDir
(
tsLogDir
,
tsLogDir
,
PATH_MAX
);
}
else
if
(
strcasecmp
(
"logKeepDays"
,
name
)
==
0
)
{
tsLogKeepDays
=
cfgGetItem
(
pCfg
,
"logKeepDays"
)
->
i32
;
}
break
;
}
case
'm'
:
{
switch
(
lowcaseName
[
1
])
{
case
'a'
:
{
if
(
strcasecmp
(
"maxShellConns"
,
name
)
==
0
)
{
tsMaxShellConns
=
cfgGetItem
(
pCfg
,
"maxShellConns"
)
->
i32
;
}
else
if
(
strcasecmp
(
"maxNumOfDistinctRes"
,
name
)
==
0
)
{
tsMaxNumOfDistinctResults
=
cfgGetItem
(
pCfg
,
"maxNumOfDistinctRes"
)
->
i32
;
}
else
if
(
strcasecmp
(
"maxStreamCompDelay"
,
name
)
==
0
)
{
tsMaxStreamComputDelay
=
cfgGetItem
(
pCfg
,
"maxStreamCompDelay"
)
->
i32
;
}
else
if
(
strcasecmp
(
"maxFirstStreamCompDelay"
,
name
)
==
0
)
{
tsStreamCompStartDelay
=
cfgGetItem
(
pCfg
,
"maxFirstStreamCompDelay"
)
->
i32
;
}
break
;
}
case
'd'
:
{
if
(
strcasecmp
(
"mDebugFlag"
,
name
)
==
0
)
{
mDebugFlag
=
cfgGetItem
(
pCfg
,
"mDebugFlag"
)
->
i32
;
}
break
;
}
case
'i'
:
{
if
(
strcasecmp
(
"minimalTempDirGB"
,
name
)
==
0
)
{
tsTempSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalTempDirGB"
)
->
fval
;
}
else
if
(
strcasecmp
(
"minimalDataDirGB"
,
name
)
==
0
)
{
tsDataSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalDataDirGB"
)
->
fval
;
}
else
if
(
strcasecmp
(
"minSlidingTime"
,
name
)
==
0
)
{
tsMinSlidingTime
=
cfgGetItem
(
pCfg
,
"minSlidingTime"
)
->
i32
;
}
else
if
(
strcasecmp
(
"minIntervalTime"
,
name
)
==
0
)
{
tsMinIntervalTime
=
cfgGetItem
(
pCfg
,
"minIntervalTime"
)
->
i32
;
}
else
if
(
strcasecmp
(
"minimalLogDirGB"
,
name
)
==
0
)
{
tsLogSpace
.
reserved
=
cfgGetItem
(
pCfg
,
"minimalLogDirGB"
)
->
fval
;
}
break
;
}
case
'n'
:
{
if
(
strcasecmp
(
"mnodeShmSize"
,
name
)
==
0
)
{
tsMnodeShmSize
=
cfgGetItem
(
pCfg
,
"mnodeShmSize"
)
->
i32
;
}
break
;
}
case
'o'
:
{
if
(
strcasecmp
(
"monitor"
,
name
)
==
0
)
{
tsEnableMonitor
=
cfgGetItem
(
pCfg
,
"monitor"
)
->
bval
;
}
else
if
(
strcasecmp
(
"monitorInterval"
,
name
)
==
0
)
{
tsMonitorInterval
=
cfgGetItem
(
pCfg
,
"monitorInterval"
)
->
i32
;
}
else
if
(
strcasecmp
(
"monitorFqdn"
,
name
)
==
0
)
{
tstrncpy
(
tsMonitorFqdn
,
cfgGetItem
(
pCfg
,
"monitorFqdn"
)
->
str
,
TSDB_FQDN_LEN
);
}
else
if
(
strcasecmp
(
"monitorPort"
,
name
)
==
0
)
{
tsMonitorPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"monitorPort"
)
->
i32
;
}
else
if
(
strcasecmp
(
"monitorMaxLogs"
,
name
)
==
0
)
{
tsMonitorMaxLogs
=
cfgGetItem
(
pCfg
,
"monitorMaxLogs"
)
->
i32
;
}
else
if
(
strcasecmp
(
"monitorComp"
,
name
)
==
0
)
{
tsMonitorComp
=
cfgGetItem
(
pCfg
,
"monitorComp"
)
->
bval
;
}
break
;
}
case
'q'
:
{
if
(
strcasecmp
(
"mqRebalanceInterval"
,
name
)
==
0
)
{
tsMqRebalanceInterval
=
cfgGetItem
(
pCfg
,
"mqRebalanceInterval"
)
->
i32
;
}
break
;
}
case
'u'
:
{
if
(
strcasecmp
(
"multiProcess"
,
name
)
==
0
)
{
tsMultiProcess
=
cfgGetItem
(
pCfg
,
"multiProcess"
)
->
bval
;
}
break
;
}
default:
terrno
=
TSDB_CODE_CFG_NOT_FOUND
;
return
-
1
;
}
break
;
}
case
'n'
:
{
if
(
strcasecmp
(
"numOfTaskQueueThreads"
,
name
)
==
0
)
{
tsNumOfTaskQueueThreads
=
cfgGetItem
(
pCfg
,
"numOfTaskQueueThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfRpcThreads"
,
name
)
==
0
)
{
tsNumOfRpcThreads
=
cfgGetItem
(
pCfg
,
"numOfRpcThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfCommitThreads"
,
name
)
==
0
)
{
tsNumOfCommitThreads
=
cfgGetItem
(
pCfg
,
"numOfCommitThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfMnodeQueryThreads"
,
name
)
==
0
)
{
tsNumOfMnodeQueryThreads
=
cfgGetItem
(
pCfg
,
"numOfMnodeQueryThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfMnodeReadThreads"
,
name
)
==
0
)
{
tsNumOfMnodeReadThreads
=
cfgGetItem
(
pCfg
,
"numOfMnodeReadThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfVnodeQueryThreads"
,
name
)
==
0
)
{
tsNumOfVnodeQueryThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeQueryThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfVnodeFetchThreads"
,
name
)
==
0
)
{
tsNumOfVnodeFetchThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeFetchThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfVnodeWriteThreads"
,
name
)
==
0
)
{
tsNumOfVnodeWriteThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeWriteThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfVnodeSyncThreads"
,
name
)
==
0
)
{
tsNumOfVnodeSyncThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeSyncThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfVnodeMergeThreads"
,
name
)
==
0
)
{
tsNumOfVnodeMergeThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeMergeThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfQnodeQueryThreads"
,
name
)
==
0
)
{
tsNumOfQnodeQueryThreads
=
cfgGetItem
(
pCfg
,
"numOfQnodeQueryThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfQnodeFetchThreads"
,
name
)
==
0
)
{
tsNumOfQnodeFetchThreads
=
cfgGetItem
(
pCfg
,
"numOfQnodeFetchThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfSnodeSharedThreads"
,
name
)
==
0
)
{
tsNumOfSnodeSharedThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeSharedThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfSnodeUniqueThreads"
,
name
)
==
0
)
{
tsNumOfSnodeUniqueThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeUniqueThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfLogLines"
,
name
)
==
0
)
{
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
}
break
;
}
case
'p'
:
{
if
(
strcasecmp
(
"printAuth"
,
name
)
==
0
)
{
tsPrintAuth
=
cfgGetItem
(
pCfg
,
"printAuth"
)
->
bval
;
}
break
;
}
case
'q'
:
{
if
(
strcasecmp
(
"queryPolicy"
,
name
)
==
0
)
{
tsQueryPolicy
=
cfgGetItem
(
pCfg
,
"queryPolicy"
)
->
i32
;
}
else
if
(
strcasecmp
(
"querySmaOptimize"
,
name
)
==
0
)
{
tsQuerySmaOptimize
=
cfgGetItem
(
pCfg
,
"querySmaOptimize"
)
->
i32
;
}
else
if
(
strcasecmp
(
"queryBufferSize"
,
name
)
==
0
)
{
tsQueryBufferSize
=
cfgGetItem
(
pCfg
,
"queryBufferSize"
)
->
i32
;
if
(
tsQueryBufferSize
>=
0
)
{
tsQueryBufferSizeBytes
=
tsQueryBufferSize
*
1048576UL
;
}
}
else
if
(
strcasecmp
(
"qnodeShmSize"
,
name
)
==
0
)
{
tsQnodeShmSize
=
cfgGetItem
(
pCfg
,
"qnodeShmSize"
)
->
i32
;
}
else
if
(
strcasecmp
(
"qDebugFlag"
,
name
)
==
0
)
{
qDebugFlag
=
cfgGetItem
(
pCfg
,
"qDebugFlag"
)
->
i32
;
}
break
;
}
case
'r'
:
{
if
(
strcasecmp
(
"retryStreamCompDelay"
,
name
)
==
0
)
{
tsRetryStreamCompDelay
=
cfgGetItem
(
pCfg
,
"retryStreamCompDelay"
)
->
i32
;
}
else
if
(
strcasecmp
(
"retrieveBlockingModel"
,
name
)
==
0
)
{
tsRetrieveBlockingModel
=
cfgGetItem
(
pCfg
,
"retrieveBlockingModel"
)
->
bval
;
}
else
if
(
strcasecmp
(
"rpcQueueMemoryAllowed"
,
name
)
==
0
)
{
tsRpcQueueMemoryAllowed
=
cfgGetItem
(
pCfg
,
"rpcQueueMemoryAllowed"
)
->
i64
;
}
else
if
(
strcasecmp
(
"rpcDebugFlag"
,
name
)
==
0
)
{
rpcDebugFlag
=
cfgGetItem
(
pCfg
,
"rpcDebugFlag"
)
->
i32
;
}
break
;
}
case
's'
:
{
if
(
strcasecmp
(
"secondEp"
,
name
)
==
0
)
{
SConfigItem
*
pSecondpItem
=
cfgGetItem
(
pCfg
,
"secondEp"
);
SEp
secondEp
=
{
0
};
taosGetFqdnPortFromEp
(
strlen
(
pSecondpItem
->
str
)
==
0
?
tsFirst
:
pSecondpItem
->
str
,
&
secondEp
);
snprintf
(
tsSecond
,
sizeof
(
tsSecond
),
"%s:%u"
,
secondEp
.
fqdn
,
secondEp
.
port
);
cfgSetItem
(
pCfg
,
"secondEp"
,
tsSecond
,
pSecondpItem
->
stype
);
}
else
if
(
strcasecmp
(
"smlChildTableName"
,
name
)
==
0
)
{
tstrncpy
(
tsSmlChildTableName
,
cfgGetItem
(
pCfg
,
"smlChildTableName"
)
->
str
,
TSDB_TABLE_NAME_LEN
);
}
else
if
(
strcasecmp
(
"smlTagName"
,
name
)
==
0
)
{
tstrncpy
(
tsSmlTagName
,
cfgGetItem
(
pCfg
,
"smlTagName"
)
->
str
,
TSDB_COL_NAME_LEN
);
}
else
if
(
strcasecmp
(
"smlDataFormat"
,
name
)
==
0
)
{
tsSmlDataFormat
=
cfgGetItem
(
pCfg
,
"smlDataFormat"
)
->
bval
;
}
else
if
(
strcasecmp
(
"shellActivityTimer"
,
name
)
==
0
)
{
tsShellActivityTimer
=
cfgGetItem
(
pCfg
,
"shellActivityTimer"
)
->
i32
;
}
else
if
(
strcasecmp
(
"supportVnodes"
,
name
)
==
0
)
{
tsNumOfSupportVnodes
=
cfgGetItem
(
pCfg
,
"supportVnodes"
)
->
i32
;
}
else
if
(
strcasecmp
(
"statusInterval"
,
name
)
==
0
)
{
tsStatusInterval
=
cfgGetItem
(
pCfg
,
"statusInterval"
)
->
i32
;
}
else
if
(
strcasecmp
(
"streamCompDelayRatio"
,
name
)
==
0
)
{
tsStreamComputDelayRatio
=
cfgGetItem
(
pCfg
,
"streamCompDelayRatio"
)
->
fval
;
}
else
if
(
strcasecmp
(
"slaveQuery"
,
name
)
==
0
)
{
tsEnableSlaveQuery
=
cfgGetItem
(
pCfg
,
"slaveQuery"
)
->
bval
;
}
else
if
(
strcasecmp
(
"snodeShmSize"
,
name
)
==
0
)
{
tsSnodeShmSize
=
cfgGetItem
(
pCfg
,
"snodeShmSize"
)
->
i32
;
}
else
if
(
strcasecmp
(
"serverPort"
,
name
)
==
0
)
{
tstrncpy
(
tsLocalFqdn
,
cfgGetItem
(
pCfg
,
"fqdn"
)
->
str
,
TSDB_FQDN_LEN
);
tsServerPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"serverPort"
)
->
i32
;
snprintf
(
tsLocalEp
,
sizeof
(
tsLocalEp
),
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
char
defaultFirstEp
[
TSDB_EP_LEN
]
=
{
0
};
snprintf
(
defaultFirstEp
,
TSDB_EP_LEN
,
"%s:%u"
,
tsLocalFqdn
,
tsServerPort
);
SConfigItem
*
pFirstEpItem
=
cfgGetItem
(
pCfg
,
"firstEp"
);
SEp
firstEp
=
{
0
};
taosGetFqdnPortFromEp
(
strlen
(
pFirstEpItem
->
str
)
==
0
?
defaultFirstEp
:
pFirstEpItem
->
str
,
&
firstEp
);
snprintf
(
tsFirst
,
sizeof
(
tsFirst
),
"%s:%u"
,
firstEp
.
fqdn
,
firstEp
.
port
);
cfgSetItem
(
pCfg
,
"firstEp"
,
tsFirst
,
pFirstEpItem
->
stype
);
}
else
if
(
strcasecmp
(
"sDebugFlag"
,
name
)
==
0
)
{
sDebugFlag
=
cfgGetItem
(
pCfg
,
"sDebugFlag"
)
->
i32
;
}
else
if
(
strcasecmp
(
"smaDebugFlag"
,
name
)
==
0
)
{
smaDebugFlag
=
cfgGetItem
(
pCfg
,
"smaDebugFlag"
)
->
i32
;
}
break
;
}
case
't'
:
{
if
(
strcasecmp
(
"timezone"
,
name
)
==
0
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"timezone"
);
osSetTimezone
(
pItem
->
str
);
uDebug
(
"timezone format changed from %s to %s"
,
pItem
->
str
,
tsTimezoneStr
);
cfgSetItem
(
pCfg
,
"timezone"
,
tsTimezoneStr
,
pItem
->
stype
);
}
else
if
(
strcasecmp
(
"tempDir"
,
name
)
==
0
)
{
tstrncpy
(
tsTempDir
,
cfgGetItem
(
pCfg
,
"tempDir"
)
->
str
,
PATH_MAX
);
taosExpandDir
(
tsTempDir
,
tsTempDir
,
PATH_MAX
);
if
(
taosMulMkDir
(
tsTempDir
)
!=
0
)
{
uError
(
"failed to create tempDir:%s since %s"
,
tsTempDir
,
terrstr
());
return
-
1
;
}
}
else
if
(
strcasecmp
(
"telemetryReporting"
,
name
)
==
0
)
{
tsEnableTelem
=
cfgGetItem
(
pCfg
,
"telemetryReporting"
)
->
bval
;
}
else
if
(
strcasecmp
(
"telemetryInterval"
,
name
)
==
0
)
{
tsTelemInterval
=
cfgGetItem
(
pCfg
,
"telemetryInterval"
)
->
i32
;
}
else
if
(
strcasecmp
(
"telemetryServer"
,
name
)
==
0
)
{
tstrncpy
(
tsTelemServer
,
cfgGetItem
(
pCfg
,
"telemetryServer"
)
->
str
,
TSDB_FQDN_LEN
);
}
else
if
(
strcasecmp
(
"telemetryPort"
,
name
)
==
0
)
{
tsTelemPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"telemetryPort"
)
->
i32
;
}
else
if
(
strcasecmp
(
"transPullupInterval"
,
name
)
==
0
)
{
tsTransPullupInterval
=
cfgGetItem
(
pCfg
,
"transPullupInterval"
)
->
i32
;
}
else
if
(
strcasecmp
(
"tmrDebugFlag"
,
name
)
==
0
)
{
tmrDebugFlag
=
cfgGetItem
(
pCfg
,
"tmrDebugFlag"
)
->
i32
;
}
else
if
(
strcasecmp
(
"tsdbDebugFlag"
,
name
)
==
0
)
{
tsdbDebugFlag
=
cfgGetItem
(
pCfg
,
"tsdbDebugFlag"
)
->
i32
;
}
else
if
(
strcasecmp
(
"tqDebugFlag"
,
name
)
==
0
)
{
tqDebugFlag
=
cfgGetItem
(
pCfg
,
"tqDebugFlag"
)
->
i32
;
}
break
;
}
case
'u'
:
{
if
(
strcasecmp
(
"udf"
,
name
)
==
0
)
{
tsStartUdfd
=
cfgGetItem
(
pCfg
,
"udf"
)
->
bval
;
}
else
if
(
strcasecmp
(
"uDebugFlag"
,
name
)
==
0
)
{
uDebugFlag
=
cfgGetItem
(
pCfg
,
"uDebugFlag"
)
->
i32
;
}
break
;
}
case
'v'
:
{
if
(
strcasecmp
(
"vnodeShmSize"
,
name
)
==
0
)
{
tsVnodeShmSize
=
cfgGetItem
(
pCfg
,
"vnodeShmSize"
)
->
i32
;
}
else
if
(
strcasecmp
(
"vDebugFlag"
,
name
)
==
0
)
{
vDebugFlag
=
cfgGetItem
(
pCfg
,
"vDebugFlag"
)
->
i32
;
}
break
;
}
case
'w'
:
{
if
(
strcasecmp
(
"wDebugFlag"
,
name
)
==
0
)
{
wDebugFlag
=
cfgGetItem
(
pCfg
,
"wDebugFlag"
)
->
i32
;
}
break
;
}
default:
terrno
=
TSDB_CODE_CFG_NOT_FOUND
;
return
-
1
;
}
return
0
;
}
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
,
SArray
*
pArgs
,
bool
tsc
)
{
if
(
tsCfg
==
NULL
)
osDefaultInit
();
...
...
@@ -760,9 +1127,9 @@ void taosCleanupCfg() {
}
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
)
{
if
(
str
casecmp
(
option
,
"debugFlag"
)
==
0
)
{
int32_t
debugF
lag
=
atoi
(
value
);
taosSetAllDebugFlag
(
debugF
lag
);
if
(
str
ncasecmp
(
option
,
"debugFlag"
,
9
)
==
0
)
{
int32_t
f
lag
=
atoi
(
value
);
taosSetAllDebugFlag
(
f
lag
);
}
if
(
strcasecmp
(
option
,
"resetlog"
)
==
0
)
{
...
...
source/common/src/tmsg.c
浏览文件 @
54283f87
...
...
@@ -539,7 +539,7 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq
const
char
*
pFunc
=
taosArrayGet
(
pReq
->
pFuncs
,
i
);
if
(
tEncodeCStr
(
&
encoder
,
pFunc
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -621,7 +621,7 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
if
(
NULL
==
pReq
->
pFuncs
)
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
numOfFuncs
;
++
i
)
{
char
*
pFunc
=
NULL
;
char
*
pFunc
=
NULL
;
if
(
tDecodeCStrAlloc
(
&
decoder
,
&
pFunc
)
<
0
)
return
-
1
;
if
(
taosArrayPush
(
pReq
->
pFuncs
,
pFunc
)
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -783,6 +783,8 @@ int32_t tSerializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pReq
if
(
tEncodeI64
(
&
encoder
,
pReq
->
interval
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
offset
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
sliding
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
watermark
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
maxDelay
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
exprLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
tagsFilterLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
sqlLen
)
<
0
)
return
-
1
;
...
...
@@ -821,6 +823,8 @@ int32_t tDeserializeSMCreateSmaReq(void *buf, int32_t bufLen, SMCreateSmaReq *pR
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
interval
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
offset
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
sliding
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
watermark
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
maxDelay
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
exprLen
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
tagsFilterLen
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
sqlLen
)
<
0
)
return
-
1
;
...
...
@@ -1500,6 +1504,33 @@ int32_t tDeserializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq
return
0
;
}
int32_t
tSerializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
config
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
value
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
config
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
value
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
...
@@ -1841,7 +1872,7 @@ int32_t tSerializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) {
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
watermark1
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pRsp
->
watermark2
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
ttl
)
<
0
)
return
-
1
;
int32_t
numOfFuncs
=
taosArrayGetSize
(
pRsp
->
pFuncs
);
if
(
tEncodeI32
(
&
encoder
,
numOfFuncs
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
numOfFuncs
;
++
i
)
{
...
...
@@ -1849,19 +1880,19 @@ int32_t tSerializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp) {
if
(
tEncodeCStr
(
&
encoder
,
pFunc
)
<
0
)
return
-
1
;
}
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
commentLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
commentLen
)
<
0
)
return
-
1
;
if
(
pRsp
->
commentLen
>
0
)
{
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
pComment
)
<
0
)
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
pRsp
->
numOfColumns
+
pRsp
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
&
pRsp
->
pSchemas
[
i
];
if
(
tEncodeSSchema
(
&
encoder
,
pSchema
)
<
0
)
return
-
1
;
}
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
tagsLen
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
&
encoder
,
pRsp
->
pTags
,
pRsp
->
tagsLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
tagsLen
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
&
encoder
,
pRsp
->
pTags
,
pRsp
->
tagsLen
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -1918,7 +1949,7 @@ int32_t tDeserializeSTableCfgRsp(void *buf, int32_t bufLen, STableCfgRsp *pRsp)
}
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
tagsLen
)
<
0
)
return
-
1
;
if
(
tDecodeBinaryAlloc
(
&
decoder
,
(
void
**
)
&
pRsp
->
pTags
,
NULL
)
<
0
)
return
-
1
;
if
(
tDecodeBinaryAlloc
(
&
decoder
,
(
void
**
)
&
pRsp
->
pTags
,
NULL
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
...
...
@@ -1934,7 +1965,7 @@ void tFreeSTableCfgRsp(STableCfgRsp *pRsp) {
taosMemoryFreeClear
(
pRsp
->
pComment
);
taosMemoryFreeClear
(
pRsp
->
pSchemas
);
taosMemoryFreeClear
(
pRsp
->
pTags
);
taosArrayDestroy
(
pRsp
->
pFuncs
);
}
...
...
@@ -2219,6 +2250,56 @@ int32_t tDeserializeSDnodeListReq(void *buf, int32_t bufLen, SDnodeListReq *pReq
return
0
;
}
int32_t
tSerializeSServerVerReq
(
void
*
buf
,
int32_t
bufLen
,
SServerVerReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
useless
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSServerVerReq
(
void
*
buf
,
int32_t
bufLen
,
SServerVerReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
useless
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSServerVerRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerVerRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
ver
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSServerVerRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerVerRsp
*
pRsp
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
ver
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
...
...
@@ -2828,6 +2909,67 @@ int32_t tDeserializeSShowVariablesReq(void *buf, int32_t bufLen, SShowVariablesR
return
0
;
}
int32_t
tEncodeSVariablesInfo
(
SEncoder
*
pEncoder
,
SVariablesInfo
*
pInfo
)
{
if
(
tEncodeCStr
(
pEncoder
,
pInfo
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pInfo
->
value
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tDecodeSVariablesInfo
(
SDecoder
*
pDecoder
,
SVariablesInfo
*
pInfo
)
{
if
(
tDecodeCStrTo
(
pDecoder
,
pInfo
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pInfo
->
value
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tSerializeSShowVariablesRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
int32_t
varNum
=
taosArrayGetSize
(
pRsp
->
variables
);
if
(
tEncodeI32
(
&
encoder
,
varNum
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
varNum
;
++
i
)
{
SVariablesInfo
*
pInfo
=
taosArrayGet
(
pRsp
->
variables
,
i
);
if
(
tEncodeSVariablesInfo
(
&
encoder
,
pInfo
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSShowVariablesRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesRsp
*
pRsp
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
int32_t
varNum
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
varNum
)
<
0
)
return
-
1
;
if
(
varNum
>
0
)
{
pRsp
->
variables
=
taosArrayInit
(
varNum
,
sizeof
(
SVariablesInfo
));
if
(
NULL
==
pRsp
->
variables
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
varNum
;
++
i
)
{
SVariablesInfo
info
=
{
0
};
if
(
tDecodeSVariablesInfo
(
&
decoder
,
&
info
)
<
0
)
return
-
1
;
if
(
NULL
==
taosArrayPush
(
pRsp
->
variables
,
&
info
))
return
-
1
;
}
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
void
tFreeSShowVariablesRsp
(
SShowVariablesRsp
*
pRsp
)
{
if
(
NULL
==
pRsp
)
{
return
;
}
taosArrayDestroy
(
pRsp
->
variables
);
}
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
...
@@ -3369,7 +3511,8 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
superUser
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
connType
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
&
encoder
,
&
pRsp
->
epSet
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
sVersion
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
sVer
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
sDetailVer
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
...
...
@@ -3389,7 +3532,8 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
superUser
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
connType
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
&
decoder
,
&
pRsp
->
epSet
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
sVersion
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
sVer
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
sDetailVer
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/common/src/tname.c
浏览文件 @
54283f87
...
...
@@ -214,6 +214,20 @@ int32_t tNameSetDbName(SName* dst, int32_t acct, const char* dbName, size_t name
return
0
;
}
int32_t
tNameAddTbName
(
SName
*
dst
,
const
char
*
tbName
,
size_t
nameLen
)
{
assert
(
dst
!=
NULL
&&
tbName
!=
NULL
&&
nameLen
>
0
);
// too long account id or too long db name
if
(
nameLen
>=
tListLen
(
dst
->
tname
)
||
nameLen
<=
0
)
{
return
-
1
;
}
dst
->
type
=
TSDB_TABLE_NAME_T
;
tstrncpy
(
dst
->
tname
,
tbName
,
nameLen
+
1
);
return
0
;
}
int32_t
tNameSetAcctId
(
SName
*
dst
,
int32_t
acctId
)
{
assert
(
dst
!=
NULL
);
dst
->
acctId
=
acctId
;
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
54283f87
...
...
@@ -123,8 +123,15 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
}
int32_t
dmProcessConfigReq
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
dError
(
"config req is received, but not supported yet"
);
return
TSDB_CODE_OPS_NOT_SUPPORT
;
SDCfgDnodeReq
cfgReq
=
{
0
};
if
(
tDeserializeSDCfgDnodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
cfgReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
dInfo
(
"start to config, option:%s, value:%s"
,
cfgReq
.
config
,
cfgReq
.
value
);
taosCfgDynamicOptions
(
cfgReq
.
config
,
cfgReq
.
value
);
return
0
;
}
static
void
dmGetServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SServerStatusRsp
*
pStatus
)
{
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
54283f87
...
...
@@ -17,7 +17,7 @@
#include "mmInt.h"
void
mmGetMonitorInfo
(
SMnodeMgmt
*
pMgmt
,
SMonMmInfo
*
pInfo
)
{
mndGetMonitorInfo
(
pMgmt
->
pMnode
,
&
pInfo
->
cluster
,
&
pInfo
->
vgroup
,
&
pInfo
->
grant
);
mndGetMonitorInfo
(
pMgmt
->
pMnode
,
&
pInfo
->
cluster
,
&
pInfo
->
vgroup
,
&
pInfo
->
stb
,
&
pInfo
->
grant
);
}
int32_t
mmProcessGetMonitorInfoReq
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
...
...
@@ -206,6 +206,8 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SYSTABLE_RETRIEVE
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_AUTH
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SHOW_VARIABLES
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SERVER_VERSION
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY
,
mmPutMsgToQueryQueue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_CONTINUE
,
mmPutMsgToQueryQueue
,
1
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/node_util/src/dmFile.c
浏览文件 @
54283f87
...
...
@@ -127,14 +127,24 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
return
NULL
;
}
int32_t
ret
=
taosLockFile
(
pFile
);
if
(
ret
!=
0
)
{
int32_t
retryTimes
=
0
;
int32_t
ret
=
0
;
do
{
ret
=
taosLockFile
(
pFile
);
if
(
ret
==
0
)
break
;
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
taosMsleep
(
100
);
retryTimes
++
;
dError
(
"failed to lock file:%s since %s, retryTimes:%d"
,
filepath
,
terrstr
(),
retryTimes
);
}
while
(
retryTimes
<
120
);
if
(
ret
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
dError
(
"failed to lock file:%s since %s"
,
filepath
,
terrstr
());
taosCloseFile
(
&
pFile
);
return
NULL
;
}
terrno
=
0
;
dDebug
(
"lock file:%s to prevent repeated starts"
,
filepath
);
return
pFile
;
}
...
...
source/dnode/mnode/impl/inc/mndScheduler.h
浏览文件 @
54283f87
...
...
@@ -27,12 +27,10 @@ void mndCleanupScheduler(SMnode* pMnode);
int32_t
mndSchedInitSubEp
(
SMnode
*
pMnode
,
const
SMqTopicObj
*
pTopic
,
SMqSubscribeObj
*
pSub
);
int32_t
mndScheduleStream
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
);
int32_t
mndConvertRsmaTask
(
char
**
pDst
,
int32_t
*
pDstLen
,
const
char
*
ast
,
int64_t
uid
,
int8_t
triggerType
,
int64_t
watermark
);
int32_t
mndScheduleStream
(
SMnode
*
pMnode
,
S
Trans
*
pTrans
,
S
StreamObj
*
pStream
);
int32_t
mndScheduleStream
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
54283f87
...
...
@@ -48,6 +48,7 @@ static int32_t mndDnodeActionInsert(SSdb *pSdb, SDnodeObj *pDnode);
static
int32_t
mndDnodeActionDelete
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOld
,
SDnodeObj
*
pNew
);
static
int32_t
mndProcessDnodeListReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessShowVariablesReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessDropDnodeReq
(
SRpcMsg
*
pReq
);
...
...
@@ -78,6 +79,7 @@ int32_t mndInitDnode(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CONFIG_DNODE_RSP
,
mndProcessConfigDnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STATUS
,
mndProcessStatusReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DNODE_LIST
,
mndProcessDnodeListReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_SHOW_VARIABLES
,
mndProcessShowVariablesReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndRetrieveConfigs
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndCancelGetNextConfig
);
...
...
@@ -502,20 +504,20 @@ _OVER:
}
static
int32_t
mndProcessDnodeListReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDnodeObj
*
pObj
=
NULL
;
void
*
pIter
=
NULL
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDnodeObj
*
pObj
=
NULL
;
void
*
pIter
=
NULL
;
SDnodeListRsp
rsp
=
{
0
};
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
rsp
.
dnodeList
=
taosArrayInit
(
5
,
sizeof
(
SEpSet
));
if
(
NULL
==
rsp
.
dnodeList
)
{
mError
(
"failed to alloc epSet while process dnode list req"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
...
...
@@ -554,6 +556,59 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessShowVariablesReq
(
SRpcMsg
*
pReq
)
{
SShowVariablesRsp
rsp
=
{
0
};
int32_t
code
=
-
1
;
rsp
.
variables
=
taosArrayInit
(
4
,
sizeof
(
SVariablesInfo
));
if
(
NULL
==
rsp
.
variables
)
{
mError
(
"failed to alloc SVariablesInfo array while process show variables req"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
SVariablesInfo
info
=
{
0
};
strcpy
(
info
.
name
,
"statusInterval"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%d"
,
tsStatusInterval
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
strcpy
(
info
.
name
,
"timezone"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsTimezoneStr
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
strcpy
(
info
.
name
,
"locale"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsLocale
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
strcpy
(
info
.
name
,
"charset"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsCharset
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
int32_t
rspLen
=
tSerializeSShowVariablesRsp
(
NULL
,
0
,
&
rsp
);
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
tSerializeSShowVariablesRsp
(
pRsp
,
rspLen
,
&
rsp
);
pReq
->
info
.
rspLen
=
rspLen
;
pReq
->
info
.
rsp
=
pRsp
;
code
=
0
;
_OVER:
if
(
code
!=
0
)
{
mError
(
"failed to get show variables info since %s"
,
terrstr
());
}
tFreeSShowVariablesRsp
(
&
rsp
);
return
code
;
}
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
...
...
@@ -732,15 +787,37 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
mError
(
"dnode:%d, failed to config since %s "
,
cfgReq
.
dnodeId
,
terrstr
());
return
-
1
;
}
SEpSet
epSet
=
mndGetDnodeEpset
(
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
int32_t
bufLen
=
tSerializeSMCfgDnodeReq
(
NULL
,
0
,
&
cfgReq
);
SDCfgDnodeReq
dcfgReq
=
{
0
};
if
(
strncasecmp
(
cfgReq
.
config
,
"debugFlag"
,
9
)
==
0
)
{
const
char
*
value
=
cfgReq
.
value
;
int32_t
flag
=
atoi
(
value
);
if
(
flag
<=
0
)
{
flag
=
atoi
(
cfgReq
.
config
+
10
);
}
if
(
flag
<=
0
||
flag
>
255
)
{
mError
(
"dnode:%d, failed to config debugFlag since value:%d"
,
cfgReq
.
dnodeId
,
flag
);
terrno
=
TSDB_CODE_INVALID_CFG
;
return
-
1
;
}
strcpy
(
dcfgReq
.
config
,
"debugFlag"
);
snprintf
(
dcfgReq
.
value
,
TSDB_DNODE_VALUE_LEN
,
"%d"
,
flag
);
}
else
if
(
strcasecmp
(
cfgReq
.
config
,
"resetlog"
)
==
0
)
{
strcpy
(
dcfgReq
.
config
,
"resetlog"
);
}
else
{
terrno
=
TSDB_CODE_INVALID_CFG
;
mError
(
"dnode:%d, failed to config since %s"
,
cfgReq
.
dnodeId
,
terrstr
());
return
-
1
;
}
int32_t
bufLen
=
tSerializeSDCfgDnodeReq
(
NULL
,
0
,
&
dcfgReq
);
void
*
pBuf
=
rpcMallocCont
(
bufLen
);
if
(
pBuf
==
NULL
)
return
-
1
;
tSerializeS
MCfgDnodeReq
(
pBuf
,
bufLen
,
&
cfgReq
);
tSerializeS
DCfgDnodeReq
(
pBuf
,
bufLen
,
&
d
cfgReq
);
mDebug
(
"dnode:%d, send config req to dnode, app:%p"
,
cfgReq
.
dnodeId
,
pReq
->
info
.
ahandle
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
};
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
54283f87
...
...
@@ -614,7 +614,7 @@ int64_t mndGenerateUid(char *name, int32_t len) {
}
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
)
{
SMon
StbInfo
*
pStbInfo
,
SMon
GrantInfo
*
pGrantInfo
)
{
if
(
mndAcquireRpcRef
(
pMnode
)
!=
0
)
return
-
1
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
@@ -623,7 +623,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
pClusterInfo
->
dnodes
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_DNODE
),
sizeof
(
SMonDnodeDesc
));
pClusterInfo
->
mnodes
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_MNODE
),
sizeof
(
SMonMnodeDesc
));
pVgroupInfo
->
vgroups
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_VGROUP
),
sizeof
(
SMonVgroupDesc
));
if
(
pClusterInfo
->
dnodes
==
NULL
||
pClusterInfo
->
mnodes
==
NULL
||
pVgroupInfo
->
vgroups
==
NULL
)
{
pStbInfo
->
stbs
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_STB
),
sizeof
(
SMonStbDesc
));
if
(
pClusterInfo
->
dnodes
==
NULL
||
pClusterInfo
->
mnodes
==
NULL
||
pVgroupInfo
->
vgroups
==
NULL
||
pStbInfo
->
stbs
==
NULL
)
{
mndReleaseRpcRef
(
pMnode
);
return
-
1
;
}
...
...
@@ -632,6 +634,8 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
tstrncpy
(
pClusterInfo
->
version
,
version
,
sizeof
(
pClusterInfo
->
version
));
pClusterInfo
->
monitor_interval
=
tsMonitorInterval
;
pClusterInfo
->
connections_total
=
mndGetNumOfConnections
(
pMnode
);
pClusterInfo
->
dbs_total
=
sdbGetSize
(
pSdb
,
SDB_DB
);
pClusterInfo
->
stbs_total
=
sdbGetSize
(
pSdb
,
SDB_STB
);
void
*
pIter
=
NULL
;
while
(
1
)
{
...
...
@@ -681,6 +685,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
if
(
pIter
==
NULL
)
break
;
pClusterInfo
->
vgroups_total
++
;
pClusterInfo
->
tbs_total
+=
pVgroup
->
numOfTables
;
SMonVgroupDesc
desc
=
{
0
};
desc
.
vgroup_id
=
pVgroup
->
vgId
;
...
...
@@ -711,6 +716,27 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
sdbRelease
(
pSdb
,
pVgroup
);
}
// stb info
pIter
=
NULL
;
while
(
1
)
{
SStbObj
*
pStb
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_STB
,
pIter
,
(
void
**
)
&
pStb
);
if
(
pIter
==
NULL
)
break
;
SMonStbDesc
desc
=
{
0
};
SName
name1
=
{
0
};
tNameFromString
(
&
name1
,
pStb
->
db
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
tNameGetDbName
(
&
name1
,
desc
.
database_name
);
SName
name2
=
{
0
};
tNameFromString
(
&
name2
,
pStb
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
tstrncpy
(
desc
.
stb_name
,
tNameGetTableName
(
&
name2
),
TSDB_TABLE_NAME_LEN
);
taosArrayPush
(
pStbInfo
->
stbs
,
&
desc
);
sdbRelease
(
pSdb
,
pStb
);
}
// grant info
pGrantInfo
->
expire_time
=
(
pMnode
->
grant
.
expireTimeMS
-
ms
)
/
86400000
.
0
f
;
pGrantInfo
->
timeseries_total
=
pMnode
->
grant
.
timeseriesAllowed
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
54283f87
...
...
@@ -70,6 +70,7 @@ static void mndCancelGetNextQuery(SMnode *pMnode, void *pIter);
static
void
mndFreeApp
(
SAppObj
*
pApp
);
static
int32_t
mndRetrieveApps
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextApp
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessSvrVerReq
(
SRpcMsg
*
pReq
);
int32_t
mndInitProfile
(
SMnode
*
pMnode
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
...
...
@@ -94,6 +95,7 @@ int32_t mndInitProfile(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CONNECT
,
mndProcessConnectReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_QUERY
,
mndProcessKillQueryReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_CONN
,
mndProcessKillConnReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_SERVER_VERSION
,
mndProcessSvrVerReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndRetrieveConns
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndCancelGetNextConn
);
...
...
@@ -262,8 +264,9 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
connectRsp
.
connId
=
pConn
->
id
;
connectRsp
.
connType
=
connReq
.
connType
;
connectRsp
.
dnodeNum
=
mndGetDnodeSize
(
pMnode
);
snprintf
(
connectRsp
.
sVersion
,
sizeof
(
connectRsp
.
sVersion
),
"ver:%s
\n
build:%s
\n
gitinfo:%s"
,
version
,
buildinfo
,
strcpy
(
connectRsp
.
sVer
,
version
);
snprintf
(
connectRsp
.
sDetailVer
,
sizeof
(
connectRsp
.
sDetailVer
),
"ver:%s
\n
build:%s
\n
gitinfo:%s"
,
version
,
buildinfo
,
gitinfo
);
mndGetMnodeEpSet
(
pMnode
,
&
connectRsp
.
epSet
);
...
...
@@ -460,6 +463,27 @@ static int32_t mndUpdateAppInfo(SMnode *pMnode, SClientHbReq *pHbReq, SRpcConnIn
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndGetOnlineDnodeNum
(
SMnode
*
pMnode
,
int32_t
*
num
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDnodeObj
*
pDnode
=
NULL
;
int64_t
curMs
=
taosGetTimestampMs
();
void
*
pIter
=
NULL
;
while
(
true
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pDnode
);
if
(
pIter
==
NULL
)
break
;
bool
online
=
mndIsDnodeOnline
(
pDnode
,
curMs
);
if
(
online
)
{
(
*
num
)
++
;
}
sdbRelease
(
pSdb
,
pDnode
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndProcessQueryHeartBeat
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
,
SClientHbReq
*
pHbReq
,
SClientHbBatchRsp
*
pBatchRsp
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
...
...
@@ -503,7 +527,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
rspBasic
->
connId
=
pConn
->
id
;
rspBasic
->
totalDnodes
=
mndGetDnodeSize
(
pMnode
);
rspBasic
->
onlineDnodes
=
1
;
// TODO
mndGetOnlineDnodeNum
(
pMnode
,
&
rspBasic
->
onlineDnodes
);
mndGetMnodeEpSet
(
pMnode
,
&
rspBasic
->
epSet
);
mndCreateQnodeList
(
pMnode
,
&
rspBasic
->
pQnodeList
,
-
1
);
...
...
@@ -694,6 +718,28 @@ static int32_t mndProcessKillConnReq(SRpcMsg *pReq) {
}
}
static
int32_t
mndProcessSvrVerReq
(
SRpcMsg
*
pReq
)
{
int32_t
code
=
-
1
;
SServerVerRsp
rsp
=
{
0
};
strcpy
(
rsp
.
ver
,
version
);
int32_t
contLen
=
tSerializeSServerVerRsp
(
NULL
,
0
,
&
rsp
);
if
(
contLen
<
0
)
goto
_over
;
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
goto
_over
;
tSerializeSServerVerRsp
(
pRsp
,
contLen
,
&
rsp
);
pReq
->
info
.
rspLen
=
contLen
;
pReq
->
info
.
rsp
=
pRsp
;
code
=
0
;
_over:
return
code
;
}
static
int32_t
mndRetrieveConns
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
54283f87
...
...
@@ -97,37 +97,7 @@ END:
return
terrno
;
}
int32_t
mndPersistTaskDeployReq
(
STrans
*
pTrans
,
SStreamTask
*
pTask
,
const
SEpSet
*
pEpSet
,
tmsg_t
type
,
int32_t
nodeId
)
{
SEncoder
encoder
;
tEncoderInit
(
&
encoder
,
NULL
,
0
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
int32_t
size
=
encoder
.
pos
;
int32_t
tlen
=
sizeof
(
SMsgHead
)
+
size
;
tEncoderClear
(
&
encoder
);
void
*
buf
=
taosMemoryCalloc
(
1
,
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
((
SMsgHead
*
)
buf
)
->
vgId
=
htonl
(
nodeId
);
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
tEncoderInit
(
&
encoder
,
abuf
,
size
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
tEncoderClear
(
&
encoder
);
STransAction
action
=
{
0
};
memcpy
(
&
action
.
epSet
,
pEpSet
,
sizeof
(
SEpSet
));
action
.
pCont
=
buf
;
action
.
contLen
=
tlen
;
action
.
msgType
=
type
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
buf
);
return
-
1
;
}
return
0
;
}
int32_t
mndAddSinkToTask
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
,
SStreamTask
*
pTask
)
{
int32_t
mndAddSinkToTask
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
,
SStreamTask
*
pTask
)
{
pTask
->
dispatchType
=
TASK_DISPATCH__NONE
;
// sink
if
(
pStream
->
smaId
!=
0
)
{
...
...
@@ -142,7 +112,7 @@ int32_t mndAddSinkToTask(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream, SS
return
0
;
}
int32_t
mndAddDispatcherToInnerTask
(
SMnode
*
pMnode
,
S
Trans
*
pTrans
,
S
StreamObj
*
pStream
,
SStreamTask
*
pTask
)
{
int32_t
mndAddDispatcherToInnerTask
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
,
SStreamTask
*
pTask
)
{
pTask
->
sinkType
=
TASK_SINK__NONE
;
if
(
pStream
->
fixedSinkVgId
==
0
)
{
pTask
->
dispatchType
=
TASK_DISPATCH__SHUFFLE
;
...
...
@@ -187,7 +157,7 @@ int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, STrans* pTrans, SStreamObj*
return
0
;
}
int32_t
mndAssignTaskToVg
(
SMnode
*
pMnode
,
S
Trans
*
pTrans
,
S
StreamTask
*
pTask
,
SSubplan
*
plan
,
const
SVgObj
*
pVgroup
)
{
int32_t
mndAssignTaskToVg
(
SMnode
*
pMnode
,
SStreamTask
*
pTask
,
SSubplan
*
plan
,
const
SVgObj
*
pVgroup
)
{
int32_t
msgLen
;
pTask
->
nodeId
=
pVgroup
->
vgId
;
pTask
->
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
...
...
@@ -196,11 +166,11 @@ int32_t mndAssignTaskToVg(SMnode* pMnode, STrans* pTrans, SStreamTask* pTask, SS
plan
->
execNode
.
epSet
=
pTask
->
epSet
;
if
(
qSubPlanToString
(
plan
,
&
pTask
->
exec
.
qmsg
,
&
msgLen
)
<
0
)
{
ASSERT
(
0
);
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
return
-
1
;
}
ASSERT
(
pTask
->
dispatchType
!=
TASK_DISPATCH__NONE
||
pTask
->
sinkType
!=
TASK_SINK__NONE
);
mndPersistTaskDeployReq
(
pTrans
,
pTask
,
&
plan
->
execNode
.
epSet
,
TDMT_STREAM_TASK_DEPLOY
,
pVgroup
->
vgId
);
return
0
;
}
...
...
@@ -212,8 +182,7 @@ SSnodeObj* mndSchedFetchOneSnode(SMnode* pMnode) {
return
pObj
;
}
int32_t
mndAssignTaskToSnode
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamTask
*
pTask
,
SSubplan
*
plan
,
const
SSnodeObj
*
pSnode
)
{
int32_t
mndAssignTaskToSnode
(
SMnode
*
pMnode
,
SStreamTask
*
pTask
,
SSubplan
*
plan
,
const
SSnodeObj
*
pSnode
)
{
int32_t
msgLen
;
pTask
->
nodeId
=
SNODE_HANDLE
;
...
...
@@ -223,10 +192,10 @@ int32_t mndAssignTaskToSnode(SMnode* pMnode, STrans* pTrans, SStreamTask* pTask,
plan
->
execNode
.
epSet
=
pTask
->
epSet
;
if
(
qSubPlanToString
(
plan
,
&
pTask
->
exec
.
qmsg
,
&
msgLen
)
<
0
)
{
ASSERT
(
0
);
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
return
-
1
;
}
mndPersistTaskDeployReq
(
pTrans
,
pTask
,
&
plan
->
execNode
.
epSet
,
TDMT_STREAM_TASK_DEPLOY
,
SNODE_HANDLE
);
return
0
;
}
...
...
@@ -245,7 +214,7 @@ SVgObj* mndSchedFetchOneVg(SMnode* pMnode, int64_t dbUid) {
return
pVgroup
;
}
int32_t
mndAddShuffleSinkTasksToStream
(
SMnode
*
pMnode
,
S
Trans
*
pTrans
,
S
StreamObj
*
pStream
)
{
int32_t
mndAddShuffleSinkTasksToStream
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
SArray
*
tasks
=
taosArrayGetP
(
pStream
->
tasks
,
0
);
...
...
@@ -262,6 +231,7 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, STrans* pTrans, SStreamOb
}
SStreamTask
*
pTask
=
tNewSStreamTask
(
pStream
->
uid
);
if
(
pTask
==
NULL
)
{
sdbRelease
(
pSdb
,
pVgroup
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
@@ -290,13 +260,11 @@ int32_t mndAddShuffleSinkTasksToStream(SMnode* pMnode, STrans* pTrans, SStreamOb
// dispatch
pTask
->
dispatchType
=
TASK_DISPATCH__NONE
;
mndPersistTaskDeployReq
(
pTrans
,
pTask
,
&
pTask
->
epSet
,
TDMT_STREAM_TASK_DEPLOY
,
pVgroup
->
vgId
);
}
return
0
;
}
int32_t
mndAddFixedSinkTaskToStream
(
SMnode
*
pMnode
,
S
Trans
*
pTrans
,
S
StreamObj
*
pStream
)
{
int32_t
mndAddFixedSinkTaskToStream
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
)
{
ASSERT
(
pStream
->
fixedSinkVgId
!=
0
);
SArray
*
tasks
=
taosArrayGetP
(
pStream
->
tasks
,
0
);
SStreamTask
*
pTask
=
tNewSStreamTask
(
pStream
->
uid
);
...
...
@@ -337,13 +305,10 @@ int32_t mndAddFixedSinkTaskToStream(SMnode* pMnode, STrans* pTrans, SStreamObj*
// dispatch
pTask
->
dispatchType
=
TASK_DISPATCH__NONE
;
mndPersistTaskDeployReq
(
pTrans
,
pTask
,
&
pTask
->
epSet
,
TDMT_STREAM_TASK_DEPLOY
,
pStream
->
fixedSinkVg
.
vgId
);
return
0
;
}
int32_t
mndScheduleStream
(
SMnode
*
pMnode
,
S
Trans
*
pTrans
,
S
StreamObj
*
pStream
)
{
int32_t
mndScheduleStream
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SQueryPlan
*
pPlan
=
qStringToQueryPlan
(
pStream
->
physicalPlan
);
if
(
pPlan
==
NULL
)
{
...
...
@@ -368,9 +333,15 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
// add extra sink
hasExtraSink
=
true
;
if
(
pStream
->
fixedSinkVgId
==
0
)
{
mndAddShuffleSinkTasksToStream
(
pMnode
,
pTrans
,
pStream
);
if
(
mndAddShuffleSinkTasksToStream
(
pMnode
,
pStream
)
<
0
)
{
// TODO free
return
-
1
;
}
}
else
{
mndAddFixedSinkTaskToStream
(
pMnode
,
pTrans
,
pStream
);
if
(
mndAddFixedSinkTaskToStream
(
pMnode
,
pStream
)
<
0
)
{
// TODO free
return
-
1
;
}
}
}
...
...
@@ -386,6 +357,11 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
ASSERT
(
plan
->
subplanType
==
SUBPLAN_TYPE_MERGE
);
pInnerTask
=
tNewSStreamTask
(
pStream
->
uid
);
if
(
pInnerTask
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
}
mndAddTaskToTaskSet
(
taskInnerLevel
,
pInnerTask
);
pInnerTask
->
childEpInfo
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
...
...
@@ -397,7 +373,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
pInnerTask
->
triggerParam
=
pStream
->
triggerParam
;
// dispatch
if
(
mndAddDispatcherToInnerTask
(
pMnode
,
p
Trans
,
p
Stream
,
pInnerTask
)
<
0
)
{
if
(
mndAddDispatcherToInnerTask
(
pMnode
,
pStream
,
pInnerTask
)
<
0
)
{
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
}
...
...
@@ -409,14 +385,13 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
SSnodeObj
*
pSnode
=
mndSchedFetchOneSnode
(
pMnode
);
if
(
pSnode
==
NULL
)
{
SVgObj
*
pVgroup
=
mndSchedFetchOneVg
(
pMnode
,
pStream
->
sourceDbUid
);
if
(
mndAssignTaskToVg
(
pMnode
,
p
Trans
,
p
InnerTask
,
plan
,
pVgroup
)
<
0
)
{
if
(
mndAssignTaskToVg
(
pMnode
,
pInnerTask
,
plan
,
pVgroup
)
<
0
)
{
sdbRelease
(
pSdb
,
pVgroup
);
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
}
}
else
{
if
(
mndAssignTaskToSnode
(
pMnode
,
pTrans
,
pInnerTask
,
plan
,
pSnode
)
<
0
)
{
ASSERT
(
0
);
if
(
mndAssignTaskToSnode
(
pMnode
,
pInnerTask
,
plan
,
pSnode
)
<
0
)
{
sdbRelease
(
pSdb
,
pSnode
);
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
...
...
@@ -424,7 +399,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
}
}
else
{
SVgObj
*
pVgroup
=
mndSchedFetchOneVg
(
pMnode
,
pStream
->
sourceDbUid
);
if
(
mndAssignTaskToVg
(
pMnode
,
p
Trans
,
p
InnerTask
,
plan
,
pVgroup
)
<
0
)
{
if
(
mndAssignTaskToVg
(
pMnode
,
pInnerTask
,
plan
,
pVgroup
)
<
0
)
{
sdbRelease
(
pSdb
,
pVgroup
);
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
...
...
@@ -450,6 +425,12 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
continue
;
}
SStreamTask
*
pTask
=
tNewSStreamTask
(
pStream
->
uid
);
if
(
pInnerTask
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
sdbRelease
(
pSdb
,
pVgroup
);
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
}
mndAddTaskToTaskSet
(
taskSourceLevel
,
pTask
);
// source
...
...
@@ -466,7 +447,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
// exec
pTask
->
execType
=
TASK_EXEC__PIPE
;
if
(
mndAssignTaskToVg
(
pMnode
,
pT
rans
,
pT
ask
,
plan
,
pVgroup
)
<
0
)
{
if
(
mndAssignTaskToVg
(
pMnode
,
pTask
,
plan
,
pVgroup
)
<
0
)
{
sdbRelease
(
pSdb
,
pVgroup
);
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
...
...
@@ -507,6 +488,11 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
continue
;
}
SStreamTask
*
pTask
=
tNewSStreamTask
(
pStream
->
uid
);
if
(
pTask
==
NULL
)
{
sdbRelease
(
pSdb
,
pVgroup
);
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
}
mndAddTaskToTaskSet
(
taskOneLevel
,
pTask
);
// source
...
...
@@ -517,14 +503,14 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
// sink or dispatch
if
(
hasExtraSink
)
{
mndAddDispatcherToInnerTask
(
pMnode
,
p
Trans
,
p
Stream
,
pTask
);
mndAddDispatcherToInnerTask
(
pMnode
,
pStream
,
pTask
);
}
else
{
mndAddSinkToTask
(
pMnode
,
p
Trans
,
p
Stream
,
pTask
);
mndAddSinkToTask
(
pMnode
,
pStream
,
pTask
);
}
// exec
pTask
->
execType
=
TASK_EXEC__PIPE
;
if
(
mndAssignTaskToVg
(
pMnode
,
pT
rans
,
pT
ask
,
plan
,
pVgroup
)
<
0
)
{
if
(
mndAssignTaskToVg
(
pMnode
,
pTask
,
plan
,
pVgroup
)
<
0
)
{
sdbRelease
(
pSdb
,
pVgroup
);
qDestroyQueryPlan
(
pPlan
);
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
54283f87
...
...
@@ -533,7 +533,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
#if 0
smaObj.timezone = pCreate->timezone;
#endif
smaObj
.
timezone
=
tsTimezone
;
// use timezone of server
smaObj
.
timezone
=
tsTimezone
;
// use timezone of server
smaObj
.
interval
=
pCreate
->
interval
;
smaObj
.
offset
=
pCreate
->
offset
;
smaObj
.
sliding
=
pCreate
->
sliding
;
...
...
@@ -623,7 +623,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
if
(
mndSetUpdateSmaStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
// if (mndSetCreateSmaRedoActions(pMnode, pTrans, pDb, &smaObj) != 0) goto _OVER;
if
(
mndSetCreateSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
streamObj
.
fixedSinkVg
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndScheduleStream
(
pMnode
,
pTrans
,
&
streamObj
)
!=
0
)
goto
_OVER
;
if
(
mndScheduleStream
(
pMnode
,
&
streamObj
)
!=
0
)
goto
_OVER
;
if
(
mndPersistStream
(
pMnode
,
pTrans
,
&
streamObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
54283f87
...
...
@@ -320,70 +320,76 @@ FAIL:
return
0
;
}
int32_t
mndPersistStream
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
)
{
SSdbRaw
*
pCommitRaw
=
mndStreamActionEncode
(
pStream
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append commit log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
int32_t
mndPersistTaskDeployReq
(
STrans
*
pTrans
,
const
SStreamTask
*
pTask
)
{
ASSERT
(
pTask
->
isDataScan
==
0
||
pTask
->
isDataScan
==
1
);
if
(
pTask
->
isDataScan
==
0
&&
pTask
->
sinkType
==
TASK_SINK__NONE
)
{
ASSERT
(
taosArrayGetSize
(
pTask
->
childEpInfo
)
!=
0
);
}
SEncoder
encoder
;
tEncoderInit
(
&
encoder
,
NULL
,
0
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
int32_t
size
=
encoder
.
pos
;
int32_t
tlen
=
sizeof
(
SMsgHead
)
+
size
;
tEncoderClear
(
&
encoder
);
void
*
buf
=
taosMemoryCalloc
(
1
,
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_READY
);
return
0
;
}
((
SMsgHead
*
)
buf
)
->
vgId
=
htonl
(
pTask
->
nodeId
);
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
tEncoderInit
(
&
encoder
,
abuf
,
size
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
tEncoderClear
(
&
encoder
);
int32_t
mndPersistDropStreamLog
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
)
{
SSdbRaw
*
pCommitRaw
=
mndStreamActionEncode
(
pStream
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append commit log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
STransAction
action
=
{
0
};
memcpy
(
&
action
.
epSet
,
&
pTask
->
epSet
,
sizeof
(
SEpSet
));
action
.
pCont
=
buf
;
action
.
contLen
=
tlen
;
action
.
msgType
=
TDMT_STREAM_TASK_DEPLOY
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
buf
);
return
-
1
;
}
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_DROPPED
);
return
0
;
}
int32_t
mndAddStreamToTrans
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
,
const
char
*
ast
,
STrans
*
pTrans
)
{
SNode
*
pAst
=
NULL
;
if
(
nodesStringToNode
(
ast
,
&
pAst
)
<
0
)
{
return
-
1
;
}
if
(
qExtractResultSchema
(
pAst
,
(
int32_t
*
)
&
pStream
->
outputSchema
.
nCols
,
&
pStream
->
outputSchema
.
pSchema
)
!=
0
)
{
nodesDestroyNode
(
pAst
);
return
-
1
;
}
// free
nodesDestroyNode
(
pAst
);
#if 0
printf("|");
for (int i = 0; i < pStream->outputSchema.nCols; i++) {
printf(" %15s |", (char *)pStream->outputSchema.pSchema[i].name);
int32_t
mndPersistStreamTasks
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
)
{
int32_t
level
=
taosArrayGetSize
(
pStream
->
tasks
);
for
(
int32_t
i
=
0
;
i
<
level
;
i
++
)
{
SArray
*
pLevel
=
taosArrayGetP
(
pStream
->
tasks
,
i
);
int32_t
sz
=
taosArrayGetSize
(
pLevel
);
for
(
int32_t
j
=
0
;
j
<
sz
;
j
++
)
{
SStreamTask
*
pTask
=
taosArrayGetP
(
pLevel
,
j
);
if
(
mndPersistTaskDeployReq
(
pTrans
,
pTask
)
<
0
)
{
return
-
1
;
}
}
}
printf("\n=======================================================\n");
#endif
return
0
;
}
if
(
TSDB_CODE_SUCCESS
!=
mndStreamGetPlanString
(
ast
,
pStream
->
trigger
,
pStream
->
watermark
,
&
pStream
->
physicalPlan
)
)
{
mError
(
"topic:%s, failed to get plan since %s"
,
pStream
->
name
,
terrstr
());
int32_t
mndPersistStream
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
)
{
if
(
mndPersistStreamTasks
(
pMnode
,
pTrans
,
pStream
)
<
0
)
{
return
-
1
;
}
if
(
mndScheduleStream
(
pMnode
,
pTrans
,
pStream
)
<
0
)
{
mError
(
"
stream:%ld, schedule stream since %s"
,
pStream
->
u
id
,
terrstr
());
SSdbRaw
*
pCommitRaw
=
mndStreamActionEncode
(
pStream
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
mError
(
"
trans:%d, failed to append commit log since %s"
,
pTrans
->
id
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
pStream
->
name
);
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_READY
);
return
0
;
}
int32_t
mndPersistDropStreamLog
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
)
{
SSdbRaw
*
pCommitRaw
=
mndStreamActionEncode
(
pStream
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
{
mError
(
"trans:%d, failed to append commit log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_READY
);
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_DROPPED
);
return
0
;
}
...
...
@@ -503,64 +509,6 @@ static int32_t mndDropStreamTasks(SMnode *pMnode, STrans *pTrans, SStreamObj *pS
return
0
;
}
static
int32_t
mndCreateStream
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SCMCreateStreamReq
*
pCreate
,
SDbObj
*
pDb
)
{
mDebug
(
"stream:%s to create"
,
pCreate
->
name
);
SStreamObj
streamObj
=
{
0
};
tstrncpy
(
streamObj
.
name
,
pCreate
->
name
,
TSDB_STREAM_FNAME_LEN
);
tstrncpy
(
streamObj
.
sourceDb
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
tstrncpy
(
streamObj
.
targetSTbName
,
pCreate
->
targetStbFullName
,
TSDB_TABLE_FNAME_LEN
);
streamObj
.
createTime
=
taosGetTimestampMs
();
streamObj
.
updateTime
=
streamObj
.
createTime
;
streamObj
.
uid
=
mndGenerateUid
(
pCreate
->
name
,
strlen
(
pCreate
->
name
));
streamObj
.
targetStbUid
=
mndGenerateUid
(
pCreate
->
targetStbFullName
,
TSDB_TABLE_FNAME_LEN
);
streamObj
.
sourceDbUid
=
pDb
->
uid
;
streamObj
.
version
=
1
;
streamObj
.
sql
=
pCreate
->
sql
;
// TODO
streamObj
.
fixedSinkVgId
=
0
;
streamObj
.
smaId
=
0
;
streamObj
.
trigger
=
pCreate
->
triggerType
;
streamObj
.
watermark
=
pCreate
->
watermark
;
streamObj
.
triggerParam
=
pCreate
->
maxDelay
;
if
(
streamObj
.
targetSTbName
[
0
])
{
pDb
=
mndAcquireDbByStb
(
pMnode
,
streamObj
.
targetSTbName
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
return
-
1
;
}
tstrncpy
(
streamObj
.
targetDb
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"stream:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
pCreate
->
name
);
if
(
mndAddStreamToTrans
(
pMnode
,
&
streamObj
,
pCreate
->
ast
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to add stream since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
if
(
streamObj
.
targetSTbName
[
0
]
&&
mndCreateStbForStream
(
pMnode
,
pTrans
,
&
streamObj
,
pReq
->
info
.
conn
.
user
)
<
0
)
{
mError
(
"trans:%d, failed to create stb for stream since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
mndTransDrop
(
pTrans
);
return
0
;
}
static
int32_t
mndProcessCreateStreamReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
...
...
@@ -631,7 +579,7 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
}
// schedule stream task for stream obj
if
(
mndScheduleStream
(
pMnode
,
pTrans
,
&
streamObj
)
<
0
)
{
if
(
mndScheduleStream
(
pMnode
,
&
streamObj
)
<
0
)
{
mError
(
"stream:%s, failed to schedule since %s"
,
createStreamReq
.
name
,
terrstr
());
mndTransDrop
(
pTrans
);
goto
_OVER
;
...
...
@@ -653,8 +601,6 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
mndTransDrop
(
pTrans
);
/*code = mndCreateStream(pMnode, pReq, &createStreamReq, pDb);*/
/*if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;*/
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
_OVER:
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
54283f87
...
...
@@ -198,6 +198,10 @@ int32_t mndInitSync(SMnode *pMnode) {
return
-
1
;
}
// decrease election timer
setElectTimerMS
(
pMgmt
->
sync
,
600
);
setHeartbeatTimerMS
(
pMgmt
->
sync
,
300
);
mDebug
(
"mnode-sync is opened, id:%"
PRId64
,
pMgmt
->
sync
);
return
0
;
}
...
...
@@ -261,7 +265,8 @@ bool mndIsMaster(SMnode *pMnode) {
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
if
(
!
syncIsReady
(
pMgmt
->
sync
))
{
terrno
=
TSDB_CODE_SYN_NOT_LEADER
;
// get terrno from syncIsReady
// terrno = TSDB_CODE_SYN_NOT_LEADER;
return
false
;
}
...
...
source/dnode/mnode/impl/test/db/CMakeLists.txt
浏览文件 @
54283f87
...
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
)
if
(
NOT TD_WINDOWS
)
add_test
(
NAME dbTest
COMMAND dbTest
)
endif
(
NOT TD_WINDOWS
)
add_test
(
NAME dbTest
COMMAND dbTest
)
source/dnode/mnode/impl/test/func/CMakeLists.txt
浏览文件 @
54283f87
...
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
)
# if(NOT TD_WINDOWS)
add_test
(
NAME funcTest
COMMAND funcTest
)
# endif(NOT TD_WINDOWS)
add_test
(
NAME funcTest
COMMAND funcTest
)
\ No newline at end of file
source/dnode/mnode/impl/test/profile/CMakeLists.txt
浏览文件 @
54283f87
...
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
)
# if(NOT TD_WINDOWS)
add_test
(
NAME profileTest
COMMAND profileTest
)
# endif(NOT TD_WINDOWS)
add_test
(
NAME profileTest
COMMAND profileTest
)
source/dnode/mnode/impl/test/show/CMakeLists.txt
浏览文件 @
54283f87
...
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
)
# if(NOT TD_WINDOWS)
add_test
(
NAME showTest
COMMAND showTest
)
# endif(NOT TD_WINDOWS)
add_test
(
NAME showTest
COMMAND showTest
)
source/dnode/mnode/impl/test/sma/CMakeLists.txt
浏览文件 @
54283f87
...
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
)
if
(
NOT TD_WINDOWS
)
add_test
(
NAME smaTest
COMMAND smaTest
)
endif
(
NOT TD_WINDOWS
)
add_test
(
NAME smaTest
COMMAND smaTest
)
source/dnode/mnode/impl/test/stb/CMakeLists.txt
浏览文件 @
54283f87
...
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
)
if
(
NOT TD_WINDOWS
)
add_test
(
NAME stbTest
COMMAND stbTest
)
endif
(
NOT TD_WINDOWS
)
\ No newline at end of file
add_test
(
NAME stbTest
COMMAND stbTest
)
\ No newline at end of file
source/dnode/mnode/impl/test/user/CMakeLists.txt
浏览文件 @
54283f87
...
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
)
if
(
NOT TD_WINDOWS
)
add_test
(
NAME userTest
COMMAND userTest
)
endif
(
NOT TD_WINDOWS
)
add_test
(
NAME userTest
COMMAND userTest
)
source/dnode/vnode/src/tq/tq.c
浏览文件 @
54283f87
...
...
@@ -455,6 +455,9 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) {
}
tDecoderClear
(
&
decoder
);
ASSERT
(
pTask
->
isDataScan
==
0
||
pTask
->
isDataScan
==
1
);
if
(
pTask
->
isDataScan
==
0
&&
pTask
->
sinkType
==
TASK_SINK__NONE
)
{
ASSERT
(
taosArrayGetSize
(
pTask
->
childEpInfo
)
!=
0
);
}
pTask
->
execStatus
=
TASK_EXEC_STATUS__IDLE
;
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
54283f87
...
...
@@ -66,6 +66,7 @@ int32_t tqScanSnapshot(STQ* pTq, const STqExecHandle* pExec, SMqDataBlkRsp* pRsp
if
(
qStreamScanSnapshot
(
task
)
<
0
)
{
ASSERT
(
0
);
}
// set version
while
(
1
)
{
SSDataBlock
*
pDataBlock
=
NULL
;
uint64_t
ts
=
0
;
...
...
source/dnode/vnode/src/tq/tqOffset.c
浏览文件 @
54283f87
...
...
@@ -44,6 +44,7 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
}
char
*
fname
=
buildFileName
(
pStore
->
pTq
->
path
);
TdFilePtr
pFile
=
taosOpenFile
(
fname
,
TD_FILE_READ
);
taosMemoryFree
(
fname
);
if
(
pFile
!=
NULL
)
{
STqOffsetHead
head
=
{
0
};
int64_t
code
;
...
...
@@ -77,7 +78,6 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
}
taosCloseFile
(
&
pFile
);
taosMemoryFree
(
fname
);
}
return
pStore
;
}
...
...
@@ -102,6 +102,7 @@ int32_t tqOffsetSnapshot(STqOffsetStore* pStore) {
// TODO file name should be with a version
char
*
fname
=
buildFileName
(
pStore
->
pTq
->
path
);
TdFilePtr
pFile
=
taosOpenFile
(
fname
,
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_APPEND
);
taosMemoryFree
(
fname
);
if
(
pFile
==
NULL
)
{
ASSERT
(
0
);
return
-
1
;
...
...
@@ -140,6 +141,5 @@ int32_t tqOffsetSnapshot(STqOffsetStore* pStore) {
}
// close and rename file
taosCloseFile
(
&
pFile
);
taosMemoryFree
(
fname
);
return
0
;
}
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
54283f87
...
...
@@ -146,11 +146,11 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReadHandle* pHandle, uint64_
int32_t
*
pNumOfRows
)
{
*
pUid
=
0
;
// TODO set to real sversion
/*int32_t sversion = 1;*/
// TODO: cache multiple schema
int32_t
sversion
=
htonl
(
pHandle
->
pBlock
->
sversion
);
if
(
pHandle
->
cachedSchemaSuid
==
0
||
pHandle
->
cachedSchemaVer
!=
sversion
||
pHandle
->
cachedSchemaSuid
!=
pHandle
->
msgIter
.
suid
)
{
if
(
pHandle
->
pSchema
)
taosMemoryFree
(
pHandle
->
pSchema
);
pHandle
->
pSchema
=
metaGetTbTSchema
(
pHandle
->
pVnodeMeta
,
pHandle
->
msgIter
.
uid
,
sversion
);
if
(
pHandle
->
pSchema
==
NULL
)
{
tqWarn
(
"cannot found tsschema for table: uid: %ld (suid: %ld), version %d, possibly dropped table"
,
...
...
@@ -160,7 +160,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReadHandle* pHandle, uint64_
return
-
1
;
}
// this interface use suid instead of uid
if
(
pHandle
->
pSchemaWrapper
)
tDeleteSSchemaWrapper
(
pHandle
->
pSchemaWrapper
);
pHandle
->
pSchemaWrapper
=
metaGetTableSchema
(
pHandle
->
pVnodeMeta
,
pHandle
->
msgIter
.
uid
,
sversion
,
true
);
if
(
pHandle
->
pSchemaWrapper
==
NULL
)
{
tqWarn
(
"cannot found schema wrapper for table: suid: %ld, version %d, possibly dropped table"
,
...
...
@@ -184,7 +184,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReadHandle* pHandle, uint64_
while
(
colMeta
<
pSchemaWrapper
->
nCols
)
{
SSchema
*
pColSchema
=
&
pSchemaWrapper
->
pSchema
[
colMeta
];
SColumnInfoData
colInfo
=
createColumnInfoData
(
pColSchema
->
type
,
pColSchema
->
bytes
,
pColSchema
->
colId
);
int32_t
code
=
blockDataAppendColInfo
(
pBlock
,
&
colInfo
);
int32_t
code
=
blockDataAppendColInfo
(
pBlock
,
&
colInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
FAIL
;
}
...
...
@@ -207,7 +207,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReadHandle* pHandle, uint64_
colNeed
++
;
}
else
{
SColumnInfoData
colInfo
=
createColumnInfoData
(
pColSchema
->
type
,
pColSchema
->
bytes
,
pColSchema
->
colId
);
int32_t
code
=
blockDataAppendColInfo
(
pBlock
,
&
colInfo
);
int32_t
code
=
blockDataAppendColInfo
(
pBlock
,
&
colInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
FAIL
;
}
...
...
@@ -243,7 +243,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReadHandle* pHandle, uint64_
if
(
!
tdSTSRowIterNext
(
&
iter
,
pColData
->
info
.
colId
,
pColData
->
info
.
type
,
&
sVal
))
{
break
;
}
if
(
colDataAppend
(
pColData
,
curRow
,
sVal
.
val
,
sVal
.
valType
==
TD_VTYPE_NULL
)
<
0
)
{
if
(
colDataAppend
(
pColData
,
curRow
,
sVal
.
val
,
sVal
.
valType
!=
TD_VTYPE_NORM
)
<
0
)
{
goto
FAIL
;
}
}
...
...
@@ -251,8 +251,8 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReadHandle* pHandle, uint64_
}
return
0
;
FAIL:
// todo refactor here
// if (*ppCols) taosArrayDestroy(*ppCols);
FAIL:
// todo refactor here
// if (*ppCols) taosArrayDestroy(*ppCols);
return
-
1
;
}
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
54283f87
...
...
@@ -144,11 +144,15 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
vnodeAccumBlockMsg
(
pVnode
,
pMsg
->
msgType
);
}
else
if
(
code
==
-
1
&&
terrno
==
TSDB_CODE_SYN_NOT_LEADER
)
{
SEpSet
newEpSet
=
{
0
};
syncGetRetryEpSet
(
pVnode
->
sync
,
&
newEpSet
);
/*
syncGetEpSet(pVnode->sync, &newEpSet);
SEp *pEp = &newEpSet.eps[newEpSet.inUse];
if (pEp->port == tsServerPort && strcmp(pEp->fqdn, tsLocalFqdn) == 0) {
newEpSet.inUse = (newEpSet.inUse + 1) % newEpSet.numOfEps;
}
*/
vGTrace
(
"vgId:%d, msg:%p is redirect since not leader, numOfEps:%d inUse:%d"
,
vgId
,
pMsg
,
newEpSet
.
numOfEps
,
newEpSet
.
inUse
);
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
54283f87
...
...
@@ -76,6 +76,7 @@ typedef enum {
CTG_TASK_GET_INDEX
,
CTG_TASK_GET_UDF
,
CTG_TASK_GET_USER
,
CTG_TASK_GET_SVR_VER
,
}
CTG_TASK_TYPE
;
typedef
enum
{
...
...
@@ -224,6 +225,7 @@ typedef struct SCtgJob {
int32_t
dbInfoNum
;
int32_t
tbIndexNum
;
int32_t
tbCfgNum
;
int32_t
svrVerNum
;
}
SCtgJob
;
typedef
struct
SCtgMsgCtx
{
...
...
@@ -578,8 +580,9 @@ int32_t ctgGetTbMetaFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SNa
int32_t
ctgGetTbMetaFromVnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
vgroupInfo
,
STableMetaOutput
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTableCfgFromVnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
vgroupInfo
,
STableCfg
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTableCfgFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableCfg
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetSvrVerFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgInitJob
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SCtgJob
**
job
,
uint64_t
reqId
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int32_t
*
taskNum
);
int32_t
ctgInitJob
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SCtgJob
**
job
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int32_t
*
taskNum
);
int32_t
ctgLaunchJob
(
SCtgJob
*
pJob
);
int32_t
ctgMakeAsyncRes
(
SCtgJob
*
pJob
);
int32_t
ctgLaunchSubTask
(
SCtgTask
*
pTask
,
CTG_TASK_TYPE
type
,
ctgSubTaskCbFp
fp
,
void
*
param
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
54283f87
...
...
@@ -1051,7 +1051,7 @@ _return:
CTG_API_LEAVE
(
code
);
}
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
)
{
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
)
{
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
pConn
||
NULL
==
pReq
||
NULL
==
fp
||
NULL
==
param
)
{
...
...
@@ -1060,7 +1060,7 @@ int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo *pConn, uint64_t
int32_t
code
=
0
,
taskNum
=
0
;
SCtgJob
*
pJob
=
NULL
;
CTG_ERR_JRET
(
ctgInitJob
(
pCtg
,
pConn
,
&
pJob
,
reqId
,
pReq
,
fp
,
param
,
&
taskNum
));
CTG_ERR_JRET
(
ctgInitJob
(
pCtg
,
pConn
,
&
pJob
,
pReq
,
fp
,
param
,
&
taskNum
));
if
(
taskNum
<=
0
)
{
SMetaData
*
pMetaData
=
taosMemoryCalloc
(
1
,
sizeof
(
SMetaData
));
fp
(
pMetaData
,
param
,
TSDB_CODE_SUCCESS
);
...
...
@@ -1247,6 +1247,22 @@ _return:
CTG_API_LEAVE
(
code
);
}
int32_t
catalogGetServerVersion
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
pVersion
)
{
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
pConn
||
NULL
==
pVersion
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgGetSvrVerFromMnode
(
pCtg
,
pConn
,
pVersion
,
NULL
));
_return:
CTG_API_LEAVE
(
code
);
}
int32_t
catalogUpdateUserAuthInfo
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
)
{
CTG_API_ENTER
();
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
54283f87
...
...
@@ -255,6 +255,20 @@ int32_t ctgInitGetUserTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInitGetSvrVerTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
SCtgTask
task
=
{
0
};
task
.
type
=
CTG_TASK_GET_SVR_VER
;
task
.
taskId
=
taskIdx
;
task
.
pJob
=
pJob
;
taosArrayPush
(
pJob
->
pTasks
,
&
task
);
qDebug
(
"QID:0x%"
PRIx64
" [%dth] task type %s initialized"
,
pJob
->
queryId
,
taskIdx
,
ctgTaskTypeStr
(
task
.
type
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInitGetTbIndexTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
SName
*
name
=
(
SName
*
)
param
;
SCtgTask
task
=
{
0
};
...
...
@@ -413,7 +427,7 @@ int32_t ctgInitTask(SCtgJob *pJob, CTG_TASK_TYPE type, void* param, int32_t *tas
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInitJob
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SCtgJob
**
job
,
uint64_t
reqId
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int32_t
*
taskNum
)
{
int32_t
ctgInitJob
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SCtgJob
**
job
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int32_t
*
taskNum
)
{
int32_t
code
=
0
;
int32_t
tbMetaNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableMeta
);
int32_t
dbVgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbVgroup
);
...
...
@@ -421,6 +435,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
int32_t
udfNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUdf
);
int32_t
qnodeNum
=
pReq
->
qNodeRequired
?
1
:
0
;
int32_t
dnodeNum
=
pReq
->
dNodeRequired
?
1
:
0
;
int32_t
svrVerNum
=
pReq
->
svrVerRequired
?
1
:
0
;
int32_t
dbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbCfg
);
int32_t
indexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pIndex
);
int32_t
userNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUser
);
...
...
@@ -428,21 +443,21 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
int32_t
tbIndexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableIndex
);
int32_t
tbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableCfg
);
*
taskNum
=
tbMetaNum
+
dbVgNum
+
udfNum
+
tbHashNum
+
qnodeNum
+
dnodeNum
+
dbCfgNum
+
indexNum
+
userNum
+
dbInfoNum
+
tbIndexNum
+
tbCfgNum
;
*
taskNum
=
tbMetaNum
+
dbVgNum
+
udfNum
+
tbHashNum
+
qnodeNum
+
dnodeNum
+
svrVerNum
+
dbCfgNum
+
indexNum
+
userNum
+
dbInfoNum
+
tbIndexNum
+
tbCfgNum
;
if
(
*
taskNum
<=
0
)
{
ctgDebug
(
"Empty input for job, no need to retrieve meta, reqId:0x%"
PRIx64
,
req
Id
);
ctgDebug
(
"Empty input for job, no need to retrieve meta, reqId:0x%"
PRIx64
,
pConn
->
request
Id
);
return
TSDB_CODE_SUCCESS
;
}
*
job
=
taosMemoryCalloc
(
1
,
sizeof
(
SCtgJob
));
if
(
NULL
==
*
job
)
{
ctgError
(
"failed to calloc, size:%d, reqId:0x%"
PRIx64
,
(
int32_t
)
sizeof
(
SCtgJob
),
req
Id
);
ctgError
(
"failed to calloc, size:%d, reqId:0x%"
PRIx64
,
(
int32_t
)
sizeof
(
SCtgJob
),
pConn
->
request
Id
);
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
SCtgJob
*
pJob
=
*
job
;
pJob
->
queryId
=
req
Id
;
pJob
->
queryId
=
pConn
->
request
Id
;
pJob
->
userFp
=
fp
;
pJob
->
pCtg
=
pCtg
;
pJob
->
conn
=
*
pConn
;
...
...
@@ -460,6 +475,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
pJob
->
dbInfoNum
=
dbInfoNum
;
pJob
->
tbIndexNum
=
tbIndexNum
;
pJob
->
tbCfgNum
=
tbCfgNum
;
pJob
->
svrVerNum
=
svrVerNum
;
pJob
->
pTasks
=
taosArrayInit
(
*
taskNum
,
sizeof
(
SCtgTask
));
...
...
@@ -530,6 +546,10 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_DNODE
,
NULL
,
NULL
));
}
if
(
svrVerNum
)
{
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_SVR_VER
,
NULL
,
NULL
));
}
pJob
->
refId
=
taosAddRef
(
gCtgMgmt
.
jobPool
,
pJob
);
if
(
pJob
->
refId
<
0
)
{
ctgError
(
"add job to ref failed, error: %s"
,
tstrerror
(
terrno
));
...
...
@@ -728,6 +748,21 @@ int32_t ctgDumpUserRes(SCtgTask* pTask) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgDumpSvrVer
(
SCtgTask
*
pTask
)
{
SCtgJob
*
pJob
=
pTask
->
pJob
;
if
(
NULL
==
pJob
->
jobRes
.
pSvrVer
)
{
pJob
->
jobRes
.
pSvrVer
=
taosMemoryCalloc
(
1
,
sizeof
(
SMetaRes
));
if
(
NULL
==
pJob
->
jobRes
.
pSvrVer
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
pJob
->
jobRes
.
pSvrVer
->
code
=
pTask
->
code
;
pJob
->
jobRes
.
pSvrVer
->
pRes
=
pTask
->
res
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInvokeSubCb
(
SCtgTask
*
pTask
)
{
int32_t
code
=
0
;
...
...
@@ -1156,6 +1191,20 @@ _return:
CTG_RET
(
code
);
}
int32_t
ctgHandleGetSvrVerRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
&
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
TSWAP
(
pTask
->
res
,
pTask
->
msgCtx
.
out
);
_return:
ctgHandleTaskEnd
(
pTask
,
code
);
CTG_RET
(
code
);
}
int32_t
ctgAsyncRefreshTbMeta
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
...
...
@@ -1459,6 +1508,15 @@ int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgLaunchGetSvrVerTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
CTG_ERR_RET
(
ctgGetSvrVerFromMnode
(
pCtg
,
pConn
,
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgRelaunchGetTbMetaTask
(
SCtgTask
*
pTask
)
{
ctgResetTbMetaTask
(
pTask
);
...
...
@@ -1532,6 +1590,7 @@ SCtgAsyncFps gCtgAsyncFps[] = {
{
ctgInitGetIndexTask
,
ctgLaunchGetIndexTask
,
ctgHandleGetIndexRsp
,
ctgDumpIndexRes
,
NULL
,
NULL
},
{
ctgInitGetUdfTask
,
ctgLaunchGetUdfTask
,
ctgHandleGetUdfRsp
,
ctgDumpUdfRes
,
NULL
,
NULL
},
{
ctgInitGetUserTask
,
ctgLaunchGetUserTask
,
ctgHandleGetUserRsp
,
ctgDumpUserRes
,
NULL
,
NULL
},
{
ctgInitGetSvrVerTask
,
ctgLaunchGetSvrVerTask
,
ctgHandleGetSvrVerRsp
,
ctgDumpSvrVer
,
NULL
,
NULL
},
};
int32_t
ctgMakeAsyncRes
(
SCtgJob
*
pJob
)
{
...
...
@@ -1633,7 +1692,7 @@ int32_t ctgLaunchJob(SCtgJob *pJob) {
for
(
int32_t
i
=
0
;
i
<
taskNum
;
++
i
)
{
SCtgTask
*
pTask
=
taosArrayGet
(
pJob
->
pTasks
,
i
);
qDebug
(
"QID:0x%"
PRIx64
" ctg
start to launch task %d
"
,
pJob
->
queryId
,
pTask
->
taskId
);
qDebug
(
"QID:0x%"
PRIx64
" ctg
launch [%dth] task
"
,
pJob
->
queryId
,
pTask
->
taskId
);
CTG_ERR_RET
((
*
gCtgAsyncFps
[
pTask
->
type
].
launchFp
)(
pTask
));
pTask
->
status
=
CTG_TASK_LAUNCHED
;
}
...
...
source/libs/catalog/src/ctgDbg.c
浏览文件 @
54283f87
...
...
@@ -210,7 +210,7 @@ int32_t ctgdLaunchAsyncCall(SCatalog* pCtg, SRequestConnInfo* pConn, uint64_t re
int64_t
jobId
=
0
;
CTG_ERR_JRET
(
catalogAsyncGetAllMeta
(
pCtg
,
pConn
,
reqId
,
&
req
,
ctgdUserCallback
,
param
,
&
jobId
));
CTG_ERR_JRET
(
catalogAsyncGetAllMeta
(
pCtg
,
pConn
,
&
req
,
ctgdUserCallback
,
param
,
&
jobId
));
_return:
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
54283f87
...
...
@@ -217,6 +217,21 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qDebug
(
"Got stb cfg from mnode, tbFName:%s"
,
target
);
break
;
}
case
TDMT_MND_SERVER_VERSION
:
{
if
(
TSDB_CODE_SUCCESS
!=
rspCode
)
{
qError
(
"error rsp for svr ver from mnode, error:%s"
,
tstrerror
(
rspCode
));
CTG_ERR_RET
(
rspCode
);
}
code
=
queryProcessMsgRsp
[
TMSG_INDEX
(
reqType
)](
out
,
msg
,
msgSize
);
if
(
code
)
{
qError
(
"Process svr ver rsp failed, error:%s"
,
tstrerror
(
code
));
CTG_ERR_RET
(
code
);
}
qDebug
(
"Got svr ver from mnode"
);
break
;
}
default:
qError
(
"invalid req type %s"
,
TMSG_INFO
(
reqType
));
return
TSDB_CODE_APP_ERROR
;
...
...
@@ -811,4 +826,38 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgGetSvrVerFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
out
,
SCtgTask
*
pTask
)
{
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
reqType
=
TDMT_MND_SERVER_VERSION
;
void
*
(
*
mallocFp
)(
int32_t
)
=
pTask
?
taosMemoryMalloc
:
rpcMallocCont
;
qDebug
(
"try to get svr ver from mnode"
);
int32_t
code
=
queryBuildMsg
[
TMSG_INDEX
(
reqType
)](
NULL
,
&
msg
,
0
,
&
msgLen
,
mallocFp
);
if
(
code
)
{
ctgError
(
"Build get svr ver msg failed, code:%s"
,
tstrerror
(
code
));
CTG_ERR_RET
(
code
);
}
if
(
pTask
)
{
CTG_ERR_RET
(
ctgUpdateMsgCtx
(
&
pTask
->
msgCtx
,
reqType
,
NULL
,
NULL
));
CTG_RET
(
ctgAsyncSendMsg
(
pCtg
,
pConn
,
pTask
,
reqType
,
msg
,
msgLen
));
}
SRpcMsg
rpcMsg
=
{
.
msgType
=
reqType
,
.
pCont
=
msg
,
.
contLen
=
msgLen
,
};
SRpcMsg
rpcRsp
=
{
0
};
rpcSendRecv
(
pConn
->
pTrans
,
&
pConn
->
mgmtEps
,
&
rpcMsg
,
&
rpcRsp
);
CTG_ERR_RET
(
ctgProcessRspMsg
(
out
,
reqType
,
rpcRsp
.
pCont
,
rpcRsp
.
contLen
,
rpcRsp
.
code
,
NULL
));
return
TSDB_CODE_SUCCESS
;
}
source/libs/catalog/src/ctgUtil.c
浏览文件 @
54283f87
...
...
@@ -45,6 +45,8 @@ char *ctgTaskTypeStr(CTG_TASK_TYPE type) {
return
"[get udf]"
;
case
CTG_TASK_GET_USER
:
return
"[get user]"
;
case
CTG_TASK_GET_SVR_VER
:
return
"[get svr ver]"
;
default:
return
"unknown"
;
}
...
...
@@ -103,8 +105,13 @@ void ctgFreeSMetaData(SMetaData* pData) {
taosArrayDestroy
(
pData
->
pQnodeList
);
pData
->
pQnodeList
=
NULL
;
taosArrayDestroy
(
pData
->
pDnodeList
);
pData
->
pDnodeList
=
NULL
;
taosArrayDestroy
(
pData
->
pTableCfg
);
pData
->
pTableCfg
=
NULL
;
taosMemoryFreeClear
(
pData
->
pSvrVer
);
}
void
ctgFreeSCtgUserAuth
(
SCtgUserAuth
*
userCache
)
{
...
...
@@ -346,20 +353,8 @@ void ctgResetTbMetaTask(SCtgTask* pTask) {
void
ctgFreeTaskRes
(
CTG_TASK_TYPE
type
,
void
**
pRes
)
{
switch
(
type
)
{
case
CTG_TASK_GET_QNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_DNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_QNODE
:
case
CTG_TASK_GET_DNODE
:
case
CTG_TASK_GET_DB_VGROUP
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
...
...
@@ -373,14 +368,6 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
}
break
;
}
case
CTG_TASK_GET_DB_INFO
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_HASH
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_INDEX
:
{
taosArrayDestroyEx
(
*
pRes
,
tFreeSTableIndexInfo
);
*
pRes
=
NULL
;
...
...
@@ -394,15 +381,13 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
}
break
;
}
case
CTG_TASK_GET_INDEX
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_UDF
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_USER
:
{
case
CTG_TASK_GET_TB_HASH
:
case
CTG_TASK_GET_DB_INFO
:
case
CTG_TASK_GET_INDEX
:
case
CTG_TASK_GET_UDF
:
case
CTG_TASK_GET_USER
:
case
CTG_TASK_GET_SVR_VER
:
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
...
...
@@ -415,20 +400,12 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
void
ctgFreeSubTaskRes
(
CTG_TASK_TYPE
type
,
void
**
pRes
)
{
switch
(
type
)
{
case
CTG_TASK_GET_QNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_QNODE
:
case
CTG_TASK_GET_DNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_DB_VGROUP
:
{
if
(
*
pRes
)
{
SDBVgInfo
*
pInfo
=
(
SDBVgInfo
*
)
*
pRes
;
...
...
@@ -445,14 +422,6 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
}
break
;
}
case
CTG_TASK_GET_DB_INFO
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_HASH
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_INDEX
:
{
taosArrayDestroyEx
(
*
pRes
,
tFreeSTableIndexInfo
);
*
pRes
=
NULL
;
...
...
@@ -466,14 +435,12 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
}
break
;
}
case
CTG_TASK_GET_INDEX
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_UDF
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_META
:
case
CTG_TASK_GET_DB_INFO
:
case
CTG_TASK_GET_TB_HASH
:
case
CTG_TASK_GET_INDEX
:
case
CTG_TASK_GET_UDF
:
case
CTG_TASK_GET_SVR_VER
:
case
CTG_TASK_GET_USER
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
...
...
@@ -497,10 +464,6 @@ void ctgClearSubTaskRes(SCtgSubRes *pRes) {
void
ctgFreeTaskCtx
(
SCtgTask
*
pTask
)
{
switch
(
pTask
->
type
)
{
case
CTG_TASK_GET_QNODE
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_TB_META
:
{
SCtgTbMetaCtx
*
taskCtx
=
(
SCtgTbMetaCtx
*
)
pTask
->
taskCtx
;
taosMemoryFreeClear
(
taskCtx
->
pName
);
...
...
@@ -511,18 +474,6 @@ void ctgFreeTaskCtx(SCtgTask* pTask) {
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_DB_VGROUP
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_DB_CFG
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_DB_INFO
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_TB_HASH
:
{
SCtgTbHashCtx
*
taskCtx
=
(
SCtgTbHashCtx
*
)
pTask
->
taskCtx
;
taosMemoryFreeClear
(
taskCtx
->
pName
);
...
...
@@ -542,14 +493,12 @@ void ctgFreeTaskCtx(SCtgTask* pTask) {
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_INDEX
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_UDF
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_DB_VGROUP
:
case
CTG_TASK_GET_DB_CFG
:
case
CTG_TASK_GET_DB_INFO
:
case
CTG_TASK_GET_INDEX
:
case
CTG_TASK_GET_UDF
:
case
CTG_TASK_GET_QNODE
:
case
CTG_TASK_GET_USER
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
...
...
source/libs/command/src/command.c
浏览文件 @
54283f87
...
...
@@ -520,7 +520,17 @@ static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt, SRetrieveTableR
return
execShowCreateTable
(
pStmt
,
pRsp
);
}
static
int32_t
execAlterLocal
(
SAlterLocalStmt
*
pStmt
)
{
return
TSDB_CODE_FAILED
;
}
static
int32_t
execAlterLocal
(
SAlterLocalStmt
*
pStmt
)
{
if
(
cfgSetItem
(
tsCfg
,
pStmt
->
config
,
pStmt
->
value
,
CFG_STYPE_ALTER_CMD
))
{
return
terrno
;
}
if
(
taosSetCfg
(
tsCfg
,
pStmt
->
config
))
{
return
terrno
;
}
return
TSDB_CODE_SUCCESS
;
}
static
SSDataBlock
*
buildLocalVariablesResultDataBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
54283f87
...
...
@@ -336,7 +336,6 @@ typedef struct SStreamBlockScanInfo {
int32_t
numOfPseudoExpr
;
int32_t
primaryTsIndex
;
// primary time stamp slot id
void
*
pDataReader
;
SReadHandle
readHandle
;
uint64_t
tableUid
;
// queried super table uid
EStreamScanMode
scanMode
;
...
...
source/libs/executor/src/executor.c
浏览文件 @
54283f87
...
...
@@ -40,15 +40,8 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
SStreamBlockScanInfo
*
pInfo
=
pOperator
->
info
;
pInfo
->
assignBlockUid
=
assignUid
;
// no need to check
#if 0
if (pInfo->blockType == 0) {
pInfo->blockType = type;
} else if (pInfo->blockType != type) {
ASSERT(0);
return TSDB_CODE_QRY_APP_ERROR;
}
#endif
// TODO: if a block was set but not consumed,
// prevent setting a different type of block
pInfo
->
blockType
=
type
;
if
(
type
==
STREAM_DATA_TYPE_SUBMIT_BLOCK
)
{
...
...
@@ -152,10 +145,10 @@ static SArray* filterQualifiedChildTables(const SStreamBlockScanInfo* pScanInfo,
continue
;
}
ASSERT
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
);
if
(
mr
.
me
.
ctbEntry
.
suid
!=
pScanInfo
->
tableUid
)
{
if
(
mr
.
me
.
type
!=
TSDB_CHILD_TABLE
||
mr
.
me
.
ctbEntry
.
suid
!=
pScanInfo
->
tableUid
)
{
continue
;
}
// TODO handle ntb case
taosArrayPush
(
qa
,
id
);
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
54283f87
...
...
@@ -1321,7 +1321,7 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
// todo move to the initialization function
int32_t
code
=
filterInitFromNode
((
SNode
*
)
pFilterNode
,
&
filter
,
0
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
SFilterColumnParam
param1
=
{.
numOfCols
=
numOfCols
,
.
pDataBlock
=
pBlock
->
pDataBlock
};
code
=
filterSetDataFromSlotId
(
filter
,
&
param1
);
...
...
@@ -1341,7 +1341,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR
}
if
(
rowRes
!=
NULL
)
{
int32_t
totalRows
=
pBlock
->
info
.
rows
;
int32_t
totalRows
=
pBlock
->
info
.
rows
;
SSDataBlock
*
px
=
createOneDataBlock
(
pBlock
,
true
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
...
...
@@ -2048,7 +2048,7 @@ int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLo
SArray
*
pColList
)
{
if
(
pColList
==
NULL
)
{
// data from other sources
blockDataCleanup
(
pRes
);
// blockDataEnsureCapacity(pRes, numOfRows);
// blockDataEnsureCapacity(pRes, numOfRows);
blockCompressDecode
(
pRes
,
numOfOutput
,
numOfRows
,
pData
);
}
else
{
// extract data according to pColList
ASSERT
(
numOfOutput
==
taosArrayGetSize
(
pColList
));
...
...
@@ -2402,14 +2402,14 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
tsem_init
(
&
pInfo
->
ready
,
0
,
0
);
pInfo
->
seqLoadData
=
false
;
pInfo
->
seqLoadData
=
false
;
pInfo
->
pTransporter
=
pTransporter
;
pInfo
->
pResult
=
createResDataBlock
(
pExNode
->
node
.
pOutputDataBlockDesc
);
pOperator
->
name
=
"ExchangeOperator"
;
pInfo
->
pResult
=
createResDataBlock
(
pExNode
->
node
.
pOutputDataBlockDesc
);
pOperator
->
name
=
"ExchangeOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
;
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pResult
->
pDataBlock
);
pOperator
->
pTaskInfo
=
pTaskInfo
;
...
...
@@ -3581,6 +3581,10 @@ static SArray* setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols)
return
pList
;
}
static
int64_t
getLimit
(
SNode
*
pLimit
)
{
return
NULL
==
pLimit
?
-
1
:
((
SLimitNode
*
)
pLimit
)
->
limit
;
}
static
int64_t
getOffset
(
SNode
*
pLimit
)
{
return
NULL
==
pLimit
?
-
1
:
((
SLimitNode
*
)
pLimit
)
->
offset
;
}
SOperatorInfo
*
createProjectOperatorInfo
(
SOperatorInfo
*
downstream
,
SProjectPhysiNode
*
pProjPhyNode
,
SExecTaskInfo
*
pTaskInfo
)
{
SProjectOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SProjectOperatorInfo
));
...
...
@@ -3593,8 +3597,8 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
SExprInfo
*
pExprInfo
=
createExprInfo
(
pProjPhyNode
->
pProjections
,
NULL
,
&
numOfCols
);
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pProjPhyNode
->
node
.
pOutputDataBlockDesc
);
SLimit
limit
=
{.
limit
=
pProjPhyNode
->
limit
,
.
offset
=
pProjPhyNode
->
offset
};
SLimit
slimit
=
{.
limit
=
pProjPhyNode
->
slimit
,
.
offset
=
pProjPhyNode
->
soffset
};
SLimit
limit
=
{.
limit
=
getLimit
(
pProjPhyNode
->
node
.
pLimit
),
.
offset
=
getOffset
(
pProjPhyNode
->
node
.
pLimit
)
};
SLimit
slimit
=
{.
limit
=
getLimit
(
pProjPhyNode
->
node
.
pSlimit
),
.
offset
=
getOffset
(
pProjPhyNode
->
node
.
pSlimit
)
};
pInfo
->
limit
=
limit
;
pInfo
->
slimit
=
slimit
;
...
...
@@ -3954,7 +3958,7 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle,
}
}
}
int32_t
len
=
(
int32_t
)(
pStart
-
(
char
*
)
keyBuf
);
int32_t
len
=
(
int32_t
)(
pStart
-
(
char
*
)
keyBuf
);
uint64_t
*
pGroupId
=
taosHashGet
(
pTableListInfo
->
map
,
keyBuf
,
len
);
...
...
@@ -3980,8 +3984,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
==
type
)
{
STableScanPhysiNode
*
pTableScanNode
=
(
STableScanPhysiNode
*
)
pPhyNode
;
tsdbReaderT
pDataReader
=
doCreateDataReader
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
(
uint64_t
)
queryId
,
taskId
);
tsdbReaderT
pDataReader
=
doCreateDataReader
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
(
uint64_t
)
queryId
,
taskId
);
if
(
pDataReader
==
NULL
&&
terrno
!=
0
)
{
pTaskInfo
->
code
=
terrno
;
return
NULL
;
...
...
@@ -4007,16 +4010,20 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
==
type
)
{
STableMergeScanPhysiNode
*
pTableScanNode
=
(
STableMergeScanPhysiNode
*
)
pPhyNode
;
createScanTableListInfo
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
queryId
,
taskId
);
extractTableSchemaVersion
(
pHandle
,
pTableScanNode
->
scan
.
uid
,
pTaskInfo
);
SOperatorInfo
*
pOperator
=
createTableMergeScanOperatorInfo
(
pTableScanNode
,
pTableListInfo
,
pHandle
,
pTaskInfo
,
queryId
,
taskId
);
SOperatorInfo
*
pOperator
=
createTableMergeScanOperatorInfo
(
pTableScanNode
,
pTableListInfo
,
pHandle
,
pTaskInfo
,
queryId
,
taskId
);
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
==
type
)
{
return
createExchangeOperatorInfo
(
pHandle
->
pMsgCb
->
clientRpc
,
(
SExchangePhysiNode
*
)
pPhyNode
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
==
type
)
{
SScanPhysiNode
*
pScanPhyNode
=
(
SScanPhysiNode
*
)
pPhyNode
;
// simple child table.
STableScanPhysiNode
*
pTableScanNode
=
(
STableScanPhysiNode
*
)
pPhyNode
;
...
...
@@ -4031,20 +4038,22 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
if
(
pHandle
->
initTsdbReader
)
{
// for stream
ASSERT
(
pHandle
->
vnode
);
pDataReader
=
doCreateDataReader
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
(
uint64_t
)
queryId
,
taskId
);
pDataReader
=
doCreateDataReader
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
(
uint64_t
)
queryId
,
taskId
);
}
else
{
// for tq
ASSERT
(
pHandle
->
meta
);
getTableList
(
pHandle
->
meta
,
pScanPhyNode
,
pTableListInfo
);
}
}
#if 0
if (pDataReader == NULL && terrno != 0) {
qDebug("%s pDataReader is NULL", GET_TASKID(pTaskInfo));
// return NULL;
} else {
qDebug("%s pDataReader is not NULL", GET_TASKID(pTaskInfo));
}
#endif
SArray
*
groupKeys
=
extractPartitionColInfo
(
pTableScanNode
->
pPartitionTags
);
int32_t
code
=
generateGroupIdMap
(
pTableListInfo
,
pHandle
,
groupKeys
);
// todo for json
...
...
@@ -4057,9 +4066,11 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pDataReader
,
pHandle
,
pTableScanNode
,
pTaskInfo
,
&
twSup
);
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
==
type
)
{
SSystemTableScanPhysiNode
*
pSysScanPhyNode
=
(
SSystemTableScanPhysiNode
*
)
pPhyNode
;
return
createSysTableScanOperatorInfo
(
pHandle
,
pSysScanPhyNode
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
==
type
)
{
STagScanPhysiNode
*
pScanPhyNode
=
(
STagScanPhysiNode
*
)
pPhyNode
;
...
...
@@ -4070,6 +4081,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
}
return
createTagScanOperatorInfo
(
pHandle
,
pScanPhyNode
,
pTableListInfo
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN
==
type
)
{
SBlockDistScanPhysiNode
*
pBlockNode
=
(
SBlockDistScanPhysiNode
*
)
pPhyNode
;
pTableListInfo
->
pTableList
=
taosArrayInit
(
4
,
sizeof
(
STableKeyInfo
));
...
...
@@ -4343,7 +4355,7 @@ tsdbReaderT doCreateDataReader(STableScanPhysiNode* pTableScanNode, SReadHandle*
goto
_error
;
}
tsdbReaderT
*
pReader
=
tsdbReaderOpen
(
pHandle
->
vnode
,
&
cond
,
pTableListInfo
,
queryId
,
taskId
);
tsdbReaderT
pReader
=
tsdbReaderOpen
(
pHandle
->
vnode
,
&
cond
,
pTableListInfo
,
queryId
,
taskId
);
cleanupQueryTableDataCond
(
&
cond
);
return
pReader
;
...
...
@@ -4353,6 +4365,72 @@ _error:
return
NULL
;
}
static
int32_t
extractTbscanInStreamOpTree
(
SOperatorInfo
*
pOperator
,
STableScanInfo
**
ppInfo
)
{
if
(
pOperator
->
operatorType
!=
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
)
{
if
(
pOperator
->
numOfDownstream
==
0
)
{
qError
(
"failed to find stream scan operator"
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
if
(
pOperator
->
numOfDownstream
>
1
)
{
qError
(
"join not supported for stream block scan"
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
return
extractTbscanInStreamOpTree
(
pOperator
->
pDownstream
[
0
],
ppInfo
);
}
else
{
SStreamBlockScanInfo
*
pInfo
=
pOperator
->
info
;
ASSERT
(
pInfo
->
pSnapshotReadOp
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
);
*
ppInfo
=
pInfo
->
pSnapshotReadOp
->
info
;
return
0
;
}
}
int32_t
extractTableScanNode
(
SPhysiNode
*
pNode
,
STableScanPhysiNode
**
ppNode
)
{
if
(
pNode
->
pChildren
==
NULL
||
LIST_LENGTH
(
pNode
->
pChildren
)
==
0
)
{
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
==
pNode
->
type
)
{
*
ppNode
=
(
STableScanPhysiNode
*
)
pNode
;
return
0
;
}
else
{
ASSERT
(
0
);
terrno
=
TSDB_CODE_QRY_APP_ERROR
;
return
-
1
;
}
}
else
{
if
(
LIST_LENGTH
(
pNode
->
pChildren
)
!=
1
)
{
ASSERT
(
0
);
terrno
=
TSDB_CODE_QRY_APP_ERROR
;
return
-
1
;
}
SPhysiNode
*
pChildNode
=
(
SPhysiNode
*
)
nodesListGetNode
(
pNode
->
pChildren
,
0
);
return
extractTableScanNode
(
pChildNode
,
ppNode
);
}
return
-
1
;
}
int32_t
rebuildReader
(
SOperatorInfo
*
pOperator
,
SSubplan
*
plan
,
SReadHandle
*
pHandle
,
int64_t
uid
,
int64_t
ts
)
{
STableScanInfo
*
pTableScanInfo
=
NULL
;
if
(
extractTbscanInStreamOpTree
(
pOperator
,
&
pTableScanInfo
)
<
0
)
{
return
-
1
;
}
STableScanPhysiNode
*
pNode
=
NULL
;
if
(
extractTableScanNode
(
plan
->
pNode
,
&
pNode
)
<
0
)
{
ASSERT
(
0
);
}
tsdbCleanupReadHandle
(
pTableScanInfo
->
dataReader
);
STableListInfo
info
=
{
0
};
pTableScanInfo
->
dataReader
=
doCreateDataReader
(
pNode
,
pHandle
,
&
info
,
0
,
0
);
if
(
pTableScanInfo
->
dataReader
==
NULL
)
{
ASSERT
(
0
);
qError
(
"failed to create data reader"
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
// TODO: set uid and ts to data reader
return
0
;
}
int32_t
encodeOperator
(
SOperatorInfo
*
ops
,
char
**
result
,
int32_t
*
length
)
{
int32_t
code
=
TDB_CODE_SUCCESS
;
char
*
pCurrent
=
NULL
;
...
...
@@ -4487,18 +4565,14 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
(
*
pTaskInfo
)
->
sql
=
sql
;
(
*
pTaskInfo
)
->
tableqinfoList
.
pTagCond
=
pPlan
->
pTagCond
;
(
*
pTaskInfo
)
->
tableqinfoList
.
pTagIndexCond
=
pPlan
->
pTagIndexCond
;
(
*
pTaskInfo
)
->
pRoot
=
createOperatorTree
(
pPlan
->
pNode
,
*
pTaskInfo
,
pHandle
,
queryId
,
taskId
,
&
(
*
pTaskInfo
)
->
tableqinfoList
);
(
*
pTaskInfo
)
->
pRoot
=
createOperatorTree
(
pPlan
->
pNode
,
*
pTaskInfo
,
pHandle
,
queryId
,
taskId
,
&
(
*
pTaskInfo
)
->
tableqinfoList
);
if
(
NULL
==
(
*
pTaskInfo
)
->
pRoot
)
{
code
=
(
*
pTaskInfo
)
->
code
;
goto
_complete
;
}
if
((
*
pTaskInfo
)
->
pRoot
==
NULL
)
{
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_complete
;
}
return
code
;
_complete:
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
54283f87
...
...
@@ -967,9 +967,9 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
while
(
tqNextDataBlock
(
pInfo
->
streamBlockReader
))
{
SSDataBlock
block
=
{
0
};
uint64_t
groupId
=
0
;
uint64_t
uid
=
0
;
int32_t
numOfRows
=
0
;
uint64_t
groupId
=
0
;
uint64_t
uid
=
0
;
int32_t
numOfRows
=
0
;
// todo refactor
int32_t
code
=
tqRetrieveDataBlock
(
&
block
,
pInfo
->
streamBlockReader
,
&
groupId
,
&
uid
,
&
numOfRows
);
...
...
@@ -1023,7 +1023,6 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
}
taosArrayDestroy
(
block
.
pDataBlock
);
if
(
pInfo
->
pRes
->
pDataBlock
==
NULL
)
{
// TODO add log
pOperator
->
status
=
OP_EXEC_DONE
;
...
...
@@ -1063,12 +1062,11 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
}
return
(
pBlockInfo
->
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
}
else
if
(
pInfo
->
blockType
==
STREAM_DATA_TYPE_FROM_SNAPSHOT
)
{
SSDataBlock
*
pResult
=
doTableScan
(
pInfo
->
pSnapshotReadOp
);
if
(
pResult
)
{
return
pResult
->
info
.
rows
>
0
?
pResult
:
NULL
;
}
return
NULL
;
return
pResult
&&
pResult
->
info
.
rows
>
0
?
pResult
:
NULL
;
}
else
{
ASSERT
(
0
);
return
NULL
;
...
...
@@ -1163,7 +1161,6 @@ SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHan
pInfo
->
pRes
=
createResDataBlock
(
pDescNode
);
pInfo
->
pUpdateRes
=
createResDataBlock
(
pDescNode
);
pInfo
->
pCondition
=
pScanPhyNode
->
node
.
pConditions
;
pInfo
->
pDataReader
=
pDataReader
;
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
pInfo
->
sessionSup
=
(
SessionWindowSupporter
){.
pStreamAggSup
=
NULL
,
.
gap
=
-
1
};
pInfo
->
groupId
=
0
;
...
...
@@ -1345,7 +1342,8 @@ static SSDataBlock* buildSysTableMetaBlock() {
SSDataBlock
*
pBlock
=
createDataBlock
();
for
(
int32_t
i
=
0
;
i
<
pMeta
[
index
].
colNum
;
++
i
)
{
SColumnInfoData
colInfoData
=
createColumnInfoData
(
pMeta
[
index
].
schema
[
i
].
type
,
pMeta
[
index
].
schema
[
i
].
bytes
,
i
+
1
);
SColumnInfoData
colInfoData
=
createColumnInfoData
(
pMeta
[
index
].
schema
[
i
].
type
,
pMeta
[
index
].
schema
[
i
].
bytes
,
i
+
1
);
blockDataAppendColInfo
(
pBlock
,
&
colInfoData
);
}
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
54283f87
...
...
@@ -390,6 +390,10 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
pInfo
->
hasGroupId
=
true
;
pInfo
->
prefetchedSortInput
=
pOperator
->
pDownstream
[
0
]
->
fpSet
.
getNextFn
(
pOperator
->
pDownstream
[
0
]);
if
(
pInfo
->
prefetchedSortInput
==
NULL
)
{
doSetOperatorCompleted
(
pOperator
);
return
NULL
;
}
pInfo
->
currGroupId
=
pInfo
->
prefetchedSortInput
->
info
.
groupId
;
pInfo
->
childOpStatus
=
CHILD_OP_NEW_GROUP
;
beginSortGroup
(
pOperator
);
...
...
@@ -463,7 +467,7 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort
pInfo
->
pColMatchInfo
=
pColMatchColInfo
;
pOperator
->
name
=
"GroupSortOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT
;
pOperator
->
blocking
=
tru
e
;
pOperator
->
blocking
=
fals
e
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
exprSupp
.
pExprInfo
=
pExprInfo
;
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
54283f87
...
...
@@ -3902,6 +3902,7 @@ typedef struct SMergeIntervalAggOperatorInfo {
SIntervalAggOperatorInfo
intervalAggOperatorInfo
;
SHashObj
*
groupIntervalHash
;
void
*
groupIntervalIter
;
bool
hasGroupId
;
uint64_t
groupId
;
SSDataBlock
*
prefetchedBlock
;
...
...
@@ -3914,6 +3915,23 @@ void destroyMergeIntervalOperatorInfo(void* param, int32_t numOfOutput) {
destroyIntervalOperatorInfo
(
&
miaInfo
->
intervalAggOperatorInfo
,
numOfOutput
);
}
static
int32_t
finalizeWindowResult
(
SOperatorInfo
*
pOperatorInfo
,
uint64_t
tableGroupId
,
STimeWindow
*
win
,
SSDataBlock
*
pResultBlock
)
{
SMergeIntervalAggOperatorInfo
*
miaInfo
=
pOperatorInfo
->
info
;
SIntervalAggOperatorInfo
*
iaInfo
=
&
miaInfo
->
intervalAggOperatorInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperatorInfo
->
pTaskInfo
;
bool
ascScan
=
(
iaInfo
->
order
==
TSDB_ORDER_ASC
);
SExprSupp
*
pExprSup
=
&
pOperatorInfo
->
exprSupp
;
SET_RES_WINDOW_KEY
(
iaInfo
->
aggSup
.
keyBuf
,
&
win
->
skey
,
TSDB_KEYSIZE
,
tableGroupId
);
SResultRowPosition
*
p1
=
(
SResultRowPosition
*
)
taosHashGet
(
iaInfo
->
aggSup
.
pResultRowHashTable
,
iaInfo
->
aggSup
.
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
TSDB_KEYSIZE
));
ASSERT
(
p1
!=
NULL
);
finalizeResultRowIntoResultDataBlock
(
iaInfo
->
aggSup
.
pResultBuf
,
p1
,
pExprSup
->
pCtx
,
pExprSup
->
pExprInfo
,
pExprSup
->
numOfExprs
,
pExprSup
->
rowEntryInfoOffset
,
pResultBlock
,
pTaskInfo
);
taosHashRemove
(
iaInfo
->
aggSup
.
pResultRowHashTable
,
iaInfo
->
aggSup
.
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
TSDB_KEYSIZE
));
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
outputPrevIntervalResult
(
SOperatorInfo
*
pOperatorInfo
,
uint64_t
tableGroupId
,
SSDataBlock
*
pResultBlock
,
STimeWindow
*
newWin
)
{
SMergeIntervalAggOperatorInfo
*
miaInfo
=
pOperatorInfo
->
info
;
...
...
@@ -3928,20 +3946,9 @@ static int32_t outputPrevIntervalResult(SOperatorInfo* pOperatorInfo, uint64_t t
return
0
;
}
if
(
newWin
==
NULL
||
(
ascScan
&&
newWin
->
skey
>
prevWin
->
ekey
||
(
!
ascScan
)
&&
newWin
->
skey
<
prevWin
->
ekey
))
{
SET_RES_WINDOW_KEY
(
iaInfo
->
aggSup
.
keyBuf
,
&
prevWin
->
skey
,
TSDB_KEYSIZE
,
tableGroupId
);
SResultRowPosition
*
p1
=
(
SResultRowPosition
*
)
taosHashGet
(
iaInfo
->
aggSup
.
pResultRowHashTable
,
iaInfo
->
aggSup
.
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
TSDB_KEYSIZE
));
ASSERT
(
p1
!=
NULL
);
finalizeResultRowIntoResultDataBlock
(
iaInfo
->
aggSup
.
pResultBuf
,
p1
,
pExprSup
->
pCtx
,
pExprSup
->
pExprInfo
,
pExprSup
->
numOfExprs
,
pExprSup
->
rowEntryInfoOffset
,
pResultBlock
,
pTaskInfo
);
taosHashRemove
(
iaInfo
->
aggSup
.
pResultRowHashTable
,
iaInfo
->
aggSup
.
keyBuf
,
GET_RES_WINDOW_KEY_LEN
(
TSDB_KEYSIZE
));
if
(
newWin
==
NULL
)
{
taosHashRemove
(
miaInfo
->
groupIntervalHash
,
&
tableGroupId
,
sizeof
(
tableGroupId
));
}
else
{
taosHashPut
(
miaInfo
->
groupIntervalHash
,
&
tableGroupId
,
sizeof
(
tableGroupId
),
newWin
,
sizeof
(
STimeWindow
));
}
if
((
ascScan
&&
newWin
->
skey
>
prevWin
->
skey
||
(
!
ascScan
)
&&
newWin
->
skey
<
prevWin
->
skey
))
{
finalizeWindowResult
(
pOperatorInfo
,
tableGroupId
,
prevWin
,
pResultBlock
);
taosHashPut
(
miaInfo
->
groupIntervalHash
,
&
tableGroupId
,
sizeof
(
tableGroupId
),
newWin
,
sizeof
(
STimeWindow
));
}
return
0
;
...
...
@@ -4090,12 +4097,17 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) {
}
pRes
->
info
.
groupId
=
miaInfo
->
groupId
;
}
else
{
void
*
p
=
taosHashIterate
(
miaInfo
->
groupIntervalHash
,
NULL
);
if
(
p
!=
NULL
)
{
}
if
(
miaInfo
->
inputBlocksFinished
)
{
void
*
win
=
taosHashIterate
(
miaInfo
->
groupIntervalHash
,
miaInfo
->
groupIntervalIter
);
if
(
win
!=
NULL
)
{
miaInfo
->
groupIntervalIter
=
win
;
size_t
len
=
0
;
uint64_t
*
pKey
=
taosHashGetKey
(
p
,
&
len
);
outputPrevIntervalResult
(
pOperator
,
*
pKey
,
pRes
,
NULL
);
uint64_t
*
pTableGroupId
=
taosHashGetKey
(
win
,
&
len
);
finalizeWindowResult
(
pOperator
,
*
pTableGroupId
,
win
,
pRes
);
pRes
->
info
.
groupId
=
*
pTableGroupId
;
}
}
...
...
@@ -4117,6 +4129,9 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprI
goto
_error
;
}
miaInfo
->
groupIntervalHash
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
true
,
HASH_NO_LOCK
);
miaInfo
->
groupIntervalIter
=
NULL
;
SIntervalAggOperatorInfo
*
iaInfo
=
&
miaInfo
->
intervalAggOperatorInfo
;
iaInfo
->
win
=
pTaskInfo
->
window
;
...
...
source/libs/function/inc/builtinsimpl.h
浏览文件 @
54283f87
...
...
@@ -202,6 +202,10 @@ bool blockDistSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo);
int32_t
blockDistFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
blockDistFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
bool
getGroupKeyFuncEnv
(
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
int32_t
groupKeyFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
groupKeyFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/function/src/builtins.c
浏览文件 @
54283f87
...
...
@@ -79,7 +79,8 @@ static int32_t translateIn2NumOutDou(SFunctionNode* pFunc, char* pErrBuf, int32_
uint8_t
para1Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
uint8_t
para2Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
if
(
!
IS_NUMERIC_TYPE
(
para1Type
)
||
!
IS_NUMERIC_TYPE
(
para2Type
))
{
if
((
!
IS_NUMERIC_TYPE
(
para1Type
)
&&
!
IS_NULL_TYPE
(
para1Type
))
||
(
!
IS_NUMERIC_TYPE
(
para2Type
)
&&
!
IS_NULL_TYPE
(
para2Type
)))
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
...
...
@@ -109,13 +110,13 @@ static int32_t translateLogarithm(SFunctionNode* pFunc, char* pErrBuf, int32_t l
}
uint8_t
para1Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
if
(
!
IS_NUMERIC_TYPE
(
para1Type
))
{
if
(
!
IS_NUMERIC_TYPE
(
para1Type
)
&&
!
IS_NULL_TYPE
(
para1Type
)
)
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
if
(
2
==
numOfParams
)
{
uint8_t
para2Type
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
))
->
resType
.
type
;
if
(
!
IS_NUMERIC_TYPE
(
para2Type
))
{
if
(
!
IS_NUMERIC_TYPE
(
para2Type
)
&&
!
IS_NULL_TYPE
(
para2Type
)
)
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
...
...
@@ -1267,6 +1268,29 @@ static bool validateMinuteRange(int8_t hour, int8_t minute, char sign) {
return
false
;
}
static
bool
validateTimestampDigits
(
const
SValueNode
*
pVal
)
{
if
(
!
IS_INTEGER_TYPE
(
pVal
->
node
.
resType
.
type
))
{
return
false
;
}
int64_t
tsVal
=
pVal
->
datum
.
i
;
char
fraction
[
20
]
=
{
0
};
NUM_TO_STRING
(
pVal
->
node
.
resType
.
type
,
&
tsVal
,
sizeof
(
fraction
),
fraction
);
int32_t
tsDigits
=
(
int32_t
)
strlen
(
fraction
);
if
(
tsDigits
>
TSDB_TIME_PRECISION_SEC_DIGITS
)
{
if
(
tsDigits
==
TSDB_TIME_PRECISION_MILLI_DIGITS
||
tsDigits
==
TSDB_TIME_PRECISION_MICRO_DIGITS
||
tsDigits
==
TSDB_TIME_PRECISION_NANO_DIGITS
)
{
return
true
;
}
else
{
return
false
;
}
}
return
true
;
}
static
bool
validateTimezoneFormat
(
const
SValueNode
*
pVal
)
{
if
(
TSDB_DATA_TYPE_BINARY
!=
pVal
->
node
.
resType
.
type
)
{
return
false
;
...
...
@@ -1379,6 +1403,15 @@ static int32_t translateToIso8601(SFunctionNode* pFunc, char* pErrBuf, int32_t l
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
if
(
QUERY_NODE_VALUE
==
nodeType
(
nodesListGetNode
(
pFunc
->
pParameterList
,
0
)))
{
SValueNode
*
pValue
=
(
SValueNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
if
(
!
validateTimestampDigits
(
pValue
))
{
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
0
,
.
type
=
TSDB_DATA_TYPE_BINARY
};
return
TSDB_CODE_SUCCESS
;
}
}
// param1
if
(
numOfParams
==
2
)
{
SValueNode
*
pValue
=
(
SValueNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
1
);
...
...
@@ -1482,6 +1515,16 @@ static bool getBlockDistFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv
return
true
;
}
static
int32_t
translateGroupKey
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
if
(
1
!=
LIST_LENGTH
(
pFunc
->
pParameterList
))
{
return
TSDB_CODE_SUCCESS
;
}
SNode
*
pPara
=
nodesListGetNode
(
pFunc
->
pParameterList
,
0
);
pFunc
->
node
.
resType
=
((
SExprNode
*
)
pPara
)
->
resType
;
return
TSDB_CODE_SUCCESS
;
}
// clang-format off
const
SBuiltinFuncDefinition
funcMgtBuiltins
[]
=
{
{
...
...
@@ -1824,7 +1867,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"last_row"
,
.
type
=
FUNCTION_TYPE_LAST_ROW
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_MULTI_RES_FUNC
|
FUNC_MGT_TIMELINE_FUNC
,
.
translateFunc
=
translateLastRow
,
.
getEnvFunc
=
getMinmaxFuncEnv
,
.
initFunc
=
minmaxFunctionSetup
,
...
...
@@ -1991,7 +2034,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"diff"
,
.
type
=
FUNCTION_TYPE_DIFF
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
translateFunc
=
translateDiff
,
.
getEnvFunc
=
getDiffFuncEnv
,
.
initFunc
=
diffFunctionSetup
,
...
...
@@ -2001,7 +2044,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"statecount"
,
.
type
=
FUNCTION_TYPE_STATE_COUNT
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
translateFunc
=
translateStateCount
,
.
getEnvFunc
=
getStateFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2011,7 +2054,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"stateduration"
,
.
type
=
FUNCTION_TYPE_STATE_DURATION
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
translateFunc
=
translateStateDuration
,
.
getEnvFunc
=
getStateFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2021,7 +2064,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"csum"
,
.
type
=
FUNCTION_TYPE_CSUM
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
translateFunc
=
translateCsum
,
.
getEnvFunc
=
getCsumFuncEnv
,
.
initFunc
=
functionSetup
,
...
...
@@ -2031,7 +2074,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
.
name
=
"mavg"
,
.
type
=
FUNCTION_TYPE_MAVG
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
|
FUNC_MGT_FORBID_WINDOW_FUNC
,
.
translateFunc
=
translateMavg
,
.
getEnvFunc
=
getMavgFuncEnv
,
.
initFunc
=
mavgFunctionSetup
,
...
...
@@ -2466,7 +2509,17 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
type
=
FUNCTION_TYPE_BLOCK_DIST_INFO
,
.
classification
=
FUNC_MGT_PSEUDO_COLUMN_FUNC
|
FUNC_MGT_SCAN_PC_FUNC
,
.
translateFunc
=
translateBlockDistInfoFunc
,
}
},
{
.
name
=
"_group_key"
,
.
type
=
FUNCTION_TYPE_GROUP_KEY
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateGroupKey
,
.
getEnvFunc
=
getGroupKeyFuncEnv
,
.
initFunc
=
functionSetup
,
.
processFunc
=
groupKeyFunction
,
.
finalizeFunc
=
groupKeyFinalize
,
},
};
// clang-format on
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/function/src/udfd.c
浏览文件 @
54283f87
...
...
@@ -613,7 +613,9 @@ int32_t udfdOpenClientRpc() {
}
int32_t
udfdCloseClientRpc
()
{
fnInfo
(
"udfd begin closing rpc"
);
rpcClose
(
global
.
clientRpc
);
fnInfo
(
"udfd finish closing rpc"
);
return
0
;
}
...
...
@@ -937,9 +939,8 @@ int main(int argc, char *argv[]) {
uv_thread_create
(
&
mnodeConnectThread
,
udfdConnectMnodeThreadFunc
,
NULL
);
udfdRun
();
removeListeningPipe
();
uv_thread_join
(
&
mnodeConnectThread
);
udfdCloseClientRpc
();
return
0
;
...
...
source/libs/monitor/src/monMain.c
浏览文件 @
54283f87
...
...
@@ -201,6 +201,9 @@ static void monGenClusterJson(SMonInfo *pMonitor) {
tjsonAddStringToObject
(
pJson
,
"version"
,
pInfo
->
version
);
tjsonAddDoubleToObject
(
pJson
,
"master_uptime"
,
pInfo
->
master_uptime
);
tjsonAddDoubleToObject
(
pJson
,
"monitor_interval"
,
pInfo
->
monitor_interval
);
tjsonAddDoubleToObject
(
pJson
,
"dbs_total"
,
pInfo
->
dbs_total
);
tjsonAddDoubleToObject
(
pJson
,
"tbs_total"
,
pInfo
->
tbs_total
);
tjsonAddDoubleToObject
(
pJson
,
"stbs_total"
,
pInfo
->
stbs_total
);
tjsonAddDoubleToObject
(
pJson
,
"vgroups_total"
,
pInfo
->
vgroups_total
);
tjsonAddDoubleToObject
(
pJson
,
"vgroups_alive"
,
pInfo
->
vgroups_alive
);
tjsonAddDoubleToObject
(
pJson
,
"vnodes_total"
,
pInfo
->
vnodes_total
);
...
...
@@ -277,6 +280,27 @@ static void monGenVgroupJson(SMonInfo *pMonitor) {
}
}
static
void
monGenStbJson
(
SMonInfo
*
pMonitor
)
{
SMonStbInfo
*
pInfo
=
&
pMonitor
->
mmInfo
.
stb
;
if
(
pMonitor
->
mmInfo
.
cluster
.
first_ep_dnode_id
==
0
)
return
;
SJson
*
pJson
=
tjsonAddArrayToObject
(
pMonitor
->
pJson
,
"stb_infos"
);
if
(
pJson
==
NULL
)
return
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
stbs
);
++
i
)
{
SJson
*
pStbJson
=
tjsonCreateObject
();
if
(
pStbJson
==
NULL
)
continue
;
if
(
tjsonAddItemToArray
(
pJson
,
pStbJson
)
!=
0
)
{
tjsonDelete
(
pStbJson
);
continue
;
}
SMonStbDesc
*
pStbDesc
=
taosArrayGet
(
pInfo
->
stbs
,
i
);
tjsonAddStringToObject
(
pStbJson
,
"stb_name"
,
pStbDesc
->
stb_name
);
tjsonAddStringToObject
(
pStbJson
,
"database_name"
,
pStbDesc
->
database_name
);
}
}
static
void
monGenGrantJson
(
SMonInfo
*
pMonitor
)
{
SMonGrantInfo
*
pInfo
=
&
pMonitor
->
mmInfo
.
grant
;
if
(
pMonitor
->
mmInfo
.
cluster
.
first_ep_dnode_id
==
0
)
return
;
...
...
@@ -524,6 +548,7 @@ void monSendReport() {
monGenBasicJson
(
pMonitor
);
monGenClusterJson
(
pMonitor
);
monGenVgroupJson
(
pMonitor
);
monGenStbJson
(
pMonitor
);
monGenGrantJson
(
pMonitor
);
monGenDnodeJson
(
pMonitor
);
monGenDiskJson
(
pMonitor
);
...
...
source/libs/monitor/src/monMsg.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/inc/parAst.h
浏览文件 @
54283f87
...
...
@@ -170,7 +170,8 @@ SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode);
SNode
*
createAlterDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
,
const
SToken
*
pConfig
,
const
SToken
*
pValue
);
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
bool
ignoreExists
,
SToken
*
pIndexName
,
SToken
*
pTableName
,
SNodeList
*
pCols
,
SNode
*
pOptions
);
SNode
*
createIndexOption
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pFuncs
,
SNode
*
pInterval
,
SNode
*
pOffset
,
SNode
*
pSliding
);
SNode
*
createIndexOption
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pFuncs
,
SNode
*
pInterval
,
SNode
*
pOffset
,
SNode
*
pSliding
,
SNode
*
pStreamOptions
);
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
SToken
*
pIndexName
);
SNode
*
createCreateComponentNodeStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pDnodeId
);
SNode
*
createDropComponentNodeStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pDnodeId
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/src/parAstCreater.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/src/parAstParser.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/src/parCalcConst.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsertData.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/src/parTokenizer.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/src/parUtil.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/src/sql.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/test/mockCatalogService.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/test/parSelectTest.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/test/parShowToUse.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/parser/test/parTestUtil.h
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/src/planLogicCreater.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/src/planOptimizer.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/src/planSpliter.c
浏览文件 @
54283f87
...
...
@@ -1040,6 +1040,7 @@ static int32_t unAllSplCreateExchangeNode(SSplitContext* pCxt, SLogicSubplan* pS
if
(
NULL
==
pExchange
->
node
.
pTargets
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
TSWAP
(
pExchange
->
node
.
pLimit
,
pProject
->
node
.
pLimit
);
pSubplan
->
subplanType
=
SUBPLAN_TYPE_MERGE
;
...
...
source/libs/planner/test/CMakeLists.txt
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/test/planBasicTest.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/test/planOrderByTest.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/test/planSetOpTest.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/test/planSubqueryTest.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/test/planTestMain.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/test/planTestUtil.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/planner/test/planTestUtil.h
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/qcom/src/querymsg.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclfunc.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/stream/inc/streamInc.h
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/stream/src/streamDispatch.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/stream/src/streamExec.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncEnv.h
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncRaftLog.h
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncAppendEntries.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncAppendEntriesReply.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncElection.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMain.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftCfg.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftLog.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncReplication.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRequestVote.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/src/syncSnapshot.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/test/syncRaftLogTest2.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/sync/test/syncRaftLogTest3.cpp
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/transport/inc/transComm.h
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/wal/src/walRead.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/libs/wal/src/walWrite.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
source/util/src/tlog.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/parallel_test/run.sh
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/pytest/util/cluster.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/pytest/util/sqlset.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/jenkins/basic.txt
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/sh/cfg.bat
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/sh/copy_udf.bat
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/sh/deploy.bat
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/sh/exec.bat
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tmp/monitor.sim
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_follower.sim
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tsim/dnode/redistribute_vgroup_replica3_v1_leader.sim
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic5.sim
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tsim/stream/partitionby1.sim
0 → 100644
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tsim/sync/3Replica1VgElect.sim
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tsim/sync/3Replica5VgElect.sim
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tsim/sync/oneReplica5VgElect.sim
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/tsim/tmq/consume.bat
0 → 100644
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/script/wtest.bat
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/0-others/taosShell.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/2-query/Now.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/2-query/To_unixtimestamp.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/2-query/first.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/2-query/function_null.py
0 → 100644
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/2-query/irate.py
0 → 100644
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/2-query/timezone.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/6-cluster/5dnode3mnodeStop.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmq3mnodeSwitch.py
0 → 100644
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqCommon.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqConsumerGroup.py
0 → 100644
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqUdf.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/simpletest.bat
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/system-test/test.py
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
tests/test/c/tmqSim.c
浏览文件 @
54283f87
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录