Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5427caf4
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
5427caf4
编写于
6月 24, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into fix/mnode
上级
d98270fe
732d69db
变更
67
展开全部
隐藏空白更改
内联
并排
Showing
67 changed file
with
1371 addition
and
870 deletion
+1371
-870
Jenkinsfile2
Jenkinsfile2
+68
-37
include/common/tmsg.h
include/common/tmsg.h
+31
-1
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+17
-13
include/libs/parser/parser.h
include/libs/parser/parser.h
+2
-0
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+9
-1
source/client/src/clientHb.c
source/client/src/clientHb.c
+3
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+3
-1
source/client/src/clientMain.c
source/client/src/clientMain.c
+3
-3
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+101
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+115
-2
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+2
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+56
-0
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+49
-3
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+4
-0
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+6
-1
source/dnode/mnode/impl/test/db/CMakeLists.txt
source/dnode/mnode/impl/test/db/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/func/CMakeLists.txt
source/dnode/mnode/impl/test/func/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/profile/CMakeLists.txt
source/dnode/mnode/impl/test/profile/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/show/CMakeLists.txt
source/dnode/mnode/impl/test/show/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/sma/CMakeLists.txt
source/dnode/mnode/impl/test/sma/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/stb/CMakeLists.txt
source/dnode/mnode/impl/test/stb/CMakeLists.txt
+4
-6
source/dnode/mnode/impl/test/user/CMakeLists.txt
source/dnode/mnode/impl/test/user/CMakeLists.txt
+4
-6
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+3
-0
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+4
-0
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+4
-1
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+18
-2
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+65
-6
source/libs/catalog/src/ctgDbg.c
source/libs/catalog/src/ctgDbg.c
+1
-1
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+49
-0
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+29
-80
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+2
-2
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+37
-27
source/libs/parser/src/parInsertData.c
source/libs/parser/src/parInsertData.c
+13
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+11
-3
source/libs/parser/test/parTestUtil.h
source/libs/parser/test/parTestUtil.h
+0
-6
source/libs/planner/test/CMakeLists.txt
source/libs/planner/test/CMakeLists.txt
+4
-6
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+39
-0
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+4
-3
source/libs/sync/src/syncElection.c
source/libs/sync/src/syncElection.c
+8
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+30
-3
source/libs/sync/src/syncReplication.c
source/libs/sync/src/syncReplication.c
+2
-2
source/libs/sync/src/syncRequestVote.c
source/libs/sync/src/syncRequestVote.c
+25
-8
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+1
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+6
-3
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+2
-2
tests/parallel_test/run.sh
tests/parallel_test/run.sh
+85
-27
tests/pytest/util/sqlset.py
tests/pytest/util/sqlset.py
+1
-1
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-0
tests/script/sh/cfg.bat
tests/script/sh/cfg.bat
+2
-2
tests/script/sh/copy_udf.bat
tests/script/sh/copy_udf.bat
+1
-1
tests/script/sh/deploy.bat
tests/script/sh/deploy.bat
+2
-2
tests/script/sh/exec.bat
tests/script/sh/exec.bat
+2
-2
tests/script/tsim/stream/partitionby1.sim
tests/script/tsim/stream/partitionby1.sim
+124
-0
tests/script/tsim/sync/3Replica1VgElect.sim
tests/script/tsim/sync/3Replica1VgElect.sim
+4
-4
tests/script/tsim/sync/3Replica5VgElect.sim
tests/script/tsim/sync/3Replica5VgElect.sim
+4
-4
tests/script/tsim/sync/oneReplica5VgElect.sim
tests/script/tsim/sync/oneReplica5VgElect.sim
+4
-4
tests/script/tsim/tmq/consume.bat
tests/script/tsim/tmq/consume.bat
+67
-0
tests/script/wtest.bat
tests/script/wtest.bat
+2
-2
tests/system-test/0-others/taosShell.py
tests/system-test/0-others/taosShell.py
+3
-3
tests/system-test/2-query/Now.py
tests/system-test/2-query/Now.py
+80
-422
tests/system-test/2-query/To_unixtimestamp.py
tests/system-test/2-query/To_unixtimestamp.py
+30
-0
tests/system-test/2-query/first.py
tests/system-test/2-query/first.py
+10
-10
tests/system-test/2-query/timezone.py
tests/system-test/2-query/timezone.py
+87
-119
tests/system-test/simpletest.bat
tests/system-test/simpletest.bat
+4
-4
tests/system-test/test.py
tests/system-test/test.py
+2
-0
未找到文件。
Jenkinsfile2
浏览文件 @
5427caf4
...
@@ -43,10 +43,8 @@ def pre_test(){
...
@@ -43,10 +43,8 @@ def pre_test(){
sh '''
sh '''
cd ${WK}
cd ${WK}
git reset --hard
git reset --hard
git fetch || git fetch
cd ${WKC}
cd ${WKC}
git reset --hard
git reset --hard
git fetch || git fetch
'''
'''
script {
script {
if (env.CHANGE_TARGET == 'master') {
if (env.CHANGE_TARGET == 'master') {
...
@@ -82,6 +80,7 @@ def pre_test(){
...
@@ -82,6 +80,7 @@ def pre_test(){
if (env.CHANGE_URL =~ /\/TDengine\//) {
if (env.CHANGE_URL =~ /\/TDengine\//) {
sh '''
sh '''
cd ${WKC}
cd ${WKC}
git remote prune origin
git pull >/dev/null
git pull >/dev/null
git log -5
git log -5
echo "`date "+%Y%m%d-%H%M%S"` ${JOB_NAME}:${BRANCH_NAME}:${BUILD_ID}:${CHANGE_TARGET}" >>${WKDIR}/jenkins.log
echo "`date "+%Y%m%d-%H%M%S"` ${JOB_NAME}:${BRANCH_NAME}:${BUILD_ID}:${CHANGE_TARGET}" >>${WKDIR}/jenkins.log
...
@@ -107,6 +106,7 @@ def pre_test(){
...
@@ -107,6 +106,7 @@ def pre_test(){
git log -5
git log -5
echo "tdinternal log merged: `git log -5`" >>${WKDIR}/jenkins.log
echo "tdinternal log merged: `git log -5`" >>${WKDIR}/jenkins.log
cd ${WKC}
cd ${WKC}
git remote prune origin
git pull >/dev/null
git pull >/dev/null
git log -5
git log -5
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
echo "community log: `git log -5`" >>${WKDIR}/jenkins.log
...
@@ -137,53 +137,51 @@ def pre_test_win(){
...
@@ -137,53 +137,51 @@ def pre_test_win(){
set
set
date /t
date /t
time /t
time /t
rd /s /Q
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug || exit 0
rd /s /Q
%WIN_INTERNAL_ROOT%
\\debug || exit 0
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git reset --hard
git reset --hard
git fetch || git fetch
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git reset --hard
git reset --hard
git fetch || git fetch
'''
'''
script {
script {
if (env.CHANGE_TARGET == 'master') {
if (env.CHANGE_TARGET == 'master') {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout master
git checkout master
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout master
git checkout master
'''
'''
} else if(env.CHANGE_TARGET == '2.0') {
} else if(env.CHANGE_TARGET == '2.0') {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout 2.0
git checkout 2.0
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout 2.0
git checkout 2.0
'''
'''
} else if(env.CHANGE_TARGET == '3.0') {
} else if(env.CHANGE_TARGET == '3.0') {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout 3.0
git checkout 3.0
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout 3.0
git checkout 3.0
'''
'''
} else {
} else {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout develop
git checkout develop
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout develop
git checkout develop
'''
'''
}
}
...
@@ -191,36 +189,38 @@ def pre_test_win(){
...
@@ -191,36 +189,38 @@ def pre_test_win(){
script {
script {
if (env.CHANGE_URL =~ /\/TDengine\//) {
if (env.CHANGE_URL =~ /\/TDengine\//) {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git pull
git pull
'''
'''
bat '''
bat '''
cd C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
git pull
git pull
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git fetch origin +refs/pull/%CHANGE_ID%/merge
git fetch origin +refs/pull/%CHANGE_ID%/merge
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git checkout -qf FETCH_HEAD
git checkout -qf FETCH_HEAD
'''
'''
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
} else if (env.CHANGE_URL =~ /\/TDinternal\//) {
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git pull
git pull
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git fetch origin +refs/pull/%CHANGE_ID%/merge
git fetch origin +refs/pull/%CHANGE_ID%/merge
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git checkout -qf FETCH_HEAD
git checkout -qf FETCH_HEAD
'''
'''
bat '''
bat '''
cd C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd %WIN_COMMUNITY_ROOT%
git remote prune origin
git pull
git pull
'''
'''
} else {
} else {
...
@@ -230,27 +230,27 @@ def pre_test_win(){
...
@@ -230,27 +230,27 @@ def pre_test_win(){
}
}
}
}
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
git branch
git branch
git log -5
git log -5
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git branch
git branch
git log -5
git log -5
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community
cd
%WIN_COMMUNITY_ROOT%
git submodule update --init --recursive
git submodule update --init --recursive
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
git branch
git branch
git reset --hard
git reset --hard
git pull
git pull
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
git log -5
git log -5
'''
'''
}
}
...
@@ -258,7 +258,7 @@ def pre_test_build_win() {
...
@@ -258,7 +258,7 @@ def pre_test_build_win() {
bat '''
bat '''
echo "building ..."
echo "building ..."
time /t
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
cd
%WIN_INTERNAL_ROOT%
mkdir debug
mkdir debug
cd debug
cd debug
time /t
time /t
...
@@ -273,9 +273,9 @@ def pre_test_build_win() {
...
@@ -273,9 +273,9 @@ def pre_test_build_win() {
time /t
time /t
'''
'''
bat '''
bat '''
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
python -m pip install .
python -m pip install .
xcopy /e/y/i/f
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
xcopy /e/y/i/f
%WIN_INTERNAL_ROOT%
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
'''
'''
return 1
return 1
}
}
...
@@ -283,7 +283,7 @@ def run_win_ctest() {
...
@@ -283,7 +283,7 @@ def run_win_ctest() {
bat '''
bat '''
echo "windows ctest ..."
echo "windows ctest ..."
time /t
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug
cd
%WIN_INTERNAL_ROOT%
\\debug
ctest -j 1 || exit 7
ctest -j 1 || exit 7
time /t
time /t
'''
'''
...
@@ -292,12 +292,12 @@ def run_win_test() {
...
@@ -292,12 +292,12 @@ def run_win_test() {
echo "LINUX NODE: ${linux_node_ip} - ${linux_node_pass}"
echo "LINUX NODE: ${linux_node_ip} - ${linux_node_pass}"
bat '''
bat '''
echo "windows test ..."
echo "windows test ..."
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\taos-connector-python
cd
%WIN_CONNECTOR_ROOT%
python -m pip install .
python -m pip install .
xcopy /e/y/i/f
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
xcopy /e/y/i/f
%WIN_INTERNAL_ROOT%
\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
ls -l C:\\Windows\\System32\\taos.dll
ls -l C:\\Windows\\System32\\taos.dll
time /t
time /t
cd
C:\\workspace\\%EXECUTOR_NUMBER%\\TDinternal\\community\\tests\\system-test
cd
%WIN_SYSTEM_TEST_ROOT%
echo "node: ''' + linux_node_ip + ''':''' + linux_node_pass + '''"
echo "node: ''' + linux_node_ip + ''':''' + linux_node_pass + '''"
echo "testing ..."
echo "testing ..."
test-all.bat "{\\\"host\\\":\\\"''' + linux_node_ip + '''\\\",\\\"port\\\":22,\\\"user\\\":\\\"root\\\",\\\"password\\\":\\\"''' + linux_node_pass + '''\\\",\\\"path\\\":\\\"/var/lib/jenkins/workspace/TDinternal\\\"}"
test-all.bat "{\\\"host\\\":\\\"''' + linux_node_ip + '''\\\",\\\"port\\\":22,\\\"user\\\":\\\"root\\\",\\\"password\\\":\\\"''' + linux_node_pass + '''\\\",\\\"path\\\":\\\"/var/lib/jenkins/workspace/TDinternal\\\"}"
...
@@ -319,6 +319,12 @@ pipeline {
...
@@ -319,6 +319,12 @@ pipeline {
parallel {
parallel {
stage('windows test') {
stage('windows test') {
agent{label " windows10_01 || windows10_02 || windows10_03 || windows10_04 "}
agent{label " windows10_01 || windows10_02 || windows10_03 || windows10_04 "}
environment{
WIN_INTERNAL_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal"
WIN_COMMUNITY_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal\\community"
WIN_SYSTEM_TEST_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\TDinternal\\community\\tests\\system-test"
WIN_CONNECTOR_ROOT="C:\\workspace\\${env.EXECUTOR_NUMBER}\\taos-connector-python"
}
steps {
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 55, unit: 'MINUTES'){
timeout(time: 55, unit: 'MINUTES'){
...
@@ -357,7 +363,7 @@ pipeline {
...
@@ -357,7 +363,7 @@ pipeline {
echo "${linux_node_ip}:${linux_node_pass}"
echo "${linux_node_ip}:${linux_node_pass}"
}
}
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time:
4
0, unit: 'MINUTES'){
timeout(time:
12
0, unit: 'MINUTES'){
pre_test()
pre_test()
script {
script {
sh '''
sh '''
...
@@ -368,11 +374,36 @@ pipeline {
...
@@ -368,11 +374,36 @@ pipeline {
rm -f /tmp/cases.task
rm -f /tmp/cases.task
./collect_cases.sh -e
./collect_cases.sh -e
'''
'''
def extra_param = ""
def log_server_file = "/home/log_server.json"
def timeout_cmd = ""
if (fileExists(log_server_file)) {
def log_server_enabled = sh (
script: 'jq .enabled ' + log_server_file,
returnStdout: true
).trim()
def timeout_param = sh (
script: 'jq .timeout ' + log_server_file,
returnStdout: true
).trim()
if (timeout_param != "null"
&&
timeout_param != "0") {
timeout_cmd = "timeout " + timeout_param
}
if (log_server_enabled == "1") {
def log_server = sh (
script: 'jq .server ' + log_server_file + ' | sed "s/\\\"//g"',
returnStdout: true
).trim()
if (log_server != "null"
&&
log_server != "") {
extra_param = "-w " + log_server
}
}
}
sh '''
sh '''
cd ${WKC}/tests/parallel_test
cd ${WKC}/tests/parallel_test
export DEFAULT_RETRY_TIME=2
export DEFAULT_RETRY_TIME=2
date
date
timeout 2100 time ./run.sh -e -m /home/m.json -t /tmp/cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480
''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t /tmp/cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 480 ''' + extra_param + '''
'''
'''
}
}
}
}
...
...
include/common/tmsg.h
浏览文件 @
5427caf4
...
@@ -510,7 +510,8 @@ typedef struct {
...
@@ -510,7 +510,8 @@ typedef struct {
int8_t
superUser
;
int8_t
superUser
;
int8_t
connType
;
int8_t
connType
;
SEpSet
epSet
;
SEpSet
epSet
;
char
sVersion
[
128
];
char
sVer
[
TSDB_VERSION_LEN
];
char
sDetailVer
[
128
];
}
SConnectRsp
;
}
SConnectRsp
;
int32_t
tSerializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
);
int32_t
tSerializeSConnectRsp
(
void
*
buf
,
int32_t
bufLen
,
SConnectRsp
*
pRsp
);
...
@@ -836,6 +837,20 @@ typedef struct {
...
@@ -836,6 +837,20 @@ typedef struct {
int32_t
tSerializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
int32_t
tSerializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
int32_t
tDeserializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
int32_t
tDeserializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
typedef
struct
{
int32_t
useless
;
// useless
}
SServerVerReq
;
int32_t
tSerializeSServerVerReq
(
void
*
buf
,
int32_t
bufLen
,
SServerVerReq
*
pReq
);
int32_t
tDeserializeSServerVerReq
(
void
*
buf
,
int32_t
bufLen
,
SServerVerReq
*
pReq
);
typedef
struct
{
char
ver
[
TSDB_VERSION_LEN
];
}
SServerVerRsp
;
int32_t
tSerializeSServerVerRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerVerRsp
*
pRsp
);
int32_t
tDeserializeSServerVerRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerVerRsp
*
pRsp
);
typedef
struct
SQueryNodeAddr
{
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
int32_t
nodeId
;
// vgId or qnodeId
...
@@ -1229,6 +1244,21 @@ typedef struct {
...
@@ -1229,6 +1244,21 @@ typedef struct {
int32_t
tSerializeSShowVariablesReq
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesReq
*
pReq
);
int32_t
tSerializeSShowVariablesReq
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesReq
*
pReq
);
int32_t
tDeserializeSShowVariablesReq
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesReq
*
pReq
);
int32_t
tDeserializeSShowVariablesReq
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesReq
*
pReq
);
typedef
struct
{
char
name
[
TSDB_CONFIG_OPTION_LEN
+
1
];
char
value
[
TSDB_CONFIG_VALUE_LEN
+
1
];
}
SVariablesInfo
;
typedef
struct
{
SArray
*
variables
;
//SArray<SVariablesInfo>
}
SShowVariablesRsp
;
int32_t
tSerializeSShowVariablesRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesRsp
*
pReq
);
int32_t
tDeserializeSShowVariablesRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesRsp
*
pReq
);
void
tFreeSShowVariablesRsp
(
SShowVariablesRsp
*
pRsp
);
/*
/*
* sql: show tables like '%a_%'
* sql: show tables like '%a_%'
* payload is the query condition, e.g., '%a_%'
* payload is the query condition, e.g., '%a_%'
...
...
include/common/tmsgdef.h
浏览文件 @
5427caf4
...
@@ -163,6 +163,7 @@ enum {
...
@@ -163,6 +163,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_REDISTRIBUTE_VGROUP
,
"redistribute-vgroup"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_REDISTRIBUTE_VGROUP
,
"redistribute-vgroup"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SPLIT_VGROUP
,
"split-vgroup"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SPLIT_VGROUP
,
"split-vgroup"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW_VARIABLES
,
"show-variables"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW_VARIABLES
,
"show-variables"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SERVER_VERSION
,
"server-version"
,
NULL
,
NULL
)
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SUBMIT
,
"submit"
,
SSubmitReq
,
SSubmitRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SUBMIT
,
"submit"
,
SSubmitReq
,
SSubmitRsp
)
...
...
include/libs/catalog/catalog.h
浏览文件 @
5427caf4
...
@@ -71,6 +71,7 @@ typedef struct SCatalogReq {
...
@@ -71,6 +71,7 @@ typedef struct SCatalogReq {
SArray
*
pTableCfg
;
// element is SNAME
SArray
*
pTableCfg
;
// element is SNAME
bool
qNodeRequired
;
// valid qnode
bool
qNodeRequired
;
// valid qnode
bool
dNodeRequired
;
// valid dnode
bool
dNodeRequired
;
// valid dnode
bool
svrVerRequired
;
bool
forceUpdate
;
bool
forceUpdate
;
}
SCatalogReq
;
}
SCatalogReq
;
...
@@ -80,18 +81,19 @@ typedef struct SMetaRes {
...
@@ -80,18 +81,19 @@ typedef struct SMetaRes {
}
SMetaRes
;
}
SMetaRes
;
typedef
struct
SMetaData
{
typedef
struct
SMetaData
{
SArray
*
pDbVgroup
;
// pRes = SArray<SVgroupInfo>*
SArray
*
pDbVgroup
;
// pRes = SArray<SVgroupInfo>*
SArray
*
pDbCfg
;
// pRes = SDbCfgInfo*
SArray
*
pDbCfg
;
// pRes = SDbCfgInfo*
SArray
*
pDbInfo
;
// pRes = SDbInfo*
SArray
*
pDbInfo
;
// pRes = SDbInfo*
SArray
*
pTableMeta
;
// pRes = STableMeta*
SArray
*
pTableMeta
;
// pRes = STableMeta*
SArray
*
pTableHash
;
// pRes = SVgroupInfo*
SArray
*
pTableHash
;
// pRes = SVgroupInfo*
SArray
*
pTableIndex
;
// pRes = SArray<STableIndexInfo>*
SArray
*
pTableIndex
;
// pRes = SArray<STableIndexInfo>*
SArray
*
pUdfList
;
// pRes = SFuncInfo*
SArray
*
pUdfList
;
// pRes = SFuncInfo*
SArray
*
pIndex
;
// pRes = SIndexInfo*
SArray
*
pIndex
;
// pRes = SIndexInfo*
SArray
*
pUser
;
// pRes = bool*
SArray
*
pUser
;
// pRes = bool*
SArray
*
pQnodeList
;
// pRes = SArray<SQueryNodeLoad>*
SArray
*
pQnodeList
;
// pRes = SArray<SQueryNodeLoad>*
SArray
*
pTableCfg
;
// pRes = STableCfg*
SArray
*
pTableCfg
;
// pRes = STableCfg*
SArray
*
pDnodeList
;
// pRes = SArray<SEpSet>*
SArray
*
pDnodeList
;
// pRes = SArray<SEpSet>*
SMetaRes
*
pSvrVer
;
// pRes = char*
}
SMetaData
;
}
SMetaData
;
typedef
struct
SCatalogCfg
{
typedef
struct
SCatalogCfg
{
...
@@ -268,7 +270,7 @@ int32_t catalogGetTableHashVgroup(SCatalog* pCatalog, SRequestConnInfo* pConn, c
...
@@ -268,7 +270,7 @@ int32_t catalogGetTableHashVgroup(SCatalog* pCatalog, SRequestConnInfo* pConn, c
*/
*/
int32_t
catalogGetAllMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
);
int32_t
catalogGetAllMeta
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
SMetaData
*
pRsp
);
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
);
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
);
int32_t
catalogGetQnodeList
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
SArray
*
pQnodeList
);
int32_t
catalogGetQnodeList
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
SArray
*
pQnodeList
);
...
@@ -298,6 +300,8 @@ int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);
...
@@ -298,6 +300,8 @@ int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth);
int32_t
catalogUpdateVgEpSet
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
vgId
,
SEpSet
*
epSet
);
int32_t
catalogUpdateVgEpSet
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
int32_t
vgId
,
SEpSet
*
epSet
);
int32_t
catalogGetServerVersion
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
pVersion
);
int32_t
ctgdLaunchAsyncCall
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
bool
forceUpdate
);
int32_t
ctgdLaunchAsyncCall
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
bool
forceUpdate
);
int32_t
catalogClearCache
(
void
);
int32_t
catalogClearCache
(
void
);
...
...
include/libs/parser/parser.h
浏览文件 @
5427caf4
...
@@ -51,6 +51,8 @@ typedef struct SParseContext {
...
@@ -51,6 +51,8 @@ typedef struct SParseContext {
bool
isSuperUser
;
bool
isSuperUser
;
bool
async
;
bool
async
;
int8_t
schemalessType
;
int8_t
schemalessType
;
const
char
*
svrVer
;
bool
nodeOffline
;
}
SParseContext
;
}
SParseContext
;
int32_t
qParseSql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
int32_t
qParseSql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
...
...
include/libs/sync/sync.h
浏览文件 @
5427caf4
...
@@ -200,6 +200,7 @@ const char* syncGetMyRoleStr(int64_t rid);
...
@@ -200,6 +200,7 @@ const char* syncGetMyRoleStr(int64_t rid);
SyncTerm
syncGetMyTerm
(
int64_t
rid
);
SyncTerm
syncGetMyTerm
(
int64_t
rid
);
SyncGroupId
syncGetVgId
(
int64_t
rid
);
SyncGroupId
syncGetVgId
(
int64_t
rid
);
void
syncGetEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
void
syncGetEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
void
syncGetRetryEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
int32_t
syncPropose
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
);
int32_t
syncPropose
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
);
bool
syncEnvIsStart
();
bool
syncEnvIsStart
();
const
char
*
syncStr
(
ESyncState
state
);
const
char
*
syncStr
(
ESyncState
state
);
...
...
source/client/inc/clientInt.h
浏览文件 @
5427caf4
...
@@ -54,6 +54,11 @@ enum {
...
@@ -54,6 +54,11 @@ enum {
RES_TYPE__TMQ_META
,
RES_TYPE__TMQ_META
,
};
};
#define SHOW_VARIABLES_RESULT_COLS 2
#define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
#define TD_RES_QUERY(res) (*(int8_t*)res == RES_TYPE__QUERY)
#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
#define TD_RES_TMQ(res) (*(int8_t*)res == RES_TYPE__TMQ)
#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
#define TD_RES_TMQ_META(res) (*(int8_t*)res == RES_TYPE__TMQ_META)
...
@@ -104,6 +109,8 @@ typedef struct SHeartBeatInfo {
...
@@ -104,6 +109,8 @@ typedef struct SHeartBeatInfo {
struct
SAppInstInfo
{
struct
SAppInstInfo
{
int64_t
numOfConns
;
int64_t
numOfConns
;
SCorEpSet
mgmtEp
;
SCorEpSet
mgmtEp
;
int32_t
totalDnodes
;
int32_t
onlineDnodes
;
TdThreadMutex
qnodeMutex
;
TdThreadMutex
qnodeMutex
;
SArray
*
pQnodeList
;
SArray
*
pQnodeList
;
SAppClusterSummary
summary
;
SAppClusterSummary
summary
;
...
@@ -127,7 +134,8 @@ typedef struct STscObj {
...
@@ -127,7 +134,8 @@ typedef struct STscObj {
char
user
[
TSDB_USER_LEN
];
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
char
ver
[
128
];
char
sVer
[
TSDB_VERSION_LEN
];
char
sDetailVer
[
128
];
int8_t
connType
;
int8_t
connType
;
int32_t
acctId
;
int32_t
acctId
;
uint32_t
connId
;
uint32_t
connId
;
...
...
source/client/src/clientHb.c
浏览文件 @
5427caf4
...
@@ -161,6 +161,9 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
...
@@ -161,6 +161,9 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
updateEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
,
&
pRsp
->
query
->
epSet
);
updateEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
,
&
pRsp
->
query
->
epSet
);
}
}
pTscObj
->
pAppInfo
->
totalDnodes
=
pRsp
->
query
->
totalDnodes
;
pTscObj
->
pAppInfo
->
onlineDnodes
=
pRsp
->
query
->
onlineDnodes
;
pTscObj
->
connId
=
pRsp
->
query
->
connId
;
pTscObj
->
connId
=
pRsp
->
query
->
connId
;
if
(
pRsp
->
query
->
killRid
)
{
if
(
pRsp
->
query
->
killRid
)
{
...
...
source/client/src/clientImpl.c
浏览文件 @
5427caf4
...
@@ -178,7 +178,9 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
...
@@ -178,7 +178,9 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
.
pStmtCb
=
pStmtCb
,
.
pStmtCb
=
pStmtCb
,
.
pUser
=
pTscObj
->
user
,
.
pUser
=
pTscObj
->
user
,
.
schemalessType
=
pTscObj
->
schemalessType
,
.
schemalessType
=
pTscObj
->
schemalessType
,
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
))};
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
)),
.
svrVer
=
pTscObj
->
sVer
,
.
nodeOffline
=
(
pTscObj
->
pAppInfo
->
onlineDnodes
<
pTscObj
->
pAppInfo
->
totalDnodes
)};
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
int32_t
code
=
catalogGetHandle
(
pTscObj
->
pAppInfo
->
clusterId
,
&
cxt
.
pCatalog
);
int32_t
code
=
catalogGetHandle
(
pTscObj
->
pAppInfo
->
clusterId
,
&
cxt
.
pCatalog
);
...
...
source/client/src/clientMain.c
浏览文件 @
5427caf4
...
@@ -623,7 +623,7 @@ const char *taos_get_server_info(TAOS *taos) {
...
@@ -623,7 +623,7 @@ const char *taos_get_server_info(TAOS *taos) {
releaseTscObj
(
*
(
int64_t
*
)
taos
);
releaseTscObj
(
*
(
int64_t
*
)
taos
);
return
pTscObj
->
v
er
;
return
pTscObj
->
sDetailV
er
;
}
}
typedef
struct
SqlParseWrapper
{
typedef
struct
SqlParseWrapper
{
...
@@ -766,7 +766,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
...
@@ -766,7 +766,7 @@ void doAsyncQuery(SRequestObj *pRequest, bool updateMetaForce) {
.
requestObjRefId
=
pCxt
->
requestRid
,
.
requestObjRefId
=
pCxt
->
requestRid
,
.
mgmtEps
=
pCxt
->
mgmtEpSet
};
.
mgmtEps
=
pCxt
->
mgmtEpSet
};
code
=
catalogAsyncGetAllMeta
(
pCxt
->
pCatalog
,
&
conn
,
pRequest
->
requestId
,
&
catalogReq
,
retrieveMetaCallback
,
pWrapper
,
code
=
catalogAsyncGetAllMeta
(
pCxt
->
pCatalog
,
&
conn
,
&
catalogReq
,
retrieveMetaCallback
,
pWrapper
,
&
pRequest
->
body
.
queryJob
);
&
pRequest
->
body
.
queryJob
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
return
;
return
;
...
@@ -934,7 +934,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
...
@@ -934,7 +934,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
conn
.
mgmtEps
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
conn
.
mgmtEps
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
code
=
catalogAsyncGetAllMeta
(
pCtg
,
&
conn
,
pRequest
->
requestId
,
&
catalogReq
,
syncCatalogFn
,
&
param
,
NULL
);
code
=
catalogAsyncGetAllMeta
(
pCtg
,
&
conn
,
&
catalogReq
,
syncCatalogFn
,
&
param
,
NULL
);
if
(
code
)
{
if
(
code
)
{
goto
_return
;
goto
_return
;
}
}
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
5427caf4
...
@@ -82,7 +82,8 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -82,7 +82,8 @@ int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) {
pTscObj
->
connId
=
connectRsp
.
connId
;
pTscObj
->
connId
=
connectRsp
.
connId
;
pTscObj
->
acctId
=
connectRsp
.
acctId
;
pTscObj
->
acctId
=
connectRsp
.
acctId
;
tstrncpy
(
pTscObj
->
ver
,
connectRsp
.
sVersion
,
tListLen
(
pTscObj
->
ver
));
tstrncpy
(
pTscObj
->
sVer
,
connectRsp
.
sVer
,
tListLen
(
pTscObj
->
sVer
));
tstrncpy
(
pTscObj
->
sDetailVer
,
connectRsp
.
sDetailVer
,
tListLen
(
pTscObj
->
sDetailVer
));
// update the appInstInfo
// update the appInstInfo
pTscObj
->
pAppInfo
->
clusterId
=
connectRsp
.
clusterId
;
pTscObj
->
pAppInfo
->
clusterId
=
connectRsp
.
clusterId
;
...
@@ -287,6 +288,103 @@ int32_t processAlterStbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -287,6 +288,103 @@ int32_t processAlterStbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
return
code
;
return
code
;
}
}
static
int32_t
buildShowVariablesBlock
(
SArray
*
pVars
,
SSDataBlock
**
block
)
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
info
.
hasVarCol
=
true
;
pBlock
->
pDataBlock
=
taosArrayInit
(
SHOW_VARIABLES_RESULT_COLS
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_VARIABLES_RESULT_FIELD1_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_VARIABLES_RESULT_FIELD2_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
int32_t
numOfCfg
=
taosArrayGetSize
(
pVars
);
blockDataEnsureCapacity
(
pBlock
,
numOfCfg
);
for
(
int32_t
i
=
0
,
c
=
0
;
i
<
numOfCfg
;
++
i
,
c
=
0
)
{
SVariablesInfo
*
pInfo
=
taosArrayGet
(
pVars
,
i
);
char
name
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pInfo
->
name
,
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
name
,
false
);
char
value
[
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
value
,
pInfo
->
value
,
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
value
,
false
);
}
pBlock
->
info
.
rows
=
numOfCfg
;
*
block
=
pBlock
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
buildShowVariablesRsp
(
SArray
*
pVars
,
SRetrieveTableRsp
**
pRsp
)
{
SSDataBlock
*
pBlock
=
NULL
;
int32_t
code
=
buildShowVariablesBlock
(
pVars
,
&
pBlock
);
if
(
code
)
{
return
code
;
}
size_t
rspSize
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
*
pRsp
=
taosMemoryCalloc
(
1
,
rspSize
);
if
(
NULL
==
*
pRsp
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pRsp
)
->
useconds
=
0
;
(
*
pRsp
)
->
completed
=
1
;
(
*
pRsp
)
->
precision
=
0
;
(
*
pRsp
)
->
compressed
=
0
;
(
*
pRsp
)
->
compLen
=
0
;
(
*
pRsp
)
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
(
*
pRsp
)
->
numOfCols
=
htonl
(
SHOW_VARIABLES_RESULT_COLS
);
int32_t
len
=
0
;
blockCompressEncode
(
pBlock
,
(
*
pRsp
)
->
data
,
&
len
,
SHOW_VARIABLES_RESULT_COLS
,
false
);
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
processShowVariablesRsp
(
void
*
param
,
const
SDataBuf
*
pMsg
,
int32_t
code
)
{
SRequestObj
*
pRequest
=
param
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
setErrno
(
pRequest
,
code
);
}
else
{
SShowVariablesRsp
rsp
=
{
0
};
SRetrieveTableRsp
*
pRes
=
NULL
;
code
=
tDeserializeSShowVariablesRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
rsp
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
buildShowVariablesRsp
(
rsp
.
variables
,
&
pRes
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
pRes
,
false
,
false
);
}
tFreeSShowVariablesRsp
(
&
rsp
);
}
if
(
pRequest
->
body
.
queryFp
!=
NULL
)
{
pRequest
->
body
.
queryFp
(
pRequest
->
body
.
param
,
pRequest
,
code
);
}
else
{
tsem_post
(
&
pRequest
->
body
.
rspSem
);
}
return
code
;
}
__async_send_cb_fn_t
getMsgRspHandle
(
int32_t
msgType
)
{
__async_send_cb_fn_t
getMsgRspHandle
(
int32_t
msgType
)
{
switch
(
msgType
)
{
switch
(
msgType
)
{
case
TDMT_MND_CONNECT
:
case
TDMT_MND_CONNECT
:
...
@@ -301,6 +399,8 @@ __async_send_cb_fn_t getMsgRspHandle(int32_t msgType) {
...
@@ -301,6 +399,8 @@ __async_send_cb_fn_t getMsgRspHandle(int32_t msgType) {
return
processDropDbRsp
;
return
processDropDbRsp
;
case
TDMT_MND_ALTER_STB
:
case
TDMT_MND_ALTER_STB
:
return
processAlterStbRsp
;
return
processAlterStbRsp
;
case
TDMT_MND_SHOW_VARIABLES
:
return
processShowVariablesRsp
;
default:
default:
return
genericRspCallback
;
return
genericRspCallback
;
}
}
...
...
source/common/src/tmsg.c
浏览文件 @
5427caf4
...
@@ -2250,6 +2250,56 @@ int32_t tDeserializeSDnodeListReq(void *buf, int32_t bufLen, SDnodeListReq *pReq
...
@@ -2250,6 +2250,56 @@ int32_t tDeserializeSDnodeListReq(void *buf, int32_t bufLen, SDnodeListReq *pReq
return
0
;
return
0
;
}
}
int32_t
tSerializeSServerVerReq
(
void
*
buf
,
int32_t
bufLen
,
SServerVerReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
useless
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSServerVerReq
(
void
*
buf
,
int32_t
bufLen
,
SServerVerReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
useless
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSServerVerRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerVerRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
ver
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSServerVerRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerVerRsp
*
pRsp
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
ver
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
SEncoder
encoder
=
{
0
};
...
@@ -2859,6 +2909,67 @@ int32_t tDeserializeSShowVariablesReq(void *buf, int32_t bufLen, SShowVariablesR
...
@@ -2859,6 +2909,67 @@ int32_t tDeserializeSShowVariablesReq(void *buf, int32_t bufLen, SShowVariablesR
return
0
;
return
0
;
}
}
int32_t
tEncodeSVariablesInfo
(
SEncoder
*
pEncoder
,
SVariablesInfo
*
pInfo
)
{
if
(
tEncodeCStr
(
pEncoder
,
pInfo
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
pInfo
->
value
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tDecodeSVariablesInfo
(
SDecoder
*
pDecoder
,
SVariablesInfo
*
pInfo
)
{
if
(
tDecodeCStrTo
(
pDecoder
,
pInfo
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
pInfo
->
value
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tSerializeSShowVariablesRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
int32_t
varNum
=
taosArrayGetSize
(
pRsp
->
variables
);
if
(
tEncodeI32
(
&
encoder
,
varNum
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
varNum
;
++
i
)
{
SVariablesInfo
*
pInfo
=
taosArrayGet
(
pRsp
->
variables
,
i
);
if
(
tEncodeSVariablesInfo
(
&
encoder
,
pInfo
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSShowVariablesRsp
(
void
*
buf
,
int32_t
bufLen
,
SShowVariablesRsp
*
pRsp
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
int32_t
varNum
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
varNum
)
<
0
)
return
-
1
;
if
(
varNum
>
0
)
{
pRsp
->
variables
=
taosArrayInit
(
varNum
,
sizeof
(
SVariablesInfo
));
if
(
NULL
==
pRsp
->
variables
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
varNum
;
++
i
)
{
SVariablesInfo
info
=
{
0
};
if
(
tDecodeSVariablesInfo
(
&
decoder
,
&
info
)
<
0
)
return
-
1
;
if
(
NULL
==
taosArrayPush
(
pRsp
->
variables
,
&
info
))
return
-
1
;
}
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
void
tFreeSShowVariablesRsp
(
SShowVariablesRsp
*
pRsp
)
{
if
(
NULL
==
pRsp
)
{
return
;
}
taosArrayDestroy
(
pRsp
->
variables
);
}
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
@@ -3400,7 +3511,8 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
...
@@ -3400,7 +3511,8 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
superUser
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
superUser
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
connType
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
connType
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
&
encoder
,
&
pRsp
->
epSet
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
&
encoder
,
&
pRsp
->
epSet
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
sVersion
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
sVer
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
sDetailVer
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -3420,7 +3532,8 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
...
@@ -3420,7 +3532,8 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) {
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
superUser
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
superUser
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
connType
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
connType
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
&
decoder
,
&
pRsp
->
epSet
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
&
decoder
,
&
pRsp
->
epSet
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
sVersion
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
sVer
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
sDetailVer
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
5427caf4
...
@@ -206,6 +206,8 @@ SArray *mmGetMsgHandles() {
...
@@ -206,6 +206,8 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SYSTABLE_RETRIEVE
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SYSTABLE_RETRIEVE
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_AUTH
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_AUTH
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SHOW_VARIABLES
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SERVER_VERSION
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY
,
mmPutMsgToQueryQueue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY
,
mmPutMsgToQueryQueue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_CONTINUE
,
mmPutMsgToQueryQueue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_CONTINUE
,
mmPutMsgToQueryQueue
,
1
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
5427caf4
...
@@ -48,6 +48,7 @@ static int32_t mndDnodeActionInsert(SSdb *pSdb, SDnodeObj *pDnode);
...
@@ -48,6 +48,7 @@ static int32_t mndDnodeActionInsert(SSdb *pSdb, SDnodeObj *pDnode);
static
int32_t
mndDnodeActionDelete
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionDelete
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOld
,
SDnodeObj
*
pNew
);
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOld
,
SDnodeObj
*
pNew
);
static
int32_t
mndProcessDnodeListReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessDnodeListReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessShowVariablesReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessDropDnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessDropDnodeReq
(
SRpcMsg
*
pReq
);
...
@@ -78,6 +79,7 @@ int32_t mndInitDnode(SMnode *pMnode) {
...
@@ -78,6 +79,7 @@ int32_t mndInitDnode(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CONFIG_DNODE_RSP
,
mndProcessConfigDnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CONFIG_DNODE_RSP
,
mndProcessConfigDnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STATUS
,
mndProcessStatusReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STATUS
,
mndProcessStatusReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DNODE_LIST
,
mndProcessDnodeListReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DNODE_LIST
,
mndProcessDnodeListReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_SHOW_VARIABLES
,
mndProcessShowVariablesReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndRetrieveConfigs
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndRetrieveConfigs
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndCancelGetNextConfig
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndCancelGetNextConfig
);
...
@@ -554,6 +556,60 @@ _OVER:
...
@@ -554,6 +556,60 @@ _OVER:
return
code
;
return
code
;
}
}
static
int32_t
mndProcessShowVariablesReq
(
SRpcMsg
*
pReq
)
{
SShowVariablesRsp
rsp
=
{
0
};
int32_t
code
=
-
1
;
rsp
.
variables
=
taosArrayInit
(
4
,
sizeof
(
SVariablesInfo
));
if
(
NULL
==
rsp
.
variables
)
{
mError
(
"failed to alloc SVariablesInfo array while process show variables req"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
SVariablesInfo
info
=
{
0
};
strcpy
(
info
.
name
,
"statusInterval"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%d"
,
tsStatusInterval
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
strcpy
(
info
.
name
,
"timezone"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsTimezoneStr
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
strcpy
(
info
.
name
,
"locale"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsLocale
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
strcpy
(
info
.
name
,
"charset"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsCharset
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
int32_t
rspLen
=
tSerializeSShowVariablesRsp
(
NULL
,
0
,
&
rsp
);
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
tSerializeSShowVariablesRsp
(
pRsp
,
rspLen
,
&
rsp
);
pReq
->
info
.
rspLen
=
rspLen
;
pReq
->
info
.
rsp
=
pRsp
;
code
=
0
;
_OVER:
if
(
code
!=
0
)
{
mError
(
"failed to get show variables info since %s"
,
terrstr
());
}
tFreeSShowVariablesRsp
(
&
rsp
);
return
code
;
}
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
5427caf4
...
@@ -71,6 +71,7 @@ static void mndCancelGetNextQuery(SMnode *pMnode, void *pIter);
...
@@ -71,6 +71,7 @@ static void mndCancelGetNextQuery(SMnode *pMnode, void *pIter);
static
void
mndFreeApp
(
SAppObj
*
pApp
);
static
void
mndFreeApp
(
SAppObj
*
pApp
);
static
int32_t
mndRetrieveApps
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveApps
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextApp
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextApp
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessSvrVerReq
(
SRpcMsg
*
pReq
);
int32_t
mndInitProfile
(
SMnode
*
pMnode
)
{
int32_t
mndInitProfile
(
SMnode
*
pMnode
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
...
@@ -95,6 +96,7 @@ int32_t mndInitProfile(SMnode *pMnode) {
...
@@ -95,6 +96,7 @@ int32_t mndInitProfile(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CONNECT
,
mndProcessConnectReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CONNECT
,
mndProcessConnectReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_QUERY
,
mndProcessKillQueryReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_QUERY
,
mndProcessKillQueryReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_CONN
,
mndProcessKillConnReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_CONN
,
mndProcessKillConnReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_SERVER_VERSION
,
mndProcessSvrVerReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndRetrieveConns
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndRetrieveConns
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndCancelGetNextConn
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndCancelGetNextConn
);
...
@@ -269,8 +271,9 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
...
@@ -269,8 +271,9 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
connectRsp
.
connId
=
pConn
->
id
;
connectRsp
.
connId
=
pConn
->
id
;
connectRsp
.
connType
=
connReq
.
connType
;
connectRsp
.
connType
=
connReq
.
connType
;
connectRsp
.
dnodeNum
=
mndGetDnodeSize
(
pMnode
);
connectRsp
.
dnodeNum
=
mndGetDnodeSize
(
pMnode
);
snprintf
(
connectRsp
.
sVersion
,
sizeof
(
connectRsp
.
sVersion
),
"ver:%s
\n
build:%s
\n
gitinfo:%s"
,
version
,
buildinfo
,
strcpy
(
connectRsp
.
sVer
,
version
);
snprintf
(
connectRsp
.
sDetailVer
,
sizeof
(
connectRsp
.
sDetailVer
),
"ver:%s
\n
build:%s
\n
gitinfo:%s"
,
version
,
buildinfo
,
gitinfo
);
gitinfo
);
mndGetMnodeEpSet
(
pMnode
,
&
connectRsp
.
epSet
);
mndGetMnodeEpSet
(
pMnode
,
&
connectRsp
.
epSet
);
...
@@ -467,6 +470,27 @@ static int32_t mndUpdateAppInfo(SMnode *pMnode, SClientHbReq *pHbReq, SRpcConnIn
...
@@ -467,6 +470,27 @@ static int32_t mndUpdateAppInfo(SMnode *pMnode, SClientHbReq *pHbReq, SRpcConnIn
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
mndGetOnlineDnodeNum
(
SMnode
*
pMnode
,
int32_t
*
num
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDnodeObj
*
pDnode
=
NULL
;
int64_t
curMs
=
taosGetTimestampMs
();
void
*
pIter
=
NULL
;
while
(
true
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pDnode
);
if
(
pIter
==
NULL
)
break
;
bool
online
=
mndIsDnodeOnline
(
pDnode
,
curMs
);
if
(
online
)
{
(
*
num
)
++
;
}
sdbRelease
(
pSdb
,
pDnode
);
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndProcessQueryHeartBeat
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
,
SClientHbReq
*
pHbReq
,
static
int32_t
mndProcessQueryHeartBeat
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
,
SClientHbReq
*
pHbReq
,
SClientHbBatchRsp
*
pBatchRsp
)
{
SClientHbBatchRsp
*
pBatchRsp
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
...
@@ -510,7 +534,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
...
@@ -510,7 +534,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
rspBasic
->
connId
=
pConn
->
id
;
rspBasic
->
connId
=
pConn
->
id
;
rspBasic
->
totalDnodes
=
mndGetDnodeSize
(
pMnode
);
rspBasic
->
totalDnodes
=
mndGetDnodeSize
(
pMnode
);
rspBasic
->
onlineDnodes
=
1
;
// TODO
mndGetOnlineDnodeNum
(
pMnode
,
&
rspBasic
->
onlineDnodes
);
mndGetMnodeEpSet
(
pMnode
,
&
rspBasic
->
epSet
);
mndGetMnodeEpSet
(
pMnode
,
&
rspBasic
->
epSet
);
mndCreateQnodeList
(
pMnode
,
&
rspBasic
->
pQnodeList
,
-
1
);
mndCreateQnodeList
(
pMnode
,
&
rspBasic
->
pQnodeList
,
-
1
);
...
@@ -701,6 +725,28 @@ static int32_t mndProcessKillConnReq(SRpcMsg *pReq) {
...
@@ -701,6 +725,28 @@ static int32_t mndProcessKillConnReq(SRpcMsg *pReq) {
}
}
}
}
static
int32_t
mndProcessSvrVerReq
(
SRpcMsg
*
pReq
)
{
int32_t
code
=
-
1
;
SServerVerRsp
rsp
=
{
0
};
strcpy
(
rsp
.
ver
,
version
);
int32_t
contLen
=
tSerializeSServerVerRsp
(
NULL
,
0
,
&
rsp
);
if
(
contLen
<
0
)
goto
_over
;
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
goto
_over
;
tSerializeSServerVerRsp
(
pRsp
,
contLen
,
&
rsp
);
pReq
->
info
.
rspLen
=
contLen
;
pReq
->
info
.
rsp
=
pRsp
;
code
=
0
;
_over:
return
code
;
}
static
int32_t
mndRetrieveConns
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
static
int32_t
mndRetrieveConns
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
5427caf4
...
@@ -321,6 +321,10 @@ FAIL:
...
@@ -321,6 +321,10 @@ FAIL:
}
}
int32_t
mndPersistTaskDeployReq
(
STrans
*
pTrans
,
const
SStreamTask
*
pTask
)
{
int32_t
mndPersistTaskDeployReq
(
STrans
*
pTrans
,
const
SStreamTask
*
pTask
)
{
ASSERT
(
pTask
->
isDataScan
==
0
||
pTask
->
isDataScan
==
1
);
if
(
pTask
->
isDataScan
==
0
&&
pTask
->
sinkType
==
TASK_SINK__NONE
)
{
ASSERT
(
taosArrayGetSize
(
pTask
->
childEpInfo
)
!=
0
);
}
SEncoder
encoder
;
SEncoder
encoder
;
tEncoderInit
(
&
encoder
,
NULL
,
0
);
tEncoderInit
(
&
encoder
,
NULL
,
0
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
tEncodeSStreamTask
(
&
encoder
,
pTask
);
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
5427caf4
...
@@ -198,6 +198,10 @@ int32_t mndInitSync(SMnode *pMnode) {
...
@@ -198,6 +198,10 @@ int32_t mndInitSync(SMnode *pMnode) {
return
-
1
;
return
-
1
;
}
}
// decrease election timer
setElectTimerMS
(
pMgmt
->
sync
,
600
);
setHeartbeatTimerMS
(
pMgmt
->
sync
,
300
);
mDebug
(
"mnode-sync is opened, id:%"
PRId64
,
pMgmt
->
sync
);
mDebug
(
"mnode-sync is opened, id:%"
PRId64
,
pMgmt
->
sync
);
return
0
;
return
0
;
}
}
...
@@ -261,7 +265,8 @@ bool mndIsMaster(SMnode *pMnode) {
...
@@ -261,7 +265,8 @@ bool mndIsMaster(SMnode *pMnode) {
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
if
(
!
syncIsReady
(
pMgmt
->
sync
))
{
if
(
!
syncIsReady
(
pMgmt
->
sync
))
{
terrno
=
TSDB_CODE_SYN_NOT_LEADER
;
// get terrno from syncIsReady
// terrno = TSDB_CODE_SYN_NOT_LEADER;
return
false
;
return
false
;
}
}
...
...
source/dnode/mnode/impl/test/db/CMakeLists.txt
浏览文件 @
5427caf4
...
@@ -5,9 +5,7 @@ target_link_libraries(
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
PUBLIC sut
)
)
if
(
NOT TD_WINDOWS
)
add_test
(
add_test
(
NAME dbTest
NAME dbTest
COMMAND dbTest
COMMAND dbTest
)
)
endif
(
NOT TD_WINDOWS
)
source/dnode/mnode/impl/test/func/CMakeLists.txt
浏览文件 @
5427caf4
...
@@ -5,9 +5,7 @@ target_link_libraries(
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
PUBLIC sut
)
)
# if(NOT TD_WINDOWS)
add_test
(
add_test
(
NAME funcTest
NAME funcTest
COMMAND funcTest
COMMAND funcTest
)
)
\ No newline at end of file
# endif(NOT TD_WINDOWS)
source/dnode/mnode/impl/test/profile/CMakeLists.txt
浏览文件 @
5427caf4
...
@@ -5,9 +5,7 @@ target_link_libraries(
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
PUBLIC sut
)
)
# if(NOT TD_WINDOWS)
add_test
(
add_test
(
NAME profileTest
NAME profileTest
COMMAND profileTest
COMMAND profileTest
)
)
# endif(NOT TD_WINDOWS)
source/dnode/mnode/impl/test/show/CMakeLists.txt
浏览文件 @
5427caf4
...
@@ -5,9 +5,7 @@ target_link_libraries(
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
PUBLIC sut
)
)
# if(NOT TD_WINDOWS)
add_test
(
add_test
(
NAME showTest
NAME showTest
COMMAND showTest
COMMAND showTest
)
)
# endif(NOT TD_WINDOWS)
source/dnode/mnode/impl/test/sma/CMakeLists.txt
浏览文件 @
5427caf4
...
@@ -5,9 +5,7 @@ target_link_libraries(
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
PUBLIC sut
)
)
if
(
NOT TD_WINDOWS
)
add_test
(
add_test
(
NAME smaTest
NAME smaTest
COMMAND smaTest
COMMAND smaTest
)
)
endif
(
NOT TD_WINDOWS
)
source/dnode/mnode/impl/test/stb/CMakeLists.txt
浏览文件 @
5427caf4
...
@@ -5,9 +5,7 @@ target_link_libraries(
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
PUBLIC sut
)
)
if
(
NOT TD_WINDOWS
)
add_test
(
add_test
(
NAME stbTest
NAME stbTest
COMMAND stbTest
COMMAND stbTest
)
)
\ No newline at end of file
endif
(
NOT TD_WINDOWS
)
\ No newline at end of file
source/dnode/mnode/impl/test/user/CMakeLists.txt
浏览文件 @
5427caf4
...
@@ -5,9 +5,7 @@ target_link_libraries(
...
@@ -5,9 +5,7 @@ target_link_libraries(
PUBLIC sut
PUBLIC sut
)
)
if
(
NOT TD_WINDOWS
)
add_test
(
add_test
(
NAME userTest
NAME userTest
COMMAND userTest
COMMAND userTest
)
)
endif
(
NOT TD_WINDOWS
)
source/dnode/vnode/src/tq/tq.c
浏览文件 @
5427caf4
...
@@ -455,6 +455,9 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) {
...
@@ -455,6 +455,9 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) {
}
}
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
ASSERT
(
pTask
->
isDataScan
==
0
||
pTask
->
isDataScan
==
1
);
ASSERT
(
pTask
->
isDataScan
==
0
||
pTask
->
isDataScan
==
1
);
if
(
pTask
->
isDataScan
==
0
&&
pTask
->
sinkType
==
TASK_SINK__NONE
)
{
ASSERT
(
taosArrayGetSize
(
pTask
->
childEpInfo
)
!=
0
);
}
pTask
->
execStatus
=
TASK_EXEC_STATUS__IDLE
;
pTask
->
execStatus
=
TASK_EXEC_STATUS__IDLE
;
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
5427caf4
...
@@ -144,11 +144,15 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
...
@@ -144,11 +144,15 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
vnodeAccumBlockMsg
(
pVnode
,
pMsg
->
msgType
);
vnodeAccumBlockMsg
(
pVnode
,
pMsg
->
msgType
);
}
else
if
(
code
==
-
1
&&
terrno
==
TSDB_CODE_SYN_NOT_LEADER
)
{
}
else
if
(
code
==
-
1
&&
terrno
==
TSDB_CODE_SYN_NOT_LEADER
)
{
SEpSet
newEpSet
=
{
0
};
SEpSet
newEpSet
=
{
0
};
syncGetRetryEpSet
(
pVnode
->
sync
,
&
newEpSet
);
/*
syncGetEpSet(pVnode->sync, &newEpSet);
syncGetEpSet(pVnode->sync, &newEpSet);
SEp *pEp = &newEpSet.eps[newEpSet.inUse];
SEp *pEp = &newEpSet.eps[newEpSet.inUse];
if (pEp->port == tsServerPort && strcmp(pEp->fqdn, tsLocalFqdn) == 0) {
if (pEp->port == tsServerPort && strcmp(pEp->fqdn, tsLocalFqdn) == 0) {
newEpSet.inUse = (newEpSet.inUse + 1) % newEpSet.numOfEps;
newEpSet.inUse = (newEpSet.inUse + 1) % newEpSet.numOfEps;
}
}
*/
vGTrace
(
"vgId:%d, msg:%p is redirect since not leader, numOfEps:%d inUse:%d"
,
vgId
,
pMsg
,
newEpSet
.
numOfEps
,
vGTrace
(
"vgId:%d, msg:%p is redirect since not leader, numOfEps:%d inUse:%d"
,
vgId
,
pMsg
,
newEpSet
.
numOfEps
,
newEpSet
.
inUse
);
newEpSet
.
inUse
);
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
5427caf4
...
@@ -76,6 +76,7 @@ typedef enum {
...
@@ -76,6 +76,7 @@ typedef enum {
CTG_TASK_GET_INDEX
,
CTG_TASK_GET_INDEX
,
CTG_TASK_GET_UDF
,
CTG_TASK_GET_UDF
,
CTG_TASK_GET_USER
,
CTG_TASK_GET_USER
,
CTG_TASK_GET_SVR_VER
,
}
CTG_TASK_TYPE
;
}
CTG_TASK_TYPE
;
typedef
enum
{
typedef
enum
{
...
@@ -224,6 +225,7 @@ typedef struct SCtgJob {
...
@@ -224,6 +225,7 @@ typedef struct SCtgJob {
int32_t
dbInfoNum
;
int32_t
dbInfoNum
;
int32_t
tbIndexNum
;
int32_t
tbIndexNum
;
int32_t
tbCfgNum
;
int32_t
tbCfgNum
;
int32_t
svrVerNum
;
}
SCtgJob
;
}
SCtgJob
;
typedef
struct
SCtgMsgCtx
{
typedef
struct
SCtgMsgCtx
{
...
@@ -578,8 +580,9 @@ int32_t ctgGetTbMetaFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SNa
...
@@ -578,8 +580,9 @@ int32_t ctgGetTbMetaFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SNa
int32_t
ctgGetTbMetaFromVnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
vgroupInfo
,
STableMetaOutput
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTbMetaFromVnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
vgroupInfo
,
STableMetaOutput
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTableCfgFromVnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
vgroupInfo
,
STableCfg
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTableCfgFromVnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
vgroupInfo
,
STableCfg
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTableCfgFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableCfg
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTableCfgFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableCfg
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetSvrVerFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgInitJob
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SCtgJob
**
job
,
uint64_t
reqId
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int32_t
*
taskNum
);
int32_t
ctgInitJob
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SCtgJob
**
job
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int32_t
*
taskNum
);
int32_t
ctgLaunchJob
(
SCtgJob
*
pJob
);
int32_t
ctgLaunchJob
(
SCtgJob
*
pJob
);
int32_t
ctgMakeAsyncRes
(
SCtgJob
*
pJob
);
int32_t
ctgMakeAsyncRes
(
SCtgJob
*
pJob
);
int32_t
ctgLaunchSubTask
(
SCtgTask
*
pTask
,
CTG_TASK_TYPE
type
,
ctgSubTaskCbFp
fp
,
void
*
param
);
int32_t
ctgLaunchSubTask
(
SCtgTask
*
pTask
,
CTG_TASK_TYPE
type
,
ctgSubTaskCbFp
fp
,
void
*
param
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
5427caf4
...
@@ -1051,7 +1051,7 @@ _return:
...
@@ -1051,7 +1051,7 @@ _return:
CTG_API_LEAVE
(
code
);
CTG_API_LEAVE
(
code
);
}
}
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
uint64_t
reqId
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
)
{
int32_t
catalogAsyncGetAllMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int64_t
*
jobId
)
{
CTG_API_ENTER
();
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
pConn
||
NULL
==
pReq
||
NULL
==
fp
||
NULL
==
param
)
{
if
(
NULL
==
pCtg
||
NULL
==
pConn
||
NULL
==
pReq
||
NULL
==
fp
||
NULL
==
param
)
{
...
@@ -1060,7 +1060,7 @@ int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo *pConn, uint64_t
...
@@ -1060,7 +1060,7 @@ int32_t catalogAsyncGetAllMeta(SCatalog* pCtg, SRequestConnInfo *pConn, uint64_t
int32_t
code
=
0
,
taskNum
=
0
;
int32_t
code
=
0
,
taskNum
=
0
;
SCtgJob
*
pJob
=
NULL
;
SCtgJob
*
pJob
=
NULL
;
CTG_ERR_JRET
(
ctgInitJob
(
pCtg
,
pConn
,
&
pJob
,
reqId
,
pReq
,
fp
,
param
,
&
taskNum
));
CTG_ERR_JRET
(
ctgInitJob
(
pCtg
,
pConn
,
&
pJob
,
pReq
,
fp
,
param
,
&
taskNum
));
if
(
taskNum
<=
0
)
{
if
(
taskNum
<=
0
)
{
SMetaData
*
pMetaData
=
taosMemoryCalloc
(
1
,
sizeof
(
SMetaData
));
SMetaData
*
pMetaData
=
taosMemoryCalloc
(
1
,
sizeof
(
SMetaData
));
fp
(
pMetaData
,
param
,
TSDB_CODE_SUCCESS
);
fp
(
pMetaData
,
param
,
TSDB_CODE_SUCCESS
);
...
@@ -1247,6 +1247,22 @@ _return:
...
@@ -1247,6 +1247,22 @@ _return:
CTG_API_LEAVE
(
code
);
CTG_API_LEAVE
(
code
);
}
}
int32_t
catalogGetServerVersion
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
pVersion
)
{
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
pConn
||
NULL
==
pVersion
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgGetSvrVerFromMnode
(
pCtg
,
pConn
,
pVersion
,
NULL
));
_return:
CTG_API_LEAVE
(
code
);
}
int32_t
catalogUpdateUserAuthInfo
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
)
{
int32_t
catalogUpdateUserAuthInfo
(
SCatalog
*
pCtg
,
SGetUserAuthRsp
*
pAuth
)
{
CTG_API_ENTER
();
CTG_API_ENTER
();
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
5427caf4
...
@@ -255,6 +255,20 @@ int32_t ctgInitGetUserTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
...
@@ -255,6 +255,20 @@ int32_t ctgInitGetUserTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgInitGetSvrVerTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
SCtgTask
task
=
{
0
};
task
.
type
=
CTG_TASK_GET_SVR_VER
;
task
.
taskId
=
taskIdx
;
task
.
pJob
=
pJob
;
taosArrayPush
(
pJob
->
pTasks
,
&
task
);
qDebug
(
"QID:0x%"
PRIx64
" [%dth] task type %s initialized"
,
pJob
->
queryId
,
taskIdx
,
ctgTaskTypeStr
(
task
.
type
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInitGetTbIndexTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
int32_t
ctgInitGetTbIndexTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
SName
*
name
=
(
SName
*
)
param
;
SName
*
name
=
(
SName
*
)
param
;
SCtgTask
task
=
{
0
};
SCtgTask
task
=
{
0
};
...
@@ -413,7 +427,7 @@ int32_t ctgInitTask(SCtgJob *pJob, CTG_TASK_TYPE type, void* param, int32_t *tas
...
@@ -413,7 +427,7 @@ int32_t ctgInitTask(SCtgJob *pJob, CTG_TASK_TYPE type, void* param, int32_t *tas
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgInitJob
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SCtgJob
**
job
,
uint64_t
reqId
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int32_t
*
taskNum
)
{
int32_t
ctgInitJob
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SCtgJob
**
job
,
const
SCatalogReq
*
pReq
,
catalogCallback
fp
,
void
*
param
,
int32_t
*
taskNum
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
tbMetaNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableMeta
);
int32_t
tbMetaNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableMeta
);
int32_t
dbVgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbVgroup
);
int32_t
dbVgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbVgroup
);
...
@@ -421,6 +435,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -421,6 +435,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
int32_t
udfNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUdf
);
int32_t
udfNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUdf
);
int32_t
qnodeNum
=
pReq
->
qNodeRequired
?
1
:
0
;
int32_t
qnodeNum
=
pReq
->
qNodeRequired
?
1
:
0
;
int32_t
dnodeNum
=
pReq
->
dNodeRequired
?
1
:
0
;
int32_t
dnodeNum
=
pReq
->
dNodeRequired
?
1
:
0
;
int32_t
svrVerNum
=
pReq
->
svrVerRequired
?
1
:
0
;
int32_t
dbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbCfg
);
int32_t
dbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbCfg
);
int32_t
indexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pIndex
);
int32_t
indexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pIndex
);
int32_t
userNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUser
);
int32_t
userNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUser
);
...
@@ -428,21 +443,21 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -428,21 +443,21 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
int32_t
tbIndexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableIndex
);
int32_t
tbIndexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableIndex
);
int32_t
tbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableCfg
);
int32_t
tbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableCfg
);
*
taskNum
=
tbMetaNum
+
dbVgNum
+
udfNum
+
tbHashNum
+
qnodeNum
+
dnodeNum
+
dbCfgNum
+
indexNum
+
userNum
+
dbInfoNum
+
tbIndexNum
+
tbCfgNum
;
*
taskNum
=
tbMetaNum
+
dbVgNum
+
udfNum
+
tbHashNum
+
qnodeNum
+
dnodeNum
+
svrVerNum
+
dbCfgNum
+
indexNum
+
userNum
+
dbInfoNum
+
tbIndexNum
+
tbCfgNum
;
if
(
*
taskNum
<=
0
)
{
if
(
*
taskNum
<=
0
)
{
ctgDebug
(
"Empty input for job, no need to retrieve meta, reqId:0x%"
PRIx64
,
req
Id
);
ctgDebug
(
"Empty input for job, no need to retrieve meta, reqId:0x%"
PRIx64
,
pConn
->
request
Id
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
*
job
=
taosMemoryCalloc
(
1
,
sizeof
(
SCtgJob
));
*
job
=
taosMemoryCalloc
(
1
,
sizeof
(
SCtgJob
));
if
(
NULL
==
*
job
)
{
if
(
NULL
==
*
job
)
{
ctgError
(
"failed to calloc, size:%d, reqId:0x%"
PRIx64
,
(
int32_t
)
sizeof
(
SCtgJob
),
req
Id
);
ctgError
(
"failed to calloc, size:%d, reqId:0x%"
PRIx64
,
(
int32_t
)
sizeof
(
SCtgJob
),
pConn
->
request
Id
);
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
SCtgJob
*
pJob
=
*
job
;
SCtgJob
*
pJob
=
*
job
;
pJob
->
queryId
=
req
Id
;
pJob
->
queryId
=
pConn
->
request
Id
;
pJob
->
userFp
=
fp
;
pJob
->
userFp
=
fp
;
pJob
->
pCtg
=
pCtg
;
pJob
->
pCtg
=
pCtg
;
pJob
->
conn
=
*
pConn
;
pJob
->
conn
=
*
pConn
;
...
@@ -460,6 +475,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -460,6 +475,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
pJob
->
dbInfoNum
=
dbInfoNum
;
pJob
->
dbInfoNum
=
dbInfoNum
;
pJob
->
tbIndexNum
=
tbIndexNum
;
pJob
->
tbIndexNum
=
tbIndexNum
;
pJob
->
tbCfgNum
=
tbCfgNum
;
pJob
->
tbCfgNum
=
tbCfgNum
;
pJob
->
svrVerNum
=
svrVerNum
;
pJob
->
pTasks
=
taosArrayInit
(
*
taskNum
,
sizeof
(
SCtgTask
));
pJob
->
pTasks
=
taosArrayInit
(
*
taskNum
,
sizeof
(
SCtgTask
));
...
@@ -530,6 +546,10 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -530,6 +546,10 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_DNODE
,
NULL
,
NULL
));
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_DNODE
,
NULL
,
NULL
));
}
}
if
(
svrVerNum
)
{
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_SVR_VER
,
NULL
,
NULL
));
}
pJob
->
refId
=
taosAddRef
(
gCtgMgmt
.
jobPool
,
pJob
);
pJob
->
refId
=
taosAddRef
(
gCtgMgmt
.
jobPool
,
pJob
);
if
(
pJob
->
refId
<
0
)
{
if
(
pJob
->
refId
<
0
)
{
ctgError
(
"add job to ref failed, error: %s"
,
tstrerror
(
terrno
));
ctgError
(
"add job to ref failed, error: %s"
,
tstrerror
(
terrno
));
...
@@ -728,6 +748,21 @@ int32_t ctgDumpUserRes(SCtgTask* pTask) {
...
@@ -728,6 +748,21 @@ int32_t ctgDumpUserRes(SCtgTask* pTask) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgDumpSvrVer
(
SCtgTask
*
pTask
)
{
SCtgJob
*
pJob
=
pTask
->
pJob
;
if
(
NULL
==
pJob
->
jobRes
.
pSvrVer
)
{
pJob
->
jobRes
.
pSvrVer
=
taosMemoryCalloc
(
1
,
sizeof
(
SMetaRes
));
if
(
NULL
==
pJob
->
jobRes
.
pSvrVer
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
pJob
->
jobRes
.
pSvrVer
->
code
=
pTask
->
code
;
pJob
->
jobRes
.
pSvrVer
->
pRes
=
pTask
->
res
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInvokeSubCb
(
SCtgTask
*
pTask
)
{
int32_t
ctgInvokeSubCb
(
SCtgTask
*
pTask
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -1156,6 +1191,20 @@ _return:
...
@@ -1156,6 +1191,20 @@ _return:
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
int32_t
ctgHandleGetSvrVerRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
&
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
TSWAP
(
pTask
->
res
,
pTask
->
msgCtx
.
out
);
_return:
ctgHandleTaskEnd
(
pTask
,
code
);
CTG_RET
(
code
);
}
int32_t
ctgAsyncRefreshTbMeta
(
SCtgTask
*
pTask
)
{
int32_t
ctgAsyncRefreshTbMeta
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
...
@@ -1459,6 +1508,15 @@ int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
...
@@ -1459,6 +1508,15 @@ int32_t ctgLaunchGetUserTask(SCtgTask *pTask) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgLaunchGetSvrVerTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
CTG_ERR_RET
(
ctgGetSvrVerFromMnode
(
pCtg
,
pConn
,
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgRelaunchGetTbMetaTask
(
SCtgTask
*
pTask
)
{
int32_t
ctgRelaunchGetTbMetaTask
(
SCtgTask
*
pTask
)
{
ctgResetTbMetaTask
(
pTask
);
ctgResetTbMetaTask
(
pTask
);
...
@@ -1532,6 +1590,7 @@ SCtgAsyncFps gCtgAsyncFps[] = {
...
@@ -1532,6 +1590,7 @@ SCtgAsyncFps gCtgAsyncFps[] = {
{
ctgInitGetIndexTask
,
ctgLaunchGetIndexTask
,
ctgHandleGetIndexRsp
,
ctgDumpIndexRes
,
NULL
,
NULL
},
{
ctgInitGetIndexTask
,
ctgLaunchGetIndexTask
,
ctgHandleGetIndexRsp
,
ctgDumpIndexRes
,
NULL
,
NULL
},
{
ctgInitGetUdfTask
,
ctgLaunchGetUdfTask
,
ctgHandleGetUdfRsp
,
ctgDumpUdfRes
,
NULL
,
NULL
},
{
ctgInitGetUdfTask
,
ctgLaunchGetUdfTask
,
ctgHandleGetUdfRsp
,
ctgDumpUdfRes
,
NULL
,
NULL
},
{
ctgInitGetUserTask
,
ctgLaunchGetUserTask
,
ctgHandleGetUserRsp
,
ctgDumpUserRes
,
NULL
,
NULL
},
{
ctgInitGetUserTask
,
ctgLaunchGetUserTask
,
ctgHandleGetUserRsp
,
ctgDumpUserRes
,
NULL
,
NULL
},
{
ctgInitGetSvrVerTask
,
ctgLaunchGetSvrVerTask
,
ctgHandleGetSvrVerRsp
,
ctgDumpSvrVer
,
NULL
,
NULL
},
};
};
int32_t
ctgMakeAsyncRes
(
SCtgJob
*
pJob
)
{
int32_t
ctgMakeAsyncRes
(
SCtgJob
*
pJob
)
{
...
@@ -1633,7 +1692,7 @@ int32_t ctgLaunchJob(SCtgJob *pJob) {
...
@@ -1633,7 +1692,7 @@ int32_t ctgLaunchJob(SCtgJob *pJob) {
for
(
int32_t
i
=
0
;
i
<
taskNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taskNum
;
++
i
)
{
SCtgTask
*
pTask
=
taosArrayGet
(
pJob
->
pTasks
,
i
);
SCtgTask
*
pTask
=
taosArrayGet
(
pJob
->
pTasks
,
i
);
qDebug
(
"QID:0x%"
PRIx64
" ctg
start to launch task %d
"
,
pJob
->
queryId
,
pTask
->
taskId
);
qDebug
(
"QID:0x%"
PRIx64
" ctg
launch [%dth] task
"
,
pJob
->
queryId
,
pTask
->
taskId
);
CTG_ERR_RET
((
*
gCtgAsyncFps
[
pTask
->
type
].
launchFp
)(
pTask
));
CTG_ERR_RET
((
*
gCtgAsyncFps
[
pTask
->
type
].
launchFp
)(
pTask
));
pTask
->
status
=
CTG_TASK_LAUNCHED
;
pTask
->
status
=
CTG_TASK_LAUNCHED
;
}
}
...
...
source/libs/catalog/src/ctgDbg.c
浏览文件 @
5427caf4
...
@@ -210,7 +210,7 @@ int32_t ctgdLaunchAsyncCall(SCatalog* pCtg, SRequestConnInfo* pConn, uint64_t re
...
@@ -210,7 +210,7 @@ int32_t ctgdLaunchAsyncCall(SCatalog* pCtg, SRequestConnInfo* pConn, uint64_t re
int64_t
jobId
=
0
;
int64_t
jobId
=
0
;
CTG_ERR_JRET
(
catalogAsyncGetAllMeta
(
pCtg
,
pConn
,
reqId
,
&
req
,
ctgdUserCallback
,
param
,
&
jobId
));
CTG_ERR_JRET
(
catalogAsyncGetAllMeta
(
pCtg
,
pConn
,
&
req
,
ctgdUserCallback
,
param
,
&
jobId
));
_return:
_return:
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
5427caf4
...
@@ -217,6 +217,21 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
...
@@ -217,6 +217,21 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qDebug
(
"Got stb cfg from mnode, tbFName:%s"
,
target
);
qDebug
(
"Got stb cfg from mnode, tbFName:%s"
,
target
);
break
;
break
;
}
}
case
TDMT_MND_SERVER_VERSION
:
{
if
(
TSDB_CODE_SUCCESS
!=
rspCode
)
{
qError
(
"error rsp for svr ver from mnode, error:%s"
,
tstrerror
(
rspCode
));
CTG_ERR_RET
(
rspCode
);
}
code
=
queryProcessMsgRsp
[
TMSG_INDEX
(
reqType
)](
out
,
msg
,
msgSize
);
if
(
code
)
{
qError
(
"Process svr ver rsp failed, error:%s"
,
tstrerror
(
code
));
CTG_ERR_RET
(
code
);
}
qDebug
(
"Got svr ver from mnode"
);
break
;
}
default:
default:
qError
(
"invalid req type %s"
,
TMSG_INFO
(
reqType
));
qError
(
"invalid req type %s"
,
TMSG_INFO
(
reqType
));
return
TSDB_CODE_APP_ERROR
;
return
TSDB_CODE_APP_ERROR
;
...
@@ -811,4 +826,38 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S
...
@@ -811,4 +826,38 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgGetSvrVerFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
char
**
out
,
SCtgTask
*
pTask
)
{
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
reqType
=
TDMT_MND_SERVER_VERSION
;
void
*
(
*
mallocFp
)(
int32_t
)
=
pTask
?
taosMemoryMalloc
:
rpcMallocCont
;
qDebug
(
"try to get svr ver from mnode"
);
int32_t
code
=
queryBuildMsg
[
TMSG_INDEX
(
reqType
)](
NULL
,
&
msg
,
0
,
&
msgLen
,
mallocFp
);
if
(
code
)
{
ctgError
(
"Build get svr ver msg failed, code:%s"
,
tstrerror
(
code
));
CTG_ERR_RET
(
code
);
}
if
(
pTask
)
{
CTG_ERR_RET
(
ctgUpdateMsgCtx
(
&
pTask
->
msgCtx
,
reqType
,
NULL
,
NULL
));
CTG_RET
(
ctgAsyncSendMsg
(
pCtg
,
pConn
,
pTask
,
reqType
,
msg
,
msgLen
));
}
SRpcMsg
rpcMsg
=
{
.
msgType
=
reqType
,
.
pCont
=
msg
,
.
contLen
=
msgLen
,
};
SRpcMsg
rpcRsp
=
{
0
};
rpcSendRecv
(
pConn
->
pTrans
,
&
pConn
->
mgmtEps
,
&
rpcMsg
,
&
rpcRsp
);
CTG_ERR_RET
(
ctgProcessRspMsg
(
out
,
reqType
,
rpcRsp
.
pCont
,
rpcRsp
.
contLen
,
rpcRsp
.
code
,
NULL
));
return
TSDB_CODE_SUCCESS
;
}
source/libs/catalog/src/ctgUtil.c
浏览文件 @
5427caf4
...
@@ -45,6 +45,8 @@ char *ctgTaskTypeStr(CTG_TASK_TYPE type) {
...
@@ -45,6 +45,8 @@ char *ctgTaskTypeStr(CTG_TASK_TYPE type) {
return
"[get udf]"
;
return
"[get udf]"
;
case
CTG_TASK_GET_USER
:
case
CTG_TASK_GET_USER
:
return
"[get user]"
;
return
"[get user]"
;
case
CTG_TASK_GET_SVR_VER
:
return
"[get svr ver]"
;
default:
default:
return
"unknown"
;
return
"unknown"
;
}
}
...
@@ -103,8 +105,13 @@ void ctgFreeSMetaData(SMetaData* pData) {
...
@@ -103,8 +105,13 @@ void ctgFreeSMetaData(SMetaData* pData) {
taosArrayDestroy
(
pData
->
pQnodeList
);
taosArrayDestroy
(
pData
->
pQnodeList
);
pData
->
pQnodeList
=
NULL
;
pData
->
pQnodeList
=
NULL
;
taosArrayDestroy
(
pData
->
pDnodeList
);
pData
->
pDnodeList
=
NULL
;
taosArrayDestroy
(
pData
->
pTableCfg
);
taosArrayDestroy
(
pData
->
pTableCfg
);
pData
->
pTableCfg
=
NULL
;
pData
->
pTableCfg
=
NULL
;
taosMemoryFreeClear
(
pData
->
pSvrVer
);
}
}
void
ctgFreeSCtgUserAuth
(
SCtgUserAuth
*
userCache
)
{
void
ctgFreeSCtgUserAuth
(
SCtgUserAuth
*
userCache
)
{
...
@@ -346,20 +353,8 @@ void ctgResetTbMetaTask(SCtgTask* pTask) {
...
@@ -346,20 +353,8 @@ void ctgResetTbMetaTask(SCtgTask* pTask) {
void
ctgFreeTaskRes
(
CTG_TASK_TYPE
type
,
void
**
pRes
)
{
void
ctgFreeTaskRes
(
CTG_TASK_TYPE
type
,
void
**
pRes
)
{
switch
(
type
)
{
switch
(
type
)
{
case
CTG_TASK_GET_QNODE
:
{
case
CTG_TASK_GET_QNODE
:
taosArrayDestroy
((
SArray
*
)
*
pRes
);
case
CTG_TASK_GET_DNODE
:
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_DNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_DB_VGROUP
:
{
case
CTG_TASK_GET_DB_VGROUP
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
*
pRes
=
NULL
;
...
@@ -373,14 +368,6 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
...
@@ -373,14 +368,6 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
}
}
break
;
break
;
}
}
case
CTG_TASK_GET_DB_INFO
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_HASH
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_INDEX
:
{
case
CTG_TASK_GET_TB_INDEX
:
{
taosArrayDestroyEx
(
*
pRes
,
tFreeSTableIndexInfo
);
taosArrayDestroyEx
(
*
pRes
,
tFreeSTableIndexInfo
);
*
pRes
=
NULL
;
*
pRes
=
NULL
;
...
@@ -394,15 +381,13 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
...
@@ -394,15 +381,13 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
}
}
break
;
break
;
}
}
case
CTG_TASK_GET_INDEX
:
{
case
CTG_TASK_GET_TB_HASH
:
taosMemoryFreeClear
(
*
pRes
);
case
CTG_TASK_GET_DB_INFO
:
break
;
case
CTG_TASK_GET_INDEX
:
}
case
CTG_TASK_GET_UDF
:
case
CTG_TASK_GET_UDF
:
{
case
CTG_TASK_GET_USER
:
taosMemoryFreeClear
(
*
pRes
);
case
CTG_TASK_GET_SVR_VER
:
break
;
case
CTG_TASK_GET_TB_META
:
{
}
case
CTG_TASK_GET_USER
:
{
taosMemoryFreeClear
(
*
pRes
);
taosMemoryFreeClear
(
*
pRes
);
break
;
break
;
}
}
...
@@ -415,20 +400,12 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
...
@@ -415,20 +400,12 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
void
ctgFreeSubTaskRes
(
CTG_TASK_TYPE
type
,
void
**
pRes
)
{
void
ctgFreeSubTaskRes
(
CTG_TASK_TYPE
type
,
void
**
pRes
)
{
switch
(
type
)
{
switch
(
type
)
{
case
CTG_TASK_GET_QNODE
:
{
case
CTG_TASK_GET_QNODE
:
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_DNODE
:
{
case
CTG_TASK_GET_DNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
*
pRes
=
NULL
;
break
;
break
;
}
}
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_DB_VGROUP
:
{
case
CTG_TASK_GET_DB_VGROUP
:
{
if
(
*
pRes
)
{
if
(
*
pRes
)
{
SDBVgInfo
*
pInfo
=
(
SDBVgInfo
*
)
*
pRes
;
SDBVgInfo
*
pInfo
=
(
SDBVgInfo
*
)
*
pRes
;
...
@@ -445,14 +422,6 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
...
@@ -445,14 +422,6 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
}
}
break
;
break
;
}
}
case
CTG_TASK_GET_DB_INFO
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_HASH
:
{
taosMemoryFreeClear
(
*
pRes
);
break
;
}
case
CTG_TASK_GET_TB_INDEX
:
{
case
CTG_TASK_GET_TB_INDEX
:
{
taosArrayDestroyEx
(
*
pRes
,
tFreeSTableIndexInfo
);
taosArrayDestroyEx
(
*
pRes
,
tFreeSTableIndexInfo
);
*
pRes
=
NULL
;
*
pRes
=
NULL
;
...
@@ -466,14 +435,12 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
...
@@ -466,14 +435,12 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
}
}
break
;
break
;
}
}
case
CTG_TASK_GET_INDEX
:
{
case
CTG_TASK_GET_TB_META
:
taosMemoryFreeClear
(
*
pRes
);
case
CTG_TASK_GET_DB_INFO
:
break
;
case
CTG_TASK_GET_TB_HASH
:
}
case
CTG_TASK_GET_INDEX
:
case
CTG_TASK_GET_UDF
:
{
case
CTG_TASK_GET_UDF
:
taosMemoryFreeClear
(
*
pRes
);
case
CTG_TASK_GET_SVR_VER
:
break
;
}
case
CTG_TASK_GET_USER
:
{
case
CTG_TASK_GET_USER
:
{
taosMemoryFreeClear
(
*
pRes
);
taosMemoryFreeClear
(
*
pRes
);
break
;
break
;
...
@@ -497,10 +464,6 @@ void ctgClearSubTaskRes(SCtgSubRes *pRes) {
...
@@ -497,10 +464,6 @@ void ctgClearSubTaskRes(SCtgSubRes *pRes) {
void
ctgFreeTaskCtx
(
SCtgTask
*
pTask
)
{
void
ctgFreeTaskCtx
(
SCtgTask
*
pTask
)
{
switch
(
pTask
->
type
)
{
switch
(
pTask
->
type
)
{
case
CTG_TASK_GET_QNODE
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_TB_META
:
{
case
CTG_TASK_GET_TB_META
:
{
SCtgTbMetaCtx
*
taskCtx
=
(
SCtgTbMetaCtx
*
)
pTask
->
taskCtx
;
SCtgTbMetaCtx
*
taskCtx
=
(
SCtgTbMetaCtx
*
)
pTask
->
taskCtx
;
taosMemoryFreeClear
(
taskCtx
->
pName
);
taosMemoryFreeClear
(
taskCtx
->
pName
);
...
@@ -511,18 +474,6 @@ void ctgFreeTaskCtx(SCtgTask* pTask) {
...
@@ -511,18 +474,6 @@ void ctgFreeTaskCtx(SCtgTask* pTask) {
taosMemoryFreeClear
(
pTask
->
taskCtx
);
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
break
;
}
}
case
CTG_TASK_GET_DB_VGROUP
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_DB_CFG
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_DB_INFO
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
}
case
CTG_TASK_GET_TB_HASH
:
{
case
CTG_TASK_GET_TB_HASH
:
{
SCtgTbHashCtx
*
taskCtx
=
(
SCtgTbHashCtx
*
)
pTask
->
taskCtx
;
SCtgTbHashCtx
*
taskCtx
=
(
SCtgTbHashCtx
*
)
pTask
->
taskCtx
;
taosMemoryFreeClear
(
taskCtx
->
pName
);
taosMemoryFreeClear
(
taskCtx
->
pName
);
...
@@ -542,14 +493,12 @@ void ctgFreeTaskCtx(SCtgTask* pTask) {
...
@@ -542,14 +493,12 @@ void ctgFreeTaskCtx(SCtgTask* pTask) {
taosMemoryFreeClear
(
pTask
->
taskCtx
);
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
break
;
}
}
case
CTG_TASK_GET_INDEX
:
{
case
CTG_TASK_GET_DB_VGROUP
:
taosMemoryFreeClear
(
pTask
->
taskCtx
);
case
CTG_TASK_GET_DB_CFG
:
break
;
case
CTG_TASK_GET_DB_INFO
:
}
case
CTG_TASK_GET_INDEX
:
case
CTG_TASK_GET_UDF
:
{
case
CTG_TASK_GET_UDF
:
taosMemoryFreeClear
(
pTask
->
taskCtx
);
case
CTG_TASK_GET_QNODE
:
break
;
}
case
CTG_TASK_GET_USER
:
{
case
CTG_TASK_GET_USER
:
{
taosMemoryFreeClear
(
pTask
->
taskCtx
);
taosMemoryFreeClear
(
pTask
->
taskCtx
);
break
;
break
;
...
...
source/libs/executor/src/executor.c
浏览文件 @
5427caf4
...
@@ -145,10 +145,10 @@ static SArray* filterQualifiedChildTables(const SStreamBlockScanInfo* pScanInfo,
...
@@ -145,10 +145,10 @@ static SArray* filterQualifiedChildTables(const SStreamBlockScanInfo* pScanInfo,
continue
;
continue
;
}
}
ASSERT
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
);
if
(
mr
.
me
.
type
!=
TSDB_CHILD_TABLE
||
mr
.
me
.
ctbEntry
.
suid
!=
pScanInfo
->
tableUid
)
{
if
(
mr
.
me
.
ctbEntry
.
suid
!=
pScanInfo
->
tableUid
)
{
continue
;
continue
;
}
}
// TODO handle ntb case
taosArrayPush
(
qa
,
id
);
taosArrayPush
(
qa
,
id
);
}
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
5427caf4
...
@@ -4365,6 +4365,26 @@ _error:
...
@@ -4365,6 +4365,26 @@ _error:
return
NULL
;
return
NULL
;
}
}
static
int32_t
extractTbscanInStreamOpTree
(
SOperatorInfo
*
pOperator
,
STableScanInfo
**
ppInfo
)
{
if
(
pOperator
->
operatorType
!=
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
)
{
if
(
pOperator
->
numOfDownstream
==
0
)
{
qError
(
"failed to find stream scan operator"
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
if
(
pOperator
->
numOfDownstream
>
1
)
{
qError
(
"join not supported for stream block scan"
);
return
TSDB_CODE_QRY_APP_ERROR
;
}
return
extractTbscanInStreamOpTree
(
pOperator
->
pDownstream
[
0
],
ppInfo
);
}
else
{
SStreamBlockScanInfo
*
pInfo
=
pOperator
->
info
;
ASSERT
(
pInfo
->
pSnapshotReadOp
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
);
*
ppInfo
=
pInfo
->
pSnapshotReadOp
->
info
;
return
0
;
}
}
int32_t
extractTableScanNode
(
SPhysiNode
*
pNode
,
STableScanPhysiNode
**
ppNode
)
{
int32_t
extractTableScanNode
(
SPhysiNode
*
pNode
,
STableScanPhysiNode
**
ppNode
)
{
if
(
pNode
->
pChildren
==
NULL
||
LIST_LENGTH
(
pNode
->
pChildren
)
==
0
)
{
if
(
pNode
->
pChildren
==
NULL
||
LIST_LENGTH
(
pNode
->
pChildren
)
==
0
)
{
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
==
pNode
->
type
)
{
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
==
pNode
->
type
)
{
...
@@ -4387,37 +4407,27 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) {
...
@@ -4387,37 +4407,27 @@ int32_t extractTableScanNode(SPhysiNode* pNode, STableScanPhysiNode** ppNode) {
return
-
1
;
return
-
1
;
}
}
int32_t
doRebuildReader
(
SOperatorInfo
*
pOperator
,
SSubplan
*
plan
,
SReadHandle
*
pHandle
)
{
int32_t
rebuildReader
(
SOperatorInfo
*
pOperator
,
SSubplan
*
plan
,
SReadHandle
*
pHandle
,
int64_t
uid
,
int64_t
ts
)
{
if
(
pOperator
->
operatorType
!=
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
)
{
STableScanInfo
*
pTableScanInfo
=
NULL
;
if
(
pOperator
->
numOfDownstream
==
0
)
{
if
(
extractTbscanInStreamOpTree
(
pOperator
,
&
pTableScanInfo
)
<
0
)
{
qError
(
"failed to find stream scan operator"
);
return
-
1
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
}
if
(
pOperator
->
numOfDownstream
>
1
)
{
STableScanPhysiNode
*
pNode
=
NULL
;
qError
(
"join not supported for stream block scan"
);
if
(
extractTableScanNode
(
plan
->
pNode
,
&
pNode
)
<
0
)
{
return
TSDB_CODE_QRY_APP_ERROR
;
ASSERT
(
0
);
}
}
return
doRebuildReader
(
pOperator
->
pDownstream
[
0
],
plan
,
pHandle
);
}
else
{
SStreamBlockScanInfo
*
pInfo
=
pOperator
->
info
;
ASSERT
(
pInfo
->
pSnapshotReadOp
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
);
STableScanInfo
*
pTableScanInfo
=
pInfo
->
pSnapshotReadOp
->
info
;
tsdbCleanupReadHandle
(
pTableScanInfo
->
dataReader
);
tsdbCleanupReadHandle
(
pTableScanInfo
->
dataReader
);
STableScanPhysiNode
*
pNode
=
NULL
;
if
(
extractTableScanNode
(
plan
->
pNode
,
&
pNode
)
<
0
)
{
ASSERT
(
0
);
}
STableListInfo
info
=
{
0
};
STableListInfo
info
=
{
0
};
pTableScanInfo
->
dataReader
=
doCreateDataReader
(
pNode
,
pHandle
,
&
info
,
0
,
0
);
pTableScanInfo
->
dataReader
=
doCreateDataReader
(
pNode
,
pHandle
,
&
info
,
0
,
0
);
if
(
pTableScanInfo
->
dataReader
==
NULL
)
{
if
(
pTableScanInfo
->
dataReader
==
NULL
)
{
ASSERT
(
0
);
ASSERT
(
0
);
qError
(
"failed to create data reader"
);
qError
(
"failed to create data reader"
);
return
TSDB_CODE_QRY_APP_ERROR
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
}
}
// TODO: set uid and ts to data reader
return
0
;
return
0
;
}
}
...
...
source/libs/parser/src/parInsertData.c
浏览文件 @
5427caf4
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
typedef
struct
SBlockKeyTuple
{
typedef
struct
SBlockKeyTuple
{
TSKEY
skey
;
TSKEY
skey
;
void
*
payloadAddr
;
void
*
payloadAddr
;
int16_t
index
;
}
SBlockKeyTuple
;
}
SBlockKeyTuple
;
typedef
struct
SBlockKeyInfo
{
typedef
struct
SBlockKeyInfo
{
...
@@ -36,7 +37,6 @@ typedef struct SBlockKeyInfo {
...
@@ -36,7 +37,6 @@ typedef struct SBlockKeyInfo {
static
int32_t
rowDataCompar
(
const
void
*
lhs
,
const
void
*
rhs
)
{
static
int32_t
rowDataCompar
(
const
void
*
lhs
,
const
void
*
rhs
)
{
TSKEY
left
=
*
(
TSKEY
*
)
lhs
;
TSKEY
left
=
*
(
TSKEY
*
)
lhs
;
TSKEY
right
=
*
(
TSKEY
*
)
rhs
;
TSKEY
right
=
*
(
TSKEY
*
)
rhs
;
if
(
left
==
right
)
{
if
(
left
==
right
)
{
return
0
;
return
0
;
}
else
{
}
else
{
...
@@ -44,6 +44,16 @@ static int32_t rowDataCompar(const void* lhs, const void* rhs) {
...
@@ -44,6 +44,16 @@ static int32_t rowDataCompar(const void* lhs, const void* rhs) {
}
}
}
}
static
int32_t
rowDataComparStable
(
const
void
*
lhs
,
const
void
*
rhs
)
{
TSKEY
left
=
*
(
TSKEY
*
)
lhs
;
TSKEY
right
=
*
(
TSKEY
*
)
rhs
;
if
(
left
==
right
)
{
return
((
SBlockKeyTuple
*
)
lhs
)
->
index
-
((
SBlockKeyTuple
*
)
rhs
)
->
index
;
}
else
{
return
left
>
right
?
1
:
-
1
;
}
}
void
setBoundColumnInfo
(
SParsedDataColInfo
*
pColList
,
SSchema
*
pSchema
,
col_id_t
numOfCols
)
{
void
setBoundColumnInfo
(
SParsedDataColInfo
*
pColList
,
SSchema
*
pSchema
,
col_id_t
numOfCols
)
{
pColList
->
numOfCols
=
numOfCols
;
pColList
->
numOfCols
=
numOfCols
;
pColList
->
numOfBound
=
numOfCols
;
pColList
->
numOfBound
=
numOfCols
;
...
@@ -343,6 +353,7 @@ int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKey
...
@@ -343,6 +353,7 @@ int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKey
while
(
n
<
nRows
)
{
while
(
n
<
nRows
)
{
pBlkKeyTuple
->
skey
=
TD_ROW_KEY
((
STSRow
*
)
pBlockData
);
pBlkKeyTuple
->
skey
=
TD_ROW_KEY
((
STSRow
*
)
pBlockData
);
pBlkKeyTuple
->
payloadAddr
=
pBlockData
;
pBlkKeyTuple
->
payloadAddr
=
pBlockData
;
pBlkKeyTuple
->
index
=
n
;
// next loop
// next loop
pBlockData
+=
extendedRowSize
;
pBlockData
+=
extendedRowSize
;
...
@@ -354,7 +365,7 @@ int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKey
...
@@ -354,7 +365,7 @@ int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKey
pBlkKeyTuple
=
pBlkKeyInfo
->
pKeyTuple
;
pBlkKeyTuple
=
pBlkKeyInfo
->
pKeyTuple
;
// todo. qsort is unstable, if timestamp is same, should get the last one
// todo. qsort is unstable, if timestamp is same, should get the last one
qsort
(
pBlkKeyTuple
,
nRows
,
sizeof
(
SBlockKeyTuple
),
rowDataCompar
);
qsort
(
pBlkKeyTuple
,
nRows
,
sizeof
(
SBlockKeyTuple
),
rowDataCompar
Stable
);
pBlkKeyTuple
=
pBlkKeyInfo
->
pKeyTuple
;
pBlkKeyTuple
=
pBlkKeyInfo
->
pKeyTuple
;
int32_t
i
=
0
;
int32_t
i
=
0
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
5427caf4
...
@@ -4641,7 +4641,7 @@ static int32_t extractShowCreateTableResultSchema(int32_t* numOfCols, SSchema**
...
@@ -4641,7 +4641,7 @@ static int32_t extractShowCreateTableResultSchema(int32_t* numOfCols, SSchema**
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
extractShow
Local
VariablesResultSchema
(
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
static
int32_t
extractShowVariablesResultSchema
(
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
*
numOfCols
=
2
;
*
numOfCols
=
2
;
*
pSchema
=
taosMemoryCalloc
((
*
numOfCols
),
sizeof
(
SSchema
));
*
pSchema
=
taosMemoryCalloc
((
*
numOfCols
),
sizeof
(
SSchema
));
if
(
NULL
==
(
*
pSchema
))
{
if
(
NULL
==
(
*
pSchema
))
{
...
@@ -4678,7 +4678,8 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS
...
@@ -4678,7 +4678,8 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS
case
QUERY_NODE_SHOW_CREATE_STABLE_STMT
:
case
QUERY_NODE_SHOW_CREATE_STABLE_STMT
:
return
extractShowCreateTableResultSchema
(
numOfCols
,
pSchema
);
return
extractShowCreateTableResultSchema
(
numOfCols
,
pSchema
);
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
return
extractShowLocalVariablesResultSchema
(
numOfCols
,
pSchema
);
case
QUERY_NODE_SHOW_VARIABLES_STMT
:
return
extractShowVariablesResultSchema
(
numOfCols
,
pSchema
);
default:
default:
break
;
break
;
}
}
...
@@ -5909,7 +5910,6 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
...
@@ -5909,7 +5910,6 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
case
QUERY_NODE_SHOW_CLUSTER_STMT
:
case
QUERY_NODE_SHOW_CLUSTER_STMT
:
case
QUERY_NODE_SHOW_TOPICS_STMT
:
case
QUERY_NODE_SHOW_TOPICS_STMT
:
case
QUERY_NODE_SHOW_TRANSACTIONS_STMT
:
case
QUERY_NODE_SHOW_TRANSACTIONS_STMT
:
case
QUERY_NODE_SHOW_VARIABLES_STMT
:
case
QUERY_NODE_SHOW_APPS_STMT
:
case
QUERY_NODE_SHOW_APPS_STMT
:
case
QUERY_NODE_SHOW_CONSUMERS_STMT
:
case
QUERY_NODE_SHOW_CONSUMERS_STMT
:
case
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT
:
case
QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT
:
...
@@ -6011,6 +6011,14 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
...
@@ -6011,6 +6011,14 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) {
case
QUERY_NODE_ALTER_LOCAL_STMT
:
case
QUERY_NODE_ALTER_LOCAL_STMT
:
pQuery
->
execMode
=
QUERY_EXEC_MODE_LOCAL
;
pQuery
->
execMode
=
QUERY_EXEC_MODE_LOCAL
;
break
;
break
;
case
QUERY_NODE_SHOW_VARIABLES_STMT
:
pQuery
->
haveResultSet
=
true
;
pQuery
->
execMode
=
QUERY_EXEC_MODE_RPC
;
if
(
NULL
!=
pCxt
->
pCmdMsg
)
{
TSWAP
(
pQuery
->
pCmdMsg
,
pCxt
->
pCmdMsg
);
pQuery
->
msgType
=
pQuery
->
pCmdMsg
->
msgType
;
}
break
;
default:
default:
pQuery
->
execMode
=
QUERY_EXEC_MODE_RPC
;
pQuery
->
execMode
=
QUERY_EXEC_MODE_RPC
;
if
(
NULL
!=
pCxt
->
pCmdMsg
)
{
if
(
NULL
!=
pCxt
->
pCmdMsg
)
{
...
...
source/libs/parser/test/parTestUtil.h
浏览文件 @
5427caf4
...
@@ -54,12 +54,6 @@ class ParserDdlTest : public ParserTestBase {
...
@@ -54,12 +54,6 @@ class ParserDdlTest : public ParserTestBase {
virtual
void
checkDdl
(
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
virtual
void
checkDdl
(
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_NE
(
pQuery
,
nullptr
);
ASSERT_NE
(
pQuery
,
nullptr
);
ASSERT_NE
(
pQuery
->
pRoot
,
nullptr
);
ASSERT_NE
(
pQuery
->
pRoot
,
nullptr
);
if
(
QUERY_EXEC_MODE_RPC
==
pQuery
->
execMode
)
{
ASSERT_EQ
(
pQuery
->
haveResultSet
,
false
);
ASSERT_EQ
(
pQuery
->
numOfResCols
,
0
);
ASSERT_EQ
(
pQuery
->
pResSchema
,
nullptr
);
ASSERT_EQ
(
pQuery
->
precision
,
0
);
}
if
(
nullptr
!=
checkDdl_
)
{
if
(
nullptr
!=
checkDdl_
)
{
checkDdl_
(
pQuery
,
stage
);
checkDdl_
(
pQuery
,
stage
);
}
}
...
...
source/libs/planner/test/CMakeLists.txt
浏览文件 @
5427caf4
...
@@ -32,9 +32,7 @@ if(${BUILD_WINGETOPT})
...
@@ -32,9 +32,7 @@ if(${BUILD_WINGETOPT})
target_link_libraries
(
plannerTest PUBLIC wingetopt
)
target_link_libraries
(
plannerTest PUBLIC wingetopt
)
endif
()
endif
()
# if(NOT TD_WINDOWS)
add_test
(
add_test
(
NAME plannerTest
NAME plannerTest
COMMAND plannerTest
COMMAND plannerTest
)
)
# endif(NOT TD_WINDOWS)
source/libs/qcom/src/querymsg.c
浏览文件 @
5427caf4
...
@@ -144,6 +144,23 @@ int32_t queryBuildDnodeListMsg(void *input, char **msg, int32_t msgSize, int32_t
...
@@ -144,6 +144,23 @@ int32_t queryBuildDnodeListMsg(void *input, char **msg, int32_t msgSize, int32_t
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
queryBuildGetSerVerMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
,
void
*
(
*
mallcFp
)(
int32_t
))
{
if
(
NULL
==
msg
||
NULL
==
msgLen
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
SServerVerReq
req
=
{
0
};
int32_t
bufLen
=
tSerializeSServerVerReq
(
NULL
,
0
,
&
req
);
void
*
pBuf
=
(
*
mallcFp
)(
bufLen
);
tSerializeSServerVerReq
(
pBuf
,
bufLen
,
&
req
);
*
msg
=
pBuf
;
*
msgLen
=
bufLen
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
queryBuildGetDBCfgMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
,
void
*
(
*
mallcFp
)(
int32_t
))
{
int32_t
queryBuildGetDBCfgMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
,
void
*
(
*
mallcFp
)(
int32_t
))
{
if
(
NULL
==
msg
||
NULL
==
msgLen
)
{
if
(
NULL
==
msg
||
NULL
==
msgLen
)
{
...
@@ -467,6 +484,26 @@ int32_t queryProcessDnodeListRsp(void *output, char *msg, int32_t msgSize) {
...
@@ -467,6 +484,26 @@ int32_t queryProcessDnodeListRsp(void *output, char *msg, int32_t msgSize) {
return
code
;
return
code
;
}
}
int32_t
queryProcessGetSerVerRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
SServerVerRsp
out
=
{
0
};
int32_t
code
=
0
;
if
(
NULL
==
output
||
NULL
==
msg
||
msgSize
<=
0
)
{
code
=
TSDB_CODE_TSC_INVALID_INPUT
;
return
code
;
}
if
(
tDeserializeSServerVerRsp
(
msg
,
msgSize
,
&
out
)
!=
0
)
{
qError
(
"invalid svr ver rsp msg, msgSize:%d"
,
msgSize
);
code
=
TSDB_CODE_INVALID_MSG
;
return
code
;
}
*
(
char
**
)
output
=
strdup
(
out
.
ver
);
return
code
;
}
int32_t
queryProcessGetDbCfgRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
int32_t
queryProcessGetDbCfgRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
SDbCfgRsp
out
=
{
0
};
SDbCfgRsp
out
=
{
0
};
...
@@ -583,6 +620,7 @@ void initQueryModuleMsgHandle() {
...
@@ -583,6 +620,7 @@ void initQueryModuleMsgHandle() {
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_TABLE_INDEX
)]
=
queryBuildGetTbIndexMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_TABLE_INDEX
)]
=
queryBuildGetTbIndexMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_VND_TABLE_CFG
)]
=
queryBuildGetTbCfgMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_VND_TABLE_CFG
)]
=
queryBuildGetTbCfgMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_TABLE_CFG
)]
=
queryBuildGetTbCfgMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_TABLE_CFG
)]
=
queryBuildGetTbCfgMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_SERVER_VERSION
)]
=
queryBuildGetSerVerMsg
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
...
@@ -596,6 +634,7 @@ void initQueryModuleMsgHandle() {
...
@@ -596,6 +634,7 @@ void initQueryModuleMsgHandle() {
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_TABLE_INDEX
)]
=
queryProcessGetTbIndexRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_TABLE_INDEX
)]
=
queryProcessGetTbIndexRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_VND_TABLE_CFG
)]
=
queryProcessGetTbCfgRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_VND_TABLE_CFG
)]
=
queryProcessGetTbCfgRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_TABLE_CFG
)]
=
queryProcessGetTbCfgRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_TABLE_CFG
)]
=
queryProcessGetTbCfgRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_SERVER_VERSION
)]
=
queryProcessGetSerVerRsp
;
}
}
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
source/libs/stream/src/streamDispatch.c
浏览文件 @
5427caf4
...
@@ -70,20 +70,21 @@ int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* p
...
@@ -70,20 +70,21 @@ int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* p
if
(
tEncodeI32
(
pEncoder
,
pReq
->
dstTaskId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
dstTaskId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
srcNodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
srcNodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
srcTaskId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pReq
->
srcTaskId
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
pEncoder
,
(
const
uint8_t
*
)
&
pReq
->
pRetrieve
,
pReq
->
retrieveLen
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
pEncoder
,
(
const
uint8_t
*
)
pReq
->
pRetrieve
,
pReq
->
retrieveLen
)
<
0
)
return
-
1
;
tEndEncode
(
pEncoder
);
tEndEncode
(
pEncoder
);
return
pEncoder
->
pos
;
return
pEncoder
->
pos
;
}
}
int32_t
tDecodeStreamRetrieveReq
(
SDecoder
*
pDecoder
,
SStreamRetrieveReq
*
pReq
)
{
int32_t
tDecodeStreamRetrieveReq
(
SDecoder
*
pDecoder
,
SStreamRetrieveReq
*
pReq
)
{
int32_t
tlen
=
0
;
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pDecoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pReq
->
streamId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
pReq
->
streamId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
dstNodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
dstNodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
dstTaskId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
dstTaskId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
srcNodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
srcNodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
srcTaskId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pReq
->
srcTaskId
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
pDecoder
,
(
uint8_t
**
)
&
pReq
->
pRetrieve
,
&
pReq
->
retrieveLen
)
<
0
)
return
-
1
;
uint64_t
len
=
0
;
if
(
tDecodeBinaryAlloc
(
pDecoder
,
(
void
**
)
&
pReq
->
pRetrieve
,
&
len
)
<
0
)
return
-
1
;
pReq
->
retrieveLen
=
len
;
tEndDecode
(
pDecoder
);
tEndDecode
(
pDecoder
);
return
0
;
return
0
;
}
}
...
...
source/libs/sync/src/syncElection.c
浏览文件 @
5427caf4
...
@@ -105,9 +105,16 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) {
...
@@ -105,9 +105,16 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) {
}
}
int32_t
syncNodeRequestVote
(
SSyncNode
*
pSyncNode
,
const
SRaftId
*
destRaftId
,
const
SyncRequestVote
*
pMsg
)
{
int32_t
syncNodeRequestVote
(
SSyncNode
*
pSyncNode
,
const
SRaftId
*
destRaftId
,
const
SyncRequestVote
*
pMsg
)
{
sTrace
(
"syncNodeRequestVote pSyncNode:%p "
,
pSyncNode
);
int32_t
ret
=
0
;
int32_t
ret
=
0
;
do
{
char
host
[
128
];
uint16_t
port
;
syncUtilU642Addr
(
destRaftId
->
addr
,
host
,
sizeof
(
host
),
&
port
);
sDebug
(
"vgId:%d, send sync-request-vote to %s:%d, {term:%lu, last-index:%ld, last-term:%lu}"
,
pSyncNode
->
vgId
,
host
,
port
,
pMsg
->
term
,
pMsg
->
lastLogTerm
,
pMsg
->
lastLogIndex
);
}
while
(
0
);
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncRequestVote2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncRequestVote2RpcMsg
(
pMsg
,
&
rpcMsg
);
syncNodeSendMsgById
(
destRaftId
,
pSyncNode
,
&
rpcMsg
);
syncNodeSendMsgById
(
destRaftId
,
pSyncNode
,
&
rpcMsg
);
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
5427caf4
...
@@ -370,6 +370,15 @@ bool syncIsReady(int64_t rid) {
...
@@ -370,6 +370,15 @@ bool syncIsReady(int64_t rid) {
ASSERT
(
rid
==
pSyncNode
->
rid
);
ASSERT
(
rid
==
pSyncNode
->
rid
);
bool
b
=
(
pSyncNode
->
state
==
TAOS_SYNC_STATE_LEADER
)
&&
pSyncNode
->
restoreFinish
;
bool
b
=
(
pSyncNode
->
state
==
TAOS_SYNC_STATE_LEADER
)
&&
pSyncNode
->
restoreFinish
;
taosReleaseRef
(
tsNodeRefId
,
pSyncNode
->
rid
);
taosReleaseRef
(
tsNodeRefId
,
pSyncNode
->
rid
);
// if false, set error code
if
(
false
==
b
)
{
if
(
pSyncNode
->
state
!=
TAOS_SYNC_STATE_LEADER
)
{
terrno
=
TSDB_CODE_SYN_NOT_LEADER
;
}
else
{
terrno
=
TSDB_CODE_APP_NOT_READY
;
}
}
return
b
;
return
b
;
}
}
...
@@ -480,12 +489,30 @@ void syncGetEpSet(int64_t rid, SEpSet* pEpSet) {
...
@@ -480,12 +489,30 @@ void syncGetEpSet(int64_t rid, SEpSet* pEpSet) {
snprintf
(
pEpSet
->
eps
[
i
].
fqdn
,
sizeof
(
pEpSet
->
eps
[
i
].
fqdn
),
"%s"
,
(
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
)[
i
].
nodeFqdn
);
snprintf
(
pEpSet
->
eps
[
i
].
fqdn
,
sizeof
(
pEpSet
->
eps
[
i
].
fqdn
),
"%s"
,
(
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
)[
i
].
nodeFqdn
);
pEpSet
->
eps
[
i
].
port
=
(
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
)[
i
].
nodePort
;
pEpSet
->
eps
[
i
].
port
=
(
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
)[
i
].
nodePort
;
(
pEpSet
->
numOfEps
)
++
;
(
pEpSet
->
numOfEps
)
++
;
sInfo
(
"vgId:%d sync get epset: index:%d %s:%d"
,
pSyncNode
->
vgId
,
i
,
pEpSet
->
eps
[
i
].
fqdn
,
pEpSet
->
eps
[
i
].
port
);
sInfo
(
"syncGetEpSet index:%d %s:%d"
,
i
,
pEpSet
->
eps
[
i
].
fqdn
,
pEpSet
->
eps
[
i
].
port
);
}
}
pEpSet
->
inUse
=
pSyncNode
->
pRaftCfg
->
cfg
.
myIndex
;
pEpSet
->
inUse
=
pSyncNode
->
pRaftCfg
->
cfg
.
myIndex
;
sInfo
(
"vgId:%d sync get epset in-use:%d"
,
pSyncNode
->
vgId
,
pEpSet
->
inUse
);
sInfo
(
"syncGetEpSet pEpSet->inUse:%d "
,
pEpSet
->
inUse
);
taosReleaseRef
(
tsNodeRefId
,
pSyncNode
->
rid
);
}
void
syncGetRetryEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
)
{
SSyncNode
*
pSyncNode
=
(
SSyncNode
*
)
taosAcquireRef
(
tsNodeRefId
,
rid
);
if
(
pSyncNode
==
NULL
)
{
memset
(
pEpSet
,
0
,
sizeof
(
*
pEpSet
));
return
;
}
ASSERT
(
rid
==
pSyncNode
->
rid
);
pEpSet
->
numOfEps
=
0
;
for
(
int
i
=
0
;
i
<
pSyncNode
->
pRaftCfg
->
cfg
.
replicaNum
;
++
i
)
{
snprintf
(
pEpSet
->
eps
[
i
].
fqdn
,
sizeof
(
pEpSet
->
eps
[
i
].
fqdn
),
"%s"
,
(
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
)[
i
].
nodeFqdn
);
pEpSet
->
eps
[
i
].
port
=
(
pSyncNode
->
pRaftCfg
->
cfg
.
nodeInfo
)[
i
].
nodePort
;
(
pEpSet
->
numOfEps
)
++
;
sInfo
(
"vgId:%d sync get retry epset: index:%d %s:%d"
,
pSyncNode
->
vgId
,
i
,
pEpSet
->
eps
[
i
].
fqdn
,
pEpSet
->
eps
[
i
].
port
);
}
pEpSet
->
inUse
=
(
pSyncNode
->
pRaftCfg
->
cfg
.
myIndex
+
1
)
%
pEpSet
->
numOfEps
;
sInfo
(
"vgId:%d sync get retry epset in-use:%d"
,
pSyncNode
->
vgId
,
pEpSet
->
inUse
);
taosReleaseRef
(
tsNodeRefId
,
pSyncNode
->
rid
);
taosReleaseRef
(
tsNodeRefId
,
pSyncNode
->
rid
);
}
}
...
...
source/libs/sync/src/syncReplication.c
浏览文件 @
5427caf4
...
@@ -224,8 +224,8 @@ int32_t syncNodeAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, c
...
@@ -224,8 +224,8 @@ int32_t syncNodeAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, c
uint16_t
port
;
uint16_t
port
;
syncUtilU642Addr
(
destRaftId
->
addr
,
host
,
sizeof
(
host
),
&
port
);
syncUtilU642Addr
(
destRaftId
->
addr
,
host
,
sizeof
(
host
),
&
port
);
sDebug
(
sDebug
(
"vgId:%d, send sync-append-entries to %s:%d, term:%lu, pre-index:%ld, pre-term:%lu, pterm:%lu, commit:%ld, "
"vgId:%d, send sync-append-entries to %s:%d,
{
term:%lu, pre-index:%ld, pre-term:%lu, pterm:%lu, commit:%ld, "
"datalen:%d"
,
"datalen:%d
}
"
,
pSyncNode
->
vgId
,
host
,
port
,
pMsg
->
term
,
pMsg
->
prevLogIndex
,
pMsg
->
prevLogTerm
,
pMsg
->
privateTerm
,
pSyncNode
->
vgId
,
host
,
port
,
pMsg
->
term
,
pMsg
->
prevLogIndex
,
pMsg
->
prevLogTerm
,
pMsg
->
privateTerm
,
pMsg
->
commitIndex
,
pMsg
->
dataLen
);
pMsg
->
commitIndex
,
pMsg
->
dataLen
);
}
while
(
0
);
}
while
(
0
);
...
...
source/libs/sync/src/syncRequestVote.c
浏览文件 @
5427caf4
...
@@ -99,15 +99,20 @@ static bool syncNodeOnRequestVoteLogOK(SSyncNode* pSyncNode, SyncRequestVote* pM
...
@@ -99,15 +99,20 @@ static bool syncNodeOnRequestVoteLogOK(SSyncNode* pSyncNode, SyncRequestVote* pM
int32_t
syncNodeOnRequestVoteSnapshotCb
(
SSyncNode
*
ths
,
SyncRequestVote
*
pMsg
)
{
int32_t
syncNodeOnRequestVoteSnapshotCb
(
SSyncNode
*
ths
,
SyncRequestVote
*
pMsg
)
{
int32_t
ret
=
0
;
int32_t
ret
=
0
;
// print log
char
logBuf
[
128
]
=
{
0
};
snprintf
(
logBuf
,
sizeof
(
logBuf
),
"recv SyncRequestVote, currentTerm:%lu"
,
ths
->
pRaftStore
->
currentTerm
);
syncRequestVoteLog2
(
logBuf
,
pMsg
);
// if already drop replica, do not process
// if already drop replica, do not process
if
(
!
syncNodeInRaftGroup
(
ths
,
&
(
pMsg
->
srcId
))
&&
!
ths
->
pRaftCfg
->
isStandBy
)
{
if
(
!
syncNodeInRaftGroup
(
ths
,
&
(
pMsg
->
srcId
))
&&
!
ths
->
pRaftCfg
->
isStandBy
)
{
sInfo
(
"recv SyncRequestVote maybe replica already dropped"
);
do
{
return
ret
;
char
logBuf
[
256
];
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
snprintf
(
logBuf
,
sizeof
(
logBuf
),
"recv sync-request-vote from %s:%d, term:%lu, lindex:%ld, lterm:%lu, maybe replica already dropped"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
lastLogIndex
,
pMsg
->
lastLogTerm
);
syncNodeEventLog
(
ths
,
logBuf
);
}
while
(
0
);
return
-
1
;
}
}
// maybe update term
// maybe update term
...
@@ -135,10 +140,22 @@ int32_t syncNodeOnRequestVoteSnapshotCb(SSyncNode* ths, SyncRequestVote* pMsg) {
...
@@ -135,10 +140,22 @@ int32_t syncNodeOnRequestVoteSnapshotCb(SSyncNode* ths, SyncRequestVote* pMsg) {
pReply
->
term
=
ths
->
pRaftStore
->
currentTerm
;
pReply
->
term
=
ths
->
pRaftStore
->
currentTerm
;
pReply
->
voteGranted
=
grant
;
pReply
->
voteGranted
=
grant
;
// trace log
do
{
char
logBuf
[
256
];
char
host
[
64
];
uint16_t
port
;
syncUtilU642Addr
(
pMsg
->
srcId
.
addr
,
host
,
sizeof
(
host
),
&
port
);
snprintf
(
logBuf
,
sizeof
(
logBuf
),
"recv sync-request-vote from %s:%d, term:%lu, lindex:%ld, lterm:%lu, reply-grant:%d"
,
host
,
port
,
pMsg
->
term
,
pMsg
->
lastLogIndex
,
pMsg
->
lastLogTerm
,
pReply
->
voteGranted
);
syncNodeEventLog
(
ths
,
logBuf
);
}
while
(
0
);
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
syncRequestVoteReply2RpcMsg
(
pReply
,
&
rpcMsg
);
syncRequestVoteReply2RpcMsg
(
pReply
,
&
rpcMsg
);
syncNodeSendMsgById
(
&
pReply
->
destId
,
ths
,
&
rpcMsg
);
syncNodeSendMsgById
(
&
pReply
->
destId
,
ths
,
&
rpcMsg
);
syncRequestVoteReplyDestroy
(
pReply
);
syncRequestVoteReplyDestroy
(
pReply
);
return
ret
;
return
0
;
}
}
\ No newline at end of file
source/libs/transport/inc/transComm.h
浏览文件 @
5427caf4
...
@@ -125,6 +125,7 @@ typedef struct {
...
@@ -125,6 +125,7 @@ typedef struct {
STransMsg
*
pRsp
;
// for synchronous API
STransMsg
*
pRsp
;
// for synchronous API
tsem_t
*
pSem
;
// for synchronous API
tsem_t
*
pSem
;
// for synchronous API
SCvtAddr
cvtAddr
;
SCvtAddr
cvtAddr
;
bool
setMaxRetry
;
int
hThrdIdx
;
int
hThrdIdx
;
}
STransConnCtx
;
}
STransConnCtx
;
...
...
source/libs/transport/src/transCli.c
浏览文件 @
5427caf4
...
@@ -980,7 +980,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
...
@@ -980,7 +980,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
tTrace
(
"try to send req to next node"
);
tTrace
(
"try to send req to next node"
);
pMsg
->
st
=
taosGetTimestampUs
();
pMsg
->
st
=
taosGetTimestampUs
();
pCtx
->
retryCount
+=
1
;
pCtx
->
retryCount
+=
1
;
if
(
pResp
->
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
)
{
if
(
pResp
->
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
&&
pCtx
->
setMaxRetry
==
false
)
{
if
(
pCtx
->
retryCount
<
pEpSet
->
numOfEps
*
3
)
{
if
(
pCtx
->
retryCount
<
pEpSet
->
numOfEps
*
3
)
{
pEpSet
->
inUse
=
(
++
pEpSet
->
inUse
)
%
pEpSet
->
numOfEps
;
pEpSet
->
inUse
=
(
++
pEpSet
->
inUse
)
%
pEpSet
->
numOfEps
;
if
(
pThrd
->
quit
==
false
)
{
if
(
pThrd
->
quit
==
false
)
{
...
@@ -997,6 +997,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
...
@@ -997,6 +997,7 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
}
}
}
}
}
else
if
(
pCtx
->
retryCount
<
TRANS_RETRY_COUNT_LIMIT
)
{
}
else
if
(
pCtx
->
retryCount
<
TRANS_RETRY_COUNT_LIMIT
)
{
pCtx
->
setMaxRetry
=
true
;
if
(
pResp
->
contLen
==
0
)
{
if
(
pResp
->
contLen
==
0
)
{
pEpSet
->
inUse
=
(
++
pEpSet
->
inUse
)
%
pEpSet
->
numOfEps
;
pEpSet
->
inUse
=
(
++
pEpSet
->
inUse
)
%
pEpSet
->
numOfEps
;
transPrintEpSet
(
&
pCtx
->
epSet
);
transPrintEpSet
(
&
pCtx
->
epSet
);
...
@@ -1012,8 +1013,10 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
...
@@ -1012,8 +1013,10 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
pCtx
->
retryCount
+
1
,
TRANS_RETRY_COUNT_LIMIT
);
pCtx
->
retryCount
+
1
,
TRANS_RETRY_COUNT_LIMIT
);
}
}
if
(
pThrd
->
quit
==
false
)
{
if
(
pThrd
->
quit
==
false
)
{
if
(
pConn
->
status
!=
ConnInPool
)
{
if
(
pResp
->
code
!=
TSDB_CODE_RPC_NETWORK_UNAVAIL
)
{
addConnToPool
(
pThrd
->
pool
,
pConn
);
if
(
pConn
->
status
!=
ConnInPool
)
addConnToPool
(
pThrd
->
pool
,
pConn
);
}
else
{
transUnrefCliHandle
(
pConn
);
}
}
STaskArg
*
arg
=
taosMemoryMalloc
(
sizeof
(
STaskArg
));
STaskArg
*
arg
=
taosMemoryMalloc
(
sizeof
(
STaskArg
));
arg
->
param1
=
pMsg
;
arg
->
param1
=
pMsg
;
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
5427caf4
...
@@ -23,7 +23,7 @@ int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) {
...
@@ -23,7 +23,7 @@ int32_t walRestoreFromSnapshot(SWal *pWal, int64_t ver) {
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
while
(
1
)
{
taosHashIterate
(
pWal
->
pRefHash
,
pIter
);
pIter
=
taosHashIterate
(
pWal
->
pRefHash
,
pIter
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
SWalRef
*
pRef
=
(
SWalRef
*
)
pIter
;
SWalRef
*
pRef
=
(
SWalRef
*
)
pIter
;
if
(
pRef
->
ver
!=
-
1
)
{
if
(
pRef
->
ver
!=
-
1
)
{
...
@@ -309,7 +309,7 @@ static int walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) {
...
@@ -309,7 +309,7 @@ static int walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) {
SWalIdxEntry
entry
=
{.
ver
=
ver
,
.
offset
=
offset
};
SWalIdxEntry
entry
=
{.
ver
=
ver
,
.
offset
=
offset
};
/*int64_t idxOffset = taosLSeekFile(pWal->pWriteIdxTFile, 0, SEEK_CUR);*/
/*int64_t idxOffset = taosLSeekFile(pWal->pWriteIdxTFile, 0, SEEK_CUR);*/
/*wDebug("write index: ver: %ld, offset: %ld, at %ld", ver, offset, idxOffset);*/
/*wDebug("write index: ver: %ld, offset: %ld, at %ld", ver, offset, idxOffset);*/
int
size
=
taosWriteFile
(
pWal
->
pWriteIdxTFile
,
&
entry
,
sizeof
(
SWalIdxEntry
));
int
64_t
size
=
taosWriteFile
(
pWal
->
pWriteIdxTFile
,
&
entry
,
sizeof
(
SWalIdxEntry
));
if
(
size
!=
sizeof
(
SWalIdxEntry
))
{
if
(
size
!=
sizeof
(
SWalIdxEntry
))
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
// TODO truncate
// TODO truncate
...
...
tests/parallel_test/run.sh
浏览文件 @
5427caf4
...
@@ -8,11 +8,12 @@ function usage() {
...
@@ -8,11 +8,12 @@ function usage() {
echo
-e
"
\t
-l log dir"
echo
-e
"
\t
-l log dir"
echo
-e
"
\t
-e enterprise edition"
echo
-e
"
\t
-e enterprise edition"
echo
-e
"
\t
-o default timeout value"
echo
-e
"
\t
-o default timeout value"
echo
-e
"
\t
-w log web server"
echo
-e
"
\t
-h help"
echo
-e
"
\t
-h help"
}
}
ent
=
0
ent
=
0
while
getopts
"m:t:b:l:o:eh"
opt
;
do
while
getopts
"m:t:b:l:o:
w:
eh"
opt
;
do
case
$opt
in
case
$opt
in
m
)
m
)
config_file
=
$OPTARG
config_file
=
$OPTARG
...
@@ -32,6 +33,9 @@ while getopts "m:t:b:l:o:eh" opt; do
...
@@ -32,6 +33,9 @@ while getopts "m:t:b:l:o:eh" opt; do
o
)
o
)
timeout_param
=
"-o
$OPTARG
"
timeout_param
=
"-o
$OPTARG
"
;;
;;
w
)
web_server
=
$OPTARG
;;
h
)
h
)
usage
usage
exit
0
exit
0
...
@@ -64,10 +68,11 @@ if [ ! -f $t_file ]; then
...
@@ -64,10 +68,11 @@ if [ ! -f $t_file ]; then
exit
1
exit
1
fi
fi
date_tag
=
`
date
+%Y%m%d-%H%M%S
`
date_tag
=
`
date
+%Y%m%d-%H%M%S
`
test_log_dir
=
${
branch
}
_
${
date_tag
}
if
[
-z
$log_dir
]
;
then
if
[
-z
$log_dir
]
;
then
log_dir
=
"log/
${
branch
}
_
${
date_tag
}
"
log_dir
=
"log/
${
test_log_dir
}
"
else
else
log_dir
=
"
$log_dir
/
${
branch
}
_
${
date_tag
}
"
log_dir
=
"
$log_dir
/
${
test_log_dir
}
"
fi
fi
hosts
=()
hosts
=()
...
@@ -190,44 +195,54 @@ function run_thread() {
...
@@ -190,44 +195,54 @@ function run_thread() {
# echo "$thread_no $count $cmd"
# echo "$thread_no $count $cmd"
local
ret
=
0
local
ret
=
0
local
redo_count
=
1
local
redo_count
=
1
local
case_log_file
=
$log_dir
/
${
case_file
}
.txt
start_time
=
`
date
+%s
`
start_time
=
`
date
+%s
`
local
case_index
=
`
flock
-x
$lock_file
-c
"sh -c
\"
echo
\\\$
((
\\\$
( cat
$index_file
) + 1 )) | tee
$index_file
\"
"
`
case_index
=
`
printf
"%5d"
$case_index
`
local
case_info
=
`
echo
"
$line
"
|cut
-d
,
-f
3,4
`
while
[
${
redo_count
}
-lt
6
]
;
do
while
[
${
redo_count
}
-lt
6
]
;
do
if
[
-f
$
log_dir
/
$case_file
.log
]
;
then
if
[
-f
$
case_log_file
]
;
then
cp
$
log_dir
/
$case_file
.log
$log_dir
/
$case_file
.
${
redo_count
}
.redolog
cp
$
case_log_file
$log_dir
/
$case_file
.
${
redo_count
}
.redotxt
fi
fi
echo
"
${
hosts
[index]
}
-
${
thread_no
}
order:
${
count
}
, redo:
${
redo_count
}
task:
${
line
}
"
>
$log_dir
/
$case_file
.log
echo
"
${
hosts
[index]
}
-
${
thread_no
}
order:
${
count
}
, redo:
${
redo_count
}
task:
${
line
}
"
>
$case_log_file
echo
-e
"
\e
[33m >>>>>
\e
[0m
${
case_cmd
}
"
local
current_time
=
`
date
"+%Y-%m-%d %H:%M:%S"
`
date
>>
$log_dir
/
$case_file
.log
echo
-e
"
$case_index
\e
[33m START >>>>>
\e
[0m
${
case_info
}
\e
[33m[
$current_time
]
\e
[0m"
# $cmd 2>&1 | tee -a $log_dir/$case_file.log
echo
"
$current_time
"
>>
$case_log_file
local
real_start_time
=
`
date
+%s
`
# $cmd 2>&1 | tee -a $case_log_file
# ret=${PIPESTATUS[0]}
# ret=${PIPESTATUS[0]}
$cmd
>>
$
log_dir
/
$case_file
.log
2>&1
$cmd
>>
$
case_log_file
2>&1
ret
=
$?
ret
=
$?
echo
"
${
hosts
[index]
}
`
date
`
ret:
${
ret
}
"
>>
$log_dir
/
$case_file
.log
local
real_end_time
=
`
date
+%s
`
local
time_elapsed
=
$((
real_end_time
-
real_start_time
))
echo
"execute time:
${
time_elapsed
}
s"
>>
$case_log_file
current_time
=
`
date
"+%Y-%m-%d %H:%M:%S"
`
echo
"
${
hosts
[index]
}
$current_time
exit code:
${
ret
}
"
>>
$case_log_file
if
[
$ret
-eq
0
]
;
then
if
[
$ret
-eq
0
]
;
then
break
break
fi
fi
redo
=
0
redo
=
0
grep
-q
"wait too long for taosd start"
$
log_dir
/
$case_file
.log
grep
-q
"wait too long for taosd start"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"kex_exchange_identification: Connection closed by remote host"
$
log_dir
/
$case_file
.log
grep
-q
"kex_exchange_identification: Connection closed by remote host"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"ssh_exchange_identification: Connection closed by remote host"
$
log_dir
/
$case_file
.log
grep
-q
"ssh_exchange_identification: Connection closed by remote host"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"kex_exchange_identification: read: Connection reset by peer"
$
log_dir
/
$case_file
.log
grep
-q
"kex_exchange_identification: read: Connection reset by peer"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"Database not ready"
$
log_dir
/
$case_file
.log
grep
-q
"Database not ready"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
grep
-q
"Unable to establish connection"
$
log_dir
/
$case_file
.log
grep
-q
"Unable to establish connection"
$
case_log_file
if
[
$?
-eq
0
]
;
then
if
[
$?
-eq
0
]
;
then
redo
=
1
redo
=
1
fi
fi
...
@@ -240,11 +255,18 @@ function run_thread() {
...
@@ -240,11 +255,18 @@ function run_thread() {
redo_count
=
$((
redo_count
+
1
))
redo_count
=
$((
redo_count
+
1
))
done
done
end_time
=
`
date
+%s
`
end_time
=
`
date
+%s
`
echo
>>
$log_dir
/
$case_file
.log
echo
>>
$case_log_file
echo
"
${
hosts
[index]
}
execute time:
$((
end_time
-
start_time
))
s"
>>
$log_dir
/
$case_file
.log
total_time
=
$((
end_time
-
start_time
))
echo
"
${
hosts
[index]
}
total time:
${
total_time
}
s"
>>
$case_log_file
# echo "$thread_no ${line} DONE"
# echo "$thread_no ${line} DONE"
if
[
$ret
-ne
0
]
;
then
if
[
$ret
-eq
0
]
;
then
flock
-x
$lock_file
-c
"echo
\"
${
hosts
[index]
}
ret:
${
ret
}
${
line
}
\"
>>
$log_dir
/failed.log"
echo
-e
"
$case_index
\e
[34m DONE <<<<<
\e
[0m
${
case_info
}
\e
[34m[
${
total_time
}
s]
\e
[0m
\e
[32m success
\e
[0m"
else
if
[
!
-z
${
web_server
}
]
;
then
flock
-x
$lock_file
-c
"echo -e
\"
${
hosts
[index]
}
ret:
${
ret
}
${
line
}
\n
${
web_server
}
/
$test_log_dir
/
${
case_file
}
.txt
\"
>>
${
failed_case_file
}
"
else
flock
-x
$lock_file
-c
"echo -e
\"
${
hosts
[index]
}
ret:
${
ret
}
${
line
}
\n
log file:
${
case_log_file
}
\"
>>
${
failed_case_file
}
"
fi
mkdir
-p
$log_dir
/
${
case_file
}
.coredump
mkdir
-p
$log_dir
/
${
case_file
}
.coredump
local
remote_coredump_dir
=
"
${
workdirs
[index]
}
/tmp/thread_volume/
$thread_no
/coredump"
local
remote_coredump_dir
=
"
${
workdirs
[index]
}
/tmp/thread_volume/
$thread_no
/coredump"
local
scpcmd
=
"sshpass -p
${
passwords
[index]
}
scp -o StrictHostKeyChecking=no -r
${
usernames
[index]
}
@
${
hosts
[index]
}
"
local
scpcmd
=
"sshpass -p
${
passwords
[index]
}
scp -o StrictHostKeyChecking=no -r
${
usernames
[index]
}
@
${
hosts
[index]
}
"
...
@@ -253,13 +275,15 @@ function run_thread() {
...
@@ -253,13 +275,15 @@ function run_thread() {
fi
fi
cmd
=
"
$scpcmd
:
${
remote_coredump_dir
}
/*
$log_dir
/
${
case_file
}
.coredump/"
cmd
=
"
$scpcmd
:
${
remote_coredump_dir
}
/*
$log_dir
/
${
case_file
}
.coredump/"
$cmd
# 2>/dev/null
$cmd
# 2>/dev/null
local
case_info
=
`
echo
"
$line
"
|cut
-d
,
-f
3,4
`
local
corefile
=
`
ls
$log_dir
/
${
case_file
}
.coredump/
`
local
corefile
=
`
ls
$log_dir
/
${
case_file
}
.coredump/
`
echo
-e
"
$case_in
fo
\e
[31m failed
\e
[0m"
echo
-e
"
$case_in
dex
\e
[34m DONE <<<<<
\e
[0m
${
case_info
}
\e
[34m[
${
total_time
}
s]
\e
[0m
\e
[31m failed
\e
[0m"
echo
"=========================log============================"
echo
"=========================log============================"
cat
$
log_dir
/
$case_file
.log
cat
$
case_log_file
echo
"====================================================="
echo
"====================================================="
echo
-e
"
\e
[34m log file:
$log_dir
/
$case_file
.log
\e
[0m"
echo
-e
"
\e
[34m log file:
$case_log_file
\e
[0m"
if
[
!
-z
"
${
web_server
}
"
]
;
then
echo
"
${
web_server
}
/
$test_log_dir
/
${
case_file
}
.txt"
fi
if
[
!
-z
"
$corefile
"
]
;
then
if
[
!
-z
"
$corefile
"
]
;
then
echo
-e
"
\e
[34m corefiles:
$corefile
\e
[0m"
echo
-e
"
\e
[34m corefiles:
$corefile
\e
[0m"
local
build_dir
=
$log_dir
/build_
${
hosts
[index]
}
local
build_dir
=
$log_dir
/build_
${
hosts
[index]
}
...
@@ -325,6 +349,10 @@ mkdir -p $log_dir
...
@@ -325,6 +349,10 @@ mkdir -p $log_dir
rm
-rf
$log_dir
/
*
rm
-rf
$log_dir
/
*
task_file
=
$log_dir
/
$$
.task
task_file
=
$log_dir
/
$$
.task
lock_file
=
$log_dir
/
$$
.lock
lock_file
=
$log_dir
/
$$
.lock
index_file
=
$log_dir
/case_index.txt
stat_file
=
$log_dir
/stat.txt
failed_case_file
=
$log_dir
/failed.txt
echo
"0"
>
$index_file
i
=
0
i
=
0
j
=
0
j
=
0
...
@@ -350,15 +378,45 @@ rm -f $lock_file
...
@@ -350,15 +378,45 @@ rm -f $lock_file
rm
-f
$task_file
rm
-f
$task_file
# docker ps -a|grep -v CONTAINER|awk '{print $1}'|xargs docker rm -f
# docker ps -a|grep -v CONTAINER|awk '{print $1}'|xargs docker rm -f
echo
"====================================================================="
echo
"log dir:
$log_dir
"
total_cases
=
`
cat
$index_file
`
failed_cases
=
0
if
[
-f
$failed_case_file
]
;
then
if
[
!
-z
"
$web_server
"
]
;
then
failed_cases
=
`
grep
-v
"
$web_server
"
$failed_case_file
|wc
-l
`
else
failed_cases
=
`
grep
-v
"log file:"
$failed_case_file
|wc
-l
`
fi
fi
success_cases
=
$((
total_cases
-
failed_cases
))
echo
"Total Cases:
$total_cases
"
>
$stat_file
echo
"Successful:
$success_cases
"
>>
$stat_file
echo
"Failed:
$failed_cases
"
>>
$stat_file
cat
$stat_file
RET
=
0
RET
=
0
i
=
1
i
=
1
if
[
-f
"
$
log_dir
/failed.log
"
]
;
then
if
[
-f
"
$
{
failed_case_file
}
"
]
;
then
echo
"====================================================="
echo
"====================================================="
while
read
line
;
do
while
read
line
;
do
if
[
!
-z
"
${
web_server
}
"
]
;
then
echo
"
$line
"
|grep
-q
"
${
web_server
}
"
if
[
$?
-eq
0
]
;
then
echo
"
$line
"
continue
fi
else
echo
"
$line
"
|grep
-q
"log file:"
if
[
$?
-eq
0
]
;
then
echo
"
$line
"
continue
fi
fi
line
=
`
echo
"
$line
"
|cut
-d
,
-f
3,4
`
line
=
`
echo
"
$line
"
|cut
-d
,
-f
3,4
`
echo
-e
"
$i
.
$line
\e
[31m failed
\e
[0m"
>
&2
echo
-e
"
$i
.
$line
\e
[31m failed
\e
[0m"
>
&2
i
=
$((
i
+
1
))
i
=
$((
i
+
1
))
done
<
$
log_dir
/failed.log
done
<
$
{
failed_case_file
}
RET
=
1
RET
=
1
fi
fi
...
...
tests/pytest/util/sqlset.py
浏览文件 @
5427caf4
...
@@ -15,7 +15,7 @@ from util.sql import tdSql
...
@@ -15,7 +15,7 @@ from util.sql import tdSql
class
TDSetSql
:
class
TDSetSql
:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
stbname
=
'stb'
self
.
stbname
=
'stb'
def
set_create_normaltable_sql
(
self
,
ntbname
=
'ntb'
,
def
set_create_normaltable_sql
(
self
,
ntbname
=
'ntb'
,
...
...
tests/script/jenkins/basic.txt
浏览文件 @
5427caf4
...
@@ -88,6 +88,7 @@
...
@@ -88,6 +88,7 @@
./test.sh -f tsim/stream/triggerInterval0.sim
./test.sh -f tsim/stream/triggerInterval0.sim
# ./test.sh -f tsim/stream/triggerSession0.sim
# ./test.sh -f tsim/stream/triggerSession0.sim
./test.sh -f tsim/stream/partitionby.sim
./test.sh -f tsim/stream/partitionby.sim
./test.sh -f tsim/stream/partitionby1.sim
./test.sh -f tsim/stream/schedSnode.sim
./test.sh -f tsim/stream/schedSnode.sim
./test.sh -f tsim/stream/windowClose.sim
./test.sh -f tsim/stream/windowClose.sim
...
...
tests/script/sh/cfg.bat
浏览文件 @
5427caf4
...
@@ -16,12 +16,12 @@ rem echo NODE: %NODE%
...
@@ -16,12 +16,12 @@ rem echo NODE: %NODE%
set
SCRIPT_DIR
=
%~dp0
..\
set
SCRIPT_DIR
=
%~dp0
..\
rem echo SCRIPT_DIR: %SCRIPT_DIR%
rem echo SCRIPT_DIR: %SCRIPT_DIR%
set
BUILD_DIR
=
%SCRIPT_DIR%
..\..\..\debug\build\bin\
echo
%cd%
|
grep
community
>
nul
&&
set
"BUILD_DIR=
%SCRIPT_DIR%
..\..\..\debug\build\bin\"
||
set
"BUILD_DIR=
%SCRIPT_DIR%
..\..\debug\build\bin\"
set
TSIM
=
%BUILD_DIR%
tsim
set
TSIM
=
%BUILD_DIR%
tsim
rem echo BUILD_DIR: %BUILD_DIR%
rem echo BUILD_DIR: %BUILD_DIR%
rem echo TSIM: %TSIM%
rem echo TSIM: %TSIM%
set
SIM_DIR
=
%SCRIPT_DIR%
..\..\..\sim\
echo
%cd%
|
grep
community
>
nul
&&
set
"SIM_DIR=
%SCRIPT_DIR%
..\..\..\sim\"
||
set
"SIM_DIR=
%SCRIPT_DIR%
..\..\sim\"
rem echo SIM_DIR: %SIM_DIR%
rem echo SIM_DIR: %SIM_DIR%
set
NODE_DIR
=
%SIM_DIR%%
NODE_NAME
%
\
set
NODE_DIR
=
%SIM_DIR%%
NODE_NAME
%
\
...
...
tests/script/sh/copy_udf.bat
浏览文件 @
5427caf4
...
@@ -4,7 +4,7 @@ echo Executing copy_udf.bat
...
@@ -4,7 +4,7 @@ echo Executing copy_udf.bat
set
SCRIPT_DIR
=
%cd%
set
SCRIPT_DIR
=
%cd%
echo
SCRIPT_DIR
:
%SCRIPT_DIR%
echo
SCRIPT_DIR
:
%SCRIPT_DIR%
cd
..\
..\..
echo
%cd%
|
grep
community
>
nul
&&
cd
..\..\..
||
cd
..\..
set
TAOS_DIR
=
%cd%
set
TAOS_DIR
=
%cd%
echo
find
udf
library
in
%TAOS_DIR%
echo
find
udf
library
in
%TAOS_DIR%
set
UDF1_DIR
=
%TAOS_DIR%
\debug\build\lib\udf1.dll
set
UDF1_DIR
=
%TAOS_DIR%
\debug\build\lib\udf1.dll
...
...
tests/script/sh/deploy.bat
浏览文件 @
5427caf4
...
@@ -13,12 +13,12 @@ rem echo NODE: %NODE%
...
@@ -13,12 +13,12 @@ rem echo NODE: %NODE%
set
SCRIPT_DIR
=
%~dp0
..\
set
SCRIPT_DIR
=
%~dp0
..\
rem echo SCRIPT_DIR: %SCRIPT_DIR%
rem echo SCRIPT_DIR: %SCRIPT_DIR%
set
BUILD_DIR
=
%SCRIPT_DIR%
..\..\..\debug\build\bin\
echo
%cd%
|
grep
community
>
nul
&&
set
"BUILD_DIR=
%SCRIPT_DIR%
..\..\..\debug\build\bin\"
||
set
"BUILD_DIR=
%SCRIPT_DIR%
..\..\debug\build\bin\"
set
TSIM
=
%BUILD_DIR%
tsim
set
TSIM
=
%BUILD_DIR%
tsim
rem echo BUILD_DIR: %BUILD_DIR%
rem echo BUILD_DIR: %BUILD_DIR%
rem echo TSIM: %TSIM%
rem echo TSIM: %TSIM%
set
SIM_DIR
=
%SCRIPT_DIR%
..\..\..\sim\
echo
%cd%
|
grep
community
>
nul
&&
set
"SIM_DIR=
%SCRIPT_DIR%
..\..\..\sim\"
||
set
"SIM_DIR=
%SCRIPT_DIR%
..\..\sim\"
rem echo SIM_DIR: %SIM_DIR%
rem echo SIM_DIR: %SIM_DIR%
set
NODE_DIR
=
%SIM_DIR%%
NODE_NAME
%
\
set
NODE_DIR
=
%SIM_DIR%%
NODE_NAME
%
\
...
...
tests/script/sh/exec.bat
浏览文件 @
5427caf4
...
@@ -13,12 +13,12 @@ rem echo NODE: %EXEC_OPTON%
...
@@ -13,12 +13,12 @@ rem echo NODE: %EXEC_OPTON%
set
SCRIPT_DIR
=
%~dp0
..\
set
SCRIPT_DIR
=
%~dp0
..\
rem echo SCRIPT_DIR: %SCRIPT_DIR%
rem echo SCRIPT_DIR: %SCRIPT_DIR%
set
BUILD_DIR
=
%SCRIPT_DIR%
..\..\..\debug\build\bin\
echo
%cd%
|
grep
community
>
nul
&&
set
"BUILD_DIR=
%SCRIPT_DIR%
..\..\..\debug\build\bin\"
||
set
"BUILD_DIR=
%SCRIPT_DIR%
..\..\debug\build\bin\"
set
TAOSD
=
%BUILD_DIR%
taosd
set
TAOSD
=
%BUILD_DIR%
taosd
rem echo BUILD_DIR: %BUILD_DIR%
rem echo BUILD_DIR: %BUILD_DIR%
rem echo TAOSD: %TAOSD%
rem echo TAOSD: %TAOSD%
set
SIM_DIR
=
%SCRIPT_DIR%
..\..\..\sim\
echo
%cd%
|
grep
community
>
nul
&&
set
"SIM_DIR=
%SCRIPT_DIR%
..\..\..\sim\"
||
set
"SIM_DIR=
%SCRIPT_DIR%
..\..\sim\"
rem echo SIM_DIR: %SIM_DIR%
rem echo SIM_DIR: %SIM_DIR%
set
NODE_DIR
=
%SIM_DIR%%
NODE_NAME
%
\
set
NODE_DIR
=
%SIM_DIR%%
NODE_NAME
%
\
...
...
tests/script/tsim/stream/partitionby1.sim
0 → 100644
浏览文件 @
5427caf4
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sleep 50
sql connect
sql create database test vgroups 4;
sql use test;
sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
sql create table ts3 using st tags(3,2,2);
sql create table ts4 using st tags(4,2,2);
sql create stream stream_t1 trigger at_once into streamtST1 as select _wstartts, count(*) c1, count(d) c2 , sum(a) c3 , max(b) c4, min(c) c5 from st partition by tbname interval(10s);
sql insert into ts1 values(1648791213001,1,12,3,1.0);
sql insert into ts2 values(1648791213001,1,12,3,1.0);
sql insert into ts3 values(1648791213001,1,12,3,1.0);
sql insert into ts4 values(1648791213001,1,12,3,1.0);
$loop_count = 0
loop0:
sleep 300
sql select * from streamtST1;
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
if $rows != 4 then
print =====rows=$rows
goto loop0
endi
print =====loop0
sql create database test1 vgroups 1;
sql use test1;
sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,2,3);
sql create table ts2 using st tags(1,3,4);
sql create table ts3 using st tags(1,4,5);
sql create stream streams1 trigger at_once into streamt as select _wstartts, count(*) c1, count(a) c2 from st partition by tbname interval(10s);
sql insert into ts1 values(1648791211000,1,2,3);
sql insert into ts2 values(1648791211000,1,2,3);
$loop_count = 0
loop1:
sleep 300
sql select * from streamt;
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
if $rows != 2 then
print =====rows=$rows
goto loop1
endi
print =====loop1
sql create database test2 vgroups 1;
sql use test2;
sql create stable st(ts timestamp,a int,b int,c int,id int) tags(ta int,tb int,tc int);
sql create table ts1 using st tags(1,1,1);
sql create table ts2 using st tags(2,2,2);
sql create stream stream_t2 trigger at_once into streamtST as select _wstartts, count(*) c1, count(a) c2 , sum(a) c3 , max(b) c5, min(c) c6, max(id) c7 from st partition by tbname interval(10s) ;
sql insert into ts1 values(1648791211000,1,2,3,1);
sql insert into ts1 values(1648791222001,2,2,3,2);
sql insert into ts2 values(1648791211000,1,2,3,3);
sql insert into ts2 values(1648791222001,2,2,3,4);
sql insert into ts2 values(1648791222002,2,2,3,5);
sql insert into ts2 values(1648791222002,2,2,3,6);
sql insert into ts1 values(1648791211000,1,2,3,1);
sql insert into ts1 values(1648791222001,2,2,3,2);
sql insert into ts2 values(1648791211000,1,2,3,3);
sql insert into ts2 values(1648791222001,2,2,3,4);
$loop_count = 0
loop2:
sleep 300
sql select * from streamtST;
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
if $data01 != 1 then
print =====data01=$data01
goto loop2
endi
if $data02 != 1 then
print =====data02=$data02
goto loop2
endi
if $data03 != 1 then
print =====data03=$data03
goto loop2
endi
if $data04 != 2 then
print =====data04=$data04
goto loop2
endi
print =====loop2
system sh/stop_dnodes.sh
tests/script/tsim/sync/3Replica1VgElect.sim
浏览文件 @
5427caf4
...
@@ -197,22 +197,22 @@ print $switch_loop_cnt
...
@@ -197,22 +197,22 @@ print $switch_loop_cnt
if $switch_loop_cnt == 1 then
if $switch_loop_cnt == 1 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
1
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 2 then
elif $switch_loop_cnt == 2 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
2
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 3 then
elif $switch_loop_cnt == 3 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
3
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 4 then
elif $switch_loop_cnt == 4 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
4
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
else
else
...
...
tests/script/tsim/sync/3Replica5VgElect.sim
浏览文件 @
5427caf4
...
@@ -290,22 +290,22 @@ print $switch_loop_cnt
...
@@ -290,22 +290,22 @@ print $switch_loop_cnt
if $switch_loop_cnt == 1 then
if $switch_loop_cnt == 1 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
1
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 2 then
elif $switch_loop_cnt == 2 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
2
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 3 then
elif $switch_loop_cnt == 3 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
3
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 4 then
elif $switch_loop_cnt == 4 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
4
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
else
else
...
...
tests/script/tsim/sync/oneReplica5VgElect.sim
浏览文件 @
5427caf4
...
@@ -227,22 +227,22 @@ print $switch_loop_cnt
...
@@ -227,22 +227,22 @@ print $switch_loop_cnt
if $switch_loop_cnt == 1 then
if $switch_loop_cnt == 1 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
1
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 2 then
elif $switch_loop_cnt == 2 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
2
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 3 then
elif $switch_loop_cnt == 3 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
3
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
elif $switch_loop_cnt == 4 then
elif $switch_loop_cnt == 4 then
sql show vgroups
sql show vgroups
$dnodeId = $data[
4
][3]
$dnodeId = $data[
0
][3]
$dnodeId = dnode . $dnodeId
$dnodeId = dnode . $dnodeId
goto switch_leader_to_offine_loop
goto switch_leader_to_offine_loop
else
else
...
...
tests/script/tsim/tmq/consume.bat
0 → 100644
浏览文件 @
5427caf4
@echo
off
set
EXEC_OPTON
=
start
set
DB_NAME
=
db
set
CDB_NAME
=
db
set
/a
POLL_DELAY
=
5
set
/a
VALGRIND
=
0
set
SIGNAL
=
SIGINT
set
/a
SHOW_MSG
=
0
set
/a
SHOW_ROW
=
0
set
/a
EXP_USE_SNAPSHOT
=
0
:param
if
"
%
1"
==
""
(
goto
:end
)
if
%
1
==
-d
(
set
"DB_NAME=
%
2"
&&
shift
&&
shift
&&
goto
:param
)
if
%
1
==
-g
(
set
"SHOW_MSG=
%
2"
&&
shift
&&
shift
&&
goto
:param
)
if
%
1
==
-r
(
set
"SHOW_ROW=
%
2"
&&
shift
&&
shift
&&
goto
:param
)
if
%
1
==
-s
(
set
"EXEC_OPTON=
%
2"
&&
shift
&&
shift
&&
goto
:param
)
if
%
1
==
-v
(
set
"VALGRIND=1"
&&
shift
&&
goto
:param
)
if
%
1
==
-y
(
set
"POLL_DELAY=
%
2"
&&
shift
&&
shift
&&
goto
:param
)
if
%
1
==
-x
(
set
"SIGNAL=
%
2"
&&
shift
&&
shift
&&
goto
:param
)
if
%
1
==
-w
(
set
"CDB_NAME=
%
2"
&&
shift
&&
shift
&&
goto
:param
)
if
%
1
==
-e
(
set
"EXP_USE_SNAPSHOT=
%
2"
&&
shift
&&
shift
&&
goto
:param
)
echo
unkown
argument
%
1
goto
:eof
:end
echo
EXEC_OPTON
%EXEC_OPTON%
echo
DB_NAME
%DB_NAME%
echo
CDB_NAME
%CDB_NAME%
echo
POLL_DELAY
%POLL_DELAY%
echo
VALGRIND
%VALGRIND%
echo
SIGNAL
%SIGNAL%
echo
SHOW_MSG
%SHOW_MSG%
echo
SHOW_ROW
%SHOW_ROW%
echo
EXP_USE_SNAPSHOT
%EXP_USE_SNAPSHOT%
echo
%cd%
|
grep
community
>
nul
&&
cd
..\..\..
||
cd
..\..
set
BUILD_DIR
=
%cd%
\debug\build\bin
set
SIM_DIR
=
%cd%
\sim
set
PRG_DIR
=
%SIM_DIR%
\tsim
set
CFG_DIR
=
%PRG_DIR%
\cfg
set
LOG_DIR
=
%PRG_DIR%
\log
set
PROGRAM
=
%BUILD_DIR%
\tmq_sim.exe
echo
------------------------------------------------------------------------
echo
BUILD_DIR
:
%BUILD_DIR%
echo
SIM_DIR
:
%SIM_DIR%
echo
CFG_DIR
:
%CFG_DIR%
echo
PRG_DIR
:
%PRG_DIR%
echo
CFG_DIR
:
%CFG_DIR%
echo
LOG_DIR
:
%LOG_DIR%
echo
PROGRAM
:
%PROGRAM%
echo
POLL_DELAY
:
%POLL_DELAY%
echo
DB_NAME
:
%DB_NAME%
echo
------------------------------------------------------------------------
if
"
%EXEC_OPTON%
"
==
"start"
(
echo
mintty
-h
never
%PROGRAM%
-c
%CFG_DIR%
-y
%POLL_DELAY%
-d
%DB_NAME%
-g
%SHOW_MSG%
-r
%SHOW_ROW%
-w
%CDB_NAME%
-e
%EXP_USE_SNAPSHOT%
mintty
-h
never
%PROGRAM%
-c
%CFG_DIR%
-y
%POLL_DELAY%
-d
%DB_NAME%
-g
%SHOW_MSG%
-r
%SHOW_ROW%
-w
%CDB_NAME%
-e
%EXP_USE_SNAPSHOT%
)
else
(
if
"
%SIGNAL%
"
==
"SIGKILL"
(
ps
|
grep
tmq_sim
|
awk
'{print $2}'
|
xargs
kill
-
9
)
else
(
ps
|
grep
tmq_sim
|
awk
'{print $2}'
|
xargs
kill
-SIGINT
)
)
goto
:eof
tests/script/wtest.bat
浏览文件 @
5427caf4
...
@@ -6,12 +6,12 @@ rem echo Start TDengine Testing Case ...
...
@@ -6,12 +6,12 @@ rem echo Start TDengine Testing Case ...
set
"SCRIPT_DIR=
%~dp0
"
set
"SCRIPT_DIR=
%~dp0
"
rem echo SCRIPT_DIR: %SCRIPT_DIR%
rem echo SCRIPT_DIR: %SCRIPT_DIR%
set
"BUILD_DIR=
%SCRIPT_DIR%
..\
..\..\debug\build\bin\"
echo
%cd%
|
grep
community
>
nul
&&
set
"BUILD_DIR=
%SCRIPT_DIR%
..\..\..\debug\build\bin\"
||
set
"BUILD_DIR=
%SCRIPT_DIR%
..\..\debug\build\bin\"
set
"TSIM=
%BUILD_DIR%
tsim"
set
"TSIM=
%BUILD_DIR%
tsim"
rem echo BUILD_DIR: %BUILD_DIR%
rem echo BUILD_DIR: %BUILD_DIR%
rem echo TSIM: %TSIM%
rem echo TSIM: %TSIM%
set
"SIM_DIR=
%SCRIPT_DIR%
..\
..\..\sim\"
echo
%cd%
|
grep
community
>
nul
&&
set
"SIM_DIR=
%SCRIPT_DIR%
..\..\..\sim\"
||
set
"SIM_DIR=
%SCRIPT_DIR%
..\..\sim\"
rem echo SIM_DIR: %SIM_DIR%
rem echo SIM_DIR: %SIM_DIR%
set
"TSIM_DIR=
%SIM_DIR%
tsim\"
set
"TSIM_DIR=
%SIM_DIR%
tsim\"
...
...
tests/system-test/0-others/taosShell.py
浏览文件 @
5427caf4
...
@@ -44,13 +44,13 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key
...
@@ -44,13 +44,13 @@ def taos_command (buildPath, key, value, expectString, cfgDir, sqlString='', key
tdLog
.
info
(
"taos cmd: %s"
%
taosCmd
)
tdLog
.
info
(
"taos cmd: %s"
%
taosCmd
)
child
=
taosExpect
.
spawn
(
taosCmd
,
timeout
=
3
)
child
=
taosExpect
.
spawn
(
taosCmd
,
timeout
=
10
)
#output = child.readline()
#output = child.readline()
#print (output.decode())
#print (output.decode())
if
len
(
expectString
)
!=
0
:
if
len
(
expectString
)
!=
0
:
i
=
child
.
expect
([
expectString
,
taosExpect
.
TIMEOUT
,
taosExpect
.
EOF
],
timeout
=
6
)
i
=
child
.
expect
([
expectString
,
taosExpect
.
TIMEOUT
,
taosExpect
.
EOF
],
timeout
=
10
)
else
:
else
:
i
=
child
.
expect
([
taosExpect
.
TIMEOUT
,
taosExpect
.
EOF
],
timeout
=
6
)
i
=
child
.
expect
([
taosExpect
.
TIMEOUT
,
taosExpect
.
EOF
],
timeout
=
10
)
if
platform
.
system
().
lower
()
==
'windows'
:
if
platform
.
system
().
lower
()
==
'windows'
:
retResult
=
child
.
before
retResult
=
child
.
before
...
...
tests/system-test/2-query/Now.py
浏览文件 @
5427caf4
此差异已折叠。
点击以展开。
tests/system-test/2-query/To_unixtimestamp.py
浏览文件 @
5427caf4
...
@@ -12,7 +12,37 @@ class TDTestCase:
...
@@ -12,7 +12,37 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
# name of normal table
self
.
ntbname
=
'ntb'
# name of stable
self
.
stbname
=
'stb'
# structure of column
self
.
column_dict
=
{
'ts'
:
'timestamp'
,
'c1'
:
'int'
,
'c2'
:
'float'
,
'c3'
:
'binary(20)'
,
'c4'
:
'nchar(20)'
}
# structure of tag
self
.
tag_dict
=
{
't0'
:
'int'
}
# number of child tables
self
.
tbnum
=
2
# values of tag,the number of values should equal to tbnum
self
.
tag_values
=
[
f
'10'
,
f
'100'
]
# values of rows, structure should be same as column
self
.
values_list
=
[
f
'now,10,99.99,"2020-1-1 00:00:00"'
,
f
'today(),100,11.111,22.222222'
]
self
.
error_param
=
[
1
,
'now()'
]
def
run
(
self
):
# sourcery skip: extract-duplicate-method
def
run
(
self
):
# sourcery skip: extract-duplicate-method
tdSql
.
prepare
()
tdSql
.
prepare
()
tdLog
.
printNoPrefix
(
"==========step1:create tables=========="
)
tdLog
.
printNoPrefix
(
"==========step1:create tables=========="
)
...
...
tests/system-test/2-query/first.py
浏览文件 @
5427caf4
...
@@ -60,10 +60,10 @@ class TDTestCase:
...
@@ -60,10 +60,10 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
checkData
(
0
,
1
,
None
)
#!bug TD-16561
#!bug TD-16561
#
for i in ['stb','db.stb']:
for
i
in
[
'stb'
,
'db.stb'
]:
#
tdSql.query(f"select first(*) from {i}")
tdSql
.
query
(
f
"select first(*) from
{
i
}
"
)
#
tdSql.checkRows(1)
tdSql
.
checkRows
(
1
)
#
tdSql.checkData(0, 1, None)
tdSql
.
checkData
(
0
,
1
,
None
)
for
i
in
column_list
:
for
i
in
column_list
:
for
j
in
[
'stb_1'
,
'db.stb_1'
,
'stb_1'
,
'db.stb_1'
]:
for
j
in
[
'stb_1'
,
'db.stb_1'
,
'stb_1'
,
'db.stb_1'
]:
tdSql
.
query
(
f
"select first(
{
i
}
) from
{
j
}
"
)
tdSql
.
query
(
f
"select first(
{
i
}
) from
{
j
}
"
)
...
@@ -125,10 +125,10 @@ class TDTestCase:
...
@@ -125,10 +125,10 @@ class TDTestCase:
tdSql
.
execute
(
f
"create table
{
stbname
}
_
{
i
}
using
{
stbname
}
tags('beijing')"
)
tdSql
.
execute
(
f
"create table
{
stbname
}
_
{
i
}
using
{
stbname
}
tags('beijing')"
)
tdSql
.
execute
(
f
"insert into
{
stbname
}
_
{
i
}
(ts) values(%d)"
%
(
self
.
ts
-
1
-
i
))
tdSql
.
execute
(
f
"insert into
{
stbname
}
_
{
i
}
(ts) values(%d)"
%
(
self
.
ts
-
1
-
i
))
#!bug TD-16561
#!bug TD-16561
#
for i in [f'{stbname}', f'{dbname}.{stbname}']:
for
i
in
[
f
'
{
stbname
}
'
,
f
'
{
dbname
}
.
{
stbname
}
'
]:
#
tdSql.query(f"select first(*) from {i}")
tdSql
.
query
(
f
"select first(*) from
{
i
}
"
)
#
tdSql.checkRows(1)
tdSql
.
checkRows
(
1
)
#
tdSql.checkData(0, 1, None)
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
query
(
'show tables'
)
tdSql
.
query
(
'show tables'
)
vgroup_list
=
[]
vgroup_list
=
[]
for
i
in
range
(
len
(
tdSql
.
queryResult
)):
for
i
in
range
(
len
(
tdSql
.
queryResult
)):
...
@@ -170,8 +170,8 @@ class TDTestCase:
...
@@ -170,8 +170,8 @@ class TDTestCase:
elif
'nchar'
in
v
:
elif
'nchar'
in
v
:
tdSql
.
checkData
(
0
,
0
,
f
'
{
self
.
nchar_str
}
1'
)
tdSql
.
checkData
(
0
,
0
,
f
'
{
self
.
nchar_str
}
1'
)
#!bug TD-16569
#!bug TD-16569
#
tdSql.query(f"select first(*),last(*) from {stbname} where ts < 23 interval(1s)")
tdSql
.
query
(
f
"select first(*),last(*) from
{
stbname
}
where ts < 23 interval(1s)"
)
#
tdSql.checkRows(0)
tdSql
.
checkRows
(
0
)
tdSql
.
execute
(
f
'drop database
{
dbname
}
'
)
tdSql
.
execute
(
f
'drop database
{
dbname
}
'
)
...
...
tests/system-test/2-query/timezone.py
浏览文件 @
5427caf4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sqlset
import
*
import
platform
import
platform
import
os
import
os
if
platform
.
system
().
lower
()
==
'windows'
:
if
platform
.
system
().
lower
()
==
'windows'
:
...
@@ -14,10 +14,39 @@ class TDTestCase:
...
@@ -14,10 +14,39 @@ class TDTestCase:
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
())
tdSql
.
init
(
conn
.
cursor
())
self
.
setsql
=
TDSetSql
()
self
.
arithmetic_operators
=
[
'+'
,
'-'
,
'*'
,
'/'
]
self
.
arithmetic_values
=
[
0
,
1
,
100
,
15.5
]
# name of normal table
self
.
ntbname
=
'ntb'
# name of stable
self
.
stbname
=
'stb'
# structure of column
self
.
column_dict
=
{
'ts'
:
'timestamp'
,
'c1'
:
'int'
,
'c2'
:
'float'
,
'c3'
:
'double'
}
# structure of tag
self
.
tag_dict
=
{
't0'
:
'int'
}
# number of child tables
self
.
tbnum
=
2
# values of tag,the number of values should equal to tbnum
self
.
tag_values
=
[
f
'10'
,
f
'100'
]
# values of rows, structure should be same as column
self
.
values_list
=
[
f
'now,10,99.99,11.111111'
,
f
'today(),100,11.111,22.222222'
def
run
(
self
):
# sourcery skip: extract-duplicate-method
]
tdSql
.
prepare
()
self
.
error_param
=
[
1
,
'now()'
]
# get system timezone
def
get_system_timezone
(
self
):
if
platform
.
system
().
lower
()
==
'windows'
:
if
platform
.
system
().
lower
()
==
'windows'
:
time_zone_1
=
tzlocal
.
get_localzone_name
()
time_zone_1
=
tzlocal
.
get_localzone_name
()
time_zone_2
=
time
.
strftime
(
'(UTC, %z)'
)
time_zone_2
=
time
.
strftime
(
'(UTC, %z)'
)
...
@@ -32,122 +61,61 @@ class TDTestCase:
...
@@ -32,122 +61,61 @@ class TDTestCase:
time_zone_2
=
os
.
popen
(
'date "+(%Z, %z)"'
).
read
().
strip
()
time_zone_2
=
os
.
popen
(
'date "+(%Z, %z)"'
).
read
().
strip
()
time_zone
=
time_zone_1
+
" "
+
time_zone_2
time_zone
=
time_zone_1
+
" "
+
time_zone_2
print
(
"expected time zone: "
+
time_zone
)
print
(
"expected time zone: "
+
time_zone
)
return
time_zone
tdLog
.
printNoPrefix
(
"==========step1:create tables=========="
)
tdSql
.
execute
(
def
tb_type_check
(
self
,
tb_type
):
'''create table if not exists ntb
if
tb_type
in
[
'normal_table'
,
'child_table'
]:
(ts timestamp, c1 int, c2 float,c3 double)
tdSql
.
checkRows
(
len
(
self
.
values_list
))
'''
elif
tb_type
==
'stable'
:
)
tdSql
.
checkRows
(
len
(
self
.
values_list
*
self
.
tbnum
))
tdSql
.
execute
(
def
data_check
(
self
,
timezone
,
tbname
,
tb_type
):
'''create table if not exists stb
tdSql
.
query
(
f
"select timezone() from
{
tbname
}
"
)
(ts timestamp, c1 int, c2 float,c3 double) tags(t0 int)
self
.
tb_type_check
(
tb_type
)
'''
tdSql
.
checkData
(
0
,
0
,
timezone
)
)
for
symbol
in
self
.
arithmetic_operators
:
tdSql
.
execute
(
tdSql
.
query
(
f
"select timezone()
{
symbol
}
null from
{
tbname
}
"
)
'''create table if not exists stb_1 using stb tags(100)
self
.
tb_type_check
(
tb_type
)
'''
tdSql
.
checkData
(
0
,
0
,
None
)
)
for
i
in
self
.
arithmetic_values
:
for
symbol
in
self
.
arithmetic_operators
:
tdLog
.
printNoPrefix
(
"==========step2:insert data=========="
)
tdSql
.
query
(
f
"select timezone()
{
symbol
}{
i
}
from
{
tbname
}
"
)
tdSql
.
execute
(
self
.
tb_type_check
(
tb_type
)
"insert into ntb values(now,10,99.99,11.111111)(today(),100,11.111,22.222222)"
)
if
symbol
==
'+'
:
tdSql
.
execute
(
tdSql
.
checkData
(
0
,
0
,
i
)
"insert into stb_1 values(now,111,99.99,11.111111)(today(),1,11.111,22.222222)"
)
elif
symbol
==
'-'
:
tdSql
.
checkData
(
0
,
0
,
-
i
)
tdLog
.
printNoPrefix
(
"==========step3:query data=========="
)
elif
symbol
in
[
'*'
,
'/'
,
'%'
]:
if
i
==
0
and
symbol
==
'/'
:
tdSql
.
checkData
(
0
,
0
,
None
)
else
:
tdSql
.
checkData
(
0
,
0
,
0
)
for
param
in
self
.
error_param
:
tdSql
.
error
(
f
'select timezone(
{
param
}
) from
{
tbname
}
'
)
tdSql
.
query
(
f
"select * from
{
tbname
}
where timezone()='
{
timezone
}
'"
)
self
.
tb_type_check
(
tb_type
)
def
timezone_check_ntb
(
self
,
timezone
):
tdSql
.
prepare
()
tdSql
.
execute
(
self
.
setsql
.
set_create_normaltable_sql
(
self
.
ntbname
,
self
.
column_dict
))
for
value
in
self
.
values_list
:
tdSql
.
execute
(
f
'insert into
{
self
.
ntbname
}
values(
{
value
}
)'
)
self
.
data_check
(
timezone
,
self
.
ntbname
,
'normal_table'
)
tdSql
.
execute
(
'drop database db'
)
def
timezone_check_stb
(
self
,
timezone
):
tdSql
.
prepare
()
tdSql
.
execute
(
self
.
setsql
.
set_create_stable_sql
(
self
.
stbname
,
self
.
column_dict
,
self
.
tag_dict
))
for
i
in
range
(
self
.
tbnum
):
tdSql
.
execute
(
f
'create table if not exists
{
self
.
stbname
}
_
{
i
}
using
{
self
.
stbname
}
tags(
{
self
.
tag_values
[
i
]
}
)'
)
for
j
in
self
.
values_list
:
tdSql
.
execute
(
f
'insert into
{
self
.
stbname
}
_
{
i
}
values(
{
j
}
)'
)
self
.
data_check
(
timezone
,
self
.
stbname
,
'stable'
)
for
i
in
range
(
self
.
tbnum
):
self
.
data_check
(
timezone
,
f
'
{
self
.
stbname
}
_
{
i
}
'
,
'child_table'
)
def
run
(
self
):
# sourcery skip: extract-duplicate-method
timezone
=
self
.
get_system_timezone
()
self
.
timezone_check_ntb
(
timezone
)
self
.
timezone_check_stb
(
timezone
)
tdSql
.
query
(
"select timezone() from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from db.ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from db.stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
query
(
"select timezone() from db.stb_1 "
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
time_zone
)
tdSql
.
error
(
"select timezone(1) from stb"
)
tdSql
.
error
(
"select timezone(1) from db.stb"
)
tdSql
.
error
(
"select timezone(1) from ntb"
)
tdSql
.
error
(
"select timezone(1) from db.ntb"
)
tdSql
.
error
(
"select timezone(1) from stb_1"
)
tdSql
.
error
(
"select timezone(1) from db.stb_1"
)
tdSql
.
error
(
"select timezone(now()) from stb"
)
tdSql
.
error
(
"select timezone(now()) from db.stb"
)
tdSql
.
query
(
f
"select * from ntb where timezone()='
{
time_zone
}
'"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from db.ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from db.stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1 from db.stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1.5 from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()+1.5 from db.ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()-100 from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()*100 from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
query
(
"select timezone()/10 from ntb"
)
# tdSql.query("select timezone()/0 from ntb")
tdSql
.
query
(
"select timezone()+null from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()-null from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()*null from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()/null from ntb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
# tdSql.query("select timezone()")
tdSql
.
query
(
"select timezone()+null from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()-null from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()*null from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()/null from stb"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()+null from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()-null from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()*null from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
query
(
"select timezone()/null from stb_1"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
None
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
...
...
tests/system-test/simpletest.bat
浏览文件 @
5427caf4
@REM
python3 .\test.py -f 0-others\taosShell.py
python3
.\test.py
-f
0
-others
\taosShell.py
@REM
python3 .\test.py -f 0-others\taosShellError.py
python3
.\test.py
-f
0
-others
\taosShellError.py
python3
.\test.py
-f
0
-others
\taosShellNetChk.py
python3
.\test.py
-f
0
-others
\taosShellNetChk.py
python3
.\test.py
-f
0
-others
\telemetry.py
python3
.\test.py
-f
0
-others
\telemetry.py
python3
.\test.py
-f
0
-others
\taosdMonitor.py
python3
.\test.py
-f
0
-others
\taosdMonitor.py
python3
.\test.py
-f
0
-others
\udfTest.py
python3
.\test.py
-f
0
-others
\udfTest.py
@REM
python3 .\test.py -f 0-others\udf_create.py
python3
.\test.py
-f
0
-others
\udf_create.py
@REM
python3 .\test.py -f 0-others\udf_restart_taosd.py
python3
.\test.py
-f
0
-others
\udf_restart_taosd.py
@REM python3 .\test.py -f 0-others\cachelast.py
@REM python3 .\test.py -f 0-others\cachelast.py
@REM python3 .\test.py -f 0-others\user_control.py
@REM python3 .\test.py -f 0-others\user_control.py
...
...
tests/system-test/test.py
浏览文件 @
5427caf4
...
@@ -38,7 +38,9 @@ def checkRunTimeError():
...
@@ -38,7 +38,9 @@ def checkRunTimeError():
while
1
:
while
1
:
time
.
sleep
(
1
)
time
.
sleep
(
1
)
timeCount
=
timeCount
+
1
timeCount
=
timeCount
+
1
print
(
"checkRunTimeError"
,
timeCount
)
if
(
timeCount
>
900
):
if
(
timeCount
>
900
):
print
(
"stop the test."
)
os
.
system
(
"TASKKILL /F /IM taosd.exe"
)
os
.
system
(
"TASKKILL /F /IM taosd.exe"
)
os
.
system
(
"TASKKILL /F /IM taos.exe"
)
os
.
system
(
"TASKKILL /F /IM taos.exe"
)
os
.
system
(
"TASKKILL /F /IM tmq_sim.exe"
)
os
.
system
(
"TASKKILL /F /IM tmq_sim.exe"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录