Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7156f525
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7156f525
编写于
6月 16, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into feature/showapps
上级
a2d19872
0d025618
变更
174
展开全部
隐藏空白更改
内联
并排
Showing
174 changed file
with
3308 addition
and
1976 deletion
+3308
-1976
.gitmodules
.gitmodules
+3
-0
Jenkinsfile2
Jenkinsfile2
+14
-0
cmake/cmake.define
cmake/cmake.define
+27
-0
docs/examples/.gitignre
docs/examples/.gitignre
+2
-0
examples/c/stream_demo.c
examples/c/stream_demo.c
+2
-1
include/common/tmsg.h
include/common/tmsg.h
+34
-5
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
include/common/ttokendef.h
include/common/ttokendef.h
+1
-1
include/libs/executor/executor.h
include/libs/executor/executor.h
+6
-3
include/libs/function/function.h
include/libs/function/function.h
+0
-1
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+2
-0
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+6
-0
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+1
-0
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+11
-2
include/libs/planner/planner.h
include/libs/planner/planner.h
+1
-1
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+31
-1
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-9
include/util/taoserror.h
include/util/taoserror.h
+5
-1
include/util/tdef.h
include/util/tdef.h
+5
-0
source/client/src/clientSml.c
source/client/src/clientSml.c
+5
-5
source/client/src/tmq.c
source/client/src/tmq.c
+84
-0
source/common/src/systable.c
source/common/src/systable.c
+3
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+16
-4
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+1
-0
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+1
-0
source/dnode/mnode/impl/inc/mndAuth.h
source/dnode/mnode/impl/inc/mndAuth.h
+32
-13
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+5
-2
source/dnode/mnode/impl/inc/mndStream.h
source/dnode/mnode/impl/inc/mndStream.h
+1
-1
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+100
-58
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+2
-19
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+5
-35
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+4
-4
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+2
-18
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+6
-24
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+10
-5
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+2
-19
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+2
-19
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+6
-2
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+3
-0
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+12
-22
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+2
-19
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+11
-30
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+105
-47
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+9
-9
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+10
-17
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+1
-8
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+31
-18
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+13
-35
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+1
-1
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+23
-8
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+13
-4
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+8
-19
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+50
-49
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+1
-1
source/libs/catalog/src/ctgDbg.c
source/libs/catalog/src/ctgDbg.c
+1
-1
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+2
-1
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+1
-4
source/libs/executor/inc/executorInt.h
source/libs/executor/inc/executorInt.h
+2
-0
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+32
-14
source/libs/executor/inc/tfill.h
source/libs/executor/inc/tfill.h
+0
-2
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+0
-246
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+13
-7
source/libs/executor/src/executorMain.c
source/libs/executor/src/executorMain.c
+12
-10
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+92
-117
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+7
-11
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+626
-55
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+4
-2
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+316
-136
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+5
-1
source/libs/function/inc/builtinsimpl.h
source/libs/function/inc/builtinsimpl.h
+4
-0
source/libs/function/inc/functionMgtInt.h
source/libs/function/inc/functionMgtInt.h
+2
-1
source/libs/function/inc/texpr.h
source/libs/function/inc/texpr.h
+0
-6
source/libs/function/inc/tunaryoperator.h
source/libs/function/inc/tunaryoperator.h
+0
-32
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+58
-4
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+217
-14
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+2
-0
source/libs/function/src/taggfunction.c
source/libs/function/src/taggfunction.c
+7
-7
source/libs/function/src/texpr.c
source/libs/function/src/texpr.c
+0
-239
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+11
-13
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+4
-1
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+2
-0
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+14
-11
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+17
-8
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+2
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+9
-3
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+14
-14
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+4
-4
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+1
-1
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+22
-12
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+26
-9
source/libs/planner/src/planScaleOut.c
source/libs/planner/src/planScaleOut.c
+49
-1
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+24
-7
source/libs/stream/inc/streamInc.h
source/libs/stream/inc/streamInc.h
+7
-0
source/libs/stream/src/stream.c
source/libs/stream/src/stream.c
+67
-1
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+8
-6
source/libs/stream/src/streamTask.c
source/libs/stream/src/streamTask.c
+2
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+112
-61
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
+1
-1
source/libs/sync/test/syncConfigChangeTest.cpp
source/libs/sync/test/syncConfigChangeTest.cpp
+1
-1
source/libs/sync/test/syncReplicateTest.cpp
source/libs/sync/test/syncReplicateTest.cpp
+1
-1
source/libs/sync/test/syncTestTool.cpp
source/libs/sync/test/syncTestTool.cpp
+1
-1
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+1
-1
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+4
-1
source/util/src/tarray.c
source/util/src/tarray.c
+5
-1
source/util/src/tcache.c
source/util/src/tcache.c
+4
-4
source/util/src/terror.c
source/util/src/terror.c
+4
-0
tests/parallel_test/collect_cases.sh
tests/parallel_test/collect_cases.sh
+11
-0
tests/parallel_test/run.sh
tests/parallel_test/run.sh
+13
-1
tests/pytest/alter/alter_replica.py
tests/pytest/alter/alter_replica.py
+1
-1
tests/pytest/functions/function_max.py
tests/pytest/functions/function_max.py
+1
-1
tests/pytest/functions/function_min.py
tests/pytest/functions/function_min.py
+1
-1
tests/pytest/functions/queryTestCases.py
tests/pytest/functions/queryTestCases.py
+1
-1
tests/pytest/insert/before_1970.py
tests/pytest/insert/before_1970.py
+1
-1
tests/pytest/insert/retentionpolicy.py
tests/pytest/insert/retentionpolicy.py
+1
-1
tests/pytest/multilevel/fileDistributionSameLevel.py
tests/pytest/multilevel/fileDistributionSameLevel.py
+2
-2
tests/pytest/multilevel/retentionTest.py
tests/pytest/multilevel/retentionTest.py
+1
-1
tests/pytest/perfbenchmark/bug3433.py
tests/pytest/perfbenchmark/bug3433.py
+1
-1
tests/pytest/perfbenchmark/joinPerformance.py
tests/pytest/perfbenchmark/joinPerformance.py
+1
-1
tests/pytest/perfbenchmark/taosdemoInsert.py
tests/pytest/perfbenchmark/taosdemoInsert.py
+1
-1
tests/pytest/query/query1970YearsAf.py
tests/pytest/query/query1970YearsAf.py
+1
-1
tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
...demoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
+1
-1
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
...st/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
+1
-1
tests/pytest/tools/taosdumpTest.py
tests/pytest/tools/taosdumpTest.py
+3
-3
tests/pytest/tools/taosdumpTestNanoSupport.py
tests/pytest/tools/taosdumpTestNanoSupport.py
+1
-1
tests/pytest/update/merge_commit_data-0.py
tests/pytest/update/merge_commit_data-0.py
+1
-1
tests/pytest/update/merge_commit_data.py
tests/pytest/update/merge_commit_data.py
+1
-1
tests/pytest/update/merge_commit_data2.py
tests/pytest/update/merge_commit_data2.py
+1
-1
tests/pytest/update/merge_commit_data2_update0.py
tests/pytest/update/merge_commit_data2_update0.py
+1
-1
tests/pytest/update/merge_commit_last.py
tests/pytest/update/merge_commit_last.py
+1
-1
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+16
-16
tests/pytest/util/sql.py
tests/pytest/util/sql.py
+2
-1
tests/pytest/util/taosdemoCfg.py
tests/pytest/util/taosdemoCfg.py
+1
-1
tests/script/general/db/alter_option.sim
tests/script/general/db/alter_option.sim
+8
-8
tests/script/general/db/backup/keep.sim
tests/script/general/db/backup/keep.sim
+2
-2
tests/script/general/db/topic1.sim
tests/script/general/db/topic1.sim
+15
-15
tests/script/general/import/commit.sim
tests/script/general/import/commit.sim
+2
-2
tests/script/general/import/replica1.sim
tests/script/general/import/replica1.sim
+1
-1
tests/script/general/parser/alter.sim
tests/script/general/parser/alter.sim
+1
-1
tests/script/general/parser/alter__for_community_version.sim
tests/script/general/parser/alter__for_community_version.sim
+1
-1
tests/script/general/parser/create_db.sim
tests/script/general/parser/create_db.sim
+3
-3
tests/script/general/parser/create_db__for_community_version.sim
...cript/general/parser/create_db__for_community_version.sim
+3
-3
tests/script/tsim/db/alter_option.sim
tests/script/tsim/db/alter_option.sim
+8
-8
tests/script/tsim/db/basic6.sim
tests/script/tsim/db/basic6.sim
+2
-2
tests/script/tsim/db/create_all_options.sim
tests/script/tsim/db/create_all_options.sim
+11
-11
tests/script/tsim/insert/commit-merge0.sim
tests/script/tsim/insert/commit-merge0.sim
+1
-1
tests/script/tsim/query/interval-offset.sim
tests/script/tsim/query/interval-offset.sim
+1
-1
tests/script/tsim/stable/alter_count.sim
tests/script/tsim/stable/alter_count.sim
+1
-1
tests/script/tsim/stable/alter_import.sim
tests/script/tsim/stable/alter_import.sim
+1
-1
tests/script/unique/db/commit.sim
tests/script/unique/db/commit.sim
+1
-1
tests/script/unique/import/replica2.sim
tests/script/unique/import/replica2.sim
+1
-1
tests/script/unique/import/replica3.sim
tests/script/unique/import/replica3.sim
+1
-1
tests/script/windows/db/basic.sim
tests/script/windows/db/basic.sim
+2
-2
tests/system-test/0-others/taosShellError.py
tests/system-test/0-others/taosShellError.py
+4
-4
tests/system-test/0-others/udfTest.py
tests/system-test/0-others/udfTest.py
+1
-1
tests/system-test/0-others/udf_cluster.py
tests/system-test/0-others/udf_cluster.py
+1
-1
tests/system-test/0-others/udf_create.py
tests/system-test/0-others/udf_create.py
+1
-1
tests/system-test/0-others/udf_restart_taosd.py
tests/system-test/0-others/udf_restart_taosd.py
+1
-1
tests/system-test/0-others/user_control.py
tests/system-test/0-others/user_control.py
+13
-7
tests/system-test/2-query/abs.py
tests/system-test/2-query/abs.py
+1
-1
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+31
-36
tests/system-test/2-query/sample.py
tests/system-test/2-query/sample.py
+1
-1
tests/system-test/6-cluster/5dnode1mnode.py
tests/system-test/6-cluster/5dnode1mnode.py
+1
-1
tests/system-test/6-cluster/5dnode2mnode.py
tests/system-test/6-cluster/5dnode2mnode.py
+7
-3
tests/system-test/6-cluster/5dnode3mnodeDrop.py
tests/system-test/6-cluster/5dnode3mnodeDrop.py
+70
-40
tests/system-test/6-cluster/5dnode3mnodeStop.py
tests/system-test/6-cluster/5dnode3mnodeStop.py
+50
-43
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
+115
-72
tests/system-test/7-tmq/basic5.py
tests/system-test/7-tmq/basic5.py
+44
-6
tests/system-test/7-tmq/schema.py
tests/system-test/7-tmq/schema.py
+170
-25
tests/system-test/7-tmq/tmqError.py
tests/system-test/7-tmq/tmqError.py
+2
-2
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+2
-1
tests/system-test/test-all.bat
tests/system-test/test-all.bat
+3
-2
tests/system-test/test.py
tests/system-test/test.py
+11
-4
tools/CMakeLists.txt
tools/CMakeLists.txt
+92
-0
未找到文件。
.gitmodules
浏览文件 @
7156f525
...
@@ -16,3 +16,6 @@
...
@@ -16,3 +16,6 @@
[submodule "tools/taos-tools"]
[submodule "tools/taos-tools"]
path = tools/taos-tools
path = tools/taos-tools
url = https://github.com/taosdata/taos-tools
url = https://github.com/taosdata/taos-tools
[submodule "tools/taosadapter"]
path = tools/taosadapter
url = https://github.com/taosdata/taosadapter.git
Jenkinsfile2
浏览文件 @
7156f525
...
@@ -38,6 +38,7 @@ def pre_test(){
...
@@ -38,6 +38,7 @@ def pre_test(){
sh '''
sh '''
hostname
hostname
date
date
env
'''
'''
sh '''
sh '''
cd ${WK}
cd ${WK}
...
@@ -82,23 +83,33 @@ def pre_test(){
...
@@ -82,23 +83,33 @@ def pre_test(){
sh '''
sh '''
cd ${WKC}
cd ${WKC}
git pull >/dev/null
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
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
git fetch origin +refs/pull/${CHANGE_ID}/merge
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
git checkout -qf FETCH_HEAD
git log -5
git log -5
echo "community log merged: `git log -5`" >>${WKDIR}/jenkins.log
cd ${WK}
cd ${WK}
git pull >/dev/null
git pull >/dev/null
git log -5
git log -5
echo "tdinternal log: `git log -5`" >>${WKDIR}/jenkins.log
'''
'''
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
sh '''
sh '''
cd ${WK}
cd ${WK}
git pull >/dev/null
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
echo "tdinternal log: `git log -5`" >>${WKDIR}/jenkins.log
git fetch origin +refs/pull/${CHANGE_ID}/merge
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
git checkout -qf FETCH_HEAD
git log -5
git log -5
echo "tdinternal log merged: `git log -5`" >>${WKDIR}/jenkins.log
cd ${WKC}
cd ${WKC}
git pull >/dev/null
git pull >/dev/null
git log -5
git log -5
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
'''
'''
} else {
} else {
sh '''
sh '''
...
@@ -113,6 +124,9 @@ def pre_test(){
...
@@ -113,6 +124,9 @@ def pre_test(){
cd ${WKPY}
cd ${WKPY}
git reset --hard
git reset --hard
git pull
git pull
git log -5
echo "python connector log: `git log -5`" >>${WKDIR}/jenkins.log
echo >>${WKDIR}/jenkins.log
'''
'''
return 1
return 1
}
}
...
...
cmake/cmake.define
浏览文件 @
7156f525
...
@@ -18,6 +18,33 @@ if (NOT DEFINED TD_GRANT)
...
@@ -18,6 +18,33 @@ if (NOT DEFINED TD_GRANT)
SET(TD_GRANT FALSE)
SET(TD_GRANT FALSE)
endif()
endif()
IF ("${BUILD_HTTP}" STREQUAL "")
IF (TD_LINUX)
IF (TD_ARM_32)
SET(TD_BUILD_HTTP TRUE)
ELSE ()
SET(TD_BUILD_HTTP TRUE)
ENDIF ()
ELSEIF (TD_DARWIN)
SET(TD_BUILD_HTTP TRUE)
ELSE ()
SET(TD_BUILD_HTTP TRUE)
ENDIF ()
ELSEIF (${BUILD_HTTP} MATCHES "false")
SET(TD_BUILD_HTTP FALSE)
ELSEIF (${BUILD_HTTP} MATCHES "true")
SET(TD_BUILD_HTTP TRUE)
ELSEIF (${BUILD_HTTP} MATCHES "internal")
SET(TD_BUILD_HTTP FALSE)
SET(TD_BUILD_TAOSA_INTERNAL TRUE)
ELSE ()
SET(TD_BUILD_HTTP TRUE)
ENDIF ()
IF (TD_BUILD_HTTP)
ADD_DEFINITIONS(-DHTTP_EMBEDDED)
ENDIF ()
IF ("${BUILD_TOOLS}" STREQUAL "")
IF ("${BUILD_TOOLS}" STREQUAL "")
IF (TD_LINUX)
IF (TD_LINUX)
IF (TD_ARM_32)
IF (TD_ARM_32)
...
...
docs/examples/.gitignre
0 → 100644
浏览文件 @
7156f525
.vscode
*.lock
\ No newline at end of file
examples/c/stream_demo.c
浏览文件 @
7156f525
...
@@ -82,7 +82,8 @@ int32_t create_stream() {
...
@@ -82,7 +82,8 @@ int32_t create_stream() {
/*const char* sql = "select sum(k) from tu1 interval(10m)";*/
/*const char* sql = "select sum(k) from tu1 interval(10m)";*/
/*pRes = tmq_create_stream(pConn, "stream1", "out1", sql);*/
/*pRes = tmq_create_stream(pConn, "stream1", "out1", sql);*/
pRes
=
taos_query
(
pRes
=
taos_query
(
pConn
,
"create stream stream1 trigger at_once into outstb as select _wstartts, sum(k) from st1 interval(10m)"
);
pConn
,
"create stream stream1 trigger max_delay 10s into outstb as select _wstartts, sum(k) from st1 interval(10m)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create stream stream1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to create stream stream1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
...
...
include/common/tmsg.h
浏览文件 @
7156f525
...
@@ -136,6 +136,8 @@ typedef enum _mgmt_table {
...
@@ -136,6 +136,8 @@ typedef enum _mgmt_table {
#define TSDB_ALTER_USER_REMOVE_WRITE_DB 0x6
#define TSDB_ALTER_USER_REMOVE_WRITE_DB 0x6
#define TSDB_ALTER_USER_ADD_ALL_DB 0x7
#define TSDB_ALTER_USER_ADD_ALL_DB 0x7
#define TSDB_ALTER_USER_REMOVE_ALL_DB 0x8
#define TSDB_ALTER_USER_REMOVE_ALL_DB 0x8
#define TSDB_ALTER_USER_ENABLE 0x9
#define TSDB_ALTER_USER_SYSINFO 0xA
#define TSDB_ALTER_USER_PRIVILEGES 0x2
#define TSDB_ALTER_USER_PRIVILEGES 0x2
...
@@ -535,6 +537,8 @@ int32_t tDeserializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq);
...
@@ -535,6 +537,8 @@ int32_t tDeserializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq);
typedef
struct
{
typedef
struct
{
int8_t
createType
;
int8_t
createType
;
int8_t
superUser
;
// denote if it is a super user or not
int8_t
superUser
;
// denote if it is a super user or not
int8_t
sysInfo
;
int8_t
enable
;
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_USET_PASSWORD_LEN
];
char
pass
[
TSDB_USET_PASSWORD_LEN
];
}
SCreateUserReq
;
}
SCreateUserReq
;
...
@@ -545,6 +549,8 @@ int32_t tDeserializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pR
...
@@ -545,6 +549,8 @@ int32_t tDeserializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pR
typedef
struct
{
typedef
struct
{
int8_t
alterType
;
int8_t
alterType
;
int8_t
superUser
;
int8_t
superUser
;
int8_t
sysInfo
;
int8_t
enable
;
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_USET_PASSWORD_LEN
];
char
pass
[
TSDB_USET_PASSWORD_LEN
];
char
dbname
[
TSDB_DB_FNAME_LEN
];
char
dbname
[
TSDB_DB_FNAME_LEN
];
...
@@ -564,6 +570,9 @@ typedef struct {
...
@@ -564,6 +570,9 @@ typedef struct {
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
int32_t
version
;
int32_t
version
;
int8_t
superAuth
;
int8_t
superAuth
;
int8_t
sysInfo
;
int8_t
enable
;
int8_t
reserve
;
SHashObj
*
createdDbs
;
SHashObj
*
createdDbs
;
SHashObj
*
readDbs
;
SHashObj
*
readDbs
;
SHashObj
*
writeDbs
;
SHashObj
*
writeDbs
;
...
@@ -1135,11 +1144,11 @@ void tFreeSMAlterStbRsp(SMAlterStbRsp* pRsp);
...
@@ -1135,11 +1144,11 @@ void tFreeSMAlterStbRsp(SMAlterStbRsp* pRsp);
int32_t
tSerializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
);
int32_t
tSerializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
);
int32_t
tDeserializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
);
int32_t
tDeserializeSTableMetaRsp
(
void
*
buf
,
int32_t
bufLen
,
STableMetaRsp
*
pRsp
);
void
tFreeSTableMetaRsp
(
STableMetaRsp
*
pRsp
);
void
tFreeSTableMetaRsp
(
STableMetaRsp
*
pRsp
);
void
tFreeSTableIndexRsp
(
void
*
info
);
void
tFreeSTableIndexRsp
(
void
*
info
);
typedef
struct
{
typedef
struct
{
SArray
*
pMetaRsp
;
// Array of STableMetaRsp
SArray
*
pMetaRsp
;
// Array of STableMetaRsp
SArray
*
pIndexRsp
;
// Array of STableIndexRsp;
SArray
*
pIndexRsp
;
// Array of STableIndexRsp;
}
SSTbHbRsp
;
}
SSTbHbRsp
;
int32_t
tSerializeSSTbHbRsp
(
void
*
buf
,
int32_t
bufLen
,
SSTbHbRsp
*
pRsp
);
int32_t
tSerializeSSTbHbRsp
(
void
*
buf
,
int32_t
bufLen
,
SSTbHbRsp
*
pRsp
);
...
@@ -1306,8 +1315,9 @@ int32_t tSerializeSSetStandbyReq(void* buf, int32_t bufLen, SSetStandbyReq* pReq
...
@@ -1306,8 +1315,9 @@ int32_t tSerializeSSetStandbyReq(void* buf, int32_t bufLen, SSetStandbyReq* pReq
int32_t
tDeserializeSSetStandbyReq
(
void
*
buf
,
int32_t
bufLen
,
SSetStandbyReq
*
pReq
);
int32_t
tDeserializeSSetStandbyReq
(
void
*
buf
,
int32_t
bufLen
,
SSetStandbyReq
*
pReq
);
typedef
struct
{
typedef
struct
{
int32_t
connId
;
int32_t
connId
;
// todo remove
int32_t
queryId
;
int32_t
queryId
;
// todo remove
char
queryStrId
[
TSDB_QUERY_ID_LEN
];
}
SKillQueryReq
;
}
SKillQueryReq
;
int32_t
tSerializeSKillQueryReq
(
void
*
buf
,
int32_t
bufLen
,
SKillQueryReq
*
pReq
);
int32_t
tSerializeSKillQueryReq
(
void
*
buf
,
int32_t
bufLen
,
SKillQueryReq
*
pReq
);
...
@@ -2266,6 +2276,25 @@ typedef struct {
...
@@ -2266,6 +2276,25 @@ typedef struct {
int8_t
reserved
;
int8_t
reserved
;
}
SMqVDeleteRsp
;
}
SMqVDeleteRsp
;
typedef
struct
{
char
name
[
TSDB_STREAM_FNAME_LEN
];
int64_t
streamId
;
}
SMDropStreamTaskReq
;
typedef
struct
{
int8_t
reserved
;
}
SMDropStreamTaskRsp
;
typedef
struct
{
SMsgHead
head
;
int64_t
leftForVer
;
int32_t
taskId
;
}
SVDropStreamTaskReq
;
typedef
struct
{
int8_t
reserved
;
}
SVDropStreamTaskRsp
;
typedef
struct
{
typedef
struct
{
int64_t
leftForVer
;
int64_t
leftForVer
;
int32_t
vgId
;
int32_t
vgId
;
...
...
include/common/tmsgdef.h
浏览文件 @
7156f525
...
@@ -187,6 +187,7 @@ enum {
...
@@ -187,6 +187,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_CONSUME
,
"vnode-consume"
,
SMqPollReq
,
SMqDataBlkRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CONSUME
,
"vnode-consume"
,
SMqPollReq
,
SMqDataBlkRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_STREAM_TRIGGER
,
"vnode-stream-trigger"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_STREAM_TRIGGER
,
"vnode-stream-trigger"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_STREAM_DISPATCH_WRITE
,
"vnode-stream-task-dispatch-write"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_STREAM_DISPATCH_WRITE
,
"vnode-stream-task-dispatch-write"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_STREAM_TASK_DROP
,
"vnode-stream-task-drop"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CREATE_SMA
,
"vnode-create-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CREATE_SMA
,
"vnode-create-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CANCEL_SMA
,
"vnode-cancel-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CANCEL_SMA
,
"vnode-cancel-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_SMA
,
"vnode-drop-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_SMA
,
"vnode-drop-sma"
,
NULL
,
NULL
)
...
...
include/common/ttokendef.h
浏览文件 @
7156f525
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
#define TK_BUFFER 60
#define TK_BUFFER 60
#define TK_CACHELAST 61
#define TK_CACHELAST 61
#define TK_COMP 62
#define TK_COMP 62
#define TK_D
AYS
63
#define TK_D
URATION
63
#define TK_NK_VARIABLE 64
#define TK_NK_VARIABLE 64
#define TK_FSYNC 65
#define TK_FSYNC 65
#define TK_MAXROWS 66
#define TK_MAXROWS 66
...
...
include/libs/executor/executor.h
浏览文件 @
7156f525
...
@@ -38,8 +38,10 @@ typedef struct SReadHandle {
...
@@ -38,8 +38,10 @@ typedef struct SReadHandle {
SMsgCb
*
pMsgCb
;
SMsgCb
*
pMsgCb
;
}
SReadHandle
;
}
SReadHandle
;
#define STREAM_DATA_TYPE_SUBMIT_BLOCK 0x1
enum
{
#define STREAM_DATA_TYPE_SSDATA_BLOCK 0x2
STREAM_DATA_TYPE_SUBMIT_BLOCK
=
1
,
STREAM_DATA_TYPE_SSDATA_BLOCK
=
2
,
};
typedef
enum
{
typedef
enum
{
OPTR_EXEC_MODEL_BATCH
=
0x1
,
OPTR_EXEC_MODEL_BATCH
=
0x1
,
...
@@ -102,7 +104,8 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
...
@@ -102,7 +104,8 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId,
* @param tversion
* @param tversion
* @return
* @return
*/
*/
int32_t
qGetQueriedTableSchemaVersion
(
qTaskInfo_t
tinfo
,
char
*
dbName
,
char
*
tableName
,
int32_t
*
sversion
,
int32_t
*
tversion
);
int32_t
qGetQueriedTableSchemaVersion
(
qTaskInfo_t
tinfo
,
char
*
dbName
,
char
*
tableName
,
int32_t
*
sversion
,
int32_t
*
tversion
);
/**
/**
* The main task execution function, including query on both table and multiple tables,
* The main task execution function, including query on both table and multiple tables,
...
...
include/libs/function/function.h
浏览文件 @
7156f525
...
@@ -132,7 +132,6 @@ typedef struct SqlFunctionCtx {
...
@@ -132,7 +132,6 @@ typedef struct SqlFunctionCtx {
char
*
pOutput
;
// final result output buffer, point to sdata->data
char
*
pOutput
;
// final result output buffer, point to sdata->data
int32_t
numOfParams
;
int32_t
numOfParams
;
SFunctParam
*
param
;
// input parameter, e.g., top(k, 20), the number of results for top query is kept in param
SFunctParam
*
param
;
// input parameter, e.g., top(k, 20), the number of results for top query is kept in param
int64_t
*
ptsList
;
// corresponding timestamp array list, todo remove it
SColumnInfoData
*
pTsOutput
;
// corresponding output buffer for timestamp of each result, e.g., top/bottom*/
SColumnInfoData
*
pTsOutput
;
// corresponding output buffer for timestamp of each result, e.g., top/bottom*/
int32_t
offset
;
int32_t
offset
;
struct
SResultRowEntryInfo
*
resultInfo
;
struct
SResultRowEntryInfo
*
resultInfo
;
...
...
include/libs/function/functionMgt.h
浏览文件 @
7156f525
...
@@ -134,6 +134,7 @@ typedef enum EFunctionType {
...
@@ -134,6 +134,7 @@ typedef enum EFunctionType {
FUNCTION_TYPE_HYPERLOGLOG_MERGE
,
FUNCTION_TYPE_HYPERLOGLOG_MERGE
,
FUNCTION_TYPE_ELAPSED_PARTIAL
,
FUNCTION_TYPE_ELAPSED_PARTIAL
,
FUNCTION_TYPE_ELAPSED_MERGE
,
FUNCTION_TYPE_ELAPSED_MERGE
,
FUNCTION_TYPE_TOP_PARTIAL
,
FUNCTION_TYPE_TOP_PARTIAL
,
FUNCTION_TYPE_TOP_MERGE
,
FUNCTION_TYPE_TOP_MERGE
,
FUNCTION_TYPE_BOTTOM_PARTIAL
,
FUNCTION_TYPE_BOTTOM_PARTIAL
,
...
@@ -184,6 +185,7 @@ bool fmIsUserDefinedFunc(int32_t funcId);
...
@@ -184,6 +185,7 @@ bool fmIsUserDefinedFunc(int32_t funcId);
bool
fmIsDistExecFunc
(
int32_t
funcId
);
bool
fmIsDistExecFunc
(
int32_t
funcId
);
bool
fmIsForbidFillFunc
(
int32_t
funcId
);
bool
fmIsForbidFillFunc
(
int32_t
funcId
);
bool
fmIsForbidStreamFunc
(
int32_t
funcId
);
bool
fmIsForbidStreamFunc
(
int32_t
funcId
);
bool
fmIsIntervalInterpoFunc
(
int32_t
funcId
);
int32_t
fmGetDistMethod
(
const
SFunctionNode
*
pFunc
,
SFunctionNode
**
pPartialFunc
,
SFunctionNode
**
pMergeFunc
);
int32_t
fmGetDistMethod
(
const
SFunctionNode
*
pFunc
,
SFunctionNode
**
pPartialFunc
,
SFunctionNode
**
pMergeFunc
);
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
7156f525
...
@@ -89,6 +89,7 @@ typedef struct STableOptions {
...
@@ -89,6 +89,7 @@ typedef struct STableOptions {
ENodeType
type
;
ENodeType
type
;
char
comment
[
TSDB_TB_COMMENT_LEN
];
char
comment
[
TSDB_TB_COMMENT_LEN
];
double
filesFactor
;
double
filesFactor
;
int32_t
delay
;
SNodeList
*
pRollupFuncs
;
SNodeList
*
pRollupFuncs
;
int32_t
ttl
;
int32_t
ttl
;
SNodeList
*
pSma
;
SNodeList
*
pSma
;
...
@@ -286,6 +287,11 @@ typedef struct SKillStmt {
...
@@ -286,6 +287,11 @@ typedef struct SKillStmt {
int32_t
targetId
;
int32_t
targetId
;
}
SKillStmt
;
}
SKillStmt
;
typedef
struct
SKillQueryStmt
{
ENodeType
type
;
char
queryId
[
TSDB_QUERY_ID_LEN
];
}
SKillQueryStmt
;
typedef
struct
SStreamOptions
{
typedef
struct
SStreamOptions
{
ENodeType
type
;
ENodeType
type
;
int8_t
triggerType
;
int8_t
triggerType
;
...
...
include/libs/nodes/nodes.h
浏览文件 @
7156f525
...
@@ -204,6 +204,7 @@ typedef enum ENodeType {
...
@@ -204,6 +204,7 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
,
QUERY_NODE_PHYSICAL_PLAN_PROJECT
,
QUERY_NODE_PHYSICAL_PLAN_PROJECT
,
...
...
include/libs/nodes/plannodes.h
浏览文件 @
7156f525
...
@@ -34,7 +34,13 @@ typedef struct SLogicNode {
...
@@ -34,7 +34,13 @@ typedef struct SLogicNode {
uint8_t
precision
;
uint8_t
precision
;
}
SLogicNode
;
}
SLogicNode
;
typedef
enum
EScanType
{
SCAN_TYPE_TAG
=
1
,
SCAN_TYPE_TABLE
,
SCAN_TYPE_SYSTEM_TABLE
,
SCAN_TYPE_STREAM
}
EScanType
;
typedef
enum
EScanType
{
SCAN_TYPE_TAG
=
1
,
SCAN_TYPE_TABLE
,
SCAN_TYPE_SYSTEM_TABLE
,
SCAN_TYPE_STREAM
,
SCAN_TYPE_TABLE_MERGE
}
EScanType
;
typedef
struct
SScanLogicNode
{
typedef
struct
SScanLogicNode
{
SLogicNode
node
;
SLogicNode
node
;
...
@@ -171,7 +177,8 @@ typedef enum ESubplanType {
...
@@ -171,7 +177,8 @@ typedef enum ESubplanType {
SUBPLAN_TYPE_MERGE
=
1
,
SUBPLAN_TYPE_MERGE
=
1
,
SUBPLAN_TYPE_PARTIAL
,
SUBPLAN_TYPE_PARTIAL
,
SUBPLAN_TYPE_SCAN
,
SUBPLAN_TYPE_SCAN
,
SUBPLAN_TYPE_MODIFY
SUBPLAN_TYPE_MODIFY
,
SUBPLAN_TYPE_COMPUTE
}
ESubplanType
;
}
ESubplanType
;
typedef
struct
SSubplanId
{
typedef
struct
SSubplanId
{
...
@@ -190,6 +197,7 @@ typedef struct SLogicSubplan {
...
@@ -190,6 +197,7 @@ typedef struct SLogicSubplan {
SVgroupsInfo
*
pVgroupList
;
SVgroupsInfo
*
pVgroupList
;
int32_t
level
;
int32_t
level
;
int32_t
splitFlag
;
int32_t
splitFlag
;
int32_t
numOfComputeNodes
;
}
SLogicSubplan
;
}
SLogicSubplan
;
typedef
struct
SQueryLogicPlan
{
typedef
struct
SQueryLogicPlan
{
...
@@ -262,6 +270,7 @@ typedef struct STableScanPhysiNode {
...
@@ -262,6 +270,7 @@ typedef struct STableScanPhysiNode {
}
STableScanPhysiNode
;
}
STableScanPhysiNode
;
typedef
STableScanPhysiNode
STableSeqScanPhysiNode
;
typedef
STableScanPhysiNode
STableSeqScanPhysiNode
;
typedef
STableScanPhysiNode
STableMergeScanPhysiNode
;
typedef
STableScanPhysiNode
SStreamScanPhysiNode
;
typedef
STableScanPhysiNode
SStreamScanPhysiNode
;
typedef
struct
SProjectPhysiNode
{
typedef
struct
SProjectPhysiNode
{
...
...
include/libs/planner/planner.h
浏览文件 @
7156f525
...
@@ -36,7 +36,7 @@ typedef struct SPlanContext {
...
@@ -36,7 +36,7 @@ typedef struct SPlanContext {
int64_t
watermark
;
int64_t
watermark
;
char
*
pMsg
;
char
*
pMsg
;
int32_t
msgLen
;
int32_t
msgLen
;
double
filesFactor
;
//
double filesFactor;
}
SPlanContext
;
}
SPlanContext
;
// Create the physical plan for the query, according to the AST.
// Create the physical plan for the query, according to the AST.
...
...
include/libs/stream/tstream.h
浏览文件 @
7156f525
...
@@ -58,6 +58,7 @@ enum {
...
@@ -58,6 +58,7 @@ enum {
enum
{
enum
{
STREAM_INPUT__DATA_SUBMIT
=
1
,
STREAM_INPUT__DATA_SUBMIT
=
1
,
STREAM_INPUT__DATA_BLOCK
,
STREAM_INPUT__DATA_BLOCK
,
STREAM_INPUT__TRIGGER
,
STREAM_INPUT__CHECKPOINT
,
STREAM_INPUT__CHECKPOINT
,
};
};
...
@@ -85,6 +86,11 @@ typedef struct {
...
@@ -85,6 +86,11 @@ typedef struct {
int8_t
type
;
int8_t
type
;
}
SStreamCheckpoint
;
}
SStreamCheckpoint
;
typedef
struct
{
int8_t
type
;
SSDataBlock
*
pBlock
;
}
SStreamTrigger
;
enum
{
enum
{
STREAM_QUEUE__SUCESS
=
1
,
STREAM_QUEUE__SUCESS
=
1
,
STREAM_QUEUE__FAILED
,
STREAM_QUEUE__FAILED
,
...
@@ -98,6 +104,9 @@ typedef struct {
...
@@ -98,6 +104,9 @@ typedef struct {
int8_t
status
;
int8_t
status
;
}
SStreamQueue
;
}
SStreamQueue
;
int32_t
streamInit
();
void
streamCleanUp
();
SStreamQueue
*
streamQueueOpen
();
SStreamQueue
*
streamQueueOpen
();
void
streamQueueClose
(
SStreamQueue
*
queue
);
void
streamQueueClose
(
SStreamQueue
*
queue
);
...
@@ -220,6 +229,11 @@ enum {
...
@@ -220,6 +229,11 @@ enum {
TASK_INPUT_TYPE__DATA_BLOCK
,
TASK_INPUT_TYPE__DATA_BLOCK
,
};
};
enum
{
TASK_TRIGGER_STATUS__IN_ACTIVE
=
1
,
TASK_TRIGGER_STATUS__ACTIVE
,
};
struct
SStreamTask
{
struct
SStreamTask
{
int64_t
streamId
;
int64_t
streamId
;
int32_t
taskId
;
int32_t
taskId
;
...
@@ -262,8 +276,16 @@ struct SStreamTask {
...
@@ -262,8 +276,16 @@ struct SStreamTask {
SStreamQueue
*
inputQueue
;
SStreamQueue
*
inputQueue
;
SStreamQueue
*
outputQueue
;
SStreamQueue
*
outputQueue
;
// trigger
int8_t
triggerStatus
;
int64_t
triggerParam
;
void
*
timer
;
// application storage
// application storage
// void* ahandle;
// void* ahandle;
// msg handle
SMsgCb
*
pMsgCb
;
};
};
SStreamTask
*
tNewSStreamTask
(
int64_t
streamId
);
SStreamTask
*
tNewSStreamTask
(
int64_t
streamId
);
...
@@ -292,6 +314,13 @@ static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem
...
@@ -292,6 +314,13 @@ static FORCE_INLINE int32_t streamTaskInput(SStreamTask* pTask, SStreamQueueItem
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
}
else
if
(
pItem
->
type
==
STREAM_INPUT__CHECKPOINT
)
{
}
else
if
(
pItem
->
type
==
STREAM_INPUT__CHECKPOINT
)
{
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
}
else
if
(
pItem
->
type
==
STREAM_INPUT__TRIGGER
)
{
taosWriteQitem
(
pTask
->
inputQueue
->
queue
,
pItem
);
}
if
(
pItem
->
type
!=
STREAM_INPUT__TRIGGER
&&
pItem
->
type
!=
STREAM_INPUT__CHECKPOINT
&&
pTask
->
triggerParam
!=
0
&&
pTask
->
triggerStatus
==
TASK_TRIGGER_STATUS__IN_ACTIVE
)
{
atomic_store_8
(
&
pTask
->
triggerStatus
,
TASK_TRIGGER_STATUS__ACTIVE
);
}
}
// TODO: back pressure
// TODO: back pressure
...
@@ -370,7 +399,8 @@ typedef struct {
...
@@ -370,7 +399,8 @@ typedef struct {
int32_t
tDecodeStreamDispatchReq
(
SDecoder
*
pDecoder
,
SStreamDispatchReq
*
pReq
);
int32_t
tDecodeStreamDispatchReq
(
SDecoder
*
pDecoder
,
SStreamDispatchReq
*
pReq
);
int32_t
streamTriggerByWrite
(
SStreamTask
*
pTask
,
int32_t
vgId
,
SMsgCb
*
pMsgCb
);
int32_t
streamLaunchByWrite
(
SStreamTask
*
pTask
,
int32_t
vgId
,
SMsgCb
*
pMsgCb
);
int32_t
streamSetupTrigger
(
SStreamTask
*
pTask
);
int32_t
streamTaskRun
(
SStreamTask
*
pTask
);
int32_t
streamTaskRun
(
SStreamTask
*
pTask
);
...
...
include/libs/sync/sync.h
浏览文件 @
7156f525
...
@@ -24,7 +24,7 @@ extern "C" {
...
@@ -24,7 +24,7 @@ extern "C" {
#include "tdef.h"
#include "tdef.h"
#include "tmsgcb.h"
#include "tmsgcb.h"
#define SYNC_INDEX_BEGIN 0
#define SYNC_INDEX_BEGIN
0
#define SYNC_INDEX_INVALID -1
#define SYNC_INDEX_INVALID -1
typedef
uint64_t
SyncNodeId
;
typedef
uint64_t
SyncNodeId
;
...
@@ -44,14 +44,6 @@ typedef enum {
...
@@ -44,14 +44,6 @@ typedef enum {
TAOS_SYNC_STATE_ERROR
=
103
,
TAOS_SYNC_STATE_ERROR
=
103
,
}
ESyncState
;
}
ESyncState
;
typedef
enum
{
TAOS_SYNC_PROPOSE_SUCCESS
=
0
,
TAOS_SYNC_PROPOSE_NOT_LEADER
=
1
,
TAOS_SYNC_ONLY_ONE_REPLICA
=
2
,
TAOS_SYNC_NOT_IN_NEW_CONFIG
=
3
,
TAOS_SYNC_OTHER_ERROR
=
100
,
}
ESyncProposeCode
;
typedef
enum
{
typedef
enum
{
TAOS_SYNC_FSM_CB_SUCCESS
=
0
,
TAOS_SYNC_FSM_CB_SUCCESS
=
0
,
TAOS_SYNC_FSM_CB_OTHER_ERROR
=
1
,
TAOS_SYNC_FSM_CB_OTHER_ERROR
=
1
,
...
...
include/util/taoserror.h
浏览文件 @
7156f525
...
@@ -132,7 +132,8 @@ int32_t* taosGetErrno();
...
@@ -132,7 +132,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0300)
#define TSDB_CODE_MND_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0300)
#define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0301)
#define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0301)
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0302)
#define TSDB_CODE_MND_NO_RIGHTS TAOS_DEF_ERROR_CODE(0, 0x0302)
#define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0303)
#define TSDB_CODE_MND_USER_DISABLED TAOS_DEF_ERROR_CODE(0, 0x0303)
#define TSDB_CODE_MND_INVALID_CONNECTION TAOS_DEF_ERROR_CODE(0, 0x0304)
// mnode-show
// mnode-show
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x0310)
#define TSDB_CODE_MND_INVALID_SHOWOBJ TAOS_DEF_ERROR_CODE(0, 0x0310)
...
@@ -411,6 +412,8 @@ int32_t* taosGetErrno();
...
@@ -411,6 +412,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_SYN_INVALID_MSGTYPE TAOS_DEF_ERROR_CODE(0, 0x090A)
#define TSDB_CODE_SYN_INVALID_MSGTYPE TAOS_DEF_ERROR_CODE(0, 0x090A)
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x0910)
#define TSDB_CODE_SYN_NOT_LEADER TAOS_DEF_ERROR_CODE(0, 0x0910)
#define TSDB_CODE_SYN_ONE_REPLICA TAOS_DEF_ERROR_CODE(0, 0x0911)
#define TSDB_CODE_SYN_NOT_IN_NEW_CONFIG TAOS_DEF_ERROR_CODE(0, 0x0912)
#define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF)
#define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF)
// tq
// tq
...
@@ -434,6 +437,7 @@ int32_t* taosGetErrno();
...
@@ -434,6 +437,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_WAL_SIZE_LIMIT TAOS_DEF_ERROR_CODE(0, 0x1002)
#define TSDB_CODE_WAL_SIZE_LIMIT TAOS_DEF_ERROR_CODE(0, 0x1002)
#define TSDB_CODE_WAL_INVALID_VER TAOS_DEF_ERROR_CODE(0, 0x1003)
#define TSDB_CODE_WAL_INVALID_VER TAOS_DEF_ERROR_CODE(0, 0x1003)
#define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1004)
#define TSDB_CODE_WAL_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x1004)
#define TSDB_CODE_WAL_LOG_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x1005)
// http
// http
#define TSDB_CODE_HTTP_SERVER_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x1100) //"http server is not online"
#define TSDB_CODE_HTTP_SERVER_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x1100) //"http server is not online"
...
...
include/util/tdef.h
浏览文件 @
7156f525
...
@@ -222,6 +222,8 @@ typedef enum ELogicConditionType {
...
@@ -222,6 +222,8 @@ typedef enum ELogicConditionType {
#define TSDB_APP_NAME_LEN TSDB_UNI_LEN
#define TSDB_APP_NAME_LEN TSDB_UNI_LEN
#define TSDB_TB_COMMENT_LEN 1025
#define TSDB_TB_COMMENT_LEN 1025
#define TSDB_QUERY_ID_LEN 26
/**
/**
* In some scenarios uint16_t (0~65535) is used to store the row len.
* In some scenarios uint16_t (0~65535) is used to store the row len.
* - Firstly, we use 65531(65535 - 4), as the SDataRow/SKVRow contains 4 bits header.
* - Firstly, we use 65531(65535 - 4), as the SDataRow/SKVRow contains 4 bits header.
...
@@ -342,6 +344,9 @@ typedef enum ELogicConditionType {
...
@@ -342,6 +344,9 @@ typedef enum ELogicConditionType {
#define TSDB_DB_SCHEMALESS_OFF 0
#define TSDB_DB_SCHEMALESS_OFF 0
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
// #define TSDB_MIN_ROLLUP_DELAY 1
// #define TSDB_MAX_ROLLUP_DELAY 10
// #define TSDB_DEFAULT_ROLLUP_DELAY 1
#define TSDB_MIN_ROLLUP_FILE_FACTOR 0
#define TSDB_MIN_ROLLUP_FILE_FACTOR 0
#define TSDB_MAX_ROLLUP_FILE_FACTOR 10
#define TSDB_MAX_ROLLUP_FILE_FACTOR 10
#define TSDB_DEFAULT_ROLLUP_FILE_FACTOR 0.1
#define TSDB_DEFAULT_ROLLUP_FILE_FACTOR 0.1
...
...
source/client/src/clientSml.c
浏览文件 @
7156f525
...
@@ -309,7 +309,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
...
@@ -309,7 +309,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
case
SCHEMA_ACTION_ADD_COLUMN
:
{
case
SCHEMA_ACTION_ADD_COLUMN
:
{
int
n
=
sprintf
(
result
,
"alter stable `%s` add column "
,
action
->
alterSTable
.
sTableName
);
int
n
=
sprintf
(
result
,
"alter stable `%s` add column "
,
action
->
alterSTable
.
sTableName
);
smlBuildColumnDescription
(
action
->
alterSTable
.
field
,
result
+
n
,
capacity
-
n
,
&
outBytes
);
smlBuildColumnDescription
(
action
->
alterSTable
.
field
,
result
+
n
,
capacity
-
n
,
&
outBytes
);
TAOS_RES
*
res
=
taos_query
(
info
->
taos
,
result
);
// TODO async doAsyncQuery
TAOS_RES
*
res
=
taos_query
(
(
TAOS
*
)
info
->
taos
->
id
,
result
);
// TODO async doAsyncQuery
code
=
taos_errno
(
res
);
code
=
taos_errno
(
res
);
const
char
*
errStr
=
taos_errstr
(
res
);
const
char
*
errStr
=
taos_errstr
(
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -323,7 +323,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
...
@@ -323,7 +323,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
case
SCHEMA_ACTION_ADD_TAG
:
{
case
SCHEMA_ACTION_ADD_TAG
:
{
int
n
=
sprintf
(
result
,
"alter stable `%s` add tag "
,
action
->
alterSTable
.
sTableName
);
int
n
=
sprintf
(
result
,
"alter stable `%s` add tag "
,
action
->
alterSTable
.
sTableName
);
smlBuildColumnDescription
(
action
->
alterSTable
.
field
,
result
+
n
,
capacity
-
n
,
&
outBytes
);
smlBuildColumnDescription
(
action
->
alterSTable
.
field
,
result
+
n
,
capacity
-
n
,
&
outBytes
);
TAOS_RES
*
res
=
taos_query
(
info
->
taos
,
result
);
// TODO async doAsyncQuery
TAOS_RES
*
res
=
taos_query
(
(
TAOS
*
)
info
->
taos
->
id
,
result
);
// TODO async doAsyncQuery
code
=
taos_errno
(
res
);
code
=
taos_errno
(
res
);
const
char
*
errStr
=
taos_errstr
(
res
);
const
char
*
errStr
=
taos_errstr
(
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -337,7 +337,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
...
@@ -337,7 +337,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
case
SCHEMA_ACTION_CHANGE_COLUMN_SIZE
:
{
case
SCHEMA_ACTION_CHANGE_COLUMN_SIZE
:
{
int
n
=
sprintf
(
result
,
"alter stable `%s` modify column "
,
action
->
alterSTable
.
sTableName
);
int
n
=
sprintf
(
result
,
"alter stable `%s` modify column "
,
action
->
alterSTable
.
sTableName
);
smlBuildColumnDescription
(
action
->
alterSTable
.
field
,
result
+
n
,
capacity
-
n
,
&
outBytes
);
smlBuildColumnDescription
(
action
->
alterSTable
.
field
,
result
+
n
,
capacity
-
n
,
&
outBytes
);
TAOS_RES
*
res
=
taos_query
(
info
->
taos
,
result
);
// TODO async doAsyncQuery
TAOS_RES
*
res
=
taos_query
(
(
TAOS
*
)
info
->
taos
->
id
,
result
);
// TODO async doAsyncQuery
code
=
taos_errno
(
res
);
code
=
taos_errno
(
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" apply schema action. error : %s"
,
info
->
id
,
taos_errstr
(
res
));
uError
(
"SML:0x%"
PRIx64
" apply schema action. error : %s"
,
info
->
id
,
taos_errstr
(
res
));
...
@@ -350,7 +350,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
...
@@ -350,7 +350,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
case
SCHEMA_ACTION_CHANGE_TAG_SIZE
:
{
case
SCHEMA_ACTION_CHANGE_TAG_SIZE
:
{
int
n
=
sprintf
(
result
,
"alter stable `%s` modify tag "
,
action
->
alterSTable
.
sTableName
);
int
n
=
sprintf
(
result
,
"alter stable `%s` modify tag "
,
action
->
alterSTable
.
sTableName
);
smlBuildColumnDescription
(
action
->
alterSTable
.
field
,
result
+
n
,
capacity
-
n
,
&
outBytes
);
smlBuildColumnDescription
(
action
->
alterSTable
.
field
,
result
+
n
,
capacity
-
n
,
&
outBytes
);
TAOS_RES
*
res
=
taos_query
(
info
->
taos
,
result
);
// TODO async doAsyncQuery
TAOS_RES
*
res
=
taos_query
(
(
TAOS
*
)
info
->
taos
->
id
,
result
);
// TODO async doAsyncQuery
code
=
taos_errno
(
res
);
code
=
taos_errno
(
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" apply schema action. error : %s"
,
info
->
id
,
taos_errstr
(
res
));
uError
(
"SML:0x%"
PRIx64
" apply schema action. error : %s"
,
info
->
id
,
taos_errstr
(
res
));
...
@@ -405,7 +405,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
...
@@ -405,7 +405,7 @@ static int32_t smlApplySchemaAction(SSmlHandle *info, SSchemaAction *action) {
pos
--
;
pos
--
;
++
freeBytes
;
++
freeBytes
;
outBytes
=
snprintf
(
pos
,
freeBytes
,
")"
);
outBytes
=
snprintf
(
pos
,
freeBytes
,
")"
);
TAOS_RES
*
res
=
taos_query
(
info
->
taos
,
result
);
TAOS_RES
*
res
=
taos_query
(
(
TAOS
*
)
info
->
taos
->
id
,
result
);
code
=
taos_errno
(
res
);
code
=
taos_errno
(
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" apply schema action. error : %s"
,
info
->
id
,
taos_errstr
(
res
));
uError
(
"SML:0x%"
PRIx64
" apply schema action. error : %s"
,
info
->
id
,
taos_errstr
(
res
));
...
...
source/client/src/tmq.c
浏览文件 @
7156f525
...
@@ -992,6 +992,90 @@ CREATE_MSG_FAIL:
...
@@ -992,6 +992,90 @@ CREATE_MSG_FAIL:
return
-
1
;
return
-
1
;
}
}
bool
tmqUpdateEp2
(
tmq_t
*
tmq
,
int32_t
epoch
,
SMqAskEpRsp
*
pRsp
)
{
bool
set
=
false
;
int32_t
topicNumGet
=
taosArrayGetSize
(
pRsp
->
topics
);
char
vgKey
[
TSDB_TOPIC_FNAME_LEN
+
22
];
tscDebug
(
"consumer %ld update ep epoch %d to epoch %d, topic num: %d"
,
tmq
->
consumerId
,
tmq
->
epoch
,
epoch
,
topicNumGet
);
SArray
*
newTopics
=
taosArrayInit
(
topicNumGet
,
sizeof
(
SMqClientTopic
));
if
(
newTopics
==
NULL
)
{
return
false
;
}
SHashObj
*
pHash
=
taosHashInit
(
64
,
MurmurHash3_32
,
false
,
HASH_NO_LOCK
);
if
(
pHash
==
NULL
)
{
taosArrayDestroy
(
newTopics
);
return
false
;
}
int32_t
topicNumCur
=
taosArrayGetSize
(
tmq
->
clientTopics
);
for
(
int32_t
i
=
0
;
i
<
topicNumCur
;
i
++
)
{
// find old topic
SMqClientTopic
*
pTopicCur
=
taosArrayGet
(
tmq
->
clientTopics
,
i
);
if
(
pTopicCur
->
vgs
)
{
int32_t
vgNumCur
=
taosArrayGetSize
(
pTopicCur
->
vgs
);
tscDebug
(
"consumer %ld new vg num: %d"
,
tmq
->
consumerId
,
vgNumCur
);
if
(
vgNumCur
==
0
)
break
;
for
(
int32_t
j
=
0
;
j
<
vgNumCur
;
j
++
)
{
SMqClientVg
*
pVgCur
=
taosArrayGet
(
pTopicCur
->
vgs
,
j
);
sprintf
(
vgKey
,
"%s:%d"
,
pTopicCur
->
topicName
,
pVgCur
->
vgId
);
tscDebug
(
"consumer %ld epoch %d vg %d build %s"
,
tmq
->
consumerId
,
epoch
,
pVgCur
->
vgId
,
vgKey
);
taosHashPut
(
pHash
,
vgKey
,
strlen
(
vgKey
),
&
pVgCur
->
currentOffset
,
sizeof
(
int64_t
));
}
break
;
}
}
for
(
int32_t
i
=
0
;
i
<
topicNumGet
;
i
++
)
{
SMqClientTopic
topic
=
{
0
};
SMqSubTopicEp
*
pTopicEp
=
taosArrayGet
(
pRsp
->
topics
,
i
);
topic
.
schema
=
pTopicEp
->
schema
;
taosHashClear
(
pHash
);
topic
.
topicName
=
strdup
(
pTopicEp
->
topic
);
tstrncpy
(
topic
.
db
,
pTopicEp
->
db
,
TSDB_DB_FNAME_LEN
);
tscDebug
(
"consumer %ld update topic: %s"
,
tmq
->
consumerId
,
topic
.
topicName
);
int32_t
vgNumGet
=
taosArrayGetSize
(
pTopicEp
->
vgs
);
topic
.
vgs
=
taosArrayInit
(
vgNumGet
,
sizeof
(
SMqClientVg
));
for
(
int32_t
j
=
0
;
j
<
vgNumGet
;
j
++
)
{
SMqSubVgEp
*
pVgEp
=
taosArrayGet
(
pTopicEp
->
vgs
,
j
);
sprintf
(
vgKey
,
"%s:%d"
,
topic
.
topicName
,
pVgEp
->
vgId
);
int64_t
*
pOffset
=
taosHashGet
(
pHash
,
vgKey
,
strlen
(
vgKey
));
int64_t
offset
=
tmq
->
resetOffsetCfg
;
if
(
pOffset
!=
NULL
)
{
offset
=
*
pOffset
;
}
tscDebug
(
"consumer %ld(epoch %d) offset of vg %d updated to %ld"
,
tmq
->
consumerId
,
epoch
,
pVgEp
->
vgId
,
offset
);
SMqClientVg
clientVg
=
{
.
pollCnt
=
0
,
.
currentOffset
=
offset
,
.
vgId
=
pVgEp
->
vgId
,
.
epSet
=
pVgEp
->
epSet
,
.
vgStatus
=
TMQ_VG_STATUS__IDLE
,
.
vgSkipCnt
=
0
,
};
taosArrayPush
(
topic
.
vgs
,
&
clientVg
);
set
=
true
;
}
taosArrayPush
(
newTopics
,
&
topic
);
}
if
(
tmq
->
clientTopics
)
taosArrayDestroy
(
tmq
->
clientTopics
);
taosHashCleanup
(
pHash
);
tmq
->
clientTopics
=
newTopics
;
if
(
taosArrayGetSize
(
tmq
->
clientTopics
)
==
0
)
atomic_store_8
(
&
tmq
->
status
,
TMQ_CONSUMER_STATUS__NO_TOPIC
);
else
atomic_store_8
(
&
tmq
->
status
,
TMQ_CONSUMER_STATUS__READY
);
atomic_store_32
(
&
tmq
->
epoch
,
epoch
);
return
set
;
}
bool
tmqUpdateEp
(
tmq_t
*
tmq
,
int32_t
epoch
,
SMqAskEpRsp
*
pRsp
)
{
bool
tmqUpdateEp
(
tmq_t
*
tmq
,
int32_t
epoch
,
SMqAskEpRsp
*
pRsp
)
{
/*printf("call update ep %d\n", epoch);*/
/*printf("call update ep %d\n", epoch);*/
bool
set
=
false
;
bool
set
=
false
;
...
...
source/common/src/systable.c
浏览文件 @
7156f525
...
@@ -170,7 +170,9 @@ static const SSysDbTableSchema userTblDistSchema[] = {
...
@@ -170,7 +170,9 @@ static const SSysDbTableSchema userTblDistSchema[] = {
static
const
SSysDbTableSchema
userUsersSchema
[]
=
{
static
const
SSysDbTableSchema
userUsersSchema
[]
=
{
{.
name
=
"name"
,
.
bytes
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"name"
,
.
bytes
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"privilege"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"super"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"enable"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"sysinfo"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
};
...
...
source/common/src/tmsg.c
浏览文件 @
7156f525
...
@@ -1184,6 +1184,8 @@ int32_t tSerializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq
...
@@ -1184,6 +1184,8 @@ int32_t tSerializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pReq
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
createType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
createType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
superUser
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
superUser
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
sysInfo
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
enable
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
...
@@ -1200,6 +1202,8 @@ int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pR
...
@@ -1200,6 +1202,8 @@ int32_t tDeserializeSCreateUserReq(void *buf, int32_t bufLen, SCreateUserReq *pR
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
createType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
createType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
superUser
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
superUser
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
sysInfo
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
enable
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
...
@@ -1215,6 +1219,8 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq)
...
@@ -1215,6 +1219,8 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq)
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
alterType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
alterType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
superUser
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
superUser
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
sysInfo
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
enable
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
dbname
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
dbname
)
<
0
)
return
-
1
;
...
@@ -1232,6 +1238,8 @@ int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq
...
@@ -1232,6 +1238,8 @@ int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
alterType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
alterType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
superUser
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
superUser
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
sysInfo
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
enable
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
pass
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
dbname
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
dbname
)
<
0
)
return
-
1
;
...
@@ -1269,6 +1277,9 @@ int32_t tDeserializeSGetUserAuthReq(void *buf, int32_t bufLen, SGetUserAuthReq *
...
@@ -1269,6 +1277,9 @@ int32_t tDeserializeSGetUserAuthReq(void *buf, int32_t bufLen, SGetUserAuthReq *
int32_t
tSerializeSGetUserAuthRspImpl
(
SEncoder
*
pEncoder
,
SGetUserAuthRsp
*
pRsp
)
{
int32_t
tSerializeSGetUserAuthRspImpl
(
SEncoder
*
pEncoder
,
SGetUserAuthRsp
*
pRsp
)
{
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pRsp
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
superAuth
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
superAuth
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
sysInfo
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
enable
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
reserve
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
version
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
version
)
<
0
)
return
-
1
;
int32_t
numOfCreatedDbs
=
taosHashGetSize
(
pRsp
->
createdDbs
);
int32_t
numOfCreatedDbs
=
taosHashGetSize
(
pRsp
->
createdDbs
);
...
@@ -1324,6 +1335,9 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
...
@@ -1324,6 +1335,9 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pRsp
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pRsp
->
superAuth
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pRsp
->
superAuth
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pRsp
->
sysInfo
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pRsp
->
enable
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pRsp
->
reserve
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
version
)
<
0
)
return
-
1
;
int32_t
numOfCreatedDbs
=
0
;
int32_t
numOfCreatedDbs
=
0
;
...
@@ -3393,8 +3407,7 @@ int32_t tSerializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *pReq)
...
@@ -3393,8 +3407,7 @@ int32_t tSerializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *pReq)
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
connId
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
queryStrId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
queryId
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -3407,8 +3420,7 @@ int32_t tDeserializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *pReq
...
@@ -3407,8 +3420,7 @@ int32_t tDeserializeSKillQueryReq(void *buf, int32_t bufLen, SKillQueryReq *pReq
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
connId
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
queryStrId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
queryId
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
7156f525
...
@@ -215,6 +215,7 @@ SArray *mmGetMsgHandles() {
...
@@ -215,6 +215,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_VG_DELETE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_VG_DELETE_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_TASK
,
mmPutMsgToQueryQueue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_TASK
,
mmPutMsgToQueryQueue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DEPLOY_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DEPLOY_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_TASK_DROP_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_CONFIG_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_CONFIG_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_REPLICA_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_REPLICA_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_CONFIRM_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_CONFIRM_RSP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
7156f525
...
@@ -350,6 +350,7 @@ SArray *vmGetMsgHandles() {
...
@@ -350,6 +350,7 @@ SArray *vmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_HEARTBEAT
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_HEARTBEAT
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_TRIGGER
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_TRIGGER
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_TASK_DROP
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DEPLOY
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DEPLOY
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_RUN
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_RUN
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DISPATCH
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DISPATCH
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/inc/mndAuth.h
浏览文件 @
7156f525
...
@@ -22,23 +22,42 @@
...
@@ -22,23 +22,42 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
enum
{
MND_OPER_CREATE_USER
=
1
,
MND_OPER_DROP_USER
,
MND_OPER_ALTER_USER
,
MND_OPER_CREATE_BNODE
,
MND_OPER_DROP_BNODE
,
MND_OPER_CREATE_DNODE
,
MND_OPER_DROP_DNODE
,
MND_OPER_CREATE_MNODE
,
MND_OPER_DROP_MNODE
,
MND_OPER_CREATE_QNODE
,
MND_OPER_DROP_QNODE
,
MND_OPER_CREATE_SNODE
,
MND_OPER_DROP_SNODE
,
MND_OPER_REDISTRIBUTE_VGROUP
,
MND_OPER_SPLIT_VGROUP
,
MND_OPER_BALANCE_VGROUP
,
MND_OPER_CREATE_FUNC
,
MND_OPER_DROP_FUNC
,
MND_OPER_KILL_TRANS
,
MND_OPER_CREATE_DB
,
MND_OPER_ALTER_DB
,
MND_OPER_DROP_DB
,
MND_OPER_COMPACT_DB
,
MND_OPER_USE_DB
,
MND_OPER_WRITE_DB
,
MND_OPER_READ_DB
,
}
EOperType
;
int32_t
mndInitAuth
(
SMnode
*
pMnode
);
int32_t
mndInitAuth
(
SMnode
*
pMnode
);
void
mndCleanupAuth
(
SMnode
*
pMnode
);
void
mndCleanupAuth
(
SMnode
*
pMnode
);
int32_t
mndCheckCreateUserAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckOperAuth
(
SMnode
*
pMnode
,
const
char
*
user
,
EOperType
operType
);
int32_t
mndCheckDbAuth
(
SMnode
*
pMnode
,
const
char
*
user
,
EOperType
operType
,
SDbObj
*
pDb
);
int32_t
mndCheckShowAuth
(
SMnode
*
pMnode
,
const
char
*
user
,
int32_t
showType
);
int32_t
mndCheckAlterUserAuth
(
SUserObj
*
pOperUser
,
SUserObj
*
pUser
,
SAlterUserReq
*
pAlter
);
int32_t
mndCheckAlterUserAuth
(
SUserObj
*
pOperUser
,
SUserObj
*
pUser
,
SAlterUserReq
*
pAlter
);
int32_t
mndCheckDropUserAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckNodeAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckFuncAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckTransAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckCreateDbAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckAlterDropCompactDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckWriteAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckReadAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
7156f525
...
@@ -226,6 +226,9 @@ typedef struct {
...
@@ -226,6 +226,9 @@ typedef struct {
int64_t
createdTime
;
int64_t
createdTime
;
int64_t
updateTime
;
int64_t
updateTime
;
int8_t
superUser
;
int8_t
superUser
;
int8_t
sysInfo
;
int8_t
enable
;
int8_t
reserve
;
int32_t
acctId
;
int32_t
acctId
;
int32_t
authVersion
;
int32_t
authVersion
;
SHashObj
*
readDbs
;
SHashObj
*
readDbs
;
...
@@ -554,8 +557,8 @@ typedef struct {
...
@@ -554,8 +557,8 @@ typedef struct {
SVgObj
fixedSinkVg
;
SVgObj
fixedSinkVg
;
int64_t
smaId
;
// 0 for unused
int64_t
smaId
;
// 0 for unused
int8_t
trigger
;
int8_t
trigger
;
int
32
_t
triggerParam
;
int
64
_t
triggerParam
;
int64_t
water
M
ark
;
int64_t
water
m
ark
;
char
*
sql
;
char
*
sql
;
char
*
physicalPlan
;
char
*
physicalPlan
;
SArray
*
tasks
;
// SArray<SArray<SStreamTask>>
SArray
*
tasks
;
// SArray<SArray<SStreamTask>>
...
...
source/dnode/mnode/impl/inc/mndStream.h
浏览文件 @
7156f525
...
@@ -31,7 +31,7 @@ void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream);
...
@@ -31,7 +31,7 @@ void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream);
SSdbRaw
*
mndStreamActionEncode
(
SStreamObj
*
pStream
);
SSdbRaw
*
mndStreamActionEncode
(
SStreamObj
*
pStream
);
SSdbRow
*
mndStreamActionDecode
(
SSdbRaw
*
pRaw
);
SSdbRow
*
mndStreamActionDecode
(
SSdbRaw
*
pRaw
);
int32_t
mndAddStreamToTrans
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
,
const
char
*
ast
,
int8_t
triggerType
,
int64_t
watermark
,
STrans
*
pTrans
);
int32_t
mndAddStreamToTrans
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
,
const
char
*
ast
,
STrans
*
pTrans
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
7156f525
...
@@ -73,29 +73,44 @@ static int32_t mndProcessAuthReq(SRpcMsg *pReq) {
...
@@ -73,29 +73,44 @@ static int32_t mndProcessAuthReq(SRpcMsg *pReq) {
return
code
;
return
code
;
}
}
int32_t
mndCheckCreateUserAuth
(
SUserObj
*
pOperUser
)
{
int32_t
mndCheckOperAuth
(
SMnode
*
pMnode
,
const
char
*
user
,
EOperType
operType
)
{
if
(
pOperUser
->
superUser
)
return
0
;
int32_t
code
=
0
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
code
=
-
1
;
goto
_OVER
;
}
if
(
pUser
->
superUser
)
{
goto
_OVER
;
}
if
(
!
pUser
->
enable
)
{
terrno
=
TSDB_CODE_MND_USER_DISABLED
;
code
=
-
1
;
goto
_OVER
;
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
code
=
-
1
;
_OVER:
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
}
int32_t
mndCheckAlterUserAuth
(
SUserObj
*
pOperUser
,
SUserObj
*
pUser
,
SAlterUserReq
*
pAlter
)
{
int32_t
mndCheckAlterUserAuth
(
SUserObj
*
pOperUser
,
SUserObj
*
pUser
,
SAlterUserReq
*
pAlter
)
{
if
(
pAlter
->
alterType
==
TSDB_ALTER_USER_PASSWD
)
{
if
(
pOperUser
->
superUser
)
return
0
;
if
(
pOperUser
->
superUser
||
strcmp
(
pUser
->
user
,
pOperUser
->
user
)
==
0
)
{
if
(
!
pOperUser
->
enable
)
{
return
0
;
terrno
=
TSDB_CODE_MND_USER_DISABLED
;
}
return
-
1
;
}
else
if
(
pAlter
->
alterType
==
TSDB_ALTER_USER_SUPERUSER
)
{
}
if
(
strcmp
(
pUser
->
user
,
TSDB_DEFAULT_USER
)
==
0
)
{
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
}
if
(
pOperUser
->
superUser
)
{
if
(
pAlter
->
alterType
==
TSDB_ALTER_USER_PASSWD
)
{
return
0
;
if
(
strcmp
(
pUser
->
user
,
pOperUser
->
user
)
==
0
)
{
}
if
(
pOperUser
->
sysInfo
)
return
0
;
}
else
{
if
(
pOperUser
->
superUser
)
{
return
0
;
}
}
}
}
...
@@ -103,65 +118,92 @@ int32_t mndCheckAlterUserAuth(SUserObj *pOperUser, SUserObj *pUser, SAlterUserRe
...
@@ -103,65 +118,92 @@ int32_t mndCheckAlterUserAuth(SUserObj *pOperUser, SUserObj *pUser, SAlterUserRe
return
-
1
;
return
-
1
;
}
}
int32_t
mndCheckDropUserAuth
(
SUserObj
*
pOperUser
)
{
int32_t
mndCheckShowAuth
(
SMnode
*
pMnode
,
const
char
*
user
,
int32_t
showType
)
{
if
(
pOperUser
->
superUser
)
return
0
;
int32_t
code
=
0
;
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
user
);
return
-
1
;
}
int32_t
mndCheckNodeAuth
(
SUserObj
*
pOperUser
)
{
if
(
pUser
==
NULL
)
{
if
(
pOperUser
->
superUser
)
return
0
;
code
=
-
1
;
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
goto
_OVER
;
return
-
1
;
}
}
int32_t
mndCheckFuncAuth
(
SUserObj
*
pOperUser
)
{
if
(
pUser
->
superUser
)
{
if
(
pOperUser
->
superUser
)
return
0
;
goto
_OVER
;
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
}
return
-
1
;
}
if
(
!
pUser
->
enable
)
{
terrno
=
TSDB_CODE_MND_USER_DISABLED
;
code
=
-
1
;
goto
_OVER
;
}
if
(
!
pUser
->
sysInfo
)
{
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
code
=
-
1
;
goto
_OVER
;
}
int32_t
mndCheckTransAuth
(
SUserObj
*
pOperUser
)
{
if
(
pOperUser
->
superUser
)
return
0
;
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
code
=
-
1
;
_OVER:
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
}
int32_t
mndCheckCreateDbAuth
(
SUserObj
*
pOperUser
)
{
return
0
;
}
int32_t
mndCheckDbAuth
(
SMnode
*
pMnode
,
const
char
*
user
,
EOperType
operType
,
SDbObj
*
pDb
)
{
int32_t
code
=
0
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
user
);
int32_t
mndCheckAlterDropCompactDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
if
(
pUser
==
NULL
)
{
if
(
pOperUser
->
superUser
||
strcmp
(
pOperUser
->
user
,
pDb
->
createUser
)
==
0
)
{
code
=
-
1
;
return
0
;
goto
_OVER
;
}
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
if
(
pUser
->
superUser
)
goto
_OVER
;
return
-
1
;
}
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
return
0
;
}
if
(
!
pUser
->
enable
)
{
terrno
=
TSDB_CODE_MND_USER_DISABLED
;
code
=
-
1
;
goto
_OVER
;
}
int32_t
mndCheckWriteAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
if
(
operType
==
MND_OPER_CREATE_DB
)
{
if
(
pOperUser
->
superUser
||
strcmp
(
pOperUser
->
user
,
pDb
->
createUser
)
==
0
)
{
if
(
pUser
->
sysInfo
)
goto
_OVER
;
return
0
;
}
}
if
(
taosHashGet
(
pOperUser
->
writeDbs
,
pDb
->
name
,
strlen
(
pDb
->
name
)
+
1
)
!=
NULL
)
{
if
(
operType
==
MND_OPER_ALTER_DB
)
{
return
0
;
if
(
strcmp
(
pUser
->
user
,
pDb
->
createUser
)
==
0
&&
pUser
->
sysInfo
)
goto
_OVER
;
}
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
if
(
operType
==
MND_OPER_DROP_DB
)
{
return
-
1
;
if
(
strcmp
(
pUser
->
user
,
pDb
->
createUser
)
==
0
&&
pUser
->
sysInfo
)
goto
_OVER
;
}
}
int32_t
mndCheckReadAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
if
(
operType
==
MND_OPER_COMPACT_DB
)
{
if
(
pOperUser
->
superUser
||
strcmp
(
pOperUser
->
user
,
pDb
->
createUser
)
==
0
)
{
if
(
strcmp
(
pUser
->
user
,
pDb
->
createUser
)
==
0
&&
pUser
->
sysInfo
)
goto
_OVER
;
return
0
;
}
}
if
(
taosHashGet
(
pOperUser
->
readDbs
,
pDb
->
name
,
strlen
(
pDb
->
name
)
+
1
)
!=
NULL
)
{
if
(
operType
==
MND_OPER_USE_DB
)
{
return
0
;
if
(
strcmp
(
pUser
->
user
,
pDb
->
createUser
)
==
0
)
goto
_OVER
;
if
(
taosHashGet
(
pUser
->
readDbs
,
pDb
->
name
,
strlen
(
pDb
->
name
)
+
1
)
!=
NULL
)
goto
_OVER
;
if
(
taosHashGet
(
pUser
->
writeDbs
,
pDb
->
name
,
strlen
(
pDb
->
name
)
+
1
)
!=
NULL
)
goto
_OVER
;
}
if
(
operType
==
MND_OPER_WRITE_DB
)
{
if
(
strcmp
(
pUser
->
user
,
pDb
->
createUser
)
==
0
)
goto
_OVER
;
if
(
taosHashGet
(
pUser
->
writeDbs
,
pDb
->
name
,
strlen
(
pDb
->
name
)
+
1
)
!=
NULL
)
goto
_OVER
;
}
if
(
operType
==
MND_OPER_READ_DB
)
{
if
(
strcmp
(
pUser
->
user
,
pDb
->
createUser
)
==
0
)
goto
_OVER
;
if
(
taosHashGet
(
pUser
->
readDbs
,
pDb
->
name
,
strlen
(
pDb
->
name
)
+
1
)
!=
NULL
)
goto
_OVER
;
}
}
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
terrno
=
TSDB_CODE_MND_NO_RIGHTS
;
return
-
1
;
code
=
-
1
;
_OVER:
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
}
}
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
7156f525
...
@@ -269,7 +269,6 @@ static int32_t mndProcessCreateBnodeReq(SRpcMsg *pReq) {
...
@@ -269,7 +269,6 @@ static int32_t mndProcessCreateBnodeReq(SRpcMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SBnodeObj
*
pObj
=
NULL
;
SBnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateBnodeReq
createReq
=
{
0
};
SMCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
...
@@ -293,13 +292,7 @@ static int32_t mndProcessCreateBnodeReq(SRpcMsg *pReq) {
...
@@ -293,13 +292,7 @@ static int32_t mndProcessCreateBnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_CREATE_BNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -313,7 +306,6 @@ _OVER:
...
@@ -313,7 +306,6 @@ _OVER:
mndReleaseBnode
(
pMnode
,
pObj
);
mndReleaseBnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
@@ -382,7 +374,6 @@ _OVER:
...
@@ -382,7 +374,6 @@ _OVER:
static
int32_t
mndProcessDropBnodeReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessDropBnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SBnodeObj
*
pObj
=
NULL
;
SBnodeObj
*
pObj
=
NULL
;
SMDropBnodeReq
dropReq
=
{
0
};
SMDropBnodeReq
dropReq
=
{
0
};
...
@@ -403,13 +394,7 @@ static int32_t mndProcessDropBnodeReq(SRpcMsg *pReq) {
...
@@ -403,13 +394,7 @@ static int32_t mndProcessDropBnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_DROP_BNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -422,8 +407,6 @@ _OVER:
...
@@ -422,8 +407,6 @@ _OVER:
}
}
mndReleaseBnode
(
pMnode
,
pObj
);
mndReleaseBnode
(
pMnode
,
pObj
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
7156f525
...
@@ -526,7 +526,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
...
@@ -526,7 +526,7 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
if
(
mndCheck
CreateDbAuth
(
pUser
)
!=
0
)
{
if
(
mndCheck
DbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_CREATE_DB
,
NULL
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -684,7 +684,6 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
...
@@ -684,7 +684,6 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SAlterDbReq
alterReq
=
{
0
};
SAlterDbReq
alterReq
=
{
0
};
SDbObj
dbObj
=
{
0
};
SDbObj
dbObj
=
{
0
};
...
@@ -701,12 +700,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
...
@@ -701,12 +700,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_ALTER_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckAlterDropCompactDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -733,7 +727,6 @@ _OVER:
...
@@ -733,7 +727,6 @@ _OVER:
}
}
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
taosArrayDestroy
(
dbObj
.
cfg
.
pRetensions
);
taosArrayDestroy
(
dbObj
.
cfg
.
pRetensions
);
return
code
;
return
code
;
...
@@ -967,7 +960,6 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
...
@@ -967,7 +960,6 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SDropDbReq
dropReq
=
{
0
};
SDropDbReq
dropReq
=
{
0
};
if
(
tDeserializeSDropDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSDropDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
...
@@ -988,12 +980,7 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
...
@@ -988,12 +980,7 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
}
}
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_DROP_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckAlterDropCompactDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -1006,8 +993,6 @@ _OVER:
...
@@ -1006,8 +993,6 @@ _OVER:
}
}
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
@@ -1103,7 +1088,6 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
...
@@ -1103,7 +1088,6 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SUseDbReq
usedbReq
=
{
0
};
SUseDbReq
usedbReq
=
{
0
};
SUseDbRsp
usedbRsp
=
{
0
};
SUseDbRsp
usedbRsp
=
{
0
};
...
@@ -1143,12 +1127,7 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
...
@@ -1143,12 +1127,7 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
mError
(
"db:%s, failed to process use db req since %s"
,
usedbReq
.
db
,
terrstr
());
mError
(
"db:%s, failed to process use db req since %s"
,
usedbReq
.
db
,
terrstr
());
}
else
{
}
else
{
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_USE_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckUseDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -1179,7 +1158,6 @@ _OVER:
...
@@ -1179,7 +1158,6 @@ _OVER:
}
}
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
tFreeSUsedbRsp
(
&
usedbRsp
);
tFreeSUsedbRsp
(
&
usedbRsp
);
return
code
;
return
code
;
...
@@ -1260,7 +1238,6 @@ static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) {
...
@@ -1260,7 +1238,6 @@ static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) {
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCompactDbReq
compactReq
=
{
0
};
SCompactDbReq
compactReq
=
{
0
};
if
(
tDeserializeSCompactDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
compactReq
)
!=
0
)
{
if
(
tDeserializeSCompactDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
compactReq
)
!=
0
)
{
...
@@ -1275,12 +1252,7 @@ static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) {
...
@@ -1275,12 +1252,7 @@ static int32_t mndProcessCompactDbReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_COMPACT_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckAlterDropCompactDbAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -1292,8 +1264,6 @@ _OVER:
...
@@ -1292,8 +1264,6 @@ _OVER:
}
}
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
7156f525
...
@@ -33,8 +33,8 @@ int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) {
...
@@ -33,8 +33,8 @@ int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) {
if
(
tEncodeI8
(
pEncoder
,
pObj
->
status
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
status
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
createdBy
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
createdBy
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
trigger
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pObj
->
trigger
)
<
0
)
return
-
1
;
if
(
tEncodeI
32
(
pEncoder
,
pObj
->
triggerParam
)
<
0
)
return
-
1
;
if
(
tEncodeI
64
(
pEncoder
,
pObj
->
triggerParam
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
water
M
ark
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
water
m
ark
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pObj
->
fixedSinkVgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pObj
->
fixedSinkVgId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
smaId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
pObj
->
smaId
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
sql
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pObj
->
sql
)
<
0
)
return
-
1
;
...
@@ -85,8 +85,8 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj) {
...
@@ -85,8 +85,8 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj) {
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
status
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
status
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
createdBy
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
createdBy
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
trigger
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pObj
->
trigger
)
<
0
)
return
-
1
;
if
(
tDecodeI
32
(
pDecoder
,
&
pObj
->
triggerParam
)
<
0
)
return
-
1
;
if
(
tDecodeI
64
(
pDecoder
,
&
pObj
->
triggerParam
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
water
M
ark
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
water
m
ark
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pObj
->
fixedSinkVgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pObj
->
fixedSinkVgId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
smaId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pObj
->
smaId
)
<
0
)
return
-
1
;
if
(
tDecodeCStrAlloc
(
pDecoder
,
&
pObj
->
sql
)
<
0
)
return
-
1
;
if
(
tDecodeCStrAlloc
(
pDecoder
,
&
pObj
->
sql
)
<
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
7156f525
...
@@ -499,7 +499,6 @@ _OVER:
...
@@ -499,7 +499,6 @@ _OVER:
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SCreateDnodeReq
createReq
=
{
0
};
SCreateDnodeReq
createReq
=
{
0
};
...
@@ -522,13 +521,7 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) {
...
@@ -522,13 +521,7 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_CREATE_DNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -541,7 +534,6 @@ _OVER:
...
@@ -541,7 +534,6 @@ _OVER:
}
}
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
@@ -586,7 +578,6 @@ _OVER:
...
@@ -586,7 +578,6 @@ _OVER:
static
int32_t
mndProcessDropDnodeReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessDropDnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SMnodeObj
*
pMObj
=
NULL
;
SMnodeObj
*
pMObj
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
SMDropMnodeReq
dropReq
=
{
0
};
...
@@ -631,13 +622,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
...
@@ -631,13 +622,7 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
}
}
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_DROP_MNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -650,7 +635,6 @@ _OVER:
...
@@ -650,7 +635,6 @@ _OVER:
}
}
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
mndReleaseMnode
(
pMnode
,
pMObj
);
mndReleaseMnode
(
pMnode
,
pMObj
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
7156f525
...
@@ -274,7 +274,6 @@ _OVER:
...
@@ -274,7 +274,6 @@ _OVER:
static
int32_t
mndProcessCreateFuncReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessCreateFuncReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SFuncObj
*
pFunc
=
NULL
;
SFuncObj
*
pFunc
=
NULL
;
SCreateFuncReq
createReq
=
{
0
};
SCreateFuncReq
createReq
=
{
0
};
...
@@ -309,23 +308,17 @@ static int32_t mndProcessCreateFuncReq(SRpcMsg *pReq) {
...
@@ -309,23 +308,17 @@ static int32_t mndProcessCreateFuncReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
if
(
createReq
.
codeLen
<=
1
)
{
if
(
createReq
.
codeLen
<=
1
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_CODE
;
terrno
=
TSDB_CODE_MND_INVALID_FUNC_CODE
;
goto
_OVER
;
}
if
(
createReq
.
bufSize
<
0
||
createReq
.
bufSize
>
TSDB_FUNC_BUF_SIZE
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_BUFSIZE
;
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
createReq
.
bufSize
<
0
||
createReq
.
bufSize
>
TSDB_FUNC_BUF_SIZE
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC_BUFSIZE
;
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
goto
_OVER
;
}
}
if
(
mndCheck
FuncAuth
(
pUser
)
)
{
if
(
mndCheck
OperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_CREATE_FUNC
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -338,16 +331,13 @@ _OVER:
...
@@ -338,16 +331,13 @@ _OVER:
}
}
mndReleaseFunc
(
pMnode
,
pFunc
);
mndReleaseFunc
(
pMnode
,
pFunc
);
mndReleaseUser
(
pMnode
,
pUser
);
tFreeSCreateFuncReq
(
&
createReq
);
tFreeSCreateFuncReq
(
&
createReq
);
return
code
;
return
code
;
}
}
static
int32_t
mndProcessDropFuncReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessDropFuncReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SFuncObj
*
pFunc
=
NULL
;
SFuncObj
*
pFunc
=
NULL
;
SDropFuncReq
dropReq
=
{
0
};
SDropFuncReq
dropReq
=
{
0
};
...
@@ -375,13 +365,7 @@ static int32_t mndProcessDropFuncReq(SRpcMsg *pReq) {
...
@@ -375,13 +365,7 @@ static int32_t mndProcessDropFuncReq(SRpcMsg *pReq) {
}
}
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_DROP_FUNC
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckFuncAuth
(
pUser
))
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -394,8 +378,6 @@ _OVER:
...
@@ -394,8 +378,6 @@ _OVER:
}
}
mndReleaseFunc
(
pMnode
,
pFunc
);
mndReleaseFunc
(
pMnode
,
pFunc
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
7156f525
...
@@ -380,17 +380,19 @@ void mndStop(SMnode *pMnode) {
...
@@ -380,17 +380,19 @@ void mndStop(SMnode *pMnode) {
int32_t
mndProcessSyncMsg
(
SRpcMsg
*
pMsg
)
{
int32_t
mndProcessSyncMsg
(
SRpcMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
int32_t
code
=
TAOS_SYNC_OTHER_ERROR
;
int32_t
code
=
0
;
if
(
!
syncEnvIsStart
())
{
if
(
!
syncEnvIsStart
())
{
mError
(
"failed to process sync msg:%p type:%s since syncEnv stop"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
mError
(
"failed to process sync msg:%p type:%s since syncEnv stop"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
return
TAOS_SYNC_OTHER_ERROR
;
terrno
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
return
-
1
;
}
}
SSyncNode
*
pSyncNode
=
syncNodeAcquire
(
pMgmt
->
sync
);
SSyncNode
*
pSyncNode
=
syncNodeAcquire
(
pMgmt
->
sync
);
if
(
pSyncNode
==
NULL
)
{
if
(
pSyncNode
==
NULL
)
{
mError
(
"failed to process sync msg:%p type:%s since syncNode is null"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
mError
(
"failed to process sync msg:%p type:%s since syncNode is null"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
return
TAOS_SYNC_OTHER_ERROR
;
terrno
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
return
-
1
;
}
}
char
logBuf
[
512
]
=
{
0
};
char
logBuf
[
512
]
=
{
0
};
...
@@ -451,7 +453,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
...
@@ -451,7 +453,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
}
else
{
}
else
{
mError
(
"failed to process msg:%p since invalid type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
mError
(
"failed to process msg:%p since invalid type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
code
=
TAOS_SYNC_OTHER_ERROR
;
code
=
-
1
;
}
}
}
else
{
}
else
{
if
(
pMsg
->
msgType
==
TDMT_SYNC_TIMEOUT
)
{
if
(
pMsg
->
msgType
==
TDMT_SYNC_TIMEOUT
)
{
...
@@ -492,10 +494,13 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
...
@@ -492,10 +494,13 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
}
else
{
}
else
{
mError
(
"failed to process msg:%p since invalid type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
mError
(
"failed to process msg:%p since invalid type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
code
=
TAOS_SYNC_OTHER_ERROR
;
code
=
-
1
;
}
}
}
}
if
(
code
!=
0
)
{
terrno
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
}
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
7156f525
...
@@ -381,7 +381,6 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
...
@@ -381,7 +381,6 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SMnodeObj
*
pObj
=
NULL
;
SMnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateMnodeReq
createReq
=
{
0
};
SMCreateMnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
...
@@ -415,13 +414,7 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
...
@@ -415,13 +414,7 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_CREATE_MNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -435,7 +428,6 @@ _OVER:
...
@@ -435,7 +428,6 @@ _OVER:
mndReleaseMnode
(
pMnode
,
pObj
);
mndReleaseMnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
@@ -594,7 +586,6 @@ _OVER:
...
@@ -594,7 +586,6 @@ _OVER:
static
int32_t
mndProcessDropMnodeReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessDropMnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SMnodeObj
*
pObj
=
NULL
;
SMnodeObj
*
pObj
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
SMDropMnodeReq
dropReq
=
{
0
};
...
@@ -630,13 +621,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
...
@@ -630,13 +621,7 @@ static int32_t mndProcessDropMnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_DROP_MNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -649,8 +634,6 @@ _OVER:
...
@@ -649,8 +634,6 @@ _OVER:
}
}
mndReleaseMnode
(
pMnode
,
pObj
);
mndReleaseMnode
(
pMnode
,
pObj
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
7156f525
...
@@ -271,7 +271,6 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
...
@@ -271,7 +271,6 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SQnodeObj
*
pObj
=
NULL
;
SQnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateQnodeReq
createReq
=
{
0
};
SMCreateQnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
...
@@ -295,13 +294,7 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
...
@@ -295,13 +294,7 @@ static int32_t mndProcessCreateQnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_CREATE_QNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -315,7 +308,6 @@ _OVER:
...
@@ -315,7 +308,6 @@ _OVER:
mndReleaseQnode
(
pMnode
,
pObj
);
mndReleaseQnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
@@ -384,7 +376,6 @@ _OVER:
...
@@ -384,7 +376,6 @@ _OVER:
static
int32_t
mndProcessDropQnodeReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessDropQnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SQnodeObj
*
pObj
=
NULL
;
SQnodeObj
*
pObj
=
NULL
;
SMDropQnodeReq
dropReq
=
{
0
};
SMDropQnodeReq
dropReq
=
{
0
};
...
@@ -405,13 +396,7 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) {
...
@@ -405,13 +396,7 @@ static int32_t mndProcessDropQnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_DROP_QNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -424,8 +409,6 @@ _OVER:
...
@@ -424,8 +409,6 @@ _OVER:
}
}
mndReleaseQnode
(
pMnode
,
pObj
);
mndReleaseQnode
(
pMnode
,
pObj
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
7156f525
...
@@ -63,10 +63,11 @@ int32_t mndConvertRsmaTask(char** pDst, int32_t* pDstLen, const char* ast, int64
...
@@ -63,10 +63,11 @@ int32_t mndConvertRsmaTask(char** pDst, int32_t* pDstLen, const char* ast, int64
.
topicQuery
=
false
,
.
topicQuery
=
false
,
.
streamQuery
=
true
,
.
streamQuery
=
true
,
.
rSmaQuery
=
true
,
.
rSmaQuery
=
true
,
.
triggerType
=
triggerType
,
.
triggerType
=
STREAM_TRIGGER_AT_ONCE
,
.
watermark
=
watermark
,
.
watermark
=
watermark
,
.
filesFactor
=
filesFactor
,
/*.filesFactor = filesFactor,*/
};
};
if
(
qCreateQueryPlan
(
&
cxt
,
&
pPlan
,
NULL
)
<
0
)
{
if
(
qCreateQueryPlan
(
&
cxt
,
&
pPlan
,
NULL
)
<
0
)
{
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
goto
END
;
goto
END
;
...
@@ -387,6 +388,9 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
...
@@ -387,6 +388,9 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
// input
// input
pFinalTask
->
inputType
=
TASK_INPUT_TYPE__DATA_BLOCK
;
pFinalTask
->
inputType
=
TASK_INPUT_TYPE__DATA_BLOCK
;
// trigger
pFinalTask
->
triggerParam
=
pStream
->
triggerParam
;
// dispatch
// dispatch
if
(
mndAddDispatcherToInnerTask
(
pMnode
,
pTrans
,
pStream
,
pFinalTask
)
<
0
)
{
if
(
mndAddDispatcherToInnerTask
(
pMnode
,
pTrans
,
pStream
,
pFinalTask
)
<
0
)
{
qDestroyQueryPlan
(
pPlan
);
qDestroyQueryPlan
(
pPlan
);
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
7156f525
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "mndShow.h"
#include "mndShow.h"
#include "systable.h"
#include "systable.h"
#include "mndAuth.h"
#define SHOW_STEP_SIZE 100
#define SHOW_STEP_SIZE 100
...
@@ -230,6 +231,8 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
...
@@ -230,6 +231,8 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
mDebug
(
"show:0x%"
PRIx64
", start retrieve data, type:%d"
,
pShow
->
id
,
pShow
->
type
);
mDebug
(
"show:0x%"
PRIx64
", start retrieve data, type:%d"
,
pShow
->
id
,
pShow
->
type
);
// if (mndCheckShowAuth(pMnode, pReq->conn.user, pShow->type) != 0) return -1;
int32_t
numOfCols
=
pShow
->
pMeta
->
numOfColumns
;
int32_t
numOfCols
=
pShow
->
pMeta
->
numOfColumns
;
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
pBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
7156f525
...
@@ -407,6 +407,7 @@ static int32_t mndSetUpdateSmaStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb
...
@@ -407,6 +407,7 @@ static int32_t mndSetUpdateSmaStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb
return
0
;
return
0
;
}
}
#if 0
static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SSmaObj *pSma) {
static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SSmaObj *pSma) {
SSdb *pSdb = pMnode->pSdb;
SSdb *pSdb = pMnode->pSdb;
SVgObj *pVgroup = NULL;
SVgObj *pVgroup = NULL;
...
@@ -445,6 +446,7 @@ static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
...
@@ -445,6 +446,7 @@ static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return 0;
return 0;
}
}
#endif
static
int32_t
mndSetCreateSmaVgroupRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
static
int32_t
mndSetCreateSmaVgroupRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
SSmaObj
*
pSma
)
{
SSmaObj
*
pSma
)
{
...
@@ -559,6 +561,8 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -559,6 +561,8 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
streamObj
.
sql
=
pCreate
->
sql
;
streamObj
.
sql
=
pCreate
->
sql
;
streamObj
.
createdBy
=
STREAM_CREATED_BY__SMA
;
streamObj
.
createdBy
=
STREAM_CREATED_BY__SMA
;
streamObj
.
smaId
=
smaObj
.
uid
;
streamObj
.
smaId
=
smaObj
.
uid
;
streamObj
.
watermark
=
0
;
streamObj
.
trigger
=
STREAM_TRIGGER_AT_ONCE
;
if
(
mndAllocSmaVgroup
(
pMnode
,
pDb
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
{
if
(
mndAllocSmaVgroup
(
pMnode
,
pDb
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
{
mError
(
"sma:%s, failed to create since %s"
,
smaObj
.
name
,
terrstr
());
mError
(
"sma:%s, failed to create since %s"
,
smaObj
.
name
,
terrstr
());
...
@@ -579,9 +583,9 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -579,9 +583,9 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
if
(
mndSetCreateSmaCommitLogs
(
pMnode
,
pTrans
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaCommitLogs
(
pMnode
,
pTrans
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetUpdateSmaStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetUpdateSmaStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
smaObj
)
!=
0
)
goto
_OVER
;
//
if (mndSetCreateSmaRedoActions(pMnode, pTrans, pDb, &smaObj) != 0) goto _OVER;
if
(
mndSetCreateSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
streamObj
.
fixedSinkVg
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
streamObj
.
fixedSinkVg
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndAddStreamToTrans
(
pMnode
,
&
streamObj
,
pCreate
->
ast
,
STREAM_TRIGGER_AT_ONCE
,
0
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndAddStreamToTrans
(
pMnode
,
&
streamObj
,
pCreate
->
ast
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
code
=
0
;
...
@@ -627,7 +631,6 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
...
@@ -627,7 +631,6 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
SSmaObj
*
pSma
=
NULL
;
SSmaObj
*
pSma
=
NULL
;
SStreamObj
*
pStream
=
NULL
;
SStreamObj
*
pStream
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateSmaReq
createReq
=
{
0
};
SMCreateSmaReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateSmaReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSMCreateSmaReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
...
@@ -671,12 +674,7 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
...
@@ -671,12 +674,7 @@ static int32_t mndProcessCreateSmaReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -692,7 +690,6 @@ _OVER:
...
@@ -692,7 +690,6 @@ _OVER:
mndReleaseSma
(
pMnode
,
pSma
);
mndReleaseSma
(
pMnode
,
pSma
);
mndReleaseStream
(
pMnode
,
pStream
);
mndReleaseStream
(
pMnode
,
pStream
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
tFreeSMCreateSmaReq
(
&
createReq
);
tFreeSMCreateSmaReq
(
&
createReq
);
return
code
;
return
code
;
...
@@ -734,6 +731,7 @@ static int32_t mndSetDropSmaVgroupCommitLogs(SMnode *pMnode, STrans *pTrans, SVg
...
@@ -734,6 +731,7 @@ static int32_t mndSetDropSmaVgroupCommitLogs(SMnode *pMnode, STrans *pTrans, SVg
return
0
;
return
0
;
}
}
#if 0
static int32_t mndSetDropSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SSmaObj *pSma) {
static int32_t mndSetDropSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SSmaObj *pSma) {
SSdb *pSdb = pMnode->pSdb;
SSdb *pSdb = pMnode->pSdb;
SVgObj *pVgroup = NULL;
SVgObj *pVgroup = NULL;
...
@@ -774,6 +772,7 @@ static int32_t mndSetDropSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
...
@@ -774,6 +772,7 @@ static int32_t mndSetDropSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
return 0;
return 0;
}
}
#endif
static
int32_t
mndSetDropSmaVgroupRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
)
{
static
int32_t
mndSetDropSmaVgroupRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
)
{
SVnodeGid
*
pVgid
=
pVgroup
->
vnodeGid
+
0
;
SVnodeGid
*
pVgid
=
pVgroup
->
vnodeGid
+
0
;
...
@@ -824,7 +823,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
...
@@ -824,7 +823,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
if
(
mndSetDropSmaCommitLogs
(
pMnode
,
pTrans
,
pSma
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaCommitLogs
(
pMnode
,
pTrans
,
pSma
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
pVgroup
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
pVgroup
)
!=
0
)
goto
_OVER
;
if
(
mndSetUpdateSmaStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetUpdateSmaStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaRedoActions
(
pMnode
,
pTrans
,
pDb
,
pSma
)
!=
0
)
goto
_OVER
;
//
if (mndSetDropSmaRedoActions(pMnode, pTrans, pDb, pSma) != 0) goto _OVER;
if
(
mndSetDropSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
pVgroup
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
pVgroup
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
...
@@ -854,7 +853,7 @@ int32_t mndDropSmasByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *p
...
@@ -854,7 +853,7 @@ int32_t mndDropSmasByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *p
if
(
mndSetDropSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
pVgroup
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
pVgroup
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
pVgroup
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
pVgroup
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaCommitLogs
(
pMnode
,
pTrans
,
pSma
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaCommitLogs
(
pMnode
,
pTrans
,
pSma
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropSmaRedoActions
(
pMnode
,
pTrans
,
pDb
,
pSma
)
!=
0
)
goto
_OVER
;
//
if (mndSetDropSmaRedoActions(pMnode, pTrans, pDb, pSma) != 0) goto _OVER;
mndReleaseVgroup
(
pMnode
,
pVgroup
);
mndReleaseVgroup
(
pMnode
,
pVgroup
);
pVgroup
=
NULL
;
pVgroup
=
NULL
;
}
}
...
@@ -907,7 +906,6 @@ _OVER:
...
@@ -907,7 +906,6 @@ _OVER:
static
int32_t
mndProcessDropSmaReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessDropSmaReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SSmaObj
*
pSma
=
NULL
;
SSmaObj
*
pSma
=
NULL
;
SMDropSmaReq
dropReq
=
{
0
};
SMDropSmaReq
dropReq
=
{
0
};
...
@@ -937,12 +935,7 @@ static int32_t mndProcessDropSmaReq(SRpcMsg *pReq) {
...
@@ -937,12 +935,7 @@ static int32_t mndProcessDropSmaReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -955,9 +948,6 @@ _OVER:
...
@@ -955,9 +948,6 @@ _OVER:
}
}
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseSma
(
pMnode
,
pSma
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
7156f525
...
@@ -277,7 +277,6 @@ static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
...
@@ -277,7 +277,6 @@ static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SSnodeObj
*
pObj
=
NULL
;
SSnodeObj
*
pObj
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateSnodeReq
createReq
=
{
0
};
SMCreateSnodeReq
createReq
=
{
0
};
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSCreateDropMQSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
...
@@ -301,13 +300,7 @@ static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
...
@@ -301,13 +300,7 @@ static int32_t mndProcessCreateSnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_CREATE_SNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -322,7 +315,6 @@ _OVER:
...
@@ -322,7 +315,6 @@ _OVER:
mndReleaseSnode
(
pMnode
,
pObj
);
mndReleaseSnode
(
pMnode
,
pObj
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
@@ -392,7 +384,6 @@ _OVER:
...
@@ -392,7 +384,6 @@ _OVER:
static
int32_t
mndProcessDropSnodeReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessDropSnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SSnodeObj
*
pObj
=
NULL
;
SSnodeObj
*
pObj
=
NULL
;
SMDropSnodeReq
dropReq
=
{
0
};
SMDropSnodeReq
dropReq
=
{
0
};
...
@@ -413,13 +404,7 @@ static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) {
...
@@ -413,13 +404,7 @@ static int32_t mndProcessDropSnodeReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_DROP_SNODE
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -432,8 +417,6 @@ _OVER:
...
@@ -432,8 +417,6 @@ _OVER:
}
}
mndReleaseSnode
(
pMnode
,
pObj
);
mndReleaseSnode
(
pMnode
,
pObj
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
7156f525
...
@@ -323,10 +323,14 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
...
@@ -323,10 +323,14 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
pOld
->
smaVer
=
pNew
->
smaVer
;
pOld
->
smaVer
=
pNew
->
smaVer
;
pOld
->
nextColId
=
pNew
->
nextColId
;
pOld
->
nextColId
=
pNew
->
nextColId
;
pOld
->
ttl
=
pNew
->
ttl
;
pOld
->
ttl
=
pNew
->
ttl
;
pOld
->
numOfColumns
=
pNew
->
numOfColumns
;
if
(
pNew
->
numOfColumns
>
0
)
{
pOld
->
numOfTags
=
pNew
->
numOfTags
;
pOld
->
numOfColumns
=
pNew
->
numOfColumns
;
memcpy
(
pOld
->
pColumns
,
pNew
->
pColumns
,
pOld
->
numOfColumns
*
sizeof
(
SSchema
));
memcpy
(
pOld
->
pColumns
,
pNew
->
pColumns
,
pOld
->
numOfColumns
*
sizeof
(
SSchema
));
memcpy
(
pOld
->
pTags
,
pNew
->
pTags
,
pOld
->
numOfTags
*
sizeof
(
SSchema
));
}
if
(
pNew
->
numOfTags
>
0
)
{
pOld
->
numOfTags
=
pNew
->
numOfTags
;
memcpy
(
pOld
->
pTags
,
pNew
->
pTags
,
pOld
->
numOfTags
*
sizeof
(
SSchema
));
}
if
(
pNew
->
commentLen
!=
0
)
{
if
(
pNew
->
commentLen
!=
0
)
{
memcpy
(
pOld
->
comment
,
pNew
->
comment
,
pNew
->
commentLen
);
memcpy
(
pOld
->
comment
,
pNew
->
comment
,
pNew
->
commentLen
);
}
}
...
@@ -769,7 +773,6 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
...
@@ -769,7 +773,6 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SStbObj
*
pStb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateStbReq
createReq
=
{
0
};
SMCreateStbReq
createReq
=
{
0
};
if
(
tDeserializeSMCreateStbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeSMCreateStbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
...
@@ -803,12 +806,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
...
@@ -803,12 +806,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -832,7 +830,6 @@ _OVER:
...
@@ -832,7 +830,6 @@ _OVER:
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
tFreeSMCreateStbReq
(
&
createReq
);
tFreeSMCreateStbReq
(
&
createReq
);
return
code
;
return
code
;
...
@@ -1287,7 +1284,6 @@ static int32_t mndBuildStbSchema(SMnode *pMnode, const char *dbFName, const char
...
@@ -1287,7 +1284,6 @@ static int32_t mndBuildStbSchema(SMnode *pMnode, const char *dbFName, const char
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
tbFName
);
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
tbFName
);
if
(
pStb
==
NULL
)
{
if
(
pStb
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
//terrno = TSDB_CODE_MND_INVALID_STB;
terrno
=
TSDB_CODE_PAR_TABLE_NOT_EXIST
;
terrno
=
TSDB_CODE_PAR_TABLE_NOT_EXIST
;
return
-
1
;
return
-
1
;
}
}
...
@@ -1428,7 +1424,6 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) {
...
@@ -1428,7 +1424,6 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMAlterStbReq
alterReq
=
{
0
};
SMAlterStbReq
alterReq
=
{
0
};
if
(
tDeserializeSMAlterStbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
alterReq
)
!=
0
)
{
if
(
tDeserializeSMAlterStbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
alterReq
)
!=
0
)
{
...
@@ -1459,12 +1454,7 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) {
...
@@ -1459,12 +1454,7 @@ static int32_t mndProcessAlterStbReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -1478,7 +1468,6 @@ _OVER:
...
@@ -1478,7 +1468,6 @@ _OVER:
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
taosArrayDestroy
(
alterReq
.
pFields
);
taosArrayDestroy
(
alterReq
.
pFields
);
return
code
;
return
code
;
...
@@ -1566,7 +1555,6 @@ _OVER:
...
@@ -1566,7 +1555,6 @@ _OVER:
static
int32_t
mndProcessDropStbReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessDropStbReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SMDropStbReq
dropReq
=
{
0
};
SMDropStbReq
dropReq
=
{
0
};
...
@@ -1596,12 +1584,7 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) {
...
@@ -1596,12 +1584,7 @@ static int32_t mndProcessDropStbReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -1615,8 +1598,6 @@ _OVER:
...
@@ -1615,8 +1598,6 @@ _OVER:
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
7156f525
...
@@ -35,7 +35,7 @@ static int32_t mndStreamActionInsert(SSdb *pSdb, SStreamObj *pStream);
...
@@ -35,7 +35,7 @@ static int32_t mndStreamActionInsert(SSdb *pSdb, SStreamObj *pStream);
static
int32_t
mndStreamActionDelete
(
SSdb
*
pSdb
,
SStreamObj
*
pStream
);
static
int32_t
mndStreamActionDelete
(
SSdb
*
pSdb
,
SStreamObj
*
pStream
);
static
int32_t
mndStreamActionUpdate
(
SSdb
*
pSdb
,
SStreamObj
*
pStream
,
SStreamObj
*
pNewStream
);
static
int32_t
mndStreamActionUpdate
(
SSdb
*
pSdb
,
SStreamObj
*
pStream
,
SStreamObj
*
pNewStream
);
static
int32_t
mndProcessCreateStreamReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessCreateStreamReq
(
SRpcMsg
*
pReq
);
/*static int32_t mndProcessDropStreamReq(SRpcMsg *pReq);*/
static
int32_t
mndProcessDropStreamReq
(
SRpcMsg
*
pReq
);
/*static int32_t mndProcessDropStreamInRsp(SRpcMsg *pRsp);*/
/*static int32_t mndProcessDropStreamInRsp(SRpcMsg *pRsp);*/
static
int32_t
mndProcessStreamMetaReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessStreamMetaReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndGetStreamMeta
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndGetStreamMeta
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
...
@@ -55,9 +55,8 @@ int32_t mndInitStream(SMnode *pMnode) {
...
@@ -55,9 +55,8 @@ int32_t mndInitStream(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_STREAM
,
mndProcessCreateStreamReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_STREAM
,
mndProcessCreateStreamReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_STREAM_TASK_DEPLOY_RSP
,
mndTransProcessRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_STREAM_TASK_DEPLOY_RSP
,
mndTransProcessRsp
);
/*mndSetMsgHandle(pMnode, TDMT_SND_TASK_DEPLOY_RSP, mndTransProcessRsp);*/
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_STREAM
,
mndProcessDropStreamReq
);
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM, mndProcessDropStreamReq);*/
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_STREAM_RSP
,
mndTransProcessRsp
);
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM_RSP, mndProcessDropStreamInRsp);*/
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAMS
,
mndRetrieveStream
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAMS
,
mndRetrieveStream
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAMS
,
mndCancelGetNextStream
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_STREAMS
,
mndCancelGetNextStream
);
...
@@ -196,16 +195,6 @@ void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream) {
...
@@ -196,16 +195,6 @@ void mndReleaseStream(SMnode *pMnode, SStreamObj *pStream) {
sdbRelease
(
pSdb
,
pStream
);
sdbRelease
(
pSdb
,
pStream
);
}
}
static
SDbObj
*
mndAcquireDbByStream
(
SMnode
*
pMnode
,
char
*
streamName
)
{
SName
name
=
{
0
};
tNameFromString
(
&
name
,
streamName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
char
db
[
TSDB_STREAM_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
db
);
return
mndAcquireDb
(
pMnode
,
db
);
}
static
int32_t
mndCheckCreateStreamReq
(
SCMCreateStreamReq
*
pCreate
)
{
static
int32_t
mndCheckCreateStreamReq
(
SCMCreateStreamReq
*
pCreate
)
{
if
(
pCreate
->
name
[
0
]
==
0
||
pCreate
->
sql
==
NULL
||
pCreate
->
sql
[
0
]
==
0
)
{
if
(
pCreate
->
name
[
0
]
==
0
||
pCreate
->
sql
==
NULL
||
pCreate
->
sql
[
0
]
==
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_STREAM_OPTION
;
terrno
=
TSDB_CODE_MND_INVALID_STREAM_OPTION
;
...
@@ -228,23 +217,22 @@ static int32_t mndStreamGetPlanString(const char *ast, int8_t triggerType, int64
...
@@ -228,23 +217,22 @@ static int32_t mndStreamGetPlanString(const char *ast, int8_t triggerType, int64
.
pAstRoot
=
pAst
,
.
pAstRoot
=
pAst
,
.
topicQuery
=
false
,
.
topicQuery
=
false
,
.
streamQuery
=
true
,
.
streamQuery
=
true
,
.
triggerType
=
triggerType
,
.
triggerType
=
triggerType
==
STREAM_TRIGGER_MAX_DELAY
?
STREAM_TRIGGER_WINDOW_CLOSE
:
triggerType
,
.
watermark
=
watermark
,
.
watermark
=
watermark
,
};
};
code
=
qCreateQueryPlan
(
&
cxt
,
&
pPlan
,
NULL
);
code
=
qCreateQueryPlan
(
&
cxt
,
&
pPlan
,
NULL
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesNodeToString
((
SNode
*
)
pPlan
,
false
,
pStr
,
NULL
);
code
=
nodesNodeToString
((
SNode
*
)
pPlan
,
false
,
pStr
,
NULL
);
}
}
nodesDestroyNode
(
pAst
);
nodesDestroyNode
(
pAst
);
nodesDestroyNode
((
SNode
*
)
pPlan
);
nodesDestroyNode
((
SNode
*
)
pPlan
);
terrno
=
code
;
terrno
=
code
;
return
code
;
return
code
;
}
}
int32_t
mndAddStreamToTrans
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
,
const
char
*
ast
,
int8_t
triggerType
,
int64_t
watermark
,
int32_t
mndAddStreamToTrans
(
SMnode
*
pMnode
,
SStreamObj
*
pStream
,
const
char
*
ast
,
STrans
*
pTrans
)
{
STrans
*
pTrans
)
{
SNode
*
pAst
=
NULL
;
SNode
*
pAst
=
NULL
;
if
(
nodesStringToNode
(
ast
,
&
pAst
)
<
0
)
{
if
(
nodesStringToNode
(
ast
,
&
pAst
)
<
0
)
{
...
@@ -258,7 +246,6 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
...
@@ -258,7 +246,6 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
// free
// free
nodesDestroyNode
(
pAst
);
nodesDestroyNode
(
pAst
);
#if 0
#if 0
printf("|");
printf("|");
for (int i = 0; i < pStream->outputSchema.nCols; i++) {
for (int i = 0; i < pStream->outputSchema.nCols; i++) {
...
@@ -268,7 +255,7 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
...
@@ -268,7 +255,7 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
#endif
#endif
if
(
TSDB_CODE_SUCCESS
!=
mndStreamGetPlanString
(
ast
,
triggerType
,
watermark
,
&
pStream
->
physicalPlan
))
{
if
(
TSDB_CODE_SUCCESS
!=
mndStreamGetPlanString
(
ast
,
pStream
->
trigger
,
pStream
->
watermark
,
&
pStream
->
physicalPlan
))
{
mError
(
"topic:%s, failed to get plan since %s"
,
pStream
->
name
,
terrstr
());
mError
(
"topic:%s, failed to get plan since %s"
,
pStream
->
name
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
...
@@ -293,7 +280,6 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
...
@@ -293,7 +280,6 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
static
int32_t
mndCreateStbForStream
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
const
SStreamObj
*
pStream
,
const
char
*
user
)
{
static
int32_t
mndCreateStbForStream
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
const
SStreamObj
*
pStream
,
const
char
*
user
)
{
SStbObj
*
pStb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMCreateStbReq
createReq
=
{
0
};
SMCreateStbReq
createReq
=
{
0
};
tstrncpy
(
createReq
.
name
,
pStream
->
targetSTbName
,
TSDB_TABLE_FNAME_LEN
);
tstrncpy
(
createReq
.
name
,
pStream
->
targetSTbName
,
TSDB_TABLE_FNAME_LEN
);
...
@@ -335,12 +321,8 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
...
@@ -335,12 +321,8 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
goto
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
user
);
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheck
WriteAuth
(
pUser
,
pDb
)
!=
0
)
{
if
(
mndCheck
DbAuth
(
pMnode
,
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -368,10 +350,50 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
...
@@ -368,10 +350,50 @@ static int32_t mndCreateStbForStream(SMnode *pMnode, STrans *pTrans, const SStre
_OVER:
_OVER:
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
return
-
1
;
return
-
1
;
}
}
static
int32_t
mndPersistTaskDropReq
(
STrans
*
pTrans
,
SStreamTask
*
pTask
)
{
ASSERT
(
pTask
->
nodeId
!=
0
);
// vnode
if
(
pTask
->
nodeId
>
0
)
{
SVDropStreamTaskReq
*
pReq
=
taosMemoryCalloc
(
1
,
sizeof
(
SVDropStreamTaskReq
));
if
(
pReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
pReq
->
head
.
vgId
=
htonl
(
pTask
->
nodeId
);
pReq
->
taskId
=
pTask
->
taskId
;
STransAction
action
=
{
0
};
memcpy
(
&
action
.
epSet
,
&
pTask
->
epSet
,
sizeof
(
SEpSet
));
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
SVDropStreamTaskReq
);
action
.
msgType
=
TDMT_VND_STREAM_TASK_DROP
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
return
-
1
;
}
}
return
0
;
}
static
int32_t
mndDropStreamTasks
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
)
{
int32_t
lv
=
taosArrayGetSize
(
pStream
->
tasks
);
for
(
int32_t
i
=
0
;
i
<
lv
;
i
++
)
{
SArray
*
pTasks
=
taosArrayGetP
(
pStream
->
tasks
,
i
);
int32_t
sz
=
taosArrayGetSize
(
pTasks
);
for
(
int32_t
j
=
0
;
j
<
sz
;
j
++
)
{
SStreamTask
*
pTask
=
taosArrayGetP
(
pTasks
,
j
);
if
(
mndPersistTaskDropReq
(
pTrans
,
pTask
)
<
0
)
{
return
-
1
;
}
}
}
return
0
;
}
static
int32_t
mndCreateStream
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SCMCreateStreamReq
*
pCreate
,
SDbObj
*
pDb
)
{
static
int32_t
mndCreateStream
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SCMCreateStreamReq
*
pCreate
,
SDbObj
*
pDb
)
{
mDebug
(
"stream:%s to create"
,
pCreate
->
name
);
mDebug
(
"stream:%s to create"
,
pCreate
->
name
);
SStreamObj
streamObj
=
{
0
};
SStreamObj
streamObj
=
{
0
};
...
@@ -391,7 +413,8 @@ static int32_t mndCreateStream(SMnode *pMnode, SRpcMsg *pReq, SCMCreateStreamReq
...
@@ -391,7 +413,8 @@ static int32_t mndCreateStream(SMnode *pMnode, SRpcMsg *pReq, SCMCreateStreamReq
streamObj
.
smaId
=
0
;
streamObj
.
smaId
=
0
;
/*streamObj.physicalPlan = "";*/
/*streamObj.physicalPlan = "";*/
streamObj
.
trigger
=
pCreate
->
triggerType
;
streamObj
.
trigger
=
pCreate
->
triggerType
;
streamObj
.
waterMark
=
pCreate
->
watermark
;
streamObj
.
watermark
=
pCreate
->
watermark
;
streamObj
.
triggerParam
=
pCreate
->
maxDelay
;
if
(
streamObj
.
targetSTbName
[
0
])
{
if
(
streamObj
.
targetSTbName
[
0
])
{
pDb
=
mndAcquireDbByStb
(
pMnode
,
streamObj
.
targetSTbName
);
pDb
=
mndAcquireDbByStb
(
pMnode
,
streamObj
.
targetSTbName
);
...
@@ -409,7 +432,7 @@ static int32_t mndCreateStream(SMnode *pMnode, SRpcMsg *pReq, SCMCreateStreamReq
...
@@ -409,7 +432,7 @@ static int32_t mndCreateStream(SMnode *pMnode, SRpcMsg *pReq, SCMCreateStreamReq
}
}
mDebug
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
pCreate
->
name
);
mDebug
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
pCreate
->
name
);
if
(
mndAddStreamToTrans
(
pMnode
,
&
streamObj
,
pCreate
->
ast
,
p
Create
->
triggerType
,
pCreate
->
watermark
,
p
Trans
)
!=
0
)
{
if
(
mndAddStreamToTrans
(
pMnode
,
&
streamObj
,
pCreate
->
ast
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to add stream since %s"
,
pTrans
->
id
,
terrstr
());
mError
(
"trans:%d, failed to add stream since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
-
1
;
return
-
1
;
...
@@ -436,19 +459,18 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
...
@@ -436,19 +459,18 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SStreamObj
*
pStream
=
NULL
;
SStreamObj
*
pStream
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCMCreateStreamReq
createStreamReq
=
{
0
};
SCMCreateStreamReq
createStreamReq
=
{
0
};
if
(
tDeserializeSCMCreateStreamReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createStreamReq
)
!=
0
)
{
if
(
tDeserializeSCMCreateStreamReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createStreamReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_STREAM
_OVER
;
goto
_OVER
;
}
}
mDebug
(
"stream:%s, start to create, sql:%s"
,
createStreamReq
.
name
,
createStreamReq
.
sql
);
mDebug
(
"stream:%s, start to create, sql:%s"
,
createStreamReq
.
name
,
createStreamReq
.
sql
);
if
(
mndCheckCreateStreamReq
(
&
createStreamReq
)
!=
0
)
{
if
(
mndCheckCreateStreamReq
(
&
createStreamReq
)
!=
0
)
{
mError
(
"stream:%s, failed to create since %s"
,
createStreamReq
.
name
,
terrstr
());
mError
(
"stream:%s, failed to create since %s"
,
createStreamReq
.
name
,
terrstr
());
goto
CREATE_STREAM
_OVER
;
goto
_OVER
;
}
}
pStream
=
mndAcquireStream
(
pMnode
,
createStreamReq
.
name
);
pStream
=
mndAcquireStream
(
pMnode
,
createStreamReq
.
name
);
...
@@ -456,46 +478,82 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
...
@@ -456,46 +478,82 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) {
if
(
createStreamReq
.
igExists
)
{
if
(
createStreamReq
.
igExists
)
{
mDebug
(
"stream:%s, already exist, ignore exist is set"
,
createStreamReq
.
name
);
mDebug
(
"stream:%s, already exist, ignore exist is set"
,
createStreamReq
.
name
);
code
=
0
;
code
=
0
;
goto
CREATE_STREAM
_OVER
;
goto
_OVER
;
}
else
{
}
else
{
terrno
=
TSDB_CODE_MND_STREAM_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_STREAM_ALREADY_EXIST
;
goto
CREATE_STREAM
_OVER
;
goto
_OVER
;
}
}
}
else
if
(
terrno
!=
TSDB_CODE_MND_STREAM_NOT_EXIST
)
{
}
else
if
(
terrno
!=
TSDB_CODE_MND_STREAM_NOT_EXIST
)
{
goto
CREATE_STREAM
_OVER
;
goto
_OVER
;
}
}
// TODO check auth
pDb
=
mndAcquireDb
(
pMnode
,
createStreamReq
.
sourceDB
);
pDb
=
mndAcquireDb
(
pMnode
,
createStreamReq
.
sourceDB
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
goto
CREATE_STREAM_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
goto
CREATE_STREAM_OVER
;
}
}
if
(
mndCheck
WriteAuth
(
pUser
,
pDb
)
!=
0
)
{
if
(
mndCheck
DbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
goto
CREATE_STREAM
_OVER
;
goto
_OVER
;
}
}
code
=
mndCreateStream
(
pMnode
,
pReq
,
&
createStreamReq
,
pDb
);
code
=
mndCreateStream
(
pMnode
,
pReq
,
&
createStreamReq
,
pDb
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
CREATE_STREAM
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"stream:%s, failed to create since %s"
,
createStreamReq
.
name
,
terrstr
());
mError
(
"stream:%s, failed to create since %s"
,
createStreamReq
.
name
,
terrstr
());
}
}
mndReleaseStream
(
pMnode
,
pStream
);
mndReleaseStream
(
pMnode
,
pStream
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
tFreeSCMCreateStreamReq
(
&
createStreamReq
);
tFreeSCMCreateStreamReq
(
&
createStreamReq
);
return
code
;
return
code
;
}
}
static
int32_t
mndProcessDropStreamReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
SStreamObj
*
pStream
=
NULL
;
/*SDbObj *pDb = NULL;*/
/*SUserObj *pUser = NULL;*/
SMDropStreamTaskReq
dropStreamReq
=
*
(
SMDropStreamTaskReq
*
)
pReq
->
pCont
;
pStream
=
mndAcquireStream
(
pMnode
,
dropStreamReq
.
name
);
if
(
pStream
==
NULL
)
{
terrno
=
TSDB_CODE_MND_STREAM_NOT_EXIST
;
return
-
1
;
}
#if 0
// todo check auth
pUser = mndAcquireUser(pMnode, pReq->conn.user);
if (pUser == NULL) {
goto DROP_STREAM_OVER;
}
#endif
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
mError
(
"stream:%s, failed to drop since %s"
,
dropStreamReq
.
name
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, used to drop stream:%s"
,
pTrans
->
id
,
dropStreamReq
.
name
);
// drop all tasks
if
(
mndDropStreamTasks
(
pMnode
,
pTrans
,
pStream
)
<
0
)
{
mError
(
"stream:%s, failed to drop task since %s"
,
dropStreamReq
.
name
,
terrstr
());
return
-
1
;
}
DROP_STREAM_OVER:
return
0
;
}
static
int32_t
mndGetNumOfStreams
(
SMnode
*
pMnode
,
char
*
dbName
,
int32_t
*
pNumOfStreams
)
{
static
int32_t
mndGetNumOfStreams
(
SMnode
*
pMnode
,
char
*
dbName
,
int32_t
*
pNumOfStreams
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
dbName
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
dbName
);
...
@@ -566,7 +624,7 @@ static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -566,7 +624,7 @@ static int32_t mndRetrieveStream(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
targetSTbName
,
true
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
targetSTbName
,
true
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
water
M
ark
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
water
m
ark
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
trigger
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pStream
->
trigger
,
false
);
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
7156f525
...
@@ -234,9 +234,9 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
...
@@ -234,9 +234,9 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
int32_t
code
=
syncPropose
(
pMgmt
->
sync
,
&
rsp
,
isWeak
);
int32_t
code
=
syncPropose
(
pMgmt
->
sync
,
&
rsp
,
isWeak
);
if
(
code
==
0
)
{
if
(
code
==
0
)
{
tsem_wait
(
&
pMgmt
->
syncSem
);
tsem_wait
(
&
pMgmt
->
syncSem
);
}
else
if
(
code
==
TAOS_SYNC_PROPOSE
_NOT_LEADER
)
{
}
else
if
(
code
==
-
1
&&
terrno
==
TSDB_CODE_SYN
_NOT_LEADER
)
{
terrno
=
TSDB_CODE_APP_NOT_READY
;
terrno
=
TSDB_CODE_APP_NOT_READY
;
}
else
if
(
code
==
TAOS_SYNC_OTHER
_ERROR
)
{
}
else
if
(
code
==
-
1
&&
terrno
==
TSDB_CODE_SYN_INTERNAL
_ERROR
)
{
terrno
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
terrno
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
}
else
{
}
else
{
terrno
=
TSDB_CODE_APP_ERROR
;
terrno
=
TSDB_CODE_APP_ERROR
;
...
@@ -257,13 +257,13 @@ void mndSyncStart(SMnode *pMnode) {
...
@@ -257,13 +257,13 @@ void mndSyncStart(SMnode *pMnode) {
syncStart
(
pMgmt
->
sync
);
syncStart
(
pMgmt
->
sync
);
mDebug
(
"mnode sync started, id:%"
PRId64
" standby:%d"
,
pMgmt
->
sync
,
pMgmt
->
standby
);
mDebug
(
"mnode sync started, id:%"
PRId64
" standby:%d"
,
pMgmt
->
sync
,
pMgmt
->
standby
);
/*
/*
if (pMgmt->standby) {
if (pMgmt->standby) {
syncStartStandBy(pMgmt->sync);
syncStartStandBy(pMgmt->sync);
} else {
} else {
syncStart(pMgmt->sync);
syncStart(pMgmt->sync);
}
}
*/
*/
}
}
void
mndSyncStop
(
SMnode
*
pMnode
)
{}
void
mndSyncStop
(
SMnode
*
pMnode
)
{}
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
7156f525
...
@@ -387,7 +387,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
...
@@ -387,7 +387,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
return
-
1
;
return
-
1
;
}
}
if
(
nodesNodeToString
((
SNode
*
)
pPlan
,
false
,
&
topicObj
.
physicalPlan
,
NULL
)
!=
0
)
{
if
(
nodesNodeToString
((
SNode
*
)
pPlan
,
false
,
&
topicObj
.
physicalPlan
,
NULL
)
!=
0
)
{
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
taosMemoryFree
(
topicObj
.
ast
);
taosMemoryFree
(
topicObj
.
ast
);
taosMemoryFree
(
topicObj
.
sql
);
taosMemoryFree
(
topicObj
.
sql
);
...
@@ -440,19 +440,18 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
...
@@ -440,19 +440,18 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SMqTopicObj
*
pTopic
=
NULL
;
SMqTopicObj
*
pTopic
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SCMCreateTopicReq
createTopicReq
=
{
0
};
SCMCreateTopicReq
createTopicReq
=
{
0
};
if
(
tDeserializeSCMCreateTopicReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createTopicReq
)
!=
0
)
{
if
(
tDeserializeSCMCreateTopicReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createTopicReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_TOPIC
_OVER
;
goto
_OVER
;
}
}
mDebug
(
"topic:%s, start to create, sql:%s"
,
createTopicReq
.
name
,
createTopicReq
.
sql
);
mDebug
(
"topic:%s, start to create, sql:%s"
,
createTopicReq
.
name
,
createTopicReq
.
sql
);
if
(
mndCheckCreateTopicReq
(
&
createTopicReq
)
!=
0
)
{
if
(
mndCheckCreateTopicReq
(
&
createTopicReq
)
!=
0
)
{
mError
(
"topic:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
mError
(
"topic:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
goto
CREATE_TOPIC
_OVER
;
goto
_OVER
;
}
}
pTopic
=
mndAcquireTopic
(
pMnode
,
createTopicReq
.
name
);
pTopic
=
mndAcquireTopic
(
pMnode
,
createTopicReq
.
name
);
...
@@ -460,41 +459,35 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
...
@@ -460,41 +459,35 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) {
if
(
createTopicReq
.
igExists
)
{
if
(
createTopicReq
.
igExists
)
{
mDebug
(
"topic:%s, already exist, ignore exist is set"
,
createTopicReq
.
name
);
mDebug
(
"topic:%s, already exist, ignore exist is set"
,
createTopicReq
.
name
);
code
=
0
;
code
=
0
;
goto
CREATE_TOPIC
_OVER
;
goto
_OVER
;
}
else
{
}
else
{
terrno
=
TSDB_CODE_MND_TOPIC_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_TOPIC_ALREADY_EXIST
;
goto
CREATE_TOPIC
_OVER
;
goto
_OVER
;
}
}
}
else
if
(
terrno
!=
TSDB_CODE_MND_TOPIC_NOT_EXIST
)
{
}
else
if
(
terrno
!=
TSDB_CODE_MND_TOPIC_NOT_EXIST
)
{
goto
CREATE_TOPIC
_OVER
;
goto
_OVER
;
}
}
pDb
=
mndAcquireDb
(
pMnode
,
createTopicReq
.
subDbName
);
pDb
=
mndAcquireDb
(
pMnode
,
createTopicReq
.
subDbName
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
goto
CREATE_TOPIC
_OVER
;
goto
_OVER
;
}
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckDbAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
goto
CREATE_TOPIC_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
CREATE_TOPIC_OVER
;
}
}
code
=
mndCreateTopic
(
pMnode
,
pReq
,
&
createTopicReq
,
pDb
);
code
=
mndCreateTopic
(
pMnode
,
pReq
,
&
createTopicReq
,
pDb
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
CREATE_TOPIC
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"topic:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
mError
(
"topic:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
}
}
mndReleaseTopic
(
pMnode
,
pTopic
);
mndReleaseTopic
(
pMnode
,
pTopic
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseUser
(
pMnode
,
pUser
);
tFreeSCMCreateTopicReq
(
&
createTopicReq
);
tFreeSCMCreateTopicReq
(
&
createTopicReq
);
return
code
;
return
code
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
7156f525
...
@@ -1362,7 +1362,6 @@ static int32_t mndProcessKillTransReq(SRpcMsg *pReq) {
...
@@ -1362,7 +1362,6 @@ static int32_t mndProcessKillTransReq(SRpcMsg *pReq) {
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SKillTransReq
killReq
=
{
0
};
SKillTransReq
killReq
=
{
0
};
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
STrans
*
pTrans
=
NULL
;
STrans
*
pTrans
=
NULL
;
if
(
tDeserializeSKillTransReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
killReq
)
!=
0
)
{
if
(
tDeserializeSKillTransReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
killReq
)
!=
0
)
{
...
@@ -1372,12 +1371,7 @@ static int32_t mndProcessKillTransReq(SRpcMsg *pReq) {
...
@@ -1372,12 +1371,7 @@ static int32_t mndProcessKillTransReq(SRpcMsg *pReq) {
mInfo
(
"trans:%d, start to kill"
,
killReq
.
transId
);
mInfo
(
"trans:%d, start to kill"
,
killReq
.
transId
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_KILL_TRANS
)
!=
0
)
{
if
(
pUser
==
NULL
)
{
goto
_OVER
;
}
if
(
mndCheckTransAuth
(
pUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -1393,7 +1387,6 @@ _OVER:
...
@@ -1393,7 +1387,6 @@ _OVER:
mError
(
"trans:%d, failed to kill since %s"
,
killReq
.
transId
,
terrstr
());
mError
(
"trans:%d, failed to kill since %s"
,
killReq
.
transId
,
terrstr
());
}
}
mndReleaseUser
(
pMnode
,
pUser
);
mndReleaseTrans
(
pMnode
,
pTrans
);
mndReleaseTrans
(
pMnode
,
pTrans
);
return
code
;
return
code
;
}
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
7156f525
...
@@ -68,6 +68,8 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
...
@@ -68,6 +68,8 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
tstrncpy
(
userObj
.
acct
,
acct
,
TSDB_USER_LEN
);
tstrncpy
(
userObj
.
acct
,
acct
,
TSDB_USER_LEN
);
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
sysInfo
=
1
;
userObj
.
enable
=
1
;
if
(
strcmp
(
user
,
TSDB_DEFAULT_USER
)
==
0
)
{
if
(
strcmp
(
user
,
TSDB_DEFAULT_USER
)
==
0
)
{
userObj
.
superUser
=
1
;
userObj
.
superUser
=
1
;
...
@@ -128,6 +130,9 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
...
@@ -128,6 +130,9 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
createdTime
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
createdTime
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
updateTime
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pUser
->
updateTime
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
superUser
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
superUser
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
sysInfo
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
enable
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pUser
->
reserve
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pUser
->
authVersion
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pUser
->
authVersion
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
numOfReadDbs
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
numOfReadDbs
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
numOfWriteDbs
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
numOfWriteDbs
,
_OVER
)
...
@@ -184,6 +189,9 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
...
@@ -184,6 +189,9 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pUser
->
createdTime
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pUser
->
createdTime
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pUser
->
updateTime
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pUser
->
updateTime
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pUser
->
superUser
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pUser
->
superUser
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pUser
->
sysInfo
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pUser
->
enable
,
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pUser
->
reserve
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pUser
->
authVersion
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pUser
->
authVersion
,
_OVER
)
int32_t
numOfReadDbs
=
0
;
int32_t
numOfReadDbs
=
0
;
...
@@ -256,6 +264,8 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) {
...
@@ -256,6 +264,8 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) {
taosWLockLatch
(
&
pOld
->
lock
);
taosWLockLatch
(
&
pOld
->
lock
);
pOld
->
updateTime
=
pNew
->
updateTime
;
pOld
->
updateTime
=
pNew
->
updateTime
;
pOld
->
authVersion
=
pNew
->
authVersion
;
pOld
->
authVersion
=
pNew
->
authVersion
;
pOld
->
sysInfo
=
pNew
->
sysInfo
;
pOld
->
enable
=
pNew
->
enable
;
memcpy
(
pOld
->
pass
,
pNew
->
pass
,
TSDB_PASSWORD_LEN
);
memcpy
(
pOld
->
pass
,
pNew
->
pass
,
TSDB_PASSWORD_LEN
);
TSWAP
(
pOld
->
readDbs
,
pNew
->
readDbs
);
TSWAP
(
pOld
->
readDbs
,
pNew
->
readDbs
);
TSWAP
(
pOld
->
writeDbs
,
pNew
->
writeDbs
);
TSWAP
(
pOld
->
writeDbs
,
pNew
->
writeDbs
);
...
@@ -286,6 +296,8 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
...
@@ -286,6 +296,8 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
createdTime
=
taosGetTimestampMs
();
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
superUser
=
pCreate
->
superUser
;
userObj
.
superUser
=
pCreate
->
superUser
;
userObj
.
sysInfo
=
pCreate
->
sysInfo
;
userObj
.
enable
=
pCreate
->
enable
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
...
@@ -348,7 +360,7 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
...
@@ -348,7 +360,7 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
if
(
mndCheck
CreateUserAuth
(
pOperUser
)
!=
0
)
{
if
(
mndCheck
OperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_CREATE_USER
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -481,6 +493,14 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
...
@@ -481,6 +493,14 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
newUser
.
superUser
=
alterReq
.
superUser
;
newUser
.
superUser
=
alterReq
.
superUser
;
}
}
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_ENABLE
)
{
newUser
.
enable
=
alterReq
.
enable
;
}
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_SYSINFO
)
{
newUser
.
sysInfo
=
alterReq
.
sysInfo
;
}
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_ADD_READ_DB
||
alterReq
.
alterType
==
TSDB_ALTER_USER_ADD_ALL_DB
)
{
if
(
alterReq
.
alterType
==
TSDB_ALTER_USER_ADD_READ_DB
||
alterReq
.
alterType
==
TSDB_ALTER_USER_ADD_ALL_DB
)
{
if
(
strcmp
(
alterReq
.
dbname
,
"1.*"
)
!=
0
)
{
if
(
strcmp
(
alterReq
.
dbname
,
"1.*"
)
!=
0
)
{
int32_t
len
=
strlen
(
alterReq
.
dbname
)
+
1
;
int32_t
len
=
strlen
(
alterReq
.
dbname
)
+
1
;
...
@@ -603,7 +623,6 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) {
...
@@ -603,7 +623,6 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) {
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SUserObj
*
pOperUser
=
NULL
;
SDropUserReq
dropReq
=
{
0
};
SDropUserReq
dropReq
=
{
0
};
if
(
tDeserializeSDropUserReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeSDropUserReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
...
@@ -624,13 +643,7 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) {
...
@@ -624,13 +643,7 @@ static int32_t mndProcessDropUserReq(SRpcMsg *pReq) {
goto
_OVER
;
goto
_OVER
;
}
}
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_DROP_USER
)
!=
0
)
{
if
(
pOperUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckDropUserAuth
(
pOperUser
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -642,9 +655,7 @@ _OVER:
...
@@ -642,9 +655,7 @@ _OVER:
mError
(
"user:%s, failed to drop since %s"
,
dropReq
.
user
,
terrstr
());
mError
(
"user:%s, failed to drop since %s"
,
dropReq
.
user
,
terrstr
());
}
}
mndReleaseUser
(
pMnode
,
pOperUser
);
mndReleaseUser
(
pMnode
,
pUser
);
mndReleaseUser
(
pMnode
,
pUser
);
return
code
;
return
code
;
}
}
...
@@ -740,19 +751,21 @@ static int32_t mndRetrieveUsers(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
...
@@ -740,19 +751,21 @@ static int32_t mndRetrieveUsers(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
cols
=
0
;
cols
=
0
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
char
name
[
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
name
[
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pUser
->
user
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pUser
->
user
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
name
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
name
,
false
);
cols
++
;
cols
++
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pUser
->
superUser
,
false
);
const
char
*
src
=
pUser
->
superUser
?
"super"
:
"normal"
;
cols
++
;
char
b
[
10
+
VARSTR_HEADER_SIZE
]
=
{
0
};
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
STR_WITH_SIZE_TO_VARSTR
(
b
,
src
,
strlen
(
src
));
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pUser
->
enable
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b
,
false
);
cols
++
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pUser
->
sysInfo
,
false
);
cols
++
;
cols
++
;
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
7156f525
...
@@ -1177,7 +1177,6 @@ _OVER:
...
@@ -1177,7 +1177,6 @@ _OVER:
static
int32_t
mndProcessRedistributeVgroupMsg
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessRedistributeVgroupMsg
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SUserObj
*
pUser
=
NULL
;
SDnodeObj
*
pNew1
=
NULL
;
SDnodeObj
*
pNew1
=
NULL
;
SDnodeObj
*
pNew2
=
NULL
;
SDnodeObj
*
pNew2
=
NULL
;
SDnodeObj
*
pNew3
=
NULL
;
SDnodeObj
*
pNew3
=
NULL
;
...
@@ -1200,13 +1199,8 @@ static int32_t mndProcessRedistributeVgroupMsg(SRpcMsg *pReq) {
...
@@ -1200,13 +1199,8 @@ static int32_t mndProcessRedistributeVgroupMsg(SRpcMsg *pReq) {
}
}
mInfo
(
"vgId:%d, start to redistribute to dnode %d:%d:%d"
,
req
.
vgId
,
req
.
dnodeId1
,
req
.
dnodeId2
,
req
.
dnodeId3
);
mInfo
(
"vgId:%d, start to redistribute to dnode %d:%d:%d"
,
req
.
vgId
,
req
.
dnodeId1
,
req
.
dnodeId2
,
req
.
dnodeId3
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheck
NodeAuth
(
pUser
)
!=
0
)
goto
_OVER
;
if
(
mndCheck
OperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_REDISTRIBUTE_VGROUP
)
!=
0
)
goto
_OVER
;
pVgroup
=
mndAcquireVgroup
(
pMnode
,
req
.
vgId
);
pVgroup
=
mndAcquireVgroup
(
pMnode
,
req
.
vgId
);
if
(
pVgroup
==
NULL
)
goto
_OVER
;
if
(
pVgroup
==
NULL
)
goto
_OVER
;
...
@@ -1368,7 +1362,6 @@ _OVER:
...
@@ -1368,7 +1362,6 @@ _OVER:
mndReleaseDnode
(
pMnode
,
pOld1
);
mndReleaseDnode
(
pMnode
,
pOld1
);
mndReleaseDnode
(
pMnode
,
pOld2
);
mndReleaseDnode
(
pMnode
,
pOld2
);
mndReleaseDnode
(
pMnode
,
pOld3
);
mndReleaseDnode
(
pMnode
,
pOld3
);
mndReleaseUser
(
pMnode
,
pUser
);
mndReleaseVgroup
(
pMnode
,
pVgroup
);
mndReleaseVgroup
(
pMnode
,
pVgroup
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
...
@@ -1493,12 +1486,11 @@ _OVER:
...
@@ -1493,12 +1486,11 @@ _OVER:
}
}
static
int32_t
mndProcessSplitVgroupMsg
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessSplitVgroupMsg
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
int32_t
vgId
=
2
;
int32_t
vgId
=
2
;
SUserObj
*
pUser
=
NULL
;
SVgObj
*
pVgroup
=
NULL
;
SVgObj
*
pVgroup
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
mDebug
(
"vgId:%d, start to split"
,
vgId
);
mDebug
(
"vgId:%d, start to split"
,
vgId
);
...
@@ -1508,19 +1500,12 @@ static int32_t mndProcessSplitVgroupMsg(SRpcMsg *pReq) {
...
@@ -1508,19 +1500,12 @@ static int32_t mndProcessSplitVgroupMsg(SRpcMsg *pReq) {
pDb
=
mndAcquireDb
(
pMnode
,
pVgroup
->
dbName
);
pDb
=
mndAcquireDb
(
pMnode
,
pVgroup
->
dbName
);
if
(
pDb
==
NULL
)
goto
_OVER
;
if
(
pDb
==
NULL
)
goto
_OVER
;
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
mndCheckOperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_SPLIT_VGROUP
)
!=
0
)
goto
_OVER
;
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheckNodeAuth
(
pUser
)
!=
0
)
goto
_OVER
;
code
=
mndSplitVgroup
(
pMnode
,
pReq
,
pDb
,
pVgroup
);
code
=
mndSplitVgroup
(
pMnode
,
pReq
,
pDb
,
pVgroup
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
_OVER:
_OVER:
mndReleaseUser
(
pMnode
,
pUser
);
mndReleaseVgroup
(
pMnode
,
pVgroup
);
mndReleaseVgroup
(
pMnode
,
pVgroup
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
return
code
;
return
code
;
...
@@ -1631,21 +1616,15 @@ _OVER:
...
@@ -1631,21 +1616,15 @@ _OVER:
}
}
static
int32_t
mndProcessBalanceVgroupMsg
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessBalanceVgroupMsg
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
SArray
*
pArray
=
NULL
;
SArray
*
pArray
=
NULL
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
int64_t
curMs
=
taosGetTimestampMs
();
int64_t
curMs
=
taosGetTimestampMs
();
mDebug
(
"start to balance vgroup"
);
mDebug
(
"start to balance vgroup"
);
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
conn
.
user
);
if
(
pUser
==
NULL
)
{
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
goto
_OVER
;
}
if
(
mndCheck
NodeAuth
(
pUser
)
!=
0
)
goto
_OVER
;
if
(
mndCheck
OperAuth
(
pMnode
,
pReq
->
conn
.
user
,
MND_OPER_BALANCE_VGROUP
)
!=
0
)
goto
_OVER
;
while
(
1
)
{
while
(
1
)
{
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
...
@@ -1676,7 +1655,6 @@ _OVER:
...
@@ -1676,7 +1655,6 @@ _OVER:
mError
(
"failed to balance vgroup since %s"
,
terrstr
());
mError
(
"failed to balance vgroup since %s"
,
terrstr
());
}
}
mndReleaseUser
(
pMnode
,
pUser
);
taosArrayDestroy
(
pArray
);
taosArrayDestroy
(
pArray
);
return
code
;
return
code
;
}
}
\ No newline at end of file
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
7156f525
...
@@ -88,7 +88,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) {
...
@@ -88,7 +88,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) {
TEST_F
(
MndTestProfile
,
03
_ConnectMsg_Show
)
{
TEST_F
(
MndTestProfile
,
03
_ConnectMsg_Show
)
{
test
.
SendShowReq
(
TSDB_MGMT_TABLE_CONNS
,
"connections"
,
""
);
test
.
SendShowReq
(
TSDB_MGMT_TABLE_CONNS
,
"connections"
,
""
);
EXPECT_EQ
(
test
.
GetShowRows
(),
0
);
EXPECT_EQ
(
test
.
GetShowRows
(),
1
);
}
}
TEST_F
(
MndTestProfile
,
04
_HeartBeatMsg
)
{
TEST_F
(
MndTestProfile
,
04
_HeartBeatMsg
)
{
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
7156f525
...
@@ -140,6 +140,7 @@ int32_t tqProcessVgDeleteReq(STQ* pTq, char* msg, int32_t msgLen);
...
@@ -140,6 +140,7 @@ int32_t tqProcessVgDeleteReq(STQ* pTq, char* msg, int32_t msgLen);
int32_t
tqProcessOffsetCommitReq
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessOffsetCommitReq
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
int32_t
workerId
);
int32_t
tqProcessPollReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
int32_t
workerId
);
int32_t
tqProcessTaskDeploy
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessTaskDeploy
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessTaskDropReq
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
);
int32_t
tqProcessStreamTrigger
(
STQ
*
pTq
,
SSubmitReq
*
data
);
int32_t
tqProcessStreamTrigger
(
STQ
*
pTq
,
SSubmitReq
*
data
);
int32_t
tqProcessTaskRunReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessTaskRunReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessTaskDispatchReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
int32_t
tqProcessTaskDispatchReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
7156f525
...
@@ -375,6 +375,8 @@ int32_t tqProcessTaskDeploy(STQ* pTq, char* msg, int32_t msgLen) {
...
@@ -375,6 +375,8 @@ int32_t tqProcessTaskDeploy(STQ* pTq, char* msg, int32_t msgLen) {
if
(
pTask
->
inputQueue
==
NULL
||
pTask
->
outputQueue
==
NULL
)
goto
FAIL
;
if
(
pTask
->
inputQueue
==
NULL
||
pTask
->
outputQueue
==
NULL
)
goto
FAIL
;
pTask
->
pMsgCb
=
&
pTq
->
pVnode
->
msgCb
;
// exec
// exec
if
(
pTask
->
execType
!=
TASK_EXEC__NONE
)
{
if
(
pTask
->
execType
!=
TASK_EXEC__NONE
)
{
// expand runners
// expand runners
...
@@ -406,9 +408,12 @@ int32_t tqProcessTaskDeploy(STQ* pTq, char* msg, int32_t msgLen) {
...
@@ -406,9 +408,12 @@ int32_t tqProcessTaskDeploy(STQ* pTq, char* msg, int32_t msgLen) {
tdGetSTSChemaFromSSChema
(
&
pTask
->
tbSink
.
pSchemaWrapper
->
pSchema
,
pTask
->
tbSink
.
pSchemaWrapper
->
nCols
);
tdGetSTSChemaFromSSChema
(
&
pTask
->
tbSink
.
pSchemaWrapper
->
pSchema
,
pTask
->
tbSink
.
pSchemaWrapper
->
nCols
);
ASSERT
(
pTask
->
tbSink
.
pTSchema
);
ASSERT
(
pTask
->
tbSink
.
pTSchema
);
}
}
streamSetupTrigger
(
pTask
);
tqInfo
(
"deploy stream task id %d child id %d on vg %d"
,
pTask
->
taskId
,
pTask
->
childId
,
pTq
->
pVnode
->
config
.
vgId
);
tqInfo
(
"deploy stream task id %d child id %d on vg %d"
,
pTask
->
taskId
,
pTask
->
childId
,
pTq
->
pVnode
->
config
.
vgId
);
taosHashPut
(
pTq
->
pStreamTasks
,
&
pTask
->
taskId
,
sizeof
(
int32_t
),
pTask
,
sizeof
(
SStreamTask
));
taosHashPut
(
pTq
->
pStreamTasks
,
&
pTask
->
taskId
,
sizeof
(
int32_t
),
&
pTask
,
sizeof
(
void
*
));
return
0
;
return
0
;
FAIL:
FAIL:
...
@@ -431,7 +436,7 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) {
...
@@ -431,7 +436,7 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) {
while
(
1
)
{
while
(
1
)
{
pIter
=
taosHashIterate
(
pTq
->
pStreamTasks
,
pIter
);
pIter
=
taosHashIterate
(
pTq
->
pStreamTasks
,
pIter
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
SStreamTask
*
pTask
=
(
SStreamTask
*
)
pIter
;
SStreamTask
*
pTask
=
*
(
SStreamTask
*
*
)
pIter
;
if
(
pTask
->
inputType
!=
STREAM_INPUT__DATA_SUBMIT
)
continue
;
if
(
pTask
->
inputType
!=
STREAM_INPUT__DATA_SUBMIT
)
continue
;
if
(
!
failed
)
{
if
(
!
failed
)
{
...
@@ -439,7 +444,7 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) {
...
@@ -439,7 +444,7 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) {
continue
;
continue
;
}
}
if
(
stream
Trigger
ByWrite
(
pTask
,
pTq
->
pVnode
->
config
.
vgId
,
&
pTq
->
pVnode
->
msgCb
)
<
0
)
{
if
(
stream
Launch
ByWrite
(
pTask
,
pTq
->
pVnode
->
config
.
vgId
,
&
pTq
->
pVnode
->
msgCb
)
<
0
)
{
continue
;
continue
;
}
}
}
else
{
}
else
{
...
@@ -459,7 +464,7 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -459,7 +464,7 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
//
//
SStreamTaskRunReq
*
pReq
=
pMsg
->
pCont
;
SStreamTaskRunReq
*
pReq
=
pMsg
->
pCont
;
int32_t
taskId
=
pReq
->
taskId
;
int32_t
taskId
=
pReq
->
taskId
;
SStreamTask
*
pTask
=
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
SStreamTask
*
pTask
=
*
(
SStreamTask
**
)
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
streamTaskProcessRunReq
(
pTask
,
&
pTq
->
pVnode
->
msgCb
);
streamTaskProcessRunReq
(
pTask
,
&
pTq
->
pVnode
->
msgCb
);
return
0
;
return
0
;
}
}
...
@@ -473,7 +478,7 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -473,7 +478,7 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) {
tDecoderInit
(
&
decoder
,
msgBody
,
msgLen
);
tDecoderInit
(
&
decoder
,
msgBody
,
msgLen
);
tDecodeStreamDispatchReq
(
&
decoder
,
&
req
);
tDecodeStreamDispatchReq
(
&
decoder
,
&
req
);
int32_t
taskId
=
req
.
taskId
;
int32_t
taskId
=
req
.
taskId
;
SStreamTask
*
pTask
=
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
SStreamTask
*
pTask
=
*
(
SStreamTask
**
)
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
SRpcMsg
rsp
=
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
info
=
pMsg
->
info
,
.
code
=
0
,
.
code
=
0
,
...
@@ -485,7 +490,7 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -485,7 +490,7 @@ int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg) {
int32_t
tqProcessTaskRecoverReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
int32_t
tqProcessTaskRecoverReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SStreamTaskRecoverReq
*
pReq
=
pMsg
->
pCont
;
SStreamTaskRecoverReq
*
pReq
=
pMsg
->
pCont
;
int32_t
taskId
=
pReq
->
taskId
;
int32_t
taskId
=
pReq
->
taskId
;
SStreamTask
*
pTask
=
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
SStreamTask
*
pTask
=
*
(
SStreamTask
**
)
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
streamProcessRecoverReq
(
pTask
,
&
pTq
->
pVnode
->
msgCb
,
pReq
,
pMsg
);
streamProcessRecoverReq
(
pTask
,
&
pTq
->
pVnode
->
msgCb
,
pReq
,
pMsg
);
return
0
;
return
0
;
}
}
...
@@ -493,7 +498,7 @@ int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -493,7 +498,7 @@ int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg) {
int32_t
tqProcessTaskDispatchRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
int32_t
tqProcessTaskDispatchRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SStreamDispatchRsp
*
pRsp
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
SStreamDispatchRsp
*
pRsp
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
taskId
=
pRsp
->
taskId
;
int32_t
taskId
=
pRsp
->
taskId
;
SStreamTask
*
pTask
=
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
SStreamTask
*
pTask
=
*
(
SStreamTask
**
)
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
streamProcessDispatchRsp
(
pTask
,
&
pTq
->
pVnode
->
msgCb
,
pRsp
);
streamProcessDispatchRsp
(
pTask
,
&
pTq
->
pVnode
->
msgCb
,
pRsp
);
return
0
;
return
0
;
}
}
...
@@ -501,7 +506,17 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
...
@@ -501,7 +506,17 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
int32_t
tqProcessTaskRecoverRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
int32_t
tqProcessTaskRecoverRsp
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
SStreamTaskRecoverRsp
*
pRsp
=
pMsg
->
pCont
;
SStreamTaskRecoverRsp
*
pRsp
=
pMsg
->
pCont
;
int32_t
taskId
=
pRsp
->
taskId
;
int32_t
taskId
=
pRsp
->
taskId
;
SStreamTask
*
pTask
=
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
SStreamTask
*
pTask
=
*
(
SStreamTask
**
)
taosHashGet
(
pTq
->
pStreamTasks
,
&
taskId
,
sizeof
(
int32_t
));
streamProcessRecoverRsp
(
pTask
,
pRsp
);
streamProcessRecoverRsp
(
pTask
,
pRsp
);
return
0
;
return
0
;
}
}
int32_t
tqProcessTaskDropReq
(
STQ
*
pTq
,
char
*
msg
,
int32_t
msgLen
)
{
SVDropStreamTaskReq
*
pReq
=
(
SVDropStreamTaskReq
*
)
msg
;
int32_t
code
=
taosHashRemove
(
pTq
->
pStreamTasks
,
&
pReq
->
taskId
,
sizeof
(
int32_t
));
if
(
code
==
0
)
{
// sendrsp
}
ASSERT
(
code
==
0
);
return
code
;
}
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
7156f525
...
@@ -168,6 +168,11 @@ int32_t vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
...
@@ -168,6 +168,11 @@ int32_t vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
goto
_err
;
goto
_err
;
}
}
}
break
;
}
break
;
case
TDMT_VND_STREAM_TASK_DROP
:
{
if
(
tqProcessTaskDropReq
(
pVnode
->
pTq
,
pMsg
->
pCont
,
pMsg
->
contLen
)
<
0
)
{
goto
_err
;
}
}
break
;
case
TDMT_VND_ALTER_CONFIRM
:
case
TDMT_VND_ALTER_CONFIRM
:
vnodeProcessAlterConfirmReq
(
pVnode
,
version
,
pReq
,
len
,
pRsp
);
vnodeProcessAlterConfirmReq
(
pVnode
,
version
,
pReq
,
len
,
pRsp
);
break
;
break
;
...
@@ -296,7 +301,7 @@ void vnodeUpdateMetaRsp(SVnode *pVnode, STableMetaRsp *pMetaRsp) {
...
@@ -296,7 +301,7 @@ void vnodeUpdateMetaRsp(SVnode *pVnode, STableMetaRsp *pMetaRsp) {
}
}
int32_t
vnodeProcessSyncReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
int32_t
vnodeProcessSyncReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
int32_t
ret
=
TAOS_SYNC_OTHER_ERROR
;
int32_t
ret
=
0
;
if
(
syncEnvIsStart
())
{
if
(
syncEnvIsStart
())
{
SSyncNode
*
pSyncNode
=
syncNodeAcquire
(
pVnode
->
sync
);
SSyncNode
*
pSyncNode
=
syncNodeAcquire
(
pVnode
->
sync
);
...
@@ -375,21 +380,25 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
...
@@ -375,21 +380,25 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
ret
=
syncNodeOnAppendEntriesReplyCb
(
pSyncNode
,
pSyncMsg
);
ret
=
syncNodeOnAppendEntriesReplyCb
(
pSyncNode
,
pSyncMsg
);
syncAppendEntriesReplyDestroy
(
pSyncMsg
);
syncAppendEntriesReplyDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_SET_
M
NODE_STANDBY
)
{
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_SET_
V
NODE_STANDBY
)
{
ret
=
syncSetStandby
(
pVnode
->
sync
);
ret
=
syncSetStandby
(
pVnode
->
sync
);
vInfo
(
"vgId:%d, set standby result:0x%x rid:%"
PRId64
,
pVnode
->
config
.
vgId
,
ret
,
pVnode
->
sync
);
SRpcMsg
rsp
=
{.
code
=
ret
,
.
info
=
pMsg
->
info
};
SRpcMsg
rsp
=
{.
code
=
ret
,
.
info
=
pMsg
->
info
};
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
}
else
{
}
else
{
vError
(
"==vnodeProcessSyncReq== error msg type:%d"
,
pRpcMsg
->
msgType
);
vError
(
"==vnodeProcessSyncReq== error msg type:%d"
,
pRpcMsg
->
msgType
);
ret
=
TAOS_SYNC_OTHER_ERROR
;
ret
=
-
1
;
}
}
syncNodeRelease
(
pSyncNode
);
syncNodeRelease
(
pSyncNode
);
}
else
{
}
else
{
vError
(
"==vnodeProcessSyncReq== error syncEnv stop"
);
vError
(
"==vnodeProcessSyncReq== error syncEnv stop"
);
ret
=
TAOS_SYNC_OTHER_ERROR
;
ret
=
-
1
;
}
}
if
(
ret
!=
0
)
{
terrno
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
}
return
ret
;
return
ret
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
7156f525
...
@@ -98,7 +98,8 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
...
@@ -98,7 +98,8 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
if
(
code
==
0
)
{
if
(
code
==
0
)
{
vnodeAccumBlockMsg
(
pVnode
,
pMsg
->
msgType
);
vnodeAccumBlockMsg
(
pVnode
,
pMsg
->
msgType
);
}
else
if
(
code
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
}
else
if
(
code
==
-
1
&&
terrno
==
TSDB_CODE_SYN_NOT_LEADER
)
{
SEpSet
newEpSet
=
{
0
};
SEpSet
newEpSet
=
{
0
};
syncGetEpSet
(
pVnode
->
sync
,
&
newEpSet
);
syncGetEpSet
(
pVnode
->
sync
,
&
newEpSet
);
SEp
*
pEp
=
&
newEpSet
.
eps
[
newEpSet
.
inUse
];
SEp
*
pEp
=
&
newEpSet
.
eps
[
newEpSet
.
inUse
];
...
@@ -247,29 +248,17 @@ static void vnodeSyncRollBackMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta
...
@@ -247,29 +248,17 @@ static void vnodeSyncRollBackMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta
syncRpcMsgLog2
(
logBuf
,
(
SRpcMsg
*
)
pMsg
);
syncRpcMsgLog2
(
logBuf
,
(
SRpcMsg
*
)
pMsg
);
}
}
int32_t
vnodeSnapshotStartRead
(
struct
SSyncFSM
*
pFsm
,
void
**
ppReader
)
{
int32_t
vnodeSnapshotStartRead
(
struct
SSyncFSM
*
pFsm
,
void
**
ppReader
)
{
return
0
;
}
return
0
;
}
int32_t
vnodeSnapshotStopRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
)
{
int32_t
vnodeSnapshotStopRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
)
{
return
0
;
}
return
0
;
}
int32_t
vnodeSnapshotDoRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
,
void
**
ppBuf
,
int32_t
*
len
)
{
int32_t
vnodeSnapshotDoRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
,
void
**
ppBuf
,
int32_t
*
len
)
{
return
0
;
}
return
0
;
}
int32_t
vnodeSnapshotStartWrite
(
struct
SSyncFSM
*
pFsm
,
void
**
ppWriter
)
{
int32_t
vnodeSnapshotStartWrite
(
struct
SSyncFSM
*
pFsm
,
void
**
ppWriter
)
{
return
0
;
}
return
0
;
}
int32_t
vnodeSnapshotStopWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
bool
isApply
)
{
int32_t
vnodeSnapshotStopWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
bool
isApply
)
{
return
0
;
}
return
0
;
}
int32_t
vnodeSnapshotDoWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
void
*
pBuf
,
int32_t
len
)
{
int32_t
vnodeSnapshotDoWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
void
*
pBuf
,
int32_t
len
)
{
return
0
;
}
return
0
;
}
static
SSyncFSM
*
vnodeSyncMakeFsm
(
SVnode
*
pVnode
)
{
static
SSyncFSM
*
vnodeSyncMakeFsm
(
SVnode
*
pVnode
)
{
SSyncFSM
*
pFsm
=
taosMemoryCalloc
(
1
,
sizeof
(
SSyncFSM
));
SSyncFSM
*
pFsm
=
taosMemoryCalloc
(
1
,
sizeof
(
SSyncFSM
));
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
7156f525
...
@@ -261,55 +261,49 @@ int32_t ctgInitGetTbIndexTask(SCtgJob *pJob, int32_t taskIdx, SName *name) {
...
@@ -261,55 +261,49 @@ int32_t ctgInitGetTbIndexTask(SCtgJob *pJob, int32_t taskIdx, SName *name) {
}
}
int32_t
ctgHandleForceUpdate
(
SCatalog
*
pCtg
,
SCtgJob
*
pJob
,
const
SCatalogReq
*
pReq
)
{
int32_t
ctgHandleForceUpdate
(
SCatalog
*
pCtg
,
int32_t
taskNum
,
SCtgJob
*
pJob
,
const
SCatalogReq
*
pReq
)
{
int32_t
dbNum
=
pJob
->
dbCfgNum
+
pJob
->
dbVgNum
+
pJob
->
dbInfoNum
;
SHashObj
*
pDb
=
taosHashInit
(
taskNum
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_NO_LOCK
);
if
(
dbNum
>
0
)
{
if
(
NULL
==
pDb
)
{
if
(
dbNum
>
pJob
->
dbCfgNum
&&
dbNum
>
pJob
->
dbVgNum
&&
dbNum
>
pJob
->
dbInfoNum
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
SHashObj
*
pDb
=
taosHashInit
(
dbNum
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_NO_LOCK
);
}
if
(
NULL
==
pDb
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbVgNum
;
++
i
)
{
}
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbVgroup
,
i
);
taosHashPut
(
pDb
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
TSDB_DB_FNAME_LEN
);
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbVgNum
;
++
i
)
{
}
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbVgroup
,
i
);
taosHashPut
(
pDb
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
TSDB_DB_FNAME_LEN
);
}
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbCfgNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbCfgNum
;
++
i
)
{
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbCfg
,
i
);
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbCfg
,
i
);
taosHashPut
(
pDb
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
TSDB_DB_FNAME_LEN
);
taosHashPut
(
pDb
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
TSDB_DB_FNAME_LEN
);
}
}
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbInfoNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbInfoNum
;
++
i
)
{
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbInfo
,
i
);
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbInfo
,
i
);
taosHashPut
(
pDb
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
TSDB_DB_FNAME_LEN
);
taosHashPut
(
pDb
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
TSDB_DB_FNAME_LEN
);
}
}
char
*
dbFName
=
taosHashIterate
(
pDb
,
NULL
);
for
(
int32_t
i
=
0
;
i
<
pJob
->
tbMetaNum
;
++
i
)
{
while
(
dbFName
)
{
SName
*
name
=
taosArrayGet
(
pReq
->
pTableMeta
,
i
);
ctgDropDbVgroupEnqueue
(
pCtg
,
dbFName
,
true
);
char
dbFName
[
TSDB_DB_FNAME_LEN
];
dbFName
=
taosHashIterate
(
pDb
,
dbFName
);
tNameGetFullDbName
(
name
,
dbFName
);
}
taosHashPut
(
pDb
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
TSDB_DB_FNAME_LEN
);
}
for
(
int32_t
i
=
0
;
i
<
pJob
->
tbHashNum
;
++
i
)
{
SName
*
name
=
taosArrayGet
(
pReq
->
pTableHash
,
i
);
char
dbFName
[
TSDB_DB_FNAME_LEN
];
tNameGetFullDbName
(
name
,
dbFName
);
taosHashPut
(
pDb
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
TSDB_DB_FNAME_LEN
);
}
taosHashCleanup
(
pDb
);
char
*
dbFName
=
taosHashIterate
(
pDb
,
NULL
);
}
else
{
while
(
dbFName
)
{
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbVgNum
;
++
i
)
{
ctgDropDbVgroupEnqueue
(
pCtg
,
dbFName
,
true
);
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbVgroup
,
i
);
dbFName
=
taosHashIterate
(
pDb
,
dbFName
);
CTG_ERR_RET
(
ctgDropDbVgroupEnqueue
(
pCtg
,
dbFName
,
true
));
}
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbCfgNum
;
++
i
)
{
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbCfg
,
i
);
CTG_ERR_RET
(
ctgDropDbVgroupEnqueue
(
pCtg
,
dbFName
,
true
));
}
for
(
int32_t
i
=
0
;
i
<
pJob
->
dbInfoNum
;
++
i
)
{
char
*
dbFName
=
taosArrayGet
(
pReq
->
pDbInfo
,
i
);
CTG_ERR_RET
(
ctgDropDbVgroupEnqueue
(
pCtg
,
dbFName
,
true
));
}
}
}
}
taosHashCleanup
(
pDb
);
int32_t
tbNum
=
pJob
->
tbMetaNum
+
pJob
->
tbHashNum
;
int32_t
tbNum
=
pJob
->
tbMetaNum
+
pJob
->
tbHashNum
;
if
(
tbNum
>
0
)
{
if
(
tbNum
>
0
)
{
if
(
tbNum
>
pJob
->
tbMetaNum
&&
tbNum
>
pJob
->
tbHashNum
)
{
if
(
tbNum
>
pJob
->
tbMetaNum
&&
tbNum
>
pJob
->
tbHashNum
)
{
...
@@ -404,7 +398,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -404,7 +398,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
}
}
if
(
pReq
->
forceUpdate
)
{
if
(
pReq
->
forceUpdate
)
{
CTG_ERR_JRET
(
ctgHandleForceUpdate
(
pCtg
,
pJob
,
pReq
));
CTG_ERR_JRET
(
ctgHandleForceUpdate
(
pCtg
,
*
taskNum
,
pJob
,
pReq
));
}
}
int32_t
taskIdx
=
0
;
int32_t
taskIdx
=
0
;
...
@@ -790,8 +784,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTask* pTask, int32_t reqType, const SDataBuf *
...
@@ -790,8 +784,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTask* pTask, int32_t reqType, const SDataBuf *
_return:
_return:
if
(
dbCache
)
{
if
(
dbCache
)
{
ctgRUnlockVgInfo
(
dbCache
);
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
}
}
ctgHandleTaskEnd
(
pTask
,
code
);
ctgHandleTaskEnd
(
pTask
,
code
);
...
@@ -870,7 +863,7 @@ _return:
...
@@ -870,7 +863,7 @@ _return:
int32_t
ctgHandleGetTbIndexRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
ctgHandleGetTbIndexRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
&
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
CTG_ERR_JRET
(
ctgProcessRspMsg
(
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
STableIndex
*
pOut
=
(
STableIndex
*
)
pTask
->
msgCtx
.
out
;
STableIndex
*
pOut
=
(
STableIndex
*
)
pTask
->
msgCtx
.
out
;
SArray
*
pInfo
=
NULL
;
SArray
*
pInfo
=
NULL
;
...
@@ -949,7 +942,6 @@ _return:
...
@@ -949,7 +942,6 @@ _return:
int32_t
ctgHandleGetUserRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
ctgHandleGetUserRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
SCtgDBCache
*
dbCache
=
NULL
;
SCtgUserCtx
*
ctx
=
(
SCtgUserCtx
*
)
pTask
->
taskCtx
;
SCtgUserCtx
*
ctx
=
(
SCtgUserCtx
*
)
pTask
->
taskCtx
;
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
bool
pass
=
false
;
bool
pass
=
false
;
...
@@ -1018,7 +1010,7 @@ int32_t ctgAsyncRefreshTbMeta(SCtgTask *pTask) {
...
@@ -1018,7 +1010,7 @@ int32_t ctgAsyncRefreshTbMeta(SCtgTask *pTask) {
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
dbFName
,
&
dbCache
));
if
(
dbCache
)
{
if
(
dbCache
)
{
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
vgInfo
=
{
0
};
CTG_ERR_RET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
ctx
->
pName
,
&
vgInfo
));
CTG_ERR_
J
RET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
ctx
->
pName
,
&
vgInfo
));
ctgDebug
(
"will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
ctx
->
pName
),
ctx
->
flag
);
ctgDebug
(
"will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d"
,
tNameGetTableName
(
ctx
->
pName
),
ctx
->
flag
);
...
@@ -1067,6 +1059,9 @@ int32_t ctgLaunchGetDbVgTask(SCtgTask *pTask) {
...
@@ -1067,6 +1059,9 @@ int32_t ctgLaunchGetDbVgTask(SCtgTask *pTask) {
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
pCtx
->
dbFName
,
&
dbCache
));
CTG_ERR_RET
(
ctgAcquireVgInfoFromCache
(
pCtg
,
pCtx
->
dbFName
,
&
dbCache
));
if
(
NULL
!=
dbCache
)
{
if
(
NULL
!=
dbCache
)
{
CTG_ERR_JRET
(
ctgGenerateVgList
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
->
vgHash
,
(
SArray
**
)
&
pTask
->
res
));
CTG_ERR_JRET
(
ctgGenerateVgList
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
->
vgHash
,
(
SArray
**
)
&
pTask
->
res
));
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
dbCache
=
NULL
;
CTG_ERR_JRET
(
ctgHandleTaskEnd
(
pTask
,
0
));
CTG_ERR_JRET
(
ctgHandleTaskEnd
(
pTask
,
0
));
}
else
{
}
else
{
...
@@ -1101,6 +1096,9 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask *pTask) {
...
@@ -1101,6 +1096,9 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask *pTask) {
CTG_ERR_JRET
(
TSDB_CODE_OUT_OF_MEMORY
);
CTG_ERR_JRET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
pCtx
->
pName
,
(
SVgroupInfo
*
)
pTask
->
res
));
CTG_ERR_JRET
(
ctgGetVgInfoFromHashValue
(
pCtg
,
dbCache
->
vgCache
.
vgInfo
,
pCtx
->
pName
,
(
SVgroupInfo
*
)
pTask
->
res
));
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
dbCache
=
NULL
;
CTG_ERR_JRET
(
ctgHandleTaskEnd
(
pTask
,
0
));
CTG_ERR_JRET
(
ctgHandleTaskEnd
(
pTask
,
0
));
}
else
{
}
else
{
...
@@ -1176,6 +1174,9 @@ int32_t ctgLaunchGetDbInfoTask(SCtgTask *pTask) {
...
@@ -1176,6 +1174,9 @@ int32_t ctgLaunchGetDbInfoTask(SCtgTask *pTask) {
pInfo
->
vgVer
=
dbCache
->
vgCache
.
vgInfo
->
vgVersion
;
pInfo
->
vgVer
=
dbCache
->
vgCache
.
vgInfo
->
vgVersion
;
pInfo
->
dbId
=
dbCache
->
dbId
;
pInfo
->
dbId
=
dbCache
->
dbId
;
pInfo
->
tbNum
=
dbCache
->
vgCache
.
vgInfo
->
numOfTable
;
pInfo
->
tbNum
=
dbCache
->
vgCache
.
vgInfo
->
numOfTable
;
ctgReleaseVgInfoToCache
(
pCtg
,
dbCache
);
dbCache
=
NULL
;
}
else
{
}
else
{
pInfo
->
vgVer
=
CTG_DEFAULT_INVALID_VERSION
;
pInfo
->
vgVer
=
CTG_DEFAULT_INVALID_VERSION
;
}
}
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
7156f525
...
@@ -1899,7 +1899,7 @@ _return:
...
@@ -1899,7 +1899,7 @@ _return:
void
ctgUpdateThreadUnexpectedStopped
(
void
)
{
void
ctgUpdateThreadUnexpectedStopped
(
void
)
{
if
(
CTG_IS_LOCKED
(
&
gCtgMgmt
.
lock
)
>
0
)
CTG_UNLOCK
(
CTG_READ
,
&
gCtgMgmt
.
lock
);
if
(
!
atomic_load_8
((
int8_t
*
)
&
gCtgMgmt
.
exit
)
&&
CTG_IS_LOCKED
(
&
gCtgMgmt
.
lock
)
>
0
)
CTG_UNLOCK
(
CTG_READ
,
&
gCtgMgmt
.
lock
);
}
}
void
ctgCleanupCacheQueue
(
void
)
{
void
ctgCleanupCacheQueue
(
void
)
{
...
...
source/libs/catalog/src/ctgDbg.c
浏览文件 @
7156f525
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include "catalogInt.h"
#include "catalogInt.h"
extern
SCatalogMgmt
gCtgMgmt
;
extern
SCatalogMgmt
gCtgMgmt
;
SCtgDebug
gCTGDebug
=
{
0
};
SCtgDebug
gCTGDebug
=
{
.
lockEnable
=
true
,
.
apiEnable
=
true
};
void
ctgdUserCallback
(
SMetaData
*
pResult
,
void
*
param
,
int32_t
code
)
{
void
ctgdUserCallback
(
SMetaData
*
pResult
,
void
*
param
,
int32_t
code
)
{
ASSERT
(
*
(
int32_t
*
)
param
==
1
);
ASSERT
(
*
(
int32_t
*
)
param
==
1
);
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
7156f525
...
@@ -675,7 +675,8 @@ int32_t ctgCloneTableIndex(SArray* pIndex, SArray** pRes) {
...
@@ -675,7 +675,8 @@ int32_t ctgCloneTableIndex(SArray* pIndex, SArray** pRes) {
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
STableIndexInfo
*
pInfo
=
taosArrayGet
(
pIndex
,
i
);
STableIndexInfo
*
pInfo
=
taosArrayGet
(
pIndex
,
i
);
taosArrayPush
(
*
pRes
,
pInfo
);
pInfo
=
taosArrayPush
(
*
pRes
,
pInfo
);
pInfo
->
expr
=
strdup
(
pInfo
->
expr
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/executor/inc/executil.h
浏览文件 @
7156f525
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
typedef
struct
SGroupResInfo
{
typedef
struct
SGroupResInfo
{
int32_t
index
;
int32_t
index
;
SArray
*
pRows
;
// SArray<SResKeyPos>
SArray
*
pRows
;
// SArray<SResKeyPos>
int32_t
position
;
}
SGroupResInfo
;
}
SGroupResInfo
;
typedef
struct
SResultRow
{
typedef
struct
SResultRow
{
...
@@ -56,7 +55,7 @@ typedef struct SResultRow {
...
@@ -56,7 +55,7 @@ typedef struct SResultRow {
uint32_t
numOfRows
;
// number of rows of current time window
uint32_t
numOfRows
;
// number of rows of current time window
STimeWindow
win
;
STimeWindow
win
;
struct
SResultRowEntryInfo
pEntryInfo
[];
// For each result column, there is a resultInfo
struct
SResultRowEntryInfo
pEntryInfo
[];
// For each result column, there is a resultInfo
// char *key;
// start key of current result row
// char *key; // start key of current result row
}
SResultRow
;
}
SResultRow
;
typedef
struct
SResultRowPosition
{
typedef
struct
SResultRowPosition
{
...
@@ -71,9 +70,7 @@ typedef struct SResKeyPos {
...
@@ -71,9 +70,7 @@ typedef struct SResKeyPos {
}
SResKeyPos
;
}
SResKeyPos
;
typedef
struct
SResultRowInfo
{
typedef
struct
SResultRowInfo
{
SResultRowPosition
*
pPosition
;
// todo remove this
int32_t
size
;
// number of result set
int32_t
size
;
// number of result set
int32_t
capacity
;
// max capacity
SResultRowPosition
cur
;
SResultRowPosition
cur
;
SList
*
openWindow
;
SList
*
openWindow
;
}
SResultRowInfo
;
}
SResultRowInfo
;
...
...
source/libs/executor/inc/executorInt.h
浏览文件 @
7156f525
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
extern
int32_t
exchangeObjRefPool
;
typedef
struct
{
typedef
struct
{
char
*
pData
;
char
*
pData
;
bool
isNull
;
bool
isNull
;
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
7156f525
...
@@ -181,7 +181,6 @@ typedef struct SExecTaskInfo {
...
@@ -181,7 +181,6 @@ typedef struct SExecTaskInfo {
STaskCostInfo
cost
;
STaskCostInfo
cost
;
int64_t
owner
;
// if it is in execution
int64_t
owner
;
// if it is in execution
int32_t
code
;
int32_t
code
;
// uint64_t totalRows; // total number of rows
struct
{
struct
{
char
*
tablename
;
char
*
tablename
;
char
*
dbname
;
char
*
dbname
;
...
@@ -222,10 +221,10 @@ typedef struct STaskRuntimeEnv {
...
@@ -222,10 +221,10 @@ typedef struct STaskRuntimeEnv {
}
STaskRuntimeEnv
;
}
STaskRuntimeEnv
;
enum
{
enum
{
OP_NOT_OPENED
=
0x0
,
OP_NOT_OPENED
=
0x0
,
OP_OPENED
=
0x1
,
OP_OPENED
=
0x1
,
OP_RES_TO_RETURN
=
0x5
,
OP_RES_TO_RETURN
=
0x5
,
OP_EXEC_DONE
=
0x9
,
OP_EXEC_DONE
=
0x9
,
};
};
typedef
struct
SOperatorFpSet
{
typedef
struct
SOperatorFpSet
{
...
@@ -262,12 +261,12 @@ typedef enum {
...
@@ -262,12 +261,12 @@ typedef enum {
}
EX_SOURCE_STATUS
;
}
EX_SOURCE_STATUS
;
typedef
struct
SSourceDataInfo
{
typedef
struct
SSourceDataInfo
{
struct
SExchangeInfo
*
pEx
;
int32_t
index
;
int32_t
index
;
SRetrieveTableRsp
*
pRsp
;
SRetrieveTableRsp
*
pRsp
;
uint64_t
totalRows
;
uint64_t
totalRows
;
int32_t
code
;
int32_t
code
;
EX_SOURCE_STATUS
status
;
EX_SOURCE_STATUS
status
;
const
char
*
taskId
;
}
SSourceDataInfo
;
}
SSourceDataInfo
;
typedef
struct
SLoadRemoteDataInfo
{
typedef
struct
SLoadRemoteDataInfo
{
...
@@ -285,6 +284,7 @@ typedef struct SExchangeInfo {
...
@@ -285,6 +284,7 @@ typedef struct SExchangeInfo {
bool
seqLoadData
;
// sequential load data or not, false by default
bool
seqLoadData
;
// sequential load data or not, false by default
int32_t
current
;
int32_t
current
;
SLoadRemoteDataInfo
loadInfo
;
SLoadRemoteDataInfo
loadInfo
;
uint64_t
self
;
}
SExchangeInfo
;
}
SExchangeInfo
;
#define COL_MATCH_FROM_COL_ID 0x1
#define COL_MATCH_FROM_COL_ID 0x1
...
@@ -365,7 +365,9 @@ typedef struct SCatchSupporter {
...
@@ -365,7 +365,9 @@ typedef struct SCatchSupporter {
}
SCatchSupporter
;
}
SCatchSupporter
;
typedef
struct
SStreamAggSupporter
{
typedef
struct
SStreamAggSupporter
{
SArray
*
pResultRows
;
SHashObj
*
pResultRows
;
SArray
*
pCurWins
;
int32_t
valueSize
;
int32_t
keySize
;
int32_t
keySize
;
char
*
pKeyBuf
;
// window key buffer
char
*
pKeyBuf
;
// window key buffer
SDiskbasedBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
SDiskbasedBuf
*
pResultBuf
;
// query result buffer based on blocked-wised disk file
...
@@ -391,7 +393,9 @@ typedef struct SStreamBlockScanInfo {
...
@@ -391,7 +393,9 @@ typedef struct SStreamBlockScanInfo {
void
*
streamBlockReader
;
// stream block reader handle
void
*
streamBlockReader
;
// stream block reader handle
SArray
*
pColMatchInfo
;
//
SArray
*
pColMatchInfo
;
//
SNode
*
pCondition
;
SNode
*
pCondition
;
int32_t
tsArrayIndex
;
SArray
*
tsArray
;
SArray
*
tsArray
;
uint64_t
groupId
;
SUpdateInfo
*
pUpdateInfo
;
SUpdateInfo
*
pUpdateInfo
;
SExprInfo
*
pPseudoExpr
;
SExprInfo
*
pPseudoExpr
;
...
@@ -466,10 +470,8 @@ typedef struct SIntervalAggOperatorInfo {
...
@@ -466,10 +470,8 @@ typedef struct SIntervalAggOperatorInfo {
bool
timeWindowInterpo
;
// interpolation needed or not
bool
timeWindowInterpo
;
// interpolation needed or not
char
**
pRow
;
// previous row/tuple of already processed datablock
char
**
pRow
;
// previous row/tuple of already processed datablock
SArray
*
pInterpCols
;
// interpolation columns
SArray
*
pInterpCols
;
// interpolation columns
STableQueryInfo
*
pCurrent
;
// current tableQueryInfo struct
int32_t
order
;
// current SSDataBlock scan order
int32_t
order
;
// current SSDataBlock scan order
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
SArray
*
pUpdatedWindow
;
// updated time window due to the input data block from the downstream operator.
STimeWindowAggSupp
twAggSup
;
STimeWindowAggSupp
twAggSup
;
bool
invertible
;
bool
invertible
;
SArray
*
pPrevValues
;
// SArray<SGroupKeys> used to keep the previous not null value for interpolation.
SArray
*
pPrevValues
;
// SArray<SGroupKeys> used to keep the previous not null value for interpolation.
...
@@ -498,8 +500,6 @@ typedef struct SAggOperatorInfo {
...
@@ -498,8 +500,6 @@ typedef struct SAggOperatorInfo {
STableQueryInfo
*
current
;
STableQueryInfo
*
current
;
uint64_t
groupId
;
uint64_t
groupId
;
SGroupResInfo
groupResInfo
;
SGroupResInfo
groupResInfo
;
STableQueryInfo
*
pTableQueryInfo
;
SExprInfo
*
pScalarExprInfo
;
SExprInfo
*
pScalarExprInfo
;
int32_t
numOfScalarExpr
;
// the number of scalar expression before the aggregate function can be applied
int32_t
numOfScalarExpr
;
// the number of scalar expression before the aggregate function can be applied
SqlFunctionCtx
*
pScalarCtx
;
// scalar function requried sql function struct.
SqlFunctionCtx
*
pScalarCtx
;
// scalar function requried sql function struct.
...
@@ -582,6 +582,7 @@ typedef struct SPartitionOperatorInfo {
...
@@ -582,6 +582,7 @@ typedef struct SPartitionOperatorInfo {
int32_t
*
columnOffset
;
// start position for each column data
int32_t
*
columnOffset
;
// start position for each column data
void
*
pGroupIter
;
// group iterator
void
*
pGroupIter
;
// group iterator
int32_t
pageIndex
;
// page index of current group
int32_t
pageIndex
;
// page index of current group
SSDataBlock
*
pUpdateRes
;
}
SPartitionOperatorInfo
;
}
SPartitionOperatorInfo
;
typedef
struct
SWindowRowsSup
{
typedef
struct
SWindowRowsSup
{
...
@@ -634,8 +635,13 @@ typedef struct SStreamSessionAggOperatorInfo {
...
@@ -634,8 +635,13 @@ typedef struct SStreamSessionAggOperatorInfo {
typedef
struct
STimeSliceOperatorInfo
{
typedef
struct
STimeSliceOperatorInfo
{
SOptrBasicInfo
binfo
;
SOptrBasicInfo
binfo
;
STimeWindow
win
;
SInterval
interval
;
SInterval
interval
;
SGroupResInfo
groupResInfo
;
// multiple results build supporter
int64_t
current
;
SArray
*
pPrevRow
;
// SArray<SGroupValue>
SArray
*
pCols
;
// SArray<SColumn>
int32_t
fillType
;
// fill type
struct
SFillColInfo
*
pFillColInfo
;
// fill column info
}
STimeSliceOperatorInfo
;
}
STimeSliceOperatorInfo
;
typedef
struct
SStateWindowOperatorInfo
{
typedef
struct
SStateWindowOperatorInfo
{
...
@@ -728,6 +734,8 @@ typedef struct SJoinOperatorInfo {
...
@@ -728,6 +734,8 @@ typedef struct SJoinOperatorInfo {
#define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED)
#define OPTR_IS_OPENED(_optr) (((_optr)->status & OP_OPENED) == OP_OPENED)
#define OPTR_SET_OPENED(_optr) ((_optr)->status |= OP_OPENED)
#define OPTR_SET_OPENED(_optr) ((_optr)->status |= OP_OPENED)
void
doDestroyExchangeOperatorInfo
(
void
*
param
);
SOperatorFpSet
createOperatorFpSet
(
__optr_open_fn_t
openFn
,
__optr_fn_t
nextFn
,
__optr_fn_t
streamFn
,
SOperatorFpSet
createOperatorFpSet
(
__optr_open_fn_t
openFn
,
__optr_fn_t
nextFn
,
__optr_fn_t
streamFn
,
__optr_fn_t
cleanup
,
__optr_close_fn_t
closeFn
,
__optr_encode_fn_t
encode
,
__optr_fn_t
cleanup
,
__optr_close_fn_t
closeFn
,
__optr_encode_fn_t
encode
,
__optr_decode_fn_t
decode
,
__optr_explain_fn_t
explain
);
__optr_decode_fn_t
decode
,
__optr_explain_fn_t
explain
);
...
@@ -835,7 +843,7 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SExprInfo*
...
@@ -835,7 +843,7 @@ SOperatorInfo* createPartitionOperatorInfo(SOperatorInfo* downstream, SExprInfo*
SSDataBlock
*
pResultBlock
,
SArray
*
pGroupColList
,
SExecTaskInfo
*
pTaskInfo
);
SSDataBlock
*
pResultBlock
,
SArray
*
pGroupColList
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTimeSliceOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createTimeSliceOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResultBlock
,
SExecTaskInfo
*
pTaskInfo
);
SSDataBlock
*
pResultBlock
,
const
SNodeListNode
*
pValNode
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createMergeJoinOperatorInfo
(
SOperatorInfo
**
pDownstream
,
int32_t
numOfDownstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SNode
*
pOnCondition
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createMergeJoinOperatorInfo
(
SOperatorInfo
**
pDownstream
,
int32_t
numOfDownstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SNode
*
pOnCondition
,
SExecTaskInfo
*
pTaskInfo
);
...
@@ -896,9 +904,9 @@ int32_t getNumOfRowsInTimeWindow(SDataBlockInfo* pDataBlockInfo, TSKEY* pPrimary
...
@@ -896,9 +904,9 @@ int32_t getNumOfRowsInTimeWindow(SDataBlockInfo* pDataBlockInfo, TSKEY* pPrimary
__block_search_fn_t
searchFn
,
STableQueryInfo
*
item
,
int32_t
order
);
__block_search_fn_t
searchFn
,
STableQueryInfo
*
item
,
int32_t
order
);
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
int32_t
binarySearchForKey
(
char
*
pValue
,
int
num
,
TSKEY
key
,
int
order
);
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
size
_t
size
);
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
int32
_t
size
);
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int64_t
tableGroupId
,
int32_t
interBufSize
);
SResultRow
*
getNewResultRow
(
SDiskbasedBuf
*
pResultBuf
,
int64_t
tableGroupId
,
int32_t
interBufSize
);
SResultWindowInfo
*
getSessionTimeWindow
(
S
Array
*
pWinInfos
,
TSKEY
ts
,
int64_t
gap
,
int32_t
*
pIndex
);
SResultWindowInfo
*
getSessionTimeWindow
(
S
StreamAggSupporter
*
pAggSup
,
TSKEY
ts
,
uint64_t
groupId
,
int64_t
gap
,
int32_t
*
pIndex
);
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pTs
,
int32_t
rows
,
int32_t
updateSessionWindowInfo
(
SResultWindowInfo
*
pWinInfo
,
TSKEY
*
pTs
,
int32_t
rows
,
int32_t
start
,
int64_t
gap
,
SHashObj
*
pStDeleted
);
int32_t
start
,
int64_t
gap
,
SHashObj
*
pStDeleted
);
bool
functionNeedToExecute
(
SqlFunctionCtx
*
pCtx
);
bool
functionNeedToExecute
(
SqlFunctionCtx
*
pCtx
);
...
@@ -908,6 +916,16 @@ int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosi
...
@@ -908,6 +916,16 @@ int32_t finalizeResultRowIntoResultDataBlock(SDiskbasedBuf* pBuf, SResultRowPosi
SqlFunctionCtx
*
pCtx
,
SExprInfo
*
pExprInfo
,
int32_t
numOfExprs
,
const
int32_t
*
rowCellOffset
,
SqlFunctionCtx
*
pCtx
,
SExprInfo
*
pExprInfo
,
int32_t
numOfExprs
,
const
int32_t
*
rowCellOffset
,
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
);
SSDataBlock
*
pBlock
,
SExecTaskInfo
*
pTaskInfo
);
int32_t
getTableList
(
void
*
metaHandle
,
int32_t
tableType
,
uint64_t
tableUid
,
STableListInfo
*
pListInfo
,
SNode
*
pTagCond
);
int32_t
createMultipleDataReaders
(
STableScanPhysiNode
*
pTableScanNode
,
SReadHandle
*
pHandle
,
STableListInfo
*
pTableListInfo
,
SArray
*
arrayReader
,
uint64_t
queryId
,
uint64_t
taskId
,
SNode
*
pTagCond
);
SOperatorInfo
*
createTableMergeScanOperatorInfo
(
STableScanPhysiNode
*
pTableScanNode
,
SArray
*
dataReaders
,
SReadHandle
*
readHandle
,
SExecTaskInfo
*
pTaskInfo
);
void
copyUpdateDataBlock
(
SSDataBlock
*
pDest
,
SSDataBlock
*
pSource
,
int32_t
tsColIndex
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/executor/inc/tfill.h
浏览文件 @
7156f525
...
@@ -28,8 +28,6 @@ struct SSDataBlock;
...
@@ -28,8 +28,6 @@ struct SSDataBlock;
typedef
struct
SFillColInfo
{
typedef
struct
SFillColInfo
{
SExprInfo
*
pExpr
;
SExprInfo
*
pExpr
;
// SResSchema schema;
// int16_t functionId; // sql function id
int16_t
flag
;
// column flag: TAG COLUMN|NORMAL COLUMN
int16_t
flag
;
// column flag: TAG COLUMN|NORMAL COLUMN
int16_t
tagIndex
;
// index of current tag in SFillTagColInfo array list
int16_t
tagIndex
;
// index of current tag in SFillTagColInfo array list
SVariant
fillVal
;
SVariant
fillVal
;
...
...
source/libs/executor/src/executil.c
浏览文件 @
7156f525
...
@@ -41,13 +41,7 @@ int32_t getOutputInterResultBufSize(STaskAttr* pQueryAttr) {
...
@@ -41,13 +41,7 @@ int32_t getOutputInterResultBufSize(STaskAttr* pQueryAttr) {
int32_t
initResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
,
int32_t
size
)
{
int32_t
initResultRowInfo
(
SResultRowInfo
*
pResultRowInfo
,
int32_t
size
)
{
pResultRowInfo
->
size
=
0
;
pResultRowInfo
->
size
=
0
;
pResultRowInfo
->
capacity
=
size
;
pResultRowInfo
->
cur
.
pageId
=
-
1
;
pResultRowInfo
->
cur
.
pageId
=
-
1
;
pResultRowInfo
->
pPosition
=
taosMemoryCalloc
(
pResultRowInfo
->
capacity
,
sizeof
(
SResultRowPosition
));
if
(
pResultRowInfo
->
pPosition
==
NULL
)
{
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -56,25 +50,14 @@ void cleanupResultRowInfo(SResultRowInfo *pResultRowInfo) {
...
@@ -56,25 +50,14 @@ void cleanupResultRowInfo(SResultRowInfo *pResultRowInfo) {
return
;
return
;
}
}
if
(
pResultRowInfo
->
capacity
==
0
)
{
// assert(pResultRowInfo->pResult == NULL);
return
;
}
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
// if (pResultRowInfo->pResult[i]) {
// if (pResultRowInfo->pResult[i]) {
// taosMemoryFreeClear(pResultRowInfo->pResult[i]->key);
// taosMemoryFreeClear(pResultRowInfo->pResult[i]->key);
// }
// }
}
}
taosMemoryFreeClear
(
pResultRowInfo
->
pPosition
);
}
}
void
resetResultRowInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
pResultRowInfo
)
{
void
resetResultRowInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SResultRowInfo
*
pResultRowInfo
)
{
if
(
pResultRowInfo
==
NULL
||
pResultRowInfo
->
capacity
==
0
)
{
return
;
}
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pResultRowInfo
->
size
;
++
i
)
{
// SResultRow *pWindowRes = pResultRowInfo->pResult[i];
// SResultRow *pWindowRes = pResultRowInfo->pResult[i];
// clearResultRow(pRuntimeEnv, pWindowRes);
// clearResultRow(pRuntimeEnv, pWindowRes);
...
@@ -288,232 +271,3 @@ void orderTheResultRows(STaskRuntimeEnv* pRuntimeEnv) {
...
@@ -288,232 +271,3 @@ void orderTheResultRows(STaskRuntimeEnv* pRuntimeEnv) {
taosArraySort
(
pRuntimeEnv
->
pResultRowArrayList
,
fn
);
taosArraySort
(
pRuntimeEnv
->
pResultRowArrayList
,
fn
);
}
}
static
int32_t
mergeIntoGroupResultImplRv
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SGroupResInfo
*
pGroupResInfo
,
uint64_t
groupId
,
int32_t
*
rowCellInfoOffset
)
{
if
(
pGroupResInfo
->
pRows
==
NULL
)
{
pGroupResInfo
->
pRows
=
taosArrayInit
(
100
,
POINTER_BYTES
);
}
size_t
len
=
taosArrayGetSize
(
pRuntimeEnv
->
pResultRowArrayList
);
for
(;
pGroupResInfo
->
position
<
len
;
++
pGroupResInfo
->
position
)
{
SResultRowCell
*
pResultRowCell
=
taosArrayGet
(
pRuntimeEnv
->
pResultRowArrayList
,
pGroupResInfo
->
position
);
if
(
pResultRowCell
->
groupId
!=
groupId
)
{
break
;
}
int64_t
num
=
0
;
//getNumOfResultWindowRes(pRuntimeEnv, &pResultRowCell->pos, rowCellInfoOffset);
if
(
num
<=
0
)
{
continue
;
}
taosArrayPush
(
pGroupResInfo
->
pRows
,
&
pResultRowCell
->
pos
);
// pResultRowCell->pRow->numOfRows = (uint32_t) num;
}
return
TSDB_CODE_SUCCESS
;
}
static
UNUSED_FUNC
int32_t
mergeIntoGroupResultImpl
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SGroupResInfo
*
pGroupResInfo
,
SArray
*
pTableList
,
int32_t
*
rowCellInfoOffset
)
{
bool
ascQuery
=
true
;
#if 0
int32_t code = TSDB_CODE_SUCCESS;
int32_t *posList = NULL;
SMultiwayMergeTreeInfo *pTree = NULL;
STableQueryInfo **pTableQueryInfoList = NULL;
size_t size = taosArrayGetSize(pTableList);
if (pGroupResInfo->pRows == NULL) {
pGroupResInfo->pRows = taosArrayInit(100, POINTER_BYTES);
}
posList = taosMemoryCalloc(size, sizeof(int32_t));
pTableQueryInfoList = taosMemoryMalloc(POINTER_BYTES * size);
if (pTableQueryInfoList == NULL || posList == NULL || pGroupResInfo->pRows == NULL || pGroupResInfo->pRows == NULL) {
// qError("QInfo:%"PRIu64" failed alloc memory", GET_TASKID(pRuntimeEnv));
code = TSDB_CODE_QRY_OUT_OF_MEMORY;
goto _end;
}
int32_t numOfTables = 0;
for (int32_t i = 0; i < size; ++i) {
STableQueryInfo *item = taosArrayGetP(pTableList, i);
// if (item->resInfo.size > 0) {
// pTableQueryInfoList[numOfTables++] = item;
// }
}
// there is no data in current group
// no need to merge results since only one table in each group
// if (numOfTables == 0) {
// goto _end;
// }
int32_t order = TSDB_ORDER_ASC;
SCompSupporter cs = {pTableQueryInfoList, posList, order};
int32_t ret = tMergeTreeCreate(&pTree, numOfTables, &cs, tableResultComparFn);
if (ret != TSDB_CODE_SUCCESS) {
code = TSDB_CODE_QRY_OUT_OF_MEMORY;
goto _end;
}
int64_t lastTimestamp = ascQuery? INT64_MIN:INT64_MAX;
int64_t startt = taosGetTimestampMs();
while (1) {
int32_t tableIndex = tMergeTreeGetChosenIndex(pTree);
SResultRowInfo *pWindowResInfo = &pTableQueryInfoList[tableIndex]->resInfo;
ASSERT(0);
SResultRow *pWindowRes = NULL;//getResultRow(pBuf, pWindowResInfo, cs.rowIndex[tableIndex]);
int64_t num = 0;//getNumOfResultWindowRes(pRuntimeEnv, pWindowRes, rowCellInfoOffset);
if (num <= 0) {
cs.rowIndex[tableIndex] += 1;
if (cs.rowIndex[tableIndex] >= pWindowResInfo->size) {
cs.rowIndex[tableIndex] = -1;
if (--numOfTables == 0) { // all input sources are exhausted
break;
}
}
} else {
assert((pWindowRes->win.skey >= lastTimestamp && ascQuery) || (pWindowRes->win.skey <= lastTimestamp && !ascQuery));
if (pWindowRes->win.skey != lastTimestamp) {
taosArrayPush(pGroupResInfo->pRows, &pWindowRes);
pWindowRes->numOfRows = (uint32_t) num;
}
lastTimestamp = pWindowRes->win.skey;
// move to the next row of current entry
if ((++cs.rowIndex[tableIndex]) >= pWindowResInfo->size) {
cs.rowIndex[tableIndex] = -1;
// all input sources are exhausted
if ((--numOfTables) == 0) {
break;
}
}
}
tMergeTreeAdjust(pTree, tMergeTreeGetAdjustIndex(pTree));
}
int64_t endt = taosGetTimestampMs();
// qDebug("QInfo:%"PRIx64" result merge completed for group:%d, elapsed time:%" PRId64 " ms", GET_TASKID(pRuntimeEnv),
// pGroupResInfo->currentGroup, endt - startt);
_end:
taosMemoryFreeClear(pTableQueryInfoList);
taosMemoryFreeClear(posList);
taosMemoryFreeClear(pTree);
return code;
}
int32_t mergeIntoGroupResult(SGroupResInfo* pGroupResInfo, STaskRuntimeEnv* pRuntimeEnv, int32_t* offset) {
int64_t st = taosGetTimestampUs();
while (pGroupResInfo->currentGroup < pGroupResInfo->totalGroup) {
mergeIntoGroupResultImplRv(pRuntimeEnv, pGroupResInfo, pGroupResInfo->currentGroup, offset);
// this group generates at least one result, return results
if (taosArrayGetSize(pGroupResInfo->pRows) > 0) {
break;
}
// qDebug("QInfo:%"PRIu64" no result in group %d, continue", GET_TASKID(pRuntimeEnv), pGroupResInfo->currentGroup);
cleanupGroupResInfo(pGroupResInfo);
incNextGroup(pGroupResInfo);
}
// int64_t elapsedTime = taosGetTimestampUs() - st;
// qDebug("QInfo:%"PRIu64" merge res data into group, index:%d, total group:%d, elapsed time:%" PRId64 "us", GET_TASKID(pRuntimeEnv),
// pGroupResInfo->currentGroup, pGroupResInfo->totalGroup, elapsedTime);
#endif
return
TSDB_CODE_SUCCESS
;
}
//void blockDistInfoToBinary(STableBlockDist* pDist, struct SBufferWriter* bw) {
// tbufWriteUint32(bw, pDist->numOfTables);
// tbufWriteUint16(bw, pDist->numOfFiles);
// tbufWriteUint64(bw, pDist->totalSize);
// tbufWriteUint64(bw, pDist->totalRows);
// tbufWriteInt32(bw, pDist->maxRows);
// tbufWriteInt32(bw, pDist->minRows);
// tbufWriteUint32(bw, pDist->numOfInmemRows);
// tbufWriteUint32(bw, pDist->numOfSmallBlocks);
// tbufWriteUint64(bw, taosArrayGetSize(pDist->dataBlockInfos));
//
// // compress the binary string
// char* p = TARRAY_GET_START(pDist->dataBlockInfos);
//
// // compress extra bytes
// size_t x = taosArrayGetSize(pDist->dataBlockInfos) * pDist->dataBlockInfos->elemSize;
// char* tmp = taosMemoryMalloc(x + 2);
//
// bool comp = false;
// int32_t len = tsCompressString(p, (int32_t)x, 1, tmp, (int32_t)x, ONE_STAGE_COMP, NULL, 0);
// if (len == -1 || len >= x) { // compress failed, do not compress this binary data
// comp = false;
// len = (int32_t)x;
// } else {
// comp = true;
// }
//
// tbufWriteUint8(bw, comp);
// tbufWriteUint32(bw, len);
// if (comp) {
// tbufWriteBinary(bw, tmp, len);
// } else {
// tbufWriteBinary(bw, p, len);
// }
// taosMemoryFreeClear(tmp);
//}
//void blockDistInfoFromBinary(const char* data, int32_t len, STableBlockDist* pDist) {
// SBufferReader br = tbufInitReader(data, len, false);
//
// pDist->numOfTables = tbufReadUint32(&br);
// pDist->numOfFiles = tbufReadUint16(&br);
// pDist->totalSize = tbufReadUint64(&br);
// pDist->totalRows = tbufReadUint64(&br);
// pDist->maxRows = tbufReadInt32(&br);
// pDist->minRows = tbufReadInt32(&br);
// pDist->numOfInmemRows = tbufReadUint32(&br);
// pDist->numOfSmallBlocks = tbufReadUint32(&br);
// int64_t numSteps = tbufReadUint64(&br);
//
// bool comp = tbufReadUint8(&br);
// uint32_t compLen = tbufReadUint32(&br);
//
// size_t originalLen = (size_t) (numSteps *sizeof(SFileBlockInfo));
//
// char* outputBuf = NULL;
// if (comp) {
// outputBuf = taosMemoryMalloc(originalLen);
//
// size_t actualLen = compLen;
// const char* compStr = tbufReadBinary(&br, &actualLen);
//
// int32_t orignalLen = tsDecompressString(compStr, compLen, 1, outputBuf,
// (int32_t)originalLen , ONE_STAGE_COMP, NULL, 0);
// assert(orignalLen == numSteps *sizeof(SFileBlockInfo));
// } else {
// outputBuf = (char*) tbufReadBinary(&br, &originalLen);
// }
//
// pDist->dataBlockInfos = taosArrayFromList(outputBuf, (uint32_t)numSteps, sizeof(SFileBlockInfo));
// if (comp) {
// taosMemoryFreeClear(outputBuf);
// }
//}
source/libs/executor/src/executor.c
浏览文件 @
7156f525
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
#include "tdatablock.h"
#include "tdatablock.h"
#include "vnode.h"
#include "vnode.h"
static
int32_t
doSetStreamBlock
(
SOperatorInfo
*
pOperator
,
void
*
input
,
size_t
numOfBlocks
,
int32_t
type
,
bool
assignUid
,
char
*
id
)
{
static
int32_t
doSetStreamBlock
(
SOperatorInfo
*
pOperator
,
void
*
input
,
size_t
numOfBlocks
,
int32_t
type
,
bool
assignUid
,
char
*
id
)
{
ASSERT
(
pOperator
!=
NULL
);
ASSERT
(
pOperator
!=
NULL
);
if
(
pOperator
->
operatorType
!=
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
)
{
if
(
pOperator
->
operatorType
!=
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
)
{
if
(
pOperator
->
numOfDownstream
==
0
)
{
if
(
pOperator
->
numOfDownstream
==
0
)
{
...
@@ -43,6 +44,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -43,6 +44,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
if
(
pInfo
->
blockType
==
0
)
{
if
(
pInfo
->
blockType
==
0
)
{
pInfo
->
blockType
=
type
;
pInfo
->
blockType
=
type
;
}
else
if
(
pInfo
->
blockType
!=
type
)
{
}
else
if
(
pInfo
->
blockType
!=
type
)
{
ASSERT
(
0
);
return
TSDB_CODE_QRY_APP_ERROR
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
}
...
@@ -51,7 +53,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -51,7 +53,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
qError
(
"submit msg messed up when initing stream block, %s"
PRIx64
,
id
);
qError
(
"submit msg messed up when initing stream block, %s"
PRIx64
,
id
);
return
TSDB_CODE_QRY_APP_ERROR
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
}
}
else
{
}
else
if
(
type
==
STREAM_DATA_TYPE_SSDATA_BLOCK
)
{
for
(
int32_t
i
=
0
;
i
<
numOfBlocks
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfBlocks
;
++
i
)
{
SSDataBlock
*
pDataBlock
=
&
((
SSDataBlock
*
)
input
)[
i
];
SSDataBlock
*
pDataBlock
=
&
((
SSDataBlock
*
)
input
)[
i
];
...
@@ -62,6 +64,8 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -62,6 +64,8 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
taosArrayAddAll
(
p
->
pDataBlock
,
pDataBlock
->
pDataBlock
);
taosArrayAddAll
(
p
->
pDataBlock
,
pDataBlock
->
pDataBlock
);
taosArrayPush
(
pInfo
->
pBlockLists
,
&
p
);
taosArrayPush
(
pInfo
->
pBlockLists
,
&
p
);
}
}
}
else
{
ASSERT
(
0
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -83,7 +87,8 @@ int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numO
...
@@ -83,7 +87,8 @@ int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numO
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
int32_t
code
=
doSetStreamBlock
(
pTaskInfo
->
pRoot
,
(
void
**
)
pBlocks
,
numOfBlocks
,
type
,
assignUid
,
GET_TASKID
(
pTaskInfo
));
int32_t
code
=
doSetStreamBlock
(
pTaskInfo
->
pRoot
,
(
void
**
)
pBlocks
,
numOfBlocks
,
type
,
assignUid
,
GET_TASKID
(
pTaskInfo
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"%s failed to set the stream block data"
,
GET_TASKID
(
pTaskInfo
));
qError
(
"%s failed to set the stream block data"
,
GET_TASKID
(
pTaskInfo
));
}
else
{
}
else
{
...
@@ -162,7 +167,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
...
@@ -162,7 +167,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
pInfo
=
pInfo
->
pDownstream
[
0
];
pInfo
=
pInfo
->
pDownstream
[
0
];
}
}
int32_t
code
=
0
;
int32_t
code
=
0
;
SStreamBlockScanInfo
*
pScanInfo
=
pInfo
->
info
;
SStreamBlockScanInfo
*
pScanInfo
=
pInfo
->
info
;
if
(
isAdd
)
{
// add new table id
if
(
isAdd
)
{
// add new table id
SArray
*
qa
=
filterQualifiedChildTables
(
pScanInfo
,
tableIdList
);
SArray
*
qa
=
filterQualifiedChildTables
(
pScanInfo
,
tableIdList
);
...
@@ -178,9 +183,10 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
...
@@ -178,9 +183,10 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
return
code
;
return
code
;
}
}
int32_t
qGetQueriedTableSchemaVersion
(
qTaskInfo_t
tinfo
,
char
*
dbName
,
char
*
tableName
,
int32_t
*
sversion
,
int32_t
*
tversion
)
{
int32_t
qGetQueriedTableSchemaVersion
(
qTaskInfo_t
tinfo
,
char
*
dbName
,
char
*
tableName
,
int32_t
*
sversion
,
int32_t
*
tversion
)
{
ASSERT
(
tinfo
!=
NULL
&&
dbName
!=
NULL
&&
tableName
!=
NULL
);
ASSERT
(
tinfo
!=
NULL
&&
dbName
!=
NULL
&&
tableName
!=
NULL
);
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
*
sversion
=
pTaskInfo
->
schemaVer
.
sversion
;
*
sversion
=
pTaskInfo
->
schemaVer
.
sversion
;
*
tversion
=
pTaskInfo
->
schemaVer
.
tversion
;
*
tversion
=
pTaskInfo
->
schemaVer
.
tversion
;
...
@@ -196,4 +202,4 @@ int32_t qGetQueriedTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tab
...
@@ -196,4 +202,4 @@ int32_t qGetQueriedTableSchemaVersion(qTaskInfo_t tinfo, char* dbName, char* tab
}
}
return
0
;
return
0
;
}
}
\ No newline at end of file
source/libs/executor/src/executorMain.c
浏览文件 @
7156f525
...
@@ -13,28 +13,30 @@
...
@@ -13,28 +13,30 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <vnode.h>
#include "dataSinkMgt.h"
#include "texception.h"
#include "os.h"
#include "os.h"
#include "tarray.h"
#include "tref.h"
#include "tcache.h"
#include "dataSinkMgt.h"
#include "tglobal.h"
#include "tmsg.h"
#include "tmsg.h"
#include "tudf.h"
#include "tudf.h"
#include "executor.h"
#include "executor.h"
#include "executorimpl.h"
#include "executorimpl.h"
#include "query.h"
#include "query.h"
#include "thash.h"
#include "tlosertree.h"
static
TdThreadOnce
initPoolOnce
=
PTHREAD_ONCE_INIT
;
#include "ttypes.h"
int32_t
exchangeObjRefPool
=
-
1
;
static
void
initRefPool
()
{
exchangeObjRefPool
=
taosOpenRef
(
1024
,
doDestroyExchangeOperatorInfo
);
}
int32_t
qCreateExecTask
(
SReadHandle
*
readHandle
,
int32_t
vgId
,
uint64_t
taskId
,
SSubplan
*
pSubplan
,
int32_t
qCreateExecTask
(
SReadHandle
*
readHandle
,
int32_t
vgId
,
uint64_t
taskId
,
SSubplan
*
pSubplan
,
qTaskInfo_t
*
pTaskInfo
,
DataSinkHandle
*
handle
,
EOPTR_EXEC_MODEL
model
)
{
qTaskInfo_t
*
pTaskInfo
,
DataSinkHandle
*
handle
,
EOPTR_EXEC_MODEL
model
)
{
assert
(
readHandle
!=
NULL
&&
pSubplan
!=
NULL
);
assert
(
readHandle
!=
NULL
&&
pSubplan
!=
NULL
);
SExecTaskInfo
**
pTask
=
(
SExecTaskInfo
**
)
pTaskInfo
;
SExecTaskInfo
**
pTask
=
(
SExecTaskInfo
**
)
pTaskInfo
;
taosThreadOnce
(
&
initPoolOnce
,
initRefPool
);
int32_t
code
=
createExecTaskInfoImpl
(
pSubplan
,
pTask
,
readHandle
,
taskId
,
model
);
int32_t
code
=
createExecTaskInfoImpl
(
pSubplan
,
pTask
,
readHandle
,
taskId
,
model
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
7156f525
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "tref.h"
#include "filter.h"
#include "filter.h"
#include "function.h"
#include "function.h"
#include "functionMgt.h"
#include "functionMgt.h"
...
@@ -37,9 +38,6 @@
...
@@ -37,9 +38,6 @@
#include "vnode.h"
#include "vnode.h"
#define IS_MAIN_SCAN(runtime) ((runtime)->scanFlag == MAIN_SCAN)
#define IS_MAIN_SCAN(runtime) ((runtime)->scanFlag == MAIN_SCAN)
#define IS_REVERSE_SCAN(runtime) ((runtime)->scanFlag == REVERSE_SCAN)
#define IS_REPEAT_SCAN(runtime) ((runtime)->scanFlag == REPEAT_SCAN)
#define SET_MAIN_SCAN_FLAG(runtime) ((runtime)->scanFlag = MAIN_SCAN)
#define SET_REVERSE_SCAN_FLAG(runtime) ((runtime)->scanFlag = REVERSE_SCAN)
#define SET_REVERSE_SCAN_FLAG(runtime) ((runtime)->scanFlag = REVERSE_SCAN)
#define SDATA_BLOCK_INITIALIZER \
#define SDATA_BLOCK_INITIALIZER \
...
@@ -47,12 +45,6 @@
...
@@ -47,12 +45,6 @@
#define GET_FORWARD_DIRECTION_FACTOR(ord) (((ord) == TSDB_ORDER_ASC) ? QUERY_ASC_FORWARD_STEP : QUERY_DESC_FORWARD_STEP)
#define GET_FORWARD_DIRECTION_FACTOR(ord) (((ord) == TSDB_ORDER_ASC) ? QUERY_ASC_FORWARD_STEP : QUERY_DESC_FORWARD_STEP)
enum
{
TS_JOIN_TS_EQUAL
=
0
,
TS_JOIN_TS_NOT_EQUALS
=
1
,
TS_JOIN_TAG_NOT_EQUALS
=
2
,
};
#if 0
#if 0
static UNUSED_FUNC void *u_malloc (size_t __size) {
static UNUSED_FUNC void *u_malloc (size_t __size) {
uint32_t v = taosRand();
uint32_t v = taosRand();
...
@@ -88,7 +80,6 @@ static UNUSED_FUNC void* u_realloc(void* p, size_t __size) {
...
@@ -88,7 +80,6 @@ static UNUSED_FUNC void* u_realloc(void* p, size_t __size) {
#endif
#endif
#define CLEAR_QUERY_STATUS(q, st) ((q)->status &= (~(st)))
#define CLEAR_QUERY_STATUS(q, st) ((q)->status &= (~(st)))
//#define GET_NUM_OF_TABLEGROUP(q) taosArrayGetSize((q)->tableqinfoGroupInfo.pGroupList)
#define QUERY_IS_INTERVAL_QUERY(_q) ((_q)->interval.interval > 0)
#define QUERY_IS_INTERVAL_QUERY(_q) ((_q)->interval.interval > 0)
int32_t
getMaximumIdleDurationSec
()
{
return
tsShellActivityTimer
*
2
;
}
int32_t
getMaximumIdleDurationSec
()
{
return
tsShellActivityTimer
*
2
;
}
...
@@ -110,7 +101,6 @@ static void releaseQueryBuf(size_t numOfTables);
...
@@ -110,7 +101,6 @@ static void releaseQueryBuf(size_t numOfTables);
static
void
destroySFillOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroySFillOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyProjectOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyProjectOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyTagScanOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyOrderOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyOrderOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyAggOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyAggOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
...
@@ -118,7 +108,6 @@ static void destroyIntervalOperatorInfo(void* param, int32_t numOfOutput);
...
@@ -118,7 +108,6 @@ static void destroyIntervalOperatorInfo(void* param, int32_t numOfOutput);
static
void
destroyExchangeOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyExchangeOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
static
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
);
static
void
destroyOperatorInfo
(
SOperatorInfo
*
pOperator
);
static
void
destroySysTableScannerOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
);
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
)
{
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
...
@@ -562,10 +551,6 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWindow
...
@@ -562,10 +551,6 @@ void doApplyFunctions(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, STimeWindow
pCtx
[
k
].
input
.
startRowIndex
=
offset
;
pCtx
[
k
].
input
.
startRowIndex
=
offset
;
pCtx
[
k
].
input
.
numOfRows
=
forwardStep
;
pCtx
[
k
].
input
.
numOfRows
=
forwardStep
;
if
(
tsCol
!=
NULL
)
{
pCtx
[
k
].
ptsList
=
tsCol
;
}
// not a whole block involved in query processing, statistics data can not be used
// not a whole block involved in query processing, statistics data can not be used
// NOTE: the original value of isSet have been changed here
// NOTE: the original value of isSet have been changed here
if
(
pCtx
[
k
].
input
.
colDataAggIsSet
&&
forwardStep
<
numOfTotal
)
{
if
(
pCtx
[
k
].
input
.
colDataAggIsSet
&&
forwardStep
<
numOfTotal
)
{
...
@@ -1133,40 +1118,6 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
...
@@ -1133,40 +1118,6 @@ SqlFunctionCtx* createSqlFunctionCtx(SExprInfo* pExprInfo, int32_t numOfOutput,
pCtx
->
increase
=
false
;
pCtx
->
increase
=
false
;
pCtx
->
param
=
pFunct
->
pParam
;
pCtx
->
param
=
pFunct
->
pParam
;
// for (int32_t j = 0; j < pCtx->numOfParams; ++j) {
// // set the order information for top/bottom query
// int32_t functionId = pCtx->functionId;
// if (functionId == FUNCTION_TOP || functionId == FUNCTION_BOTTOM || functionId == FUNCTION_DIFF) {
// int32_t f = getExprFunctionId(&pExpr[0]);
// assert(f == FUNCTION_TS || f == FUNCTION_TS_DUMMY);
//
// // pCtx->param[2].i = pQueryAttr->order.order;
// // pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT;
// // pCtx->param[3].i = functionId;
// // pCtx->param[3].nType = TSDB_DATA_TYPE_BIGINT;
//
// // pCtx->param[1].i = pQueryAttr->order.col.info.colId;
// } else if (functionId == FUNCTION_INTERP) {
// // pCtx->param[2].i = (int8_t)pQueryAttr->fillType;
// // if (pQueryAttr->fillVal != NULL) {
// // if (isNull((const char *)&pQueryAttr->fillVal[i], pCtx->inputType)) {
// // pCtx->param[1].nType = TSDB_DATA_TYPE_NULL;
// // } else { // todo refactor, taosVariantCreateFromBinary should handle the NULL value
// // if (pCtx->inputType != TSDB_DATA_TYPE_BINARY && pCtx->inputType != TSDB_DATA_TYPE_NCHAR) {
// // taosVariantCreateFromBinary(&pCtx->param[1], (char *)&pQueryAttr->fillVal[i],
// pCtx->inputBytes, pCtx->inputType);
// // }
// // }
// // }
// } else if (functionId == FUNCTION_TWA) {
// // pCtx->param[1].i = pQueryAttr->window.skey;
// // pCtx->param[1].nType = TSDB_DATA_TYPE_BIGINT;
// // pCtx->param[2].i = pQueryAttr->window.ekey;
// // pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT;
// } else if (functionId == FUNCTION_ARITHM) {
// // pCtx->param[1].pz = (char*) getScalarFuncSupport(pRuntimeEnv->scalarSup, i);
// }
// }
}
}
for
(
int32_t
i
=
1
;
i
<
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
1
;
i
<
numOfOutput
;
++
i
)
{
...
@@ -2438,44 +2389,44 @@ static void doTableQueryInfoTimeWindowCheck(SExecTaskInfo* pTaskInfo, STableQuer
...
@@ -2438,44 +2389,44 @@ static void doTableQueryInfoTimeWindowCheck(SExecTaskInfo* pTaskInfo, STableQuer
#endif
#endif
}
}
// static void updateTableIdInfo(STableQueryInfo* pTableQueryInfo, SSDataBlock* pBlock, SHashObj* pTableIdInfo, int32_t
typedef
struct
SFetchRspHandleWrapper
{
// order) {
uint32_t
exchangeId
;
// int32_t step = GET_FORWARD_DIRECTION_FACTOR(order);
int32_t
sourceIndex
;
// pTableQueryInfo->lastKey = ((order == TSDB_ORDER_ASC)? pBlock->info.window.ekey:pBlock->info.window.skey) + step;
}
SFetchRspHandleWrapper
;
//
// if (pTableQueryInfo->pTable == NULL) {
// return;
// }
//
// STableIdInfo tidInfo = createTableIdInfo(pTableQueryInfo);
// STableIdInfo *idinfo = taosHashGet(pTableIdInfo, &tidInfo.tid, sizeof(tidInfo.tid));
// if (idinfo != NULL) {
// assert(idinfo->tid == tidInfo.tid && idinfo->uid == tidInfo.uid);
// idinfo->key = tidInfo.key;
// } else {
// taosHashPut(pTableIdInfo, &tidInfo.tid, sizeof(tidInfo.tid), &tidInfo, sizeof(STableIdInfo));
// }
// }
int32_t
loadRemoteDataCallback
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
int32_t
loadRemoteDataCallback
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SSourceDataInfo
*
pSourceDataInfo
=
(
SSourceDataInfo
*
)
param
;
SFetchRspHandleWrapper
*
pWrapper
=
(
SFetchRspHandleWrapper
*
)
param
;
SExchangeInfo
*
pExchangeInfo
=
taosAcquireRef
(
exchangeObjRefPool
,
pWrapper
->
exchangeId
);
if
(
pExchangeInfo
==
NULL
)
{
qWarn
(
"failed to acquire exchange operator, since it may have been released"
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
index
=
pWrapper
->
sourceIndex
;
SSourceDataInfo
*
pSourceDataInfo
=
taosArrayGet
(
pExchangeInfo
->
pSourceDataInfo
,
index
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
pSourceDataInfo
->
pRsp
=
pMsg
->
pData
;
pSourceDataInfo
->
pRsp
=
pMsg
->
pData
;
SRetrieveTableRsp
*
pRsp
=
pSourceDataInfo
->
pRsp
;
SRetrieveTableRsp
*
pRsp
=
pSourceDataInfo
->
pRsp
;
pRsp
->
numOfRows
=
htonl
(
pRsp
->
numOfRows
);
pRsp
->
numOfRows
=
htonl
(
pRsp
->
numOfRows
);
pRsp
->
compLen
=
htonl
(
pRsp
->
compLen
);
pRsp
->
compLen
=
htonl
(
pRsp
->
compLen
);
pRsp
->
numOfCols
=
htonl
(
pRsp
->
numOfCols
);
pRsp
->
numOfCols
=
htonl
(
pRsp
->
numOfCols
);
pRsp
->
useconds
=
htobe64
(
pRsp
->
useconds
);
pRsp
->
useconds
=
htobe64
(
pRsp
->
useconds
);
ASSERT
(
p
SourceDataInfo
->
p
Rsp
!=
NULL
);
ASSERT
(
pRsp
!=
NULL
);
qDebug
(
"
fetch rsp received, index:%d, rows:%d"
,
pSourceDataInfo
->
index
,
pRsp
->
numOfRows
);
qDebug
(
"
%s fetch rsp received, index:%d, rows:%d"
,
pSourceDataInfo
->
taskId
,
index
,
pRsp
->
numOfRows
);
}
else
{
}
else
{
pSourceDataInfo
->
code
=
code
;
pSourceDataInfo
->
code
=
code
;
}
}
pSourceDataInfo
->
status
=
EX_SOURCE_DATA_READY
;
pSourceDataInfo
->
status
=
EX_SOURCE_DATA_READY
;
tsem_post
(
&
pSourceDataInfo
->
pEx
->
ready
);
tsem_post
(
&
pExchangeInfo
->
ready
);
taosReleaseRef
(
exchangeObjRefPool
,
pWrapper
->
exchangeId
);
taosMemoryFree
(
pWrapper
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -2524,9 +2475,9 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf
...
@@ -2524,9 +2475,9 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf
pSource
->
addr
.
nodeId
,
pSource
->
addr
.
epSet
.
eps
[
0
].
fqdn
,
pSource
->
taskId
,
sourceIndex
,
totalSources
);
pSource
->
addr
.
nodeId
,
pSource
->
addr
.
epSet
.
eps
[
0
].
fqdn
,
pSource
->
taskId
,
sourceIndex
,
totalSources
);
pMsg
->
header
.
vgId
=
htonl
(
pSource
->
addr
.
nodeId
);
pMsg
->
header
.
vgId
=
htonl
(
pSource
->
addr
.
nodeId
);
pMsg
->
sId
=
htobe64
(
pSource
->
schedId
);
pMsg
->
sId
=
htobe64
(
pSource
->
schedId
);
pMsg
->
taskId
=
htobe64
(
pSource
->
taskId
);
pMsg
->
taskId
=
htobe64
(
pSource
->
taskId
);
pMsg
->
queryId
=
htobe64
(
pTaskInfo
->
id
.
queryId
);
pMsg
->
queryId
=
htobe64
(
pTaskInfo
->
id
.
queryId
);
// send the fetch remote task result reques
// send the fetch remote task result reques
SMsgSendInfo
*
pMsgSendInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SMsgSendInfo
));
SMsgSendInfo
*
pMsgSendInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SMsgSendInfo
));
...
@@ -2537,11 +2488,15 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf
...
@@ -2537,11 +2488,15 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf
return
pTaskInfo
->
code
;
return
pTaskInfo
->
code
;
}
}
pMsgSendInfo
->
param
=
pDataInfo
;
SFetchRspHandleWrapper
*
pWrapper
=
taosMemoryCalloc
(
1
,
sizeof
(
SFetchRspHandleWrapper
));
pWrapper
->
exchangeId
=
pExchangeInfo
->
self
;
pWrapper
->
sourceIndex
=
sourceIndex
;
pMsgSendInfo
->
param
=
pWrapper
;
pMsgSendInfo
->
msgInfo
.
pData
=
pMsg
;
pMsgSendInfo
->
msgInfo
.
pData
=
pMsg
;
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SResFetchReq
);
pMsgSendInfo
->
msgInfo
.
len
=
sizeof
(
SResFetchReq
);
pMsgSendInfo
->
msgType
=
TDMT_VND_FETCH
;
pMsgSendInfo
->
msgType
=
TDMT_VND_FETCH
;
pMsgSendInfo
->
fp
=
loadRemoteDataCallback
;
pMsgSendInfo
->
fp
=
loadRemoteDataCallback
;
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
int32_t
code
=
asyncSendMsgToServer
(
pExchangeInfo
->
pTransporter
,
&
pSource
->
addr
.
epSet
,
&
transporterId
,
pMsgSendInfo
);
int32_t
code
=
asyncSendMsgToServer
(
pExchangeInfo
->
pTransporter
,
&
pSource
->
addr
.
epSet
,
&
transporterId
,
pMsgSendInfo
);
...
@@ -2689,10 +2644,10 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx
...
@@ -2689,10 +2644,10 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx
SSDataBlock
*
pRes
=
pExchangeInfo
->
pResult
;
SSDataBlock
*
pRes
=
pExchangeInfo
->
pResult
;
SLoadRemoteDataInfo
*
pLoadInfo
=
&
pExchangeInfo
->
loadInfo
;
SLoadRemoteDataInfo
*
pLoadInfo
=
&
pExchangeInfo
->
loadInfo
;
if
(
pRsp
->
numOfRows
==
0
)
{
if
(
pRsp
->
numOfRows
==
0
)
{
qDebug
(
"%s vgId:%d, taskI
D
:0x%"
PRIx64
" index:%d completed, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
qDebug
(
"%s vgId:%d, taskI
d
:0x%"
PRIx64
" index:%d completed, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
"
try next"
,
"
, completed:%d try next %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
i
+
1
,
pDataInfo
->
totalRows
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
i
,
pDataInfo
->
totalRows
,
pExchangeInfo
->
loadInfo
.
totalRows
);
pExchangeInfo
->
loadInfo
.
totalRows
,
completed
+
1
,
i
+
1
,
totalSources
);
pDataInfo
->
status
=
EX_SOURCE_DATA_EXHAUSTED
;
pDataInfo
->
status
=
EX_SOURCE_DATA_EXHAUSTED
;
completed
+=
1
;
completed
+=
1
;
taosMemoryFreeClear
(
pDataInfo
->
pRsp
);
taosMemoryFreeClear
(
pDataInfo
->
pRsp
);
...
@@ -2708,10 +2663,11 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx
...
@@ -2708,10 +2663,11 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx
}
}
if
(
pRsp
->
completed
==
1
)
{
if
(
pRsp
->
completed
==
1
)
{
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" numOfRows:%d, rowsOfSource:%"
PRIu64
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" index:%d completed, numOfRows:%d, rowsOfSource:%"
PRIu64
", totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
" try next %d/%"
PRIzu
,
", totalRows:%"
PRIu64
", totalBytes:%"
PRIu64
", completed:%d try next %d/%"
PRIzu
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
pRes
->
info
.
rows
,
pDataInfo
->
totalRows
,
GET_TASKID
(
pTaskInfo
),
pSource
->
addr
.
nodeId
,
pSource
->
taskId
,
i
,
pRes
->
info
.
rows
,
pDataInfo
->
totalRows
,
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
,
i
+
1
,
totalSources
);
pLoadInfo
->
totalRows
,
pLoadInfo
->
totalSize
,
completed
+
1
,
i
+
1
,
totalSources
);
completed
+=
1
;
pDataInfo
->
status
=
EX_SOURCE_DATA_EXHAUSTED
;
pDataInfo
->
status
=
EX_SOURCE_DATA_EXHAUSTED
;
}
else
{
}
else
{
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" numOfRows:%d, totalRows:%"
PRIu64
qDebug
(
"%s fetch msg rsp from vgId:%d, taskId:0x%"
PRIx64
" numOfRows:%d, totalRows:%"
PRIu64
...
@@ -2761,13 +2717,13 @@ static int32_t prepareConcurrentlyLoad(SOperatorInfo* pOperator) {
...
@@ -2761,13 +2717,13 @@ static int32_t prepareConcurrentlyLoad(SOperatorInfo* pOperator) {
}
}
int64_t
endTs
=
taosGetTimestampUs
();
int64_t
endTs
=
taosGetTimestampUs
();
qDebug
(
"%s send all fetch requests to %"
PRIzu
" sources completed, elapsed:%
"
PRId64
,
GET_TASKID
(
pTaskInfo
),
qDebug
(
"%s send all fetch requests to %"
PRIzu
" sources completed, elapsed:%
.2fms"
,
GET_TASKID
(
pTaskInfo
),
totalSources
,
endTs
-
startTs
);
totalSources
,
(
endTs
-
startTs
)
/
1000
.
0
);
tsem_wait
(
&
pExchangeInfo
->
ready
);
pOperator
->
status
=
OP_RES_TO_RETURN
;
pOperator
->
status
=
OP_RES_TO_RETURN
;
pOperator
->
cost
.
openCost
=
taosGetTimestampUs
()
-
startTs
;
pOperator
->
cost
.
openCost
=
taosGetTimestampUs
()
-
startTs
;
tsem_wait
(
&
pExchangeInfo
->
ready
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -2883,7 +2839,7 @@ static SSDataBlock* doLoadRemoteData(SOperatorInfo* pOperator) {
...
@@ -2883,7 +2839,7 @@ static SSDataBlock* doLoadRemoteData(SOperatorInfo* pOperator) {
}
}
}
}
static
int32_t
initDataSource
(
int32_t
numOfSources
,
SExchangeInfo
*
pInfo
)
{
static
int32_t
initDataSource
(
int32_t
numOfSources
,
SExchangeInfo
*
pInfo
,
const
char
*
id
)
{
pInfo
->
pSourceDataInfo
=
taosArrayInit
(
numOfSources
,
sizeof
(
SSourceDataInfo
));
pInfo
->
pSourceDataInfo
=
taosArrayInit
(
numOfSources
,
sizeof
(
SSourceDataInfo
));
if
(
pInfo
->
pSourceDataInfo
==
NULL
)
{
if
(
pInfo
->
pSourceDataInfo
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -2892,11 +2848,10 @@ static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo) {
...
@@ -2892,11 +2848,10 @@ static int32_t initDataSource(int32_t numOfSources, SExchangeInfo* pInfo) {
for
(
int32_t
i
=
0
;
i
<
numOfSources
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfSources
;
++
i
)
{
SSourceDataInfo
dataInfo
=
{
0
};
SSourceDataInfo
dataInfo
=
{
0
};
dataInfo
.
status
=
EX_SOURCE_DATA_NOT_READY
;
dataInfo
.
status
=
EX_SOURCE_DATA_NOT_READY
;
dataInfo
.
pEx
=
pInfo
;
dataInfo
.
taskId
=
id
;
dataInfo
.
index
=
i
;
dataInfo
.
index
=
i
;
SSourceDataInfo
*
pDs
=
taosArrayPush
(
pInfo
->
pSourceDataInfo
,
&
dataInfo
);
void
*
ret
=
taosArrayPush
(
pInfo
->
pSourceDataInfo
,
&
dataInfo
);
if
(
pDs
==
NULL
)
{
if
(
ret
==
NULL
)
{
taosArrayDestroy
(
pInfo
->
pSourceDataInfo
);
taosArrayDestroy
(
pInfo
->
pSourceDataInfo
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
...
@@ -2924,7 +2879,9 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo*
...
@@ -2924,7 +2879,9 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo*
taosArrayPush
(
pInfo
->
pSources
,
pNode
);
taosArrayPush
(
pInfo
->
pSources
,
pNode
);
}
}
return
initDataSource
(
numOfSources
,
pInfo
);
pInfo
->
self
=
taosAddRef
(
exchangeObjRefPool
,
pInfo
);
return
initDataSource
(
numOfSources
,
pInfo
,
id
);
}
}
SOperatorInfo
*
createExchangeOperatorInfo
(
void
*
pTransporter
,
SExchangePhysiNode
*
pExNode
,
SExecTaskInfo
*
pTaskInfo
)
{
SOperatorInfo
*
createExchangeOperatorInfo
(
void
*
pTransporter
,
SExchangePhysiNode
*
pExNode
,
SExecTaskInfo
*
pTaskInfo
)
{
...
@@ -2939,18 +2896,18 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
...
@@ -2939,18 +2896,18 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
goto
_error
;
goto
_error
;
}
}
pInfo
->
seqLoadData
=
false
;
pInfo
->
pTransporter
=
pTransporter
;
pInfo
->
pResult
=
createResDataBlock
(
pExNode
->
node
.
pOutputDataBlockDesc
);
tsem_init
(
&
pInfo
->
ready
,
0
,
0
);
tsem_init
(
&
pInfo
->
ready
,
0
,
0
);
pOperator
->
name
=
"ExchangeOperator"
;
pInfo
->
seqLoadData
=
false
;
pInfo
->
pTransporter
=
pTransporter
;
pInfo
->
pResult
=
createResDataBlock
(
pExNode
->
node
.
pOutputDataBlockDesc
);
pOperator
->
name
=
"ExchangeOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
;
pOperator
->
blocking
=
false
;
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
numOfExprs
=
pInfo
->
pResult
->
info
.
numOfCols
;
pOperator
->
numOfExprs
=
pInfo
->
pResult
->
info
.
numOfCols
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
fpSet
=
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
NULL
,
pOperator
->
fpSet
=
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
NULL
,
destroyExchangeOperatorInfo
,
NULL
,
NULL
,
NULL
);
destroyExchangeOperatorInfo
,
NULL
,
NULL
,
NULL
);
...
@@ -2958,7 +2915,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
...
@@ -2958,7 +2915,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
_error:
_error:
if
(
pInfo
!=
NULL
)
{
if
(
pInfo
!=
NULL
)
{
d
estroyExchangeOperatorInfo
(
pInfo
,
LIST_LENGTH
(
pExNode
->
pSrcEndPoints
)
);
d
oDestroyExchangeOperatorInfo
(
pInfo
);
}
}
taosMemoryFreeClear
(
pInfo
);
taosMemoryFreeClear
(
pInfo
);
...
@@ -4105,6 +4062,12 @@ static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -4105,6 +4062,12 @@ static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) {
void
destroyExchangeOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
void
destroyExchangeOperatorInfo
(
void
*
param
,
int32_t
numOfOutput
)
{
SExchangeInfo
*
pExInfo
=
(
SExchangeInfo
*
)
param
;
SExchangeInfo
*
pExInfo
=
(
SExchangeInfo
*
)
param
;
taosRemoveRef
(
exchangeObjRefPool
,
pExInfo
->
self
);
}
void
doDestroyExchangeOperatorInfo
(
void
*
param
)
{
SExchangeInfo
*
pExInfo
=
(
SExchangeInfo
*
)
param
;
taosArrayDestroy
(
pExInfo
->
pSources
);
taosArrayDestroy
(
pExInfo
->
pSources
);
taosArrayDestroy
(
pExInfo
->
pSourceDataInfo
);
taosArrayDestroy
(
pExInfo
->
pSourceDataInfo
);
if
(
pExInfo
->
pResult
!=
NULL
)
{
if
(
pExInfo
->
pResult
!=
NULL
)
{
...
@@ -4322,6 +4285,8 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t
...
@@ -4322,6 +4285,8 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t
pInfo
->
p
=
taosMemoryCalloc
(
numOfCols
,
POINTER_BYTES
);
pInfo
->
p
=
taosMemoryCalloc
(
numOfCols
,
POINTER_BYTES
);
if
(
pInfo
->
pFillInfo
==
NULL
||
pInfo
->
p
==
NULL
)
{
if
(
pInfo
->
pFillInfo
==
NULL
||
pInfo
->
p
==
NULL
)
{
taosMemoryFree
(
pInfo
->
pFillInfo
);
taosMemoryFree
(
pInfo
->
p
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
else
{
}
else
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -4556,8 +4521,6 @@ static tsdbReaderT doCreateDataReader(STableScanPhysiNode* pTableScanNode, SRead
...
@@ -4556,8 +4521,6 @@ static tsdbReaderT doCreateDataReader(STableScanPhysiNode* pTableScanNode, SRead
STableListInfo
*
pTableListInfo
,
uint64_t
queryId
,
uint64_t
taskId
,
STableListInfo
*
pTableListInfo
,
uint64_t
queryId
,
uint64_t
taskId
,
SNode
*
pTagCond
);
SNode
*
pTagCond
);
static
int32_t
getTableList
(
void
*
metaHandle
,
int32_t
tableType
,
uint64_t
tableUid
,
STableListInfo
*
pListInfo
,
SNode
*
pTagCond
);
static
SArray
*
extractColumnInfo
(
SNodeList
*
pNodeList
);
static
SArray
*
extractColumnInfo
(
SNodeList
*
pNodeList
);
static
SArray
*
createSortInfo
(
SNodeList
*
pNodeList
);
static
SArray
*
createSortInfo
(
SNodeList
*
pNodeList
);
...
@@ -4691,19 +4654,30 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4691,19 +4654,30 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
}
}
SArray
*
groupKeys
=
extractPartitionColInfo
(
pTableScanNode
->
pPartitionKeys
);
SArray
*
groupKeys
=
extractPartitionColInfo
(
pTableScanNode
->
pPartitionKeys
);
code
=
generateGroupIdMap
(
pTableListInfo
,
pHandle
,
groupKeys
);
//
todo for json
code
=
generateGroupIdMap
(
pTableListInfo
,
pHandle
,
groupKeys
);
//
todo for json
taosArrayDestroy
(
groupKeys
);
taosArrayDestroy
(
groupKeys
);
if
(
code
){
if
(
code
)
{
tsdbCleanupReadHandle
(
pDataReader
);
tsdbCleanupReadHandle
(
pDataReader
);
return
NULL
;
return
NULL
;
}
}
SOperatorInfo
*
pOperator
=
SOperatorInfo
*
pOperator
=
createTableScanOperatorInfo
(
pTableScanNode
,
pDataReader
,
pHandle
,
pTaskInfo
);
createTableScanOperatorInfo
(
pTableScanNode
,
pDataReader
,
pHandle
,
pTaskInfo
);
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
==
type
)
{
STableMergeScanPhysiNode
*
pTableScanNode
=
(
STableMergeScanPhysiNode
*
)
pPhyNode
;
SArray
*
dataReaders
=
taosArrayInit
(
8
,
POINTER_BYTES
);
createMultipleDataReaders
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
dataReaders
,
queryId
,
taskId
,
pTagCond
);
extractTableSchemaVersion
(
pHandle
,
pTableScanNode
->
scan
.
uid
,
pTaskInfo
);
SArray
*
groupKeys
=
extractPartitionColInfo
(
pTableScanNode
->
pPartitionKeys
);
generateGroupIdMap
(
pTableListInfo
,
pHandle
,
groupKeys
);
//todo for json
taosArrayDestroy
(
groupKeys
);
SOperatorInfo
*
pOperator
=
createTableMergeScanOperatorInfo
(
pTableScanNode
,
dataReaders
,
pHandle
,
pTaskInfo
);
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
return
pOperator
;
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
==
type
)
{
return
createExchangeOperatorInfo
(
pHandle
->
pMsgCb
->
clientRpc
,
(
SExchangePhysiNode
*
)
pPhyNode
,
pTaskInfo
);
return
createExchangeOperatorInfo
(
pHandle
->
pMsgCb
->
clientRpc
,
(
SExchangePhysiNode
*
)
pPhyNode
,
pTaskInfo
);
...
@@ -4814,6 +4788,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4814,6 +4788,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
.
calTrigger
=
pIntervalPhyNode
->
window
.
triggerType
,
.
calTrigger
=
pIntervalPhyNode
->
window
.
triggerType
,
.
maxTs
=
INT64_MIN
,
.
maxTs
=
INT64_MIN
,
};
};
ASSERT
(
as
.
calTrigger
!=
STREAM_TRIGGER_MAX_DELAY
);
int32_t
tsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
int32_t
tsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
bool
isStream
=
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
==
type
);
bool
isStream
=
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
==
type
);
...
@@ -4836,11 +4811,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4836,11 +4811,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t
tsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
int32_t
tsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
pOptr
=
createMergeIntervalOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
&
interval
,
tsSlotId
,
pTaskInfo
);
pOptr
=
createMergeIntervalOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
&
interval
,
tsSlotId
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
==
type
)
{
qDebug
(
"[******]create Semi"
);
int32_t
children
=
0
;
int32_t
children
=
0
;
pOptr
=
createStreamFinalIntervalOperatorInfo
(
ops
[
0
],
pPhyNode
,
pTaskInfo
,
children
);
pOptr
=
createStreamFinalIntervalOperatorInfo
(
ops
[
0
],
pPhyNode
,
pTaskInfo
,
children
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
==
type
)
{
qDebug
(
"[******]create Final"
);
int32_t
children
=
1
;
int32_t
children
=
1
;
pOptr
=
createStreamFinalIntervalOperatorInfo
(
ops
[
0
],
pPhyNode
,
pTaskInfo
,
children
);
pOptr
=
createStreamFinalIntervalOperatorInfo
(
ops
[
0
],
pPhyNode
,
pTaskInfo
,
children
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SORT
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SORT
==
type
)
{
...
@@ -5498,14 +5471,16 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo
...
@@ -5498,14 +5471,16 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo
}
}
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
int32_t
initStreamAggSupporter
(
SStreamAggSupporter
*
pSup
,
const
char
*
pKey
,
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
size
_t
size
)
{
int32
_t
size
)
{
pSup
->
resultRowSize
=
getResultRowSize
(
pCtx
,
numOfOutput
);
pSup
->
resultRowSize
=
getResultRowSize
(
pCtx
,
numOfOutput
);
pSup
->
keySize
=
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
);
pSup
->
keySize
=
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
);
pSup
->
pKeyBuf
=
taosMemoryCalloc
(
1
,
pSup
->
keySize
);
pSup
->
pKeyBuf
=
taosMemoryCalloc
(
1
,
pSup
->
keySize
);
pSup
->
pResultRows
=
taosArrayInit
(
1024
,
size
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
pSup
->
pResultRows
=
taosHashInit
(
1024
,
hashFn
,
false
,
HASH_NO_LOCK
);
if
(
pSup
->
pKeyBuf
==
NULL
||
pSup
->
pResultRows
==
NULL
)
{
if
(
pSup
->
pKeyBuf
==
NULL
||
pSup
->
pResultRows
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
pSup
->
valueSize
=
size
;
pSup
->
pScanWindow
=
taosArrayInit
(
4
,
sizeof
(
STimeWindow
));
pSup
->
pScanWindow
=
taosArrayInit
(
4
,
sizeof
(
STimeWindow
));
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
7156f525
...
@@ -332,12 +332,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
...
@@ -332,12 +332,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
pOperator
->
status
=
OP_RES_TO_RETURN
;
pOperator
->
status
=
OP_RES_TO_RETURN
;
closeAllResultRows
(
&
pInfo
->
binfo
.
resultRowInfo
);
closeAllResultRows
(
&
pInfo
->
binfo
.
resultRowInfo
);
// if (!stableQuery) { // finalize include the update of result rows
// finalizeQueryResult(pInfo->binfo.pCtx, pOperator->numOfExprs);
// } else {
// updateNumOfRowsInResultRows(pInfo->binfo.pCtx, pOperator->numOfExprs, &pInfo->binfo.resultRowInfo,
// pInfo->binfo.rowCellInfoOffset);
// }
#if 0
#if 0
if(pOperator->fpSet.encodeResultRow){
if(pOperator->fpSet.encodeResultRow){
char *result = NULL;
char *result = NULL;
...
@@ -378,8 +373,9 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
...
@@ -378,8 +373,9 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
return
(
rows
==
0
)
?
NULL
:
pRes
;
return
(
rows
==
0
)
?
NULL
:
pRes
;
}
}
SOperatorInfo
*
createGroupOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResultBlock
,
SArray
*
pGroupColList
,
SOperatorInfo
*
createGroupOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SNode
*
pCondition
,
SExprInfo
*
pScalarExprInfo
,
int32_t
numOfScalarExpr
,
SExecTaskInfo
*
pTaskInfo
)
{
SSDataBlock
*
pResultBlock
,
SArray
*
pGroupColList
,
SNode
*
pCondition
,
SExprInfo
*
pScalarExprInfo
,
int32_t
numOfScalarExpr
,
SExecTaskInfo
*
pTaskInfo
)
{
SGroupbyOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SGroupbyOperatorInfo
));
SGroupbyOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SGroupbyOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
...
@@ -407,7 +403,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx
...
@@ -407,7 +403,7 @@ SOperatorInfo* createGroupOperatorInfo(SOperatorInfo* downstream, SExprInfo* pEx
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
// pOperator->operatorType = OP_Groupby;
// pOperator->operatorType = OP_Groupby;
pOperator
->
pExpr
=
pExprInfo
;
pOperator
->
pExpr
=
pExprInfo
;
pOperator
->
numOfExprs
=
numOfCols
;
pOperator
->
numOfExprs
=
numOfCols
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
...
@@ -669,8 +665,8 @@ static void destroyPartitionOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -669,8 +665,8 @@ static void destroyPartitionOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFree
(
pInfo
->
columnOffset
);
taosMemoryFree
(
pInfo
->
columnOffset
);
}
}
SOperatorInfo
*
createPartitionOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResultBlock
,
SArray
*
pGroupColList
,
SOperatorInfo
*
createPartitionOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SExecTaskInfo
*
pTaskInfo
)
{
S
SDataBlock
*
pResultBlock
,
SArray
*
pGroupColList
,
S
ExecTaskInfo
*
pTaskInfo
)
{
SPartitionOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SPartitionOperatorInfo
));
SPartitionOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SPartitionOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/executor/src/sortoperator.c
浏览文件 @
7156f525
...
@@ -76,7 +76,9 @@ void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle) {
...
@@ -76,7 +76,9 @@ void appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle) {
colDataAppendNULL
(
pColInfo
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pColInfo
,
pBlock
->
info
.
rows
);
}
else
{
}
else
{
char
*
pData
=
tsortGetValue
(
pTupleHandle
,
i
);
char
*
pData
=
tsortGetValue
(
pTupleHandle
,
i
);
colDataAppend
(
pColInfo
,
pBlock
->
info
.
rows
,
pData
,
false
);
if
(
pData
!=
NULL
)
{
colDataAppend
(
pColInfo
,
pBlock
->
info
.
rows
,
pData
,
false
);
}
}
}
}
}
...
@@ -427,7 +429,7 @@ SOperatorInfo* createMultiwaySortMergeOperatorInfo(SOperatorInfo** downStreams,
...
@@ -427,7 +429,7 @@ SOperatorInfo* createMultiwaySortMergeOperatorInfo(SOperatorInfo** downStreams,
pInfo
->
pInputBlock
=
pInputBlock
;
pInfo
->
pInputBlock
=
pInputBlock
;
pOperator
->
name
=
"MultiwaySortMerge"
;
pOperator
->
name
=
"MultiwaySortMerge"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_MERGE
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_MERGE
;
pOperator
->
blocking
=
tru
e
;
pOperator
->
blocking
=
fals
e
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/executor/src/tsort.c
浏览文件 @
7156f525
...
@@ -738,7 +738,11 @@ bool tsortIsNullVal(STupleHandle* pVHandle, int32_t colIndex) {
...
@@ -738,7 +738,11 @@ bool tsortIsNullVal(STupleHandle* pVHandle, int32_t colIndex) {
void
*
tsortGetValue
(
STupleHandle
*
pVHandle
,
int32_t
colIndex
)
{
void
*
tsortGetValue
(
STupleHandle
*
pVHandle
,
int32_t
colIndex
)
{
SColumnInfoData
*
pColInfo
=
TARRAY_GET_ELEM
(
pVHandle
->
pBlock
->
pDataBlock
,
colIndex
);
SColumnInfoData
*
pColInfo
=
TARRAY_GET_ELEM
(
pVHandle
->
pBlock
->
pDataBlock
,
colIndex
);
return
colDataGetData
(
pColInfo
,
pVHandle
->
rowIndex
);
if
(
pColInfo
->
pData
==
NULL
)
{
return
NULL
;
}
else
{
return
colDataGetData
(
pColInfo
,
pVHandle
->
rowIndex
);
}
}
}
uint64_t
tsortGetGroupId
(
STupleHandle
*
pVHandle
)
{
uint64_t
tsortGetGroupId
(
STupleHandle
*
pVHandle
)
{
...
...
source/libs/function/inc/builtinsimpl.h
浏览文件 @
7156f525
...
@@ -97,6 +97,10 @@ bool getDiffFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
...
@@ -97,6 +97,10 @@ bool getDiffFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
bool
diffFunctionSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResInfo
);
bool
diffFunctionSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResInfo
);
int32_t
diffFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
diffFunction
(
SqlFunctionCtx
*
pCtx
);
bool
getDerivativeFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
derivativeFuncSetup
(
SqlFunctionCtx
*
pCtx
,
SResultRowEntryInfo
*
pResInfo
);
int32_t
derivativeFunction
(
SqlFunctionCtx
*
pCtx
);
bool
getFirstLastFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
bool
getFirstLastFuncEnv
(
struct
SFunctionNode
*
pFunc
,
SFuncExecEnv
*
pEnv
);
int32_t
firstFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
firstFunction
(
SqlFunctionCtx
*
pCtx
);
int32_t
firstFunctionMerge
(
SqlFunctionCtx
*
pCtx
);
int32_t
firstFunctionMerge
(
SqlFunctionCtx
*
pCtx
);
...
...
source/libs/function/inc/functionMgtInt.h
浏览文件 @
7156f525
...
@@ -42,7 +42,8 @@ extern "C" {
...
@@ -42,7 +42,8 @@ extern "C" {
#define FUNC_MGT_SELECT_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(13)
#define FUNC_MGT_SELECT_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(13)
#define FUNC_MGT_REPEAT_SCAN_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(14)
#define FUNC_MGT_REPEAT_SCAN_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(14)
#define FUNC_MGT_FORBID_FILL_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(15)
#define FUNC_MGT_FORBID_FILL_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(15)
#define FUNC_MGT_FORBID_STREAM_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(16)
#define FUNC_MGT_INTERVAL_INTERPO_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(16)
#define FUNC_MGT_FORBID_STREAM_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(17)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)
...
...
source/libs/function/inc/texpr.h
浏览文件 @
7156f525
...
@@ -60,12 +60,6 @@ typedef struct SExprTraverseSupp {
...
@@ -60,12 +60,6 @@ typedef struct SExprTraverseSupp {
void
*
pExtInfo
;
void
*
pExtInfo
;
}
SExprTraverseSupp
;
}
SExprTraverseSupp
;
tExprNode
*
exprTreeFromTableName
(
const
char
*
tbnameCond
);
bool
exprTreeApplyFilter
(
tExprNode
*
pExpr
,
const
void
*
pItem
,
SExprTraverseSupp
*
param
);
void
buildFilterSetFromBinary
(
void
**
q
,
const
char
*
buf
,
int32_t
len
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/function/inc/tunaryoperator.h
已删除
100644 → 0
浏览文件 @
a2d19872
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_COMMON_UNARY_SCALAR_OPERATOR_H_
#define _TD_COMMON_UNARY_SCALAR_OPERATOR_H_
#ifdef __cplusplus
extern
"C"
{
#endif
//#include "tscalarfunction.h"
//typedef void (*_unary_scalar_fn_t)(SScalarParam *pLeft, SScalarParam* pOutput);
//_unary_scalar_fn_t getUnaryScalarOperatorFn(int32_t binOperator);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_COMMON_BIN_SCALAR_OPERATOR_H_*/
source/libs/function/src/builtins.c
浏览文件 @
7156f525
...
@@ -997,6 +997,38 @@ static int32_t translateLastRow(SFunctionNode* pFunc, char* pErrBuf, int32_t len
...
@@ -997,6 +997,38 @@ static int32_t translateLastRow(SFunctionNode* pFunc, char* pErrBuf, int32_t len
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
translateDerivative
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
if
(
3
!=
LIST_LENGTH
(
pFunc
->
pParameterList
))
{
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
uint8_t
colType
=
((
SExprNode
*
)
nodesListGetNode
(
pFunc
->
pParameterList
,
0
))
->
resType
.
type
;
// param1
SNode
*
pParamNode1
=
nodesListGetNode
(
pFunc
->
pParameterList
,
1
);
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pParamNode1
))
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
SValueNode
*
pValue
=
(
SValueNode
*
)
pParamNode1
;
pValue
->
notReserved
=
true
;
if
(
!
IS_NUMERIC_TYPE
(
colType
))
{
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
SNode
*
pParamNode2
=
nodesListGetNode
(
pFunc
->
pParameterList
,
2
);
SValueNode
*
pValue2
=
(
SValueNode
*
)
pParamNode2
;
pValue2
->
notReserved
=
true
;
if
(
pValue2
->
datum
.
i
!=
0
&&
pValue2
->
datum
.
i
!=
1
)
{
return
invaildFuncParaValueErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
pFunc
->
node
.
resType
=
(
SDataType
){.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_DOUBLE
].
bytes
,
.
type
=
TSDB_DATA_TYPE_DOUBLE
};
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateFirstLast
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateFirstLast
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
// first(col_list) will be rewritten as first(col)
// first(col_list) will be rewritten as first(col)
if
(
1
!=
LIST_LENGTH
(
pFunc
->
pParameterList
))
{
if
(
1
!=
LIST_LENGTH
(
pFunc
->
pParameterList
))
{
...
@@ -1596,6 +1628,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1596,6 +1628,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
type
=
FUNCTION_TYPE_AVG
,
.
type
=
FUNCTION_TYPE_AVG
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
,
.
translateFunc
=
translateInNumOutDou
,
.
translateFunc
=
translateInNumOutDou
,
.
dataRequiredFunc
=
statisDataRequired
,
.
getEnvFunc
=
getAvgFuncEnv
,
.
getEnvFunc
=
getAvgFuncEnv
,
.
initFunc
=
avgFunctionSetup
,
.
initFunc
=
avgFunctionSetup
,
.
processFunc
=
avgFunction
,
.
processFunc
=
avgFunction
,
...
@@ -1682,7 +1715,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1682,7 +1715,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
{
.
name
=
"top"
,
.
name
=
"top"
,
.
type
=
FUNCTION_TYPE_TOP
,
.
type
=
FUNCTION_TYPE_TOP
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_INDEFINITE_ROWS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateTopBot
,
.
translateFunc
=
translateTopBot
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
initFunc
=
topBotFunctionSetup
,
.
initFunc
=
topBotFunctionSetup
,
...
@@ -1717,7 +1750,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1717,7 +1750,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
{
.
name
=
"bottom"
,
.
name
=
"bottom"
,
.
type
=
FUNCTION_TYPE_BOTTOM
,
.
type
=
FUNCTION_TYPE_BOTTOM
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_INDEFINITE_ROWS_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_SELECT_FUNC
|
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
translateFunc
=
translateTopBot
,
.
translateFunc
=
translateTopBot
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
getEnvFunc
=
getTopBotFuncEnv
,
.
initFunc
=
topBotFunctionSetup
,
.
initFunc
=
topBotFunctionSetup
,
...
@@ -1793,7 +1826,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1793,7 +1826,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
{
.
name
=
"elapsed"
,
.
name
=
"elapsed"
,
.
type
=
FUNCTION_TYPE_ELAPSED
,
.
type
=
FUNCTION_TYPE_ELAPSED
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_
TIMELINE_FUNC
|
FUNC_MGT_INTERVAL_INTERPO_FUNC
|
FUNC_MGT_
FORBID_STREAM_FUNC
,
.
dataRequiredFunc
=
statisDataRequired
,
.
dataRequiredFunc
=
statisDataRequired
,
.
translateFunc
=
translateElapsed
,
.
translateFunc
=
translateElapsed
,
.
getEnvFunc
=
getElapsedFuncEnv
,
.
getEnvFunc
=
getElapsedFuncEnv
,
...
@@ -1831,6 +1864,26 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1831,6 +1864,26 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.
invertFunc
=
NULL
,
.
invertFunc
=
NULL
,
.
combineFunc
=
elapsedCombine
,
.
combineFunc
=
elapsedCombine
,
},
},
{
.
name
=
"interp"
,
.
type
=
FUNCTION_TYPE_INTERP
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_INTERVAL_INTERPO_FUNC
,
.
translateFunc
=
translateFirstLast
,
.
getEnvFunc
=
getSelectivityFuncEnv
,
.
initFunc
=
functionSetup
,
.
processFunc
=
NULL
,
.
finalizeFunc
=
NULL
},
{
.
name
=
"derivative"
,
.
type
=
FUNCTION_TYPE_DERIVATIVE
,
.
classification
=
FUNC_MGT_INDEFINITE_ROWS_FUNC
|
FUNC_MGT_TIMELINE_FUNC
,
.
translateFunc
=
translateDerivative
,
.
getEnvFunc
=
getDerivativeFuncEnv
,
.
initFunc
=
derivativeFuncSetup
,
.
processFunc
=
derivativeFunction
,
.
finalizeFunc
=
functionFinalize
},
{
{
.
name
=
"last_row"
,
.
name
=
"last_row"
,
.
type
=
FUNCTION_TYPE_LAST_ROW
,
.
type
=
FUNCTION_TYPE_LAST_ROW
,
...
@@ -1914,8 +1967,9 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -1914,8 +1967,9 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
{
.
name
=
"twa"
,
.
name
=
"twa"
,
.
type
=
FUNCTION_TYPE_TWA
,
.
type
=
FUNCTION_TYPE_TWA
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_FORBID_STREAM_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_TIMELINE_FUNC
|
FUNC_MGT_
INTERVAL_INTERPO_FUNC
|
FUNC_MGT_
FORBID_STREAM_FUNC
,
.
translateFunc
=
translateInNumOutDou
,
.
translateFunc
=
translateInNumOutDou
,
.
dataRequiredFunc
=
statisDataRequired
,
.
getEnvFunc
=
getTwaFuncEnv
,
.
getEnvFunc
=
getTwaFuncEnv
,
.
initFunc
=
twaFunctionSetup
,
.
initFunc
=
twaFunctionSetup
,
.
processFunc
=
twaFunction
,
.
processFunc
=
twaFunction
,
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/function/src/functionMgt.c
浏览文件 @
7156f525
...
@@ -161,6 +161,8 @@ bool fmIsUserDefinedFunc(int32_t funcId) { return funcId > FUNC_UDF_ID_START; }
...
@@ -161,6 +161,8 @@ bool fmIsUserDefinedFunc(int32_t funcId) { return funcId > FUNC_UDF_ID_START; }
bool
fmIsForbidFillFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_FILL_FUNC
);
}
bool
fmIsForbidFillFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_FILL_FUNC
);
}
bool
fmIsIntervalInterpoFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_INTERVAL_INTERPO_FUNC
);
}
bool
fmIsForbidStreamFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_STREAM_FUNC
);
}
bool
fmIsForbidStreamFunc
(
int32_t
funcId
)
{
return
isSpecificClassifyFunc
(
funcId
,
FUNC_MGT_FORBID_STREAM_FUNC
);
}
void
fmFuncMgtDestroy
()
{
void
fmFuncMgtDestroy
()
{
...
...
source/libs/function/src/taggfunction.c
浏览文件 @
7156f525
...
@@ -161,13 +161,13 @@ typedef struct SRateInfo {
...
@@ -161,13 +161,13 @@ typedef struct SRateInfo {
bool
isIRate
;
// true for IRate functions, false for Rate functions
bool
isIRate
;
// true for IRate functions, false for Rate functions
}
SRateInfo
;
}
SRateInfo
;
typedef
struct
SDerivInfo
{
//
typedef struct SDerivInfo {
double
prevValue
;
// previous value
//
double prevValue; // previous value
TSKEY
prevTs
;
// previous timestamp
//
TSKEY prevTs; // previous timestamp
bool
ignoreNegative
;
// ignore the negative value
//
bool ignoreNegative;// ignore the negative value
int64_t
tsWindow
;
// time window for derivative
//
int64_t tsWindow; // time window for derivative
bool
valueSet
;
// the value has been set already
//
bool valueSet; // the value has been set already
}
SDerivInfo
;
//
} SDerivInfo;
typedef
struct
SResPair
{
typedef
struct
SResPair
{
TSKEY
key
;
TSKEY
key
;
...
...
source/libs/function/src/texpr.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
7156f525
...
@@ -1115,6 +1115,7 @@ static const char* jkLogicSubplanVgroupsSize = "VgroupsSize";
...
@@ -1115,6 +1115,7 @@ static const char* jkLogicSubplanVgroupsSize = "VgroupsSize";
static
const
char
*
jkLogicSubplanVgroups
=
"Vgroups"
;
static
const
char
*
jkLogicSubplanVgroups
=
"Vgroups"
;
static
const
char
*
jkLogicSubplanLevel
=
"Level"
;
static
const
char
*
jkLogicSubplanLevel
=
"Level"
;
static
const
char
*
jkLogicSubplanSplitFlag
=
"SplitFlag"
;
static
const
char
*
jkLogicSubplanSplitFlag
=
"SplitFlag"
;
static
const
char
*
jkLogicSubplanNumOfComputeNodes
=
"NumOfComputeNodes"
;
static
int32_t
logicSubplanToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
static
int32_t
logicSubplanToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SLogicSubplan
*
pNode
=
(
const
SLogicSubplan
*
)
pObj
;
const
SLogicSubplan
*
pNode
=
(
const
SLogicSubplan
*
)
pObj
;
...
@@ -1141,6 +1142,9 @@ static int32_t logicSubplanToJson(const void* pObj, SJson* pJson) {
...
@@ -1141,6 +1142,9 @@ static int32_t logicSubplanToJson(const void* pObj, SJson* pJson) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddIntegerToObject
(
pJson
,
jkLogicSubplanSplitFlag
,
pNode
->
splitFlag
);
code
=
tjsonAddIntegerToObject
(
pJson
,
jkLogicSubplanSplitFlag
,
pNode
->
splitFlag
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddIntegerToObject
(
pJson
,
jkLogicSubplanNumOfComputeNodes
,
pNode
->
numOfComputeNodes
);
}
return
code
;
return
code
;
}
}
...
@@ -1157,7 +1161,6 @@ static int32_t jsonToLogicSubplan(const SJson* pJson, void* pObj) {
...
@@ -1157,7 +1161,6 @@ static int32_t jsonToLogicSubplan(const SJson* pJson, void* pObj) {
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkLogicSubplanType
,
pNode
->
subplanType
,
code
);
tjsonGetNumberValue
(
pJson
,
jkLogicSubplanType
,
pNode
->
subplanType
,
code
);
;
}
}
int32_t
objSize
=
0
;
int32_t
objSize
=
0
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
@@ -1172,6 +1175,9 @@ static int32_t jsonToLogicSubplan(const SJson* pJson, void* pObj) {
...
@@ -1172,6 +1175,9 @@ static int32_t jsonToLogicSubplan(const SJson* pJson, void* pObj) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetIntValue
(
pJson
,
jkLogicSubplanSplitFlag
,
&
pNode
->
splitFlag
);
code
=
tjsonGetIntValue
(
pJson
,
jkLogicSubplanSplitFlag
,
&
pNode
->
splitFlag
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetIntValue
(
pJson
,
jkLogicSubplanNumOfComputeNodes
,
&
pNode
->
numOfComputeNodes
);
}
return
code
;
return
code
;
}
}
...
@@ -1478,14 +1484,6 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) {
...
@@ -1478,14 +1484,6 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) {
return
code
;
return
code
;
}
}
static
int32_t
physiStreamScanNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
return
physiTableScanNodeToJson
(
pObj
,
pJson
);
}
static
int32_t
jsonToPhysiStreamScanNode
(
const
SJson
*
pJson
,
void
*
pObj
)
{
return
jsonToPhysiTableScanNode
(
pJson
,
pObj
);
}
static
const
char
*
jkSysTableScanPhysiPlanMnodeEpSet
=
"MnodeEpSet"
;
static
const
char
*
jkSysTableScanPhysiPlanMnodeEpSet
=
"MnodeEpSet"
;
static
const
char
*
jkSysTableScanPhysiPlanShowRewrite
=
"ShowRewrite"
;
static
const
char
*
jkSysTableScanPhysiPlanShowRewrite
=
"ShowRewrite"
;
static
const
char
*
jkSysTableScanPhysiPlanAccountId
=
"AccountId"
;
static
const
char
*
jkSysTableScanPhysiPlanAccountId
=
"AccountId"
;
...
@@ -3962,9 +3960,9 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
...
@@ -3962,9 +3960,9 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
:
return
physiTagScanNodeToJson
(
pObj
,
pJson
);
return
physiTagScanNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
:
return
physiTableScanNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
return
physi
Stream
ScanNodeToJson
(
pObj
,
pJson
);
return
physi
Table
ScanNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
return
physiSysTableScanNodeToJson
(
pObj
,
pJson
);
return
physiSysTableScanNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_PHYSICAL_PLAN_PROJECT
:
case
QUERY_NODE_PHYSICAL_PLAN_PROJECT
:
...
@@ -4095,9 +4093,9 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
...
@@ -4095,9 +4093,9 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
case
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
:
return
jsonToPhysiTagScanNode
(
pJson
,
pObj
);
return
jsonToPhysiTagScanNode
(
pJson
,
pObj
);
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
:
return
jsonToPhysiTableScanNode
(
pJson
,
pObj
);
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
return
jsonToPhysi
Stream
ScanNode
(
pJson
,
pObj
);
return
jsonToPhysi
Table
ScanNode
(
pJson
,
pObj
);
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
return
jsonToPhysiSysTableScanNode
(
pJson
,
pObj
);
return
jsonToPhysiSysTableScanNode
(
pJson
,
pObj
);
case
QUERY_NODE_PHYSICAL_PLAN_PROJECT
:
case
QUERY_NODE_PHYSICAL_PLAN_PROJECT
:
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
7156f525
...
@@ -209,9 +209,10 @@ SNode* nodesMakeNode(ENodeType type) {
...
@@ -209,9 +209,10 @@ SNode* nodesMakeNode(ENodeType type) {
case
QUERY_NODE_SHOW_CREATE_STABLE_STMT
:
case
QUERY_NODE_SHOW_CREATE_STABLE_STMT
:
case
QUERY_NODE_SHOW_TRANSACTIONS_STMT
:
case
QUERY_NODE_SHOW_TRANSACTIONS_STMT
:
return
makeNode
(
type
,
sizeof
(
SShowStmt
));
return
makeNode
(
type
,
sizeof
(
SShowStmt
));
case
QUERY_NODE_KILL_CONNECTION_STMT
:
case
QUERY_NODE_KILL_QUERY_STMT
:
case
QUERY_NODE_KILL_QUERY_STMT
:
return
makeNode
(
type
,
sizeof
(
SKillQueryStmt
));
case
QUERY_NODE_KILL_TRANSACTION_STMT
:
case
QUERY_NODE_KILL_TRANSACTION_STMT
:
case
QUERY_NODE_KILL_CONNECTION_STMT
:
return
makeNode
(
type
,
sizeof
(
SKillStmt
));
return
makeNode
(
type
,
sizeof
(
SKillStmt
));
case
QUERY_NODE_DELETE_STMT
:
case
QUERY_NODE_DELETE_STMT
:
return
makeNode
(
type
,
sizeof
(
SDeleteStmt
));
return
makeNode
(
type
,
sizeof
(
SDeleteStmt
));
...
@@ -251,6 +252,8 @@ SNode* nodesMakeNode(ENodeType type) {
...
@@ -251,6 +252,8 @@ SNode* nodesMakeNode(ENodeType type) {
return
makeNode
(
type
,
sizeof
(
STableScanPhysiNode
));
return
makeNode
(
type
,
sizeof
(
STableScanPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN
:
return
makeNode
(
type
,
sizeof
(
STableSeqScanPhysiNode
));
return
makeNode
(
type
,
sizeof
(
STableSeqScanPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
:
return
makeNode
(
type
,
sizeof
(
STableMergeScanPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
return
makeNode
(
type
,
sizeof
(
SStreamScanPhysiNode
));
return
makeNode
(
type
,
sizeof
(
SStreamScanPhysiNode
));
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
7156f525
...
@@ -60,6 +60,7 @@ typedef enum EDatabaseOptionType {
...
@@ -60,6 +60,7 @@ typedef enum EDatabaseOptionType {
typedef
enum
ETableOptionType
{
typedef
enum
ETableOptionType
{
TABLE_OPTION_COMMENT
=
1
,
TABLE_OPTION_COMMENT
=
1
,
TABLE_OPTION_FILE_FACTOR
,
TABLE_OPTION_FILE_FACTOR
,
TABLE_OPTION_DELAY
,
TABLE_OPTION_ROLLUP
,
TABLE_OPTION_ROLLUP
,
TABLE_OPTION_TTL
,
TABLE_OPTION_TTL
,
TABLE_OPTION_SMA
TABLE_OPTION_SMA
...
@@ -187,6 +188,7 @@ SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const
...
@@ -187,6 +188,7 @@ SNode* createCreateStreamStmt(SAstCreateContext* pCxt, bool ignoreExists, const
SNode
*
pOptions
,
SNode
*
pQuery
);
SNode
*
pOptions
,
SNode
*
pQuery
);
SNode
*
createDropStreamStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
const
SToken
*
pStreamName
);
SNode
*
createDropStreamStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
const
SToken
*
pStreamName
);
SNode
*
createKillStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pId
);
SNode
*
createKillStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
const
SToken
*
pId
);
SNode
*
createKillQueryStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pQueryId
);
SNode
*
createBalanceVgroupStmt
(
SAstCreateContext
*
pCxt
);
SNode
*
createBalanceVgroupStmt
(
SAstCreateContext
*
pCxt
);
SNode
*
createMergeVgroupStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pVgId1
,
const
SToken
*
pVgId2
);
SNode
*
createMergeVgroupStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pVgId1
,
const
SToken
*
pVgId2
);
SNode
*
createRedistributeVgroupStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pVgId
,
SNodeList
*
pDnodes
);
SNode
*
createRedistributeVgroupStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pVgId
,
SNodeList
*
pDnodes
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
7156f525
...
@@ -168,8 +168,8 @@ db_options(A) ::= .
...
@@ -168,8 +168,8 @@ db_options(A) ::= .
db_options(A) ::= db_options(B) BUFFER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_BUFFER, &C); }
db_options(A) ::= db_options(B) BUFFER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_BUFFER, &C); }
db_options(A) ::= db_options(B) CACHELAST NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHELAST, &C); }
db_options(A) ::= db_options(B) CACHELAST NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHELAST, &C); }
db_options(A) ::= db_options(B) COMP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMP, &C); }
db_options(A) ::= db_options(B) COMP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMP, &C); }
db_options(A) ::= db_options(B) D
AYS NK_INTEGER(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); }
db_options(A) ::= db_options(B) D
URATION NK_INTEGER(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); }
db_options(A) ::= db_options(B) D
AYS NK_VARIABLE(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); }
db_options(A) ::= db_options(B) D
URATION NK_VARIABLE(C).
{ A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); }
db_options(A) ::= db_options(B) FSYNC NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); }
db_options(A) ::= db_options(B) FSYNC NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); }
db_options(A) ::= db_options(B) MAXROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MAXROWS, &C); }
db_options(A) ::= db_options(B) MAXROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MAXROWS, &C); }
db_options(A) ::= db_options(B) MINROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MINROWS, &C); }
db_options(A) ::= db_options(B) MINROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MINROWS, &C); }
...
@@ -317,8 +317,9 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP.
...
@@ -317,8 +317,9 @@ tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP.
table_options(A) ::= . { A = createDefaultTableOptions(pCxt); }
table_options(A) ::= . { A = createDefaultTableOptions(pCxt); }
table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); }
table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); }
//table_options(A) ::= table_options(B) DELAY NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_DELAY, &C); }
table_options(A) ::= table_options(B) FILE_FACTOR NK_FLOAT(C). { A = setTableOption(pCxt, B, TABLE_OPTION_FILE_FACTOR, &C); }
table_options(A) ::= table_options(B) FILE_FACTOR NK_FLOAT(C). { A = setTableOption(pCxt, B, TABLE_OPTION_FILE_FACTOR, &C); }
table_options(A) ::= table_options(B) ROLLUP NK_LP
func_name_list(C) NK_RP.
{ A = setTableOption(pCxt, B, TABLE_OPTION_ROLLUP, C); }
table_options(A) ::= table_options(B) ROLLUP NK_LP
rollup_func_list(C) NK_RP.
{ A = setTableOption(pCxt, B, TABLE_OPTION_ROLLUP, C); }
table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); }
table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); }
table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { A = setTableOption(pCxt, B, TABLE_OPTION_SMA, C); }
table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { A = setTableOption(pCxt, B, TABLE_OPTION_SMA, C); }
...
@@ -330,6 +331,15 @@ alter_table_options(A) ::= alter_table_options(B) alter_table_option(C).
...
@@ -330,6 +331,15 @@ alter_table_options(A) ::= alter_table_options(B) alter_table_option(C).
alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.val = B; }
alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.val = B; }
alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.val = B; }
alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.val = B; }
%type rollup_func_list { SNodeList* }
%destructor rollup_func_list { nodesDestroyList($$); }
rollup_func_list(A) ::= rollup_func_name(B). { A = createNodeList(pCxt, B); }
rollup_func_list(A) ::= rollup_func_list(B) NK_COMMA rollup_func_name(C). { A = addNodeToList(pCxt, B, C); }
rollup_func_name(A) ::= function_name(B). { A = createFunctionNode(pCxt, &B, NULL); }
rollup_func_name(A) ::= FIRST(B). { A = createFunctionNode(pCxt, &B, NULL); }
rollup_func_name(A) ::= LAST(B). { A = createFunctionNode(pCxt, &B, NULL); }
%type col_name_list { SNodeList* }
%type col_name_list { SNodeList* }
%destructor col_name_list { nodesDestroyList($$); }
%destructor col_name_list { nodesDestroyList($$); }
col_name_list(A) ::= col_name(B). { A = createNodeList(pCxt, B); }
col_name_list(A) ::= col_name(B). { A = createNodeList(pCxt, B); }
...
@@ -378,13 +388,6 @@ table_name_cond(A) ::= table_name(B).
...
@@ -378,13 +388,6 @@ table_name_cond(A) ::= table_name(B).
from_db_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
from_db_opt(A) ::= . { A = createDefaultDatabaseCondValue(pCxt); }
from_db_opt(A) ::= FROM db_name(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
from_db_opt(A) ::= FROM db_name(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); }
%type func_name_list { SNodeList* }
%destructor func_name_list { nodesDestroyList($$); }
func_name_list(A) ::= func_name(B). { A = createNodeList(pCxt, B); }
func_name_list(A) ::= func_name_list(B) NK_COMMA func_name(C). { A = addNodeToList(pCxt, B, C); }
func_name(A) ::= function_name(B). { A = createFunctionNode(pCxt, &B, NULL); }
/************************************************ create index ********************************************************/
/************************************************ create index ********************************************************/
cmd ::= CREATE SMA INDEX not_exists_opt(D)
cmd ::= CREATE SMA INDEX not_exists_opt(D)
index_name(A) ON table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &A, &B, NULL, C); }
index_name(A) ON table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &A, &B, NULL, C); }
...
@@ -466,7 +469,7 @@ stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C).
...
@@ -466,7 +469,7 @@ stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C).
/************************************************ kill connection/query ***********************************************/
/************************************************ kill connection/query ***********************************************/
cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); }
cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); }
cmd ::= KILL QUERY NK_
INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT
, &A); }
cmd ::= KILL QUERY NK_
STRING(A). { pCxt->pRootNode = createKillQueryStmt(pCxt
, &A); }
cmd ::= KILL TRANSACTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &A); }
cmd ::= KILL TRANSACTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &A); }
/************************************************ merge/redistribute/ vgroup ******************************************/
/************************************************ merge/redistribute/ vgroup ******************************************/
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/parser/src/parTokenizer.c
浏览文件 @
7156f525
...
@@ -68,7 +68,7 @@ static SKeyword keywordTable[] = {
...
@@ -68,7 +68,7 @@ static SKeyword keywordTable[] = {
{
"CONTAINS"
,
TK_CONTAINS
},
{
"CONTAINS"
,
TK_CONTAINS
},
{
"DATABASE"
,
TK_DATABASE
},
{
"DATABASE"
,
TK_DATABASE
},
{
"DATABASES"
,
TK_DATABASES
},
{
"DATABASES"
,
TK_DATABASES
},
{
"DAYS"
,
TK_DAYS
},
//
{"DAYS", TK_DAYS},
{
"DBS"
,
TK_DBS
},
{
"DBS"
,
TK_DBS
},
{
"DELETE"
,
TK_DELETE
},
{
"DELETE"
,
TK_DELETE
},
{
"DESC"
,
TK_DESC
},
{
"DESC"
,
TK_DESC
},
...
@@ -78,6 +78,7 @@ static SKeyword keywordTable[] = {
...
@@ -78,6 +78,7 @@ static SKeyword keywordTable[] = {
{
"DNODES"
,
TK_DNODES
},
{
"DNODES"
,
TK_DNODES
},
{
"DOUBLE"
,
TK_DOUBLE
},
{
"DOUBLE"
,
TK_DOUBLE
},
{
"DROP"
,
TK_DROP
},
{
"DROP"
,
TK_DROP
},
{
"DURATION"
,
TK_DURATION
},
{
"EXISTS"
,
TK_EXISTS
},
{
"EXISTS"
,
TK_EXISTS
},
{
"EXPLAIN"
,
TK_EXPLAIN
},
{
"EXPLAIN"
,
TK_EXPLAIN
},
{
"FILE_FACTOR"
,
TK_FILE_FACTOR
},
{
"FILE_FACTOR"
,
TK_FILE_FACTOR
},
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/parser/src/sql.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
7156f525
...
@@ -46,7 +46,7 @@ TEST_F(ParserInitialCTest, createBnode) {
...
@@ -46,7 +46,7 @@ TEST_F(ParserInitialCTest, createBnode) {
* BUFFER value
* BUFFER value
* | CACHELAST value
* | CACHELAST value
* | COMP {0 | 1 | 2}
* | COMP {0 | 1 | 2}
* | D
AYS
value
* | D
URATION
value
* | FSYNC value
* | FSYNC value
* | MAXROWS value
* | MAXROWS value
* | MINROWS value
* | MINROWS value
...
@@ -155,7 +155,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
...
@@ -155,7 +155,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
ASSERT_EQ
(
req
.
replications
,
expect
.
replications
);
ASSERT_EQ
(
req
.
replications
,
expect
.
replications
);
ASSERT_EQ
(
req
.
strict
,
expect
.
strict
);
ASSERT_EQ
(
req
.
strict
,
expect
.
strict
);
ASSERT_EQ
(
req
.
cacheLastRow
,
expect
.
cacheLastRow
);
ASSERT_EQ
(
req
.
cacheLastRow
,
expect
.
cacheLastRow
);
//ASSERT_EQ(req.schemaless, expect.schemaless);
//
ASSERT_EQ(req.schemaless, expect.schemaless);
ASSERT_EQ
(
req
.
ignoreExist
,
expect
.
ignoreExist
);
ASSERT_EQ
(
req
.
ignoreExist
,
expect
.
ignoreExist
);
ASSERT_EQ
(
req
.
numOfRetensions
,
expect
.
numOfRetensions
);
ASSERT_EQ
(
req
.
numOfRetensions
,
expect
.
numOfRetensions
);
if
(
expect
.
numOfRetensions
>
0
)
{
if
(
expect
.
numOfRetensions
>
0
)
{
...
@@ -202,7 +202,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
...
@@ -202,7 +202,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
"BUFFER 64 "
"BUFFER 64 "
"CACHELAST 2 "
"CACHELAST 2 "
"COMP 1 "
"COMP 1 "
"D
AYS
100 "
"D
URATION
100 "
"FSYNC 100 "
"FSYNC 100 "
"MAXROWS 1000 "
"MAXROWS 1000 "
"MINROWS 100 "
"MINROWS 100 "
...
@@ -223,7 +223,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
...
@@ -223,7 +223,7 @@ TEST_F(ParserInitialCTest, createDatabase) {
setDbDaysFunc
(
100
);
setDbDaysFunc
(
100
);
setDbKeepFunc
(
1440
,
300
*
60
,
400
*
1440
);
setDbKeepFunc
(
1440
,
300
*
60
,
400
*
1440
);
run
(
"CREATE DATABASE IF NOT EXISTS wxy_db "
run
(
"CREATE DATABASE IF NOT EXISTS wxy_db "
"D
AYS
100m "
"D
URATION
100m "
"KEEP 1440m,300h,400d "
);
"KEEP 1440m,300h,400d "
);
clearCreateDbReq
();
clearCreateDbReq
();
}
}
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/planner/src/planOptimizer.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/planner/src/planScaleOut.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/planner/src/planSpliter.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/stream/inc/streamInc.h
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/stream/src/stream.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/stream/src/streamExec.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/stream/src/streamTask.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMain.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/sync/test/syncConfigChangeTest.cpp
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/sync/test/syncReplicateTest.cpp
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/sync/test/syncTestTool.cpp
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/wal/src/walRead.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/libs/wal/src/walWrite.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/util/src/tarray.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/util/src/tcache.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/parallel_test/collect_cases.sh
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/parallel_test/run.sh
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/alter/alter_replica.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/functions/function_max.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/functions/function_min.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/functions/queryTestCases.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/insert/before_1970.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/insert/retentionpolicy.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/multilevel/fileDistributionSameLevel.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/multilevel/retentionTest.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/perfbenchmark/bug3433.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/perfbenchmark/joinPerformance.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/perfbenchmark/taosdemoInsert.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/query/query1970YearsAf.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/tools/taosdemoAllTest/taosdemoTestSupportNanoInsert.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/tools/taosdumpTest.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/tools/taosdumpTestNanoSupport.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/update/merge_commit_data-0.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/update/merge_commit_data.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/update/merge_commit_data2.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/update/merge_commit_data2_update0.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/update/merge_commit_last.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/util/dnodes.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/util/sql.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/pytest/util/taosdemoCfg.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/db/alter_option.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/db/backup/keep.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/db/topic1.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/import/commit.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/import/replica1.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/parser/alter.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/parser/alter__for_community_version.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/parser/create_db.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/general/parser/create_db__for_community_version.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/tsim/db/alter_option.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/tsim/db/basic6.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/tsim/db/create_all_options.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/tsim/insert/commit-merge0.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/tsim/query/interval-offset.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/tsim/stable/alter_count.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/tsim/stable/alter_import.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/unique/db/commit.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/unique/import/replica2.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/unique/import/replica3.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/script/windows/db/basic.sim
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/0-others/taosShellError.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/0-others/udfTest.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/0-others/udf_cluster.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/0-others/udf_create.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/0-others/udf_restart_taosd.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/0-others/user_control.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/2-query/abs.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/2-query/json_tag.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/2-query/sample.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/6-cluster/5dnode1mnode.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/6-cluster/5dnode2mnode.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/6-cluster/5dnode3mnodeDrop.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/6-cluster/5dnode3mnodeStop.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/6-cluster/5dnode3mnodeStopInsert.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/basic5.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/schema.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqError.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/test-all.bat
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tests/system-test/test.py
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
tools/CMakeLists.txt
浏览文件 @
7156f525
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录