Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0035bb19
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
0035bb19
编写于
10月 28, 2022
作者:
H
Haojun Liao
提交者:
GitHub
10月 28, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into feature/3_liaohj
上级
cb0adb0e
d058475f
变更
113
展开全部
隐藏空白更改
内联
并排
Showing
113 changed file
with
5828 addition
and
4294 deletion
+5828
-4294
Jenkinsfile2
Jenkinsfile2
+3
-3
cmake/taostools_CMakeLists.txt.in
cmake/taostools_CMakeLists.txt.in
+1
-1
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+1
-1
docs/en/14-reference/03-connector/05-go.mdx
docs/en/14-reference/03-connector/05-go.mdx
+51
-3
docs/zh/08-connector/20-go.mdx
docs/zh/08-connector/20-go.mdx
+50
-2
docs/zh/08-connector/26-rust.mdx
docs/zh/08-connector/26-rust.mdx
+1
-1
docs/zh/08-connector/35-node.mdx
docs/zh/08-connector/35-node.mdx
+2
-2
docs/zh/08-connector/40-csharp.mdx
docs/zh/08-connector/40-csharp.mdx
+1
-1
docs/zh/08-connector/_preparation.mdx
docs/zh/08-connector/_preparation.mdx
+0
-0
docs/zh/12-taos-sql/24-show.md
docs/zh/12-taos-sql/24-show.md
+1
-1
include/common/tcommon.h
include/common/tcommon.h
+8
-0
include/common/tglobal.h
include/common/tglobal.h
+2
-2
include/common/tmsg.h
include/common/tmsg.h
+3
-0
include/common/ttokendef.h
include/common/ttokendef.h
+130
-129
include/dnode/snode/snode.h
include/dnode/snode/snode.h
+2
-2
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+8
-0
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+1
-0
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+1
-2
include/libs/planner/planner.h
include/libs/planner/planner.h
+0
-1
include/libs/stream/streamState.h
include/libs/stream/streamState.h
+2
-0
packaging/cfg/taos.cfg
packaging/cfg/taos.cfg
+33
-20
source/common/src/tglobal.c
source/common/src/tglobal.c
+19
-19
source/common/src/tmsg.c
source/common/src/tmsg.c
+1
-0
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+1
-0
source/dnode/mgmt/mgmt_snode/inc/smInt.h
source/dnode/mgmt/mgmt_snode/inc/smInt.h
+8
-7
source/dnode/mgmt/mgmt_snode/src/smHandle.c
source/dnode/mgmt/mgmt_snode/src/smHandle.c
+7
-7
source/dnode/mgmt/mgmt_snode/src/smInt.c
source/dnode/mgmt/mgmt_snode/src/smInt.c
+1
-0
source/dnode/mgmt/mgmt_snode/src/smWorker.c
source/dnode/mgmt/mgmt_snode/src/smWorker.c
+75
-53
source/dnode/mgmt/test/sut/inc/server.h
source/dnode/mgmt/test/sut/inc/server.h
+2
-1
source/dnode/mgmt/test/sut/src/server.cpp
source/dnode/mgmt/test/sut/src/server.cpp
+14
-4
source/dnode/mgmt/test/sut/src/sut.cpp
source/dnode/mgmt/test/sut/src/sut.cpp
+4
-1
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+2
-2
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+3
-3
source/dnode/mnode/impl/src/mndTelem.c
source/dnode/mnode/impl/src/mndTelem.c
+8
-4
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+55
-38
source/dnode/mnode/impl/test/sdb/sdbTest.cpp
source/dnode/mnode/impl/test/sdb/sdbTest.cpp
+79
-5
source/dnode/mnode/sdb/src/sdbFile.c
source/dnode/mnode/sdb/src/sdbFile.c
+0
-3
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+1
-3
source/dnode/snode/inc/sndInt.h
source/dnode/snode/inc/sndInt.h
+3
-1
source/dnode/snode/src/snode.c
source/dnode/snode/src/snode.c
+177
-167
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+8
-5
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-4
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+3
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+0
-3
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+10
-9
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+26
-37
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+8
-5
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+536
-2
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+1
-20
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+25
-24
source/libs/executor/src/cachescanoperator.c
source/libs/executor/src/cachescanoperator.c
+19
-25
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+24
-75
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+17
-27
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+53
-109
source/libs/executor/src/projectoperator.c
source/libs/executor/src/projectoperator.c
+0
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+466
-130
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+10
-9
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+1
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+4
-3
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+26
-1
source/libs/nodes/src/nodesMsgFuncs.c
source/libs/nodes/src/nodesMsgFuncs.c
+12
-1
source/libs/nodes/src/nodesTraverseFuncs.c
source/libs/nodes/src/nodesTraverseFuncs.c
+0
-207
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-0
source/libs/nodes/test/CMakeLists.txt
source/libs/nodes/test/CMakeLists.txt
+19
-12
source/libs/nodes/test/nodesCloneTest.cpp
source/libs/nodes/test/nodesCloneTest.cpp
+299
-0
source/libs/nodes/test/nodesTestMain.cpp
source/libs/nodes/test/nodesTestMain.cpp
+0
-0
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-0
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+1
-0
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+1
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+1
-0
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2759
-2753
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+18
-16
source/libs/parser/test/parTestUtil.cpp
source/libs/parser/test/parTestUtil.cpp
+4
-0
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+0
-37
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+1
-47
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+1
-0
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+2
-1
source/libs/planner/src/planner.c
source/libs/planner/src/planner.c
+0
-9
source/libs/planner/test/planTestUtil.cpp
source/libs/planner/test/planTestUtil.cpp
+5
-0
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+41
-1
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+18
-12
source/os/src/osDir.c
source/os/src/osDir.c
+1
-1
tests/parallel_test/container_build.sh
tests/parallel_test/container_build.sh
+1
-1
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+2
-0
tests/script/api/makefile
tests/script/api/makefile
+2
-3
tests/script/api/stopquery.c
tests/script/api/stopquery.c
+6
-7
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+5
-3
tests/script/test.sh
tests/script/test.sh
+7
-1
tests/script/tmp/monitor.sim
tests/script/tmp/monitor.sim
+2
-0
tests/script/tsim/dnode/split_vgroup_replica1.sim
tests/script/tsim/dnode/split_vgroup_replica1.sim
+87
-0
tests/script/tsim/dnode/split_vgroup_replica3.sim
tests/script/tsim/dnode/split_vgroup_replica3.sim
+67
-0
tests/script/tsim/insert/basic.sim
tests/script/tsim/insert/basic.sim
+1
-0
tests/script/tsim/parser/limit1_stb.sim
tests/script/tsim/parser/limit1_stb.sim
+0
-7
tests/script/tsim/parser/limit_stb.sim
tests/script/tsim/parser/limit_stb.sim
+0
-1
tests/script/tsim/stream/partitionbyColumnInterval.sim
tests/script/tsim/stream/partitionbyColumnInterval.sim
+54
-4
tests/script/tsim/stream/schedSnode.sim
tests/script/tsim/stream/schedSnode.sim
+20
-16
tests/system-test/0-others/taosdShell.py
tests/system-test/0-others/taosdShell.py
+6
-1
tests/system-test/1-insert/block_wise.py
tests/system-test/1-insert/block_wise.py
+12
-2
tests/system-test/1-insert/database_pre_suf.py
tests/system-test/1-insert/database_pre_suf.py
+1
-0
tests/system-test/1-insert/keep_expired.py
tests/system-test/1-insert/keep_expired.py
+1
-0
tests/system-test/2-query/diff.py
tests/system-test/2-query/diff.py
+11
-0
tests/system-test/2-query/elapsed.py
tests/system-test/2-query/elapsed.py
+49
-13
tests/system-test/2-query/histogram.py
tests/system-test/2-query/histogram.py
+73
-2
tests/system-test/2-query/last.py
tests/system-test/2-query/last.py
+47
-5
tests/system-test/2-query/select_index.py
tests/system-test/2-query/select_index.py
+78
-8
tests/system-test/2-query/unique.py
tests/system-test/2-query/unique.py
+4
-0
tests/system-test/7-tmq/tmqDnodeRestart.py
tests/system-test/7-tmq/tmqDnodeRestart.py
+2
-2
tests/system-test/7-tmq/tmqDnodeRestart1.py
tests/system-test/7-tmq/tmqDnodeRestart1.py
+27
-14
tests/system-test/7-tmq/tmqError.py
tests/system-test/7-tmq/tmqError.py
+54
-35
tests/system-test/7-tmq/tmqShow.py
tests/system-test/7-tmq/tmqShow.py
+2
-2
tools/CMakeLists.txt
tools/CMakeLists.txt
+21
-89
未找到文件。
Jenkinsfile2
浏览文件 @
0035bb19
...
...
@@ -173,8 +173,8 @@ def pre_test_build_mac() {
'''
sh '''
cd ${WK}/debug
cmake .. -DBUILD_TEST=true
make -j
8
cmake .. -DBUILD_TEST=true
-DBUILD_HTTPS=false
make -j
10
'''
sh '''
date
...
...
@@ -428,7 +428,7 @@ pipeline {
date
rm -rf ${WKC}/debug
cd ${WKC}/tests/parallel_test
time ./container_build.sh -w ${WKDIR} -t
8
-e
time ./container_build.sh -w ${WKDIR} -t
10
-e
rm -f /tmp/cases.task
./collect_cases.sh -e
'''
...
...
cmake/taostools_CMakeLists.txt.in
浏览文件 @
0035bb19
...
...
@@ -2,7 +2,7 @@
# taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG
f20eb34
GIT_TAG
7321fbb
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
...
...
contrib/CMakeLists.txt
浏览文件 @
0035bb19
...
...
@@ -270,7 +270,7 @@ if(${JEMALLOC_ENABLED})
PREFIX
"jemalloc"
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/jemalloc
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --prefix=
${
CMAKE_BINARY_DIR
}
/build/ --disable-initial-exec-tls
--with-malloc-conf='background_thread:true,metadata_thp:auto'
CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --prefix=
${
CMAKE_BINARY_DIR
}
/build/ --disable-initial-exec-tls
BUILD_COMMAND
${
MAKE
}
)
INCLUDE_DIRECTORIES
(
${
CMAKE_BINARY_DIR
}
/build/include
)
...
...
docs/en/14-reference/03-connector/05-go.mdx
浏览文件 @
0035bb19
...
...
@@ -353,7 +353,7 @@ The `af` package encapsulates TDengine advanced functions such as connection man
Closes
the
connection
.
####
Subscribe
to
####
Subscribe
*
`
func
NewConsumer
(
conf
*
Config
)
(*
Consumer
,
error
)`
...
...
@@ -387,7 +387,7 @@ Close consumer.
*
`
func
(
conn
*
Connector
)
InfluxDBInsertLines
(
lines
[]
string
,
precision
string
)
error
`
Write
to
i
nfluxDB
line
protocol
.
Write
to
I
nfluxDB
line
protocol
.
*
`
func
(
conn
*
Connector
)
OpenTSDBInsertTelnetLines
(
lines
[]
string
)
error
`
...
...
@@ -413,7 +413,7 @@ Close consumer.
*
`
func
(
stmt
*
InsertStmt
)
SetTableName
(
name
string
)
error
`
Bind
the
set
table
name
parameter
.
Bind
the
table
name
parameter
.
*
`
func
(
stmt
*
InsertStmt
)
SetSubTableName
(
name
string
)
error
`
...
...
@@ -463,6 +463,54 @@ Close consumer.
For
a
complete
example
see
[
GitHub
sample
file
](
https
://
github
.
com
/
taosdata
/
driver
-
go
/
blob
/
3.0
/
examples
/
tmqoverws
/
main
.
go
)
###
parameter
binding
via
WebSocket
*
`
func
NewConnector
(
config
*
Config
)
(*
Connector
,
error
)`
Create
a
connection
.
*
`
func
(
c
*
Connector
)
Init
()
(*
Stmt
,
error
)`
Initialize
the
parameters
.
*
`
func
(
c
*
Connector
)
Close
()
error
`
Close
the
connection
.
*
`
func
(
s
*
Stmt
)
Prepare
(
sql
string
)
error
`
Parameter
binding
preprocessing
SQL
statement
.
*
`
func
(
s
*
Stmt
)
SetTableName
(
name
string
)
error
`
Bind
the
table
name
parameter
.
*
`
func
(
s
*
Stmt
)
SetTags
(
tags
*
param
.
Param
,
bindType
*
param
.
ColumnType
)
error
`
Set
tags
.
*
`
func
(
s
*
Stmt
)
BindParam
(
params
[]*
param
.
Param
,
bindType
*
param
.
ColumnType
)
error
`
Parameter
bind
multiple
rows
of
data
.
*
`
func
(
s
*
Stmt
)
AddBatch
()
error
`
Add
to
a
parameter
-
bound
batch
.
*
`
func
(
s
*
Stmt
)
Exec
()
error
`
Execute
a
parameter
binding
.
*
`
func
(
s
*
Stmt
)
GetAffectedRows
()
int
`
Gets
the
number
of
affected
rows
inserted
by
the
parameter
binding
.
*
`
func
(
s
*
Stmt
)
Close
()
error
`
Closes
the
parameter
binding
.
For
a
complete
example
see
[
GitHub
sample
file
](
https
://
github
.
com
/
taosdata
/
driver
-
go
/
blob
/
3.0
/
examples
/
stmtoverws
/
main
.
go
)
##
API
Reference
Full
API
see
[
driver
-
go
documentation
](
https
://
pkg
.
go
.
dev
/
github
.
com
/
taosdata
/
driver
-
go
/
v3
)
docs/zh/08-connector/20-go.mdx
浏览文件 @
0035bb19
...
...
@@ -8,7 +8,7 @@ title: TDengine Go Connector
import
Tabs
from
'@theme/Tabs'
;
import
TabItem
from
'@theme/TabItem'
;
import
Prepar
ition
from
"./_prepari
tion.mdx"
import
Prepar
ation
from
"./_prepara
tion.mdx"
import
GoInsert
from
"../07-develop/03-insert-data/_go_sql.mdx"
import
GoInfluxLine
from
"../07-develop/03-insert-data/_go_line.mdx"
import
GoOpenTSDBTelnet
from
"../07-develop/03-insert-data/_go_opts_telnet.mdx"
...
...
@@ -389,7 +389,7 @@ func main() {
*
`
func
(
conn
*
Connector
)
InfluxDBInsertLines
(
lines
[]
string
,
precision
string
)
error
`
写入
i
nfluxDB
行协议。
写入
I
nfluxDB
行协议。
*
`
func
(
conn
*
Connector
)
OpenTSDBInsertTelnetLines
(
lines
[]
string
)
error
`
...
...
@@ -465,6 +465,54 @@ func main() {
完整订阅示例参见
[
GitHub
示例文件
](
https
://
github
.
com
/
taosdata
/
driver
-
go
/
blob
/
3.0
/
examples
/
tmqoverws
/
main
.
go
)
###
通过
WebSocket
进行参数绑定
*
`
func
NewConnector
(
config
*
Config
)
(*
Connector
,
error
)`
创建连接。
*
`
func
(
c
*
Connector
)
Init
()
(*
Stmt
,
error
)`
初始化参数。
*
`
func
(
c
*
Connector
)
Close
()
error
`
关闭连接。
*
`
func
(
s
*
Stmt
)
Prepare
(
sql
string
)
error
`
参数绑定预处理
SQL
语句。
*
`
func
(
s
*
Stmt
)
SetTableName
(
name
string
)
error
`
参数绑定设置表名。
*
`
func
(
s
*
Stmt
)
SetTags
(
tags
*
param
.
Param
,
bindType
*
param
.
ColumnType
)
error
`
参数绑定设置标签。
*
`
func
(
s
*
Stmt
)
BindParam
(
params
[]*
param
.
Param
,
bindType
*
param
.
ColumnType
)
error
`
参数绑定多行数据。
*
`
func
(
s
*
Stmt
)
AddBatch
()
error
`
添加到参数绑定批处理。
*
`
func
(
s
*
Stmt
)
Exec
()
error
`
执行参数绑定。
*
`
func
(
s
*
Stmt
)
GetAffectedRows
()
int
`
获取参数绑定插入受影响行数。
*
`
func
(
s
*
Stmt
)
Close
()
error
`
结束参数绑定。
完整参数绑定示例参见
[
GitHub
示例文件
](
https
://
github
.
com
/
taosdata
/
driver
-
go
/
blob
/
3.0
/
examples
/
stmtoverws
/
main
.
go
)
##
API
参考
全部
API
见
[
driver
-
go
文档
](
https
://
pkg
.
go
.
dev
/
github
.
com
/
taosdata
/
driver
-
go
/
v3
)
docs/zh/08-connector/26-rust.mdx
浏览文件 @
0035bb19
...
...
@@ -7,7 +7,7 @@ title: TDengine Rust Connector
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Prepar
ition from "./_prepari
tion.mdx"
import Prepar
ation from "./_prepara
tion.mdx"
import RustInsert from "../07-develop/03-insert-data/_rust_sql.mdx"
import RustBind from "../07-develop/03-insert-data/_rust_stmt.mdx"
import RustQuery from "../07-develop/04-query-data/_rust.mdx"
...
...
docs/zh/08-connector/35-node.mdx
浏览文件 @
0035bb19
...
...
@@ -7,7 +7,7 @@ title: TDengine Node.js Connector
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Prepar
ition from "./_prepari
tion.mdx";
import Prepar
ation from "./_prepara
tion.mdx";
import NodeInsert from "../07-develop/03-insert-data/_js_sql.mdx";
import NodeInfluxLine from "../07-develop/03-insert-data/_js_line.mdx";
import NodeOpenTSDBTelnet from "../07-develop/03-insert-data/_js_opts_telnet.mdx";
...
...
@@ -249,4 +249,4 @@ Node.js 连接器的使用参见[视频教程](https://www.taosdata.com/blog/202
## API 参考
[API 参考](https://docs.taosdata.com/api/td2.0-connector/)
\ No newline at end of file
[API 参考](https://docs.taosdata.com/api/td2.0-connector/)
docs/zh/08-connector/40-csharp.mdx
浏览文件 @
0035bb19
...
...
@@ -7,7 +7,7 @@ title: C# Connector
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Prepar
ition from "./_prepari
tion.mdx"
import Prepar
ation from "./_prepara
tion.mdx"
import CSInsert from "../07-develop/03-insert-data/_cs_sql.mdx"
import CSInfluxLine from "../07-develop/03-insert-data/_cs_line.mdx"
import CSOpenTSDBTelnet from "../07-develop/03-insert-data/_cs_opts_telnet.mdx"
...
...
docs/zh/08-connector/_prepar
i
tion.mdx
→
docs/zh/08-connector/_prepar
a
tion.mdx
浏览文件 @
0035bb19
文件已移动
docs/zh/12-taos-sql/24-show.md
浏览文件 @
0035bb19
...
...
@@ -201,7 +201,7 @@ SHOW TOPICS;
SHOW
TRANSACTIONS
;
```
显示当前系统中正在执行的事务的信息
显示当前系统中正在执行的事务的信息
(该事务仅针对除普通表以外的元数据级别)
## SHOW USERS
...
...
include/common/tcommon.h
浏览文件 @
0035bb19
...
...
@@ -164,6 +164,14 @@ typedef enum EStreamType {
STREAM_FILL_OVER
,
}
EStreamType
;
typedef
struct
{
SArray
*
pGroupList
;
SArray
*
pTableList
;
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
bool
needSortTableByGroupId
;
uint64_t
suid
;
}
STableListInfo
;
#pragma pack(push, 1)
typedef
struct
SColumnDataAgg
{
int16_t
colId
;
...
...
include/common/tglobal.h
浏览文件 @
0035bb19
...
...
@@ -60,8 +60,8 @@ extern int32_t tsNumOfVnodeSyncThreads;
extern
int32_t
tsNumOfVnodeRsmaThreads
;
extern
int32_t
tsNumOfQnodeQueryThreads
;
extern
int32_t
tsNumOfQnodeFetchThreads
;
extern
int32_t
tsNumOfSnodeS
hared
Threads
;
extern
int32_t
tsNumOfSnode
Uniqu
eThreads
;
extern
int32_t
tsNumOfSnodeS
tream
Threads
;
extern
int32_t
tsNumOfSnode
Writ
eThreads
;
extern
int64_t
tsRpcQueueMemoryAllowed
;
// monitor
...
...
include/common/tmsg.h
浏览文件 @
0035bb19
...
...
@@ -1726,6 +1726,9 @@ typedef struct {
#define STREAM_TRIGGER_WINDOW_CLOSE 2
#define STREAM_TRIGGER_MAX_DELAY 3
#define STREAM_DEFAULT_IGNORE_EXPIRED 0
#define STREAM_FILL_HISTORY_ON 1
#define STREAM_FILL_HISTORY_OFF 0
#define STREAM_DEFAULT_FILL_HISTORY STREAM_FILL_HISTORY_OFF
typedef
struct
{
char
name
[
TSDB_STREAM_FNAME_LEN
];
...
...
include/common/ttokendef.h
浏览文件 @
0035bb19
...
...
@@ -203,135 +203,136 @@
#define TK_WINDOW_CLOSE 185
#define TK_IGNORE 186
#define TK_EXPIRED 187
#define TK_SUBTABLE 188
#define TK_KILL 189
#define TK_CONNECTION 190
#define TK_TRANSACTION 191
#define TK_BALANCE 192
#define TK_VGROUP 193
#define TK_MERGE 194
#define TK_REDISTRIBUTE 195
#define TK_SPLIT 196
#define TK_DELETE 197
#define TK_INSERT 198
#define TK_NULL 199
#define TK_NK_QUESTION 200
#define TK_NK_ARROW 201
#define TK_ROWTS 202
#define TK_TBNAME 203
#define TK_QSTART 204
#define TK_QEND 205
#define TK_QDURATION 206
#define TK_WSTART 207
#define TK_WEND 208
#define TK_WDURATION 209
#define TK_IROWTS 210
#define TK_QTAGS 211
#define TK_CAST 212
#define TK_NOW 213
#define TK_TODAY 214
#define TK_TIMEZONE 215
#define TK_CLIENT_VERSION 216
#define TK_SERVER_VERSION 217
#define TK_SERVER_STATUS 218
#define TK_CURRENT_USER 219
#define TK_COUNT 220
#define TK_LAST_ROW 221
#define TK_CASE 222
#define TK_END 223
#define TK_WHEN 224
#define TK_THEN 225
#define TK_ELSE 226
#define TK_BETWEEN 227
#define TK_IS 228
#define TK_NK_LT 229
#define TK_NK_GT 230
#define TK_NK_LE 231
#define TK_NK_GE 232
#define TK_NK_NE 233
#define TK_MATCH 234
#define TK_NMATCH 235
#define TK_CONTAINS 236
#define TK_IN 237
#define TK_JOIN 238
#define TK_INNER 239
#define TK_SELECT 240
#define TK_DISTINCT 241
#define TK_WHERE 242
#define TK_PARTITION 243
#define TK_BY 244
#define TK_SESSION 245
#define TK_STATE_WINDOW 246
#define TK_SLIDING 247
#define TK_FILL 248
#define TK_VALUE 249
#define TK_NONE 250
#define TK_PREV 251
#define TK_LINEAR 252
#define TK_NEXT 253
#define TK_HAVING 254
#define TK_RANGE 255
#define TK_EVERY 256
#define TK_ORDER 257
#define TK_SLIMIT 258
#define TK_SOFFSET 259
#define TK_LIMIT 260
#define TK_OFFSET 261
#define TK_ASC 262
#define TK_NULLS 263
#define TK_ABORT 264
#define TK_AFTER 265
#define TK_ATTACH 266
#define TK_BEFORE 267
#define TK_BEGIN 268
#define TK_BITAND 269
#define TK_BITNOT 270
#define TK_BITOR 271
#define TK_BLOCKS 272
#define TK_CHANGE 273
#define TK_COMMA 274
#define TK_COMPACT 275
#define TK_CONCAT 276
#define TK_CONFLICT 277
#define TK_COPY 278
#define TK_DEFERRED 279
#define TK_DELIMITERS 280
#define TK_DETACH 281
#define TK_DIVIDE 282
#define TK_DOT 283
#define TK_EACH 284
#define TK_FAIL 285
#define TK_FILE 286
#define TK_FOR 287
#define TK_GLOB 288
#define TK_ID 289
#define TK_IMMEDIATE 290
#define TK_IMPORT 291
#define TK_INITIALLY 292
#define TK_INSTEAD 293
#define TK_ISNULL 294
#define TK_KEY 295
#define TK_MODULES 296
#define TK_NK_BITNOT 297
#define TK_NK_SEMI 298
#define TK_NOTNULL 299
#define TK_OF 300
#define TK_PLUS 301
#define TK_PRIVILEGE 302
#define TK_RAISE 303
#define TK_REPLACE 304
#define TK_RESTRICT 305
#define TK_ROW 306
#define TK_SEMI 307
#define TK_STAR 308
#define TK_STATEMENT 309
#define TK_STRING 310
#define TK_TIMES 311
#define TK_UPDATE 312
#define TK_VALUES 313
#define TK_VARIABLE 314
#define TK_VIEW 315
#define TK_WAL 316
#define TK_FILL_HISTORY 188
#define TK_SUBTABLE 189
#define TK_KILL 190
#define TK_CONNECTION 191
#define TK_TRANSACTION 192
#define TK_BALANCE 193
#define TK_VGROUP 194
#define TK_MERGE 195
#define TK_REDISTRIBUTE 196
#define TK_SPLIT 197
#define TK_DELETE 198
#define TK_INSERT 199
#define TK_NULL 200
#define TK_NK_QUESTION 201
#define TK_NK_ARROW 202
#define TK_ROWTS 203
#define TK_TBNAME 204
#define TK_QSTART 205
#define TK_QEND 206
#define TK_QDURATION 207
#define TK_WSTART 208
#define TK_WEND 209
#define TK_WDURATION 210
#define TK_IROWTS 211
#define TK_QTAGS 212
#define TK_CAST 213
#define TK_NOW 214
#define TK_TODAY 215
#define TK_TIMEZONE 216
#define TK_CLIENT_VERSION 217
#define TK_SERVER_VERSION 218
#define TK_SERVER_STATUS 219
#define TK_CURRENT_USER 220
#define TK_COUNT 221
#define TK_LAST_ROW 222
#define TK_CASE 223
#define TK_END 224
#define TK_WHEN 225
#define TK_THEN 226
#define TK_ELSE 227
#define TK_BETWEEN 228
#define TK_IS 229
#define TK_NK_LT 230
#define TK_NK_GT 231
#define TK_NK_LE 232
#define TK_NK_GE 233
#define TK_NK_NE 234
#define TK_MATCH 235
#define TK_NMATCH 236
#define TK_CONTAINS 237
#define TK_IN 238
#define TK_JOIN 239
#define TK_INNER 240
#define TK_SELECT 241
#define TK_DISTINCT 242
#define TK_WHERE 243
#define TK_PARTITION 244
#define TK_BY 245
#define TK_SESSION 246
#define TK_STATE_WINDOW 247
#define TK_SLIDING 248
#define TK_FILL 249
#define TK_VALUE 250
#define TK_NONE 251
#define TK_PREV 252
#define TK_LINEAR 253
#define TK_NEXT 254
#define TK_HAVING 255
#define TK_RANGE 256
#define TK_EVERY 257
#define TK_ORDER 258
#define TK_SLIMIT 259
#define TK_SOFFSET 260
#define TK_LIMIT 261
#define TK_OFFSET 262
#define TK_ASC 263
#define TK_NULLS 264
#define TK_ABORT 265
#define TK_AFTER 266
#define TK_ATTACH 267
#define TK_BEFORE 268
#define TK_BEGIN 269
#define TK_BITAND 270
#define TK_BITNOT 271
#define TK_BITOR 272
#define TK_BLOCKS 273
#define TK_CHANGE 274
#define TK_COMMA 275
#define TK_COMPACT 276
#define TK_CONCAT 277
#define TK_CONFLICT 278
#define TK_COPY 279
#define TK_DEFERRED 280
#define TK_DELIMITERS 281
#define TK_DETACH 282
#define TK_DIVIDE 283
#define TK_DOT 284
#define TK_EACH 285
#define TK_FAIL 286
#define TK_FILE 287
#define TK_FOR 288
#define TK_GLOB 289
#define TK_ID 290
#define TK_IMMEDIATE 291
#define TK_IMPORT 292
#define TK_INITIALLY 293
#define TK_INSTEAD 294
#define TK_ISNULL 295
#define TK_KEY 296
#define TK_MODULES 297
#define TK_NK_BITNOT 298
#define TK_NK_SEMI 299
#define TK_NOTNULL 300
#define TK_OF 301
#define TK_PLUS 302
#define TK_PRIVILEGE 303
#define TK_RAISE 304
#define TK_REPLACE 305
#define TK_RESTRICT 306
#define TK_ROW 307
#define TK_SEMI 308
#define TK_STAR 309
#define TK_STATEMENT 310
#define TK_STRING 311
#define TK_TIMES 312
#define TK_UPDATE 313
#define TK_VALUES 314
#define TK_VARIABLE 315
#define TK_VIEW 316
#define TK_WAL 317
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
...
...
include/dnode/snode/snode.h
浏览文件 @
0035bb19
...
...
@@ -68,8 +68,8 @@ int32_t sndGetLoad(SSnode *pSnode, SSnodeLoad *pLoad);
* @param pMsg The request message
* @param pRsp The response message
*/
int32_t
sndProcess
UMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
);
int32_t
sndProcessSMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
);
int32_t
sndProcess
WriteMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
);
int32_t
sndProcessS
tream
Msg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
include/libs/catalog/catalog.h
浏览文件 @
0035bb19
...
...
@@ -203,6 +203,14 @@ int32_t catalogUpdateTableMeta(SCatalog* pCatalog, STableMetaRsp* rspMsg);
int32_t
catalogUpdateTableMeta
(
SCatalog
*
pCatalog
,
STableMetaRsp
*
rspMsg
);
int32_t
catalogGetCachedTableMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogGetCachedSTableMeta
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
);
int32_t
catalogGetCachedTableHashVgroup
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
SName
*
pTableName
,
SVgroupInfo
*
pVgroup
,
bool
*
exists
);
/**
* Force refresh DB's local cached vgroup info.
* @param pCtg (input, got with catalogGetHandle)
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
0035bb19
...
...
@@ -374,6 +374,7 @@ typedef struct SStreamOptions {
int8_t
triggerType
;
SNode
*
pDelay
;
SNode
*
pWatermark
;
int8_t
fillHistory
;
int8_t
ignoreExpired
;
}
SStreamOptions
;
...
...
include/libs/nodes/plannodes.h
浏览文件 @
0035bb19
...
...
@@ -567,6 +567,7 @@ typedef struct SSubplan {
SDataSinkNode
*
pDataSink
;
// data of the subplan flow into the datasink
SNode
*
pTagCond
;
SNode
*
pTagIndexCond
;
bool
showRewrite
;
}
SSubplan
;
typedef
enum
EExplainMode
{
EXPLAIN_MODE_DISABLE
=
1
,
EXPLAIN_MODE_STATIC
,
EXPLAIN_MODE_ANALYZE
}
EExplainMode
;
...
...
@@ -585,8 +586,6 @@ typedef struct SQueryPlan {
SExplainInfo
explainInfo
;
}
SQueryPlan
;
void
nodesWalkPhysiPlan
(
SNode
*
pNode
,
FNodeWalker
walker
,
void
*
pContext
);
const
char
*
dataOrderStr
(
EDataOrderLevel
order
);
#ifdef __cplusplus
...
...
include/libs/planner/planner.h
浏览文件 @
0035bb19
...
...
@@ -61,7 +61,6 @@ int32_t qStringToSubplan(const char* pStr, SSubplan** pSubplan);
int32_t
qSubPlanToMsg
(
const
SSubplan
*
pSubplan
,
char
**
pStr
,
int32_t
*
pLen
);
int32_t
qMsgToSubplan
(
const
char
*
pStr
,
int32_t
len
,
SSubplan
**
pSubplan
);
char
*
qQueryPlanToString
(
const
SQueryPlan
*
pPlan
);
SQueryPlan
*
qStringToQueryPlan
(
const
char
*
pStr
);
void
qDestroyQueryPlan
(
SQueryPlan
*
pPlan
);
...
...
include/libs/stream/streamState.h
浏览文件 @
0035bb19
...
...
@@ -99,6 +99,8 @@ int32_t streamStateSeekLast(SStreamState* pState, SStreamStateCur* pCur);
int32_t
streamStateCurNext
(
SStreamState
*
pState
,
SStreamStateCur
*
pCur
);
int32_t
streamStateCurPrev
(
SStreamState
*
pState
,
SStreamStateCur
*
pCur
);
// char* streamStateSessionDump(SStreamState* pState);
#ifdef __cplusplus
}
#endif
...
...
packaging/cfg/taos.cfg
浏览文件 @
0035bb19
...
...
@@ -5,42 +5,50 @@
# #
########################################################
# The end point of the first dnode in the cluster to be connected to when `taosd` or `taos` is started
######### 0. Client only configurations #############
# The interval for TDengine CLI to send heartbeat to mnode
# shellActivityTimer 3
############### 1. Cluster End point ############################
# The end point of the first dnode in the cluster to be connected to when this dnode or a TDengine CLI `taos` is started
# firstEp hostname:6030
# The end point of the second dnode to be connected to if the firstEp is not available
when `taosd` or `taos` is started
# The end point of the second dnode to be connected to if the firstEp is not available
# secondEp
# The FQDN of the host where `taosd` will be started. It can be IP address
############### 2. Configuration Parameters of current dnode #####
# The FQDN of the host on which this dnode will be started. It can be IP address
# fqdn hostname
# The port for external access after
`taosd`
is started
# The port for external access after
this dnode
is started
# serverPort 6030
# The maximum number of connections a dnode can accept
# maxShellConns 5000
# maxShellConns
5000
# The directory for writing log files
# The directory for writing log files
, if you are using Windows platform please change to Windows path
# logDir /var/log/taos
# All data files are stored in this directory
# All data files are stored in this directory
, if you are using Windows platform please change to Windows path
# dataDir /var/lib/taos
# temporary file's directory
# temporary file's directory
, if you are using Windows platform please change to Windows path
# tempDir /tmp/
# Switch for allowing TDengine to collect and report service usage information
# telemetryReporting 1
# The maximum number of vnodes supported by dnode
# The maximum number of vnodes supported by
this
dnode
# supportVnodes 0
# The interval of
dnode reporting status to mnode
# The interval of
this dnode reporting status to mnode, [1..10] seconds
# statusInterval 1
# The interval for TDengine CLI to send heartbeat to mnode
# shellActivityTimer 3
# The minimum sliding window time, milli-second
# minSlidingTime 10
...
...
@@ -66,13 +74,14 @@
# system time zone
# timezone Asia/Shanghai (CST, +0800)
# system time zone (for windows 10)
# timezone UTC-8
# system locale
# locale en_US.UTF-8
#
default
system charset
# system charset
# charset UTF-8
# stop writing logs when the disk size of the log folder is less than this value
...
...
@@ -81,7 +90,7 @@
# stop writing temporary files when the disk size of the tmp folder is less than this value
# minimalTmpDirGB 1.0
# if
disk free space is less than this value, taosd service exit directly within startup process
# if
free disk space is less than this value, this dnode will fail to start
# minimalDataDirGB 2.0
# enable/disable system monitor
...
...
@@ -91,14 +100,18 @@
# max number of lines per log filters
# numOfLogLines 10000000
#
enable/disable async log
#
write log in async way: 1 - async, 0 - sync
# asyncLog 1
# time
of keeping log files,
days
# time
period of keeping log files, in
days
# logKeepDays 0
# The following parameters are used for debug purpose only.
# debugFlag 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
############ 3. Debug Flag and levels #############################################
# The following parameters are used for debug purpose only by this dnode.
# debugFlag is a 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
# Available debug levels are:
# 131: output warning and error
# 135: output debug, warning and error
# 143: output trace, debug, warning and error to log
...
...
@@ -166,4 +179,4 @@
# metaDebugFlag 131
# generate core file when service crash
# enableCoreFile 1
# enableCoreFile 1
\ No newline at end of file
source/common/src/tglobal.c
浏览文件 @
0035bb19
...
...
@@ -55,8 +55,8 @@ int32_t tsNumOfVnodeSyncThreads = 2;
int32_t
tsNumOfVnodeRsmaThreads
=
2
;
int32_t
tsNumOfQnodeQueryThreads
=
4
;
int32_t
tsNumOfQnodeFetchThreads
=
1
;
int32_t
tsNumOfSnodeS
haredThreads
=
2
;
int32_t
tsNumOfSnode
UniqueThreads
=
2
;
int32_t
tsNumOfSnodeS
treamThreads
=
4
;
int32_t
tsNumOfSnode
WriteThreads
=
1
;
// monitor
bool
tsEnableMonitor
=
true
;
...
...
@@ -133,7 +133,7 @@ int32_t tsDiskCfgNum = 0;
SDiskCfg
tsDiskCfg
[
TFS_MAX_DISKS
]
=
{
0
};
// stream scheduler
bool
ts
SchedStreamTo
Snode
=
true
;
bool
ts
DeployOn
Snode
=
true
;
/*
* minimum scale for whole system, millisecond by default
...
...
@@ -390,13 +390,13 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
// tsNumOfQnodeFetchThreads = TMAX(tsNumOfQnodeFetchThreads, 4);
// if (cfgAddInt32(pCfg, "numOfQnodeFetchThreads", tsNumOfQnodeFetchThreads, 1, 1024, 0) != 0) return -1;
tsNumOfSnodeS
hared
Threads
=
tsNumOfCores
/
4
;
tsNumOfSnodeS
haredThreads
=
TRANGE
(
tsNumOfSnodeShared
Threads
,
2
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfSnodeSharedThreads"
,
tsNumOfSnodeS
hared
Threads
,
2
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfSnodeS
tream
Threads
=
tsNumOfCores
/
4
;
tsNumOfSnodeS
treamThreads
=
TRANGE
(
tsNumOfSnodeStream
Threads
,
2
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfSnodeSharedThreads"
,
tsNumOfSnodeS
tream
Threads
,
2
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfSnode
Uniqu
eThreads
=
tsNumOfCores
/
4
;
tsNumOfSnode
UniqueThreads
=
TRANGE
(
tsNumOfSnodeUniqu
eThreads
,
2
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfSnodeUniqueThreads"
,
tsNumOfSnode
Uniqu
eThreads
,
2
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfSnode
Writ
eThreads
=
tsNumOfCores
/
4
;
tsNumOfSnode
WriteThreads
=
TRANGE
(
tsNumOfSnodeWrit
eThreads
,
2
,
4
);
if
(
cfgAddInt32
(
pCfg
,
"numOfSnodeUniqueThreads"
,
tsNumOfSnode
Writ
eThreads
,
2
,
1024
,
0
)
!=
0
)
return
-
1
;
tsRpcQueueMemoryAllowed
=
tsTotalMemoryKB
*
1024
*
0
.
1
;
tsRpcQueueMemoryAllowed
=
TRANGE
(
tsRpcQueueMemoryAllowed
,
TSDB_MAX_MSG_SIZE
*
10LL
,
TSDB_MAX_MSG_SIZE
*
10000LL
);
...
...
@@ -542,17 +542,17 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem
=
cfgGetItem
(
tsCfg
,
"numOfSnodeSharedThreads"
);
if
(
pItem
!=
NULL
&&
pItem
->
stype
==
CFG_STYPE_DEFAULT
)
{
tsNumOfSnodeS
hared
Threads
=
numOfCores
/
4
;
tsNumOfSnodeS
haredThreads
=
TRANGE
(
tsNumOfSnodeShared
Threads
,
2
,
4
);
pItem
->
i32
=
tsNumOfSnodeS
hared
Threads
;
tsNumOfSnodeS
tream
Threads
=
numOfCores
/
4
;
tsNumOfSnodeS
treamThreads
=
TRANGE
(
tsNumOfSnodeStream
Threads
,
2
,
4
);
pItem
->
i32
=
tsNumOfSnodeS
tream
Threads
;
pItem
->
stype
=
stype
;
}
pItem
=
cfgGetItem
(
tsCfg
,
"numOfSnodeUniqueThreads"
);
if
(
pItem
!=
NULL
&&
pItem
->
stype
==
CFG_STYPE_DEFAULT
)
{
tsNumOfSnode
Uniqu
eThreads
=
numOfCores
/
4
;
tsNumOfSnode
UniqueThreads
=
TRANGE
(
tsNumOfSnodeUniqu
eThreads
,
2
,
4
);
pItem
->
i32
=
tsNumOfSnode
Uniqu
eThreads
;
tsNumOfSnode
Writ
eThreads
=
numOfCores
/
4
;
tsNumOfSnode
WriteThreads
=
TRANGE
(
tsNumOfSnodeWrit
eThreads
,
2
,
4
);
pItem
->
i32
=
tsNumOfSnode
Writ
eThreads
;
pItem
->
stype
=
stype
;
}
...
...
@@ -696,8 +696,8 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsNumOfVnodeRsmaThreads
=
cfgGetItem
(
pCfg
,
"numOfVnodeRsmaThreads"
)
->
i32
;
tsNumOfQnodeQueryThreads
=
cfgGetItem
(
pCfg
,
"numOfQnodeQueryThreads"
)
->
i32
;
// tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
tsNumOfSnodeS
hared
Threads
=
cfgGetItem
(
pCfg
,
"numOfSnodeSharedThreads"
)
->
i32
;
tsNumOfSnode
Uniqu
eThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeUniqueThreads"
)
->
i32
;
tsNumOfSnodeS
tream
Threads
=
cfgGetItem
(
pCfg
,
"numOfSnodeSharedThreads"
)
->
i32
;
tsNumOfSnode
Writ
eThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeUniqueThreads"
)
->
i32
;
tsRpcQueueMemoryAllowed
=
cfgGetItem
(
pCfg
,
"rpcQueueMemoryAllowed"
)
->
i64
;
tsEnableMonitor
=
cfgGetItem
(
pCfg
,
"monitor"
)
->
bval
;
...
...
@@ -946,9 +946,9 @@ int32_t taosSetCfg(SConfig *pCfg, char *name) {
tsNumOfQnodeFetchThreads = cfgGetItem(pCfg, "numOfQnodeFetchThreads")->i32;
*/
}
else
if
(
strcasecmp
(
"numOfSnodeSharedThreads"
,
name
)
==
0
)
{
tsNumOfSnodeS
hared
Threads
=
cfgGetItem
(
pCfg
,
"numOfSnodeSharedThreads"
)
->
i32
;
tsNumOfSnodeS
tream
Threads
=
cfgGetItem
(
pCfg
,
"numOfSnodeSharedThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfSnodeUniqueThreads"
,
name
)
==
0
)
{
tsNumOfSnode
Uniqu
eThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeUniqueThreads"
)
->
i32
;
tsNumOfSnode
Writ
eThreads
=
cfgGetItem
(
pCfg
,
"numOfSnodeUniqueThreads"
)
->
i32
;
}
else
if
(
strcasecmp
(
"numOfLogLines"
,
name
)
==
0
)
{
tsNumOfLogLines
=
cfgGetItem
(
pCfg
,
"numOfLogLines"
)
->
i32
;
}
...
...
source/common/src/tmsg.c
浏览文件 @
0035bb19
...
...
@@ -4996,6 +4996,7 @@ int32_t tDeserializeSMRecoverStreamReq(void *buf, int32_t bufLen, SMRecoverStrea
}
void
tFreeSCMCreateStreamReq
(
SCMCreateStreamReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pTags
);
taosMemoryFreeClear
(
pReq
->
sql
);
taosMemoryFreeClear
(
pReq
->
ast
);
}
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
0035bb19
...
...
@@ -124,6 +124,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_VGROUP_LIST
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_REDISTRIBUTE_VGROUP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_MERGE_VGROUP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_SPLIT_VGROUP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_BALANCE_VGROUP
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_FUNC
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_RETRIEVE_FUNC
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_snode/inc/smInt.h
浏览文件 @
0035bb19
...
...
@@ -30,9 +30,9 @@ typedef struct SSnodeMgmt {
SMsgCb
msgCb
;
const
char
*
path
;
const
char
*
name
;
int8_t
uniqu
eWorkerInUse
;
SArray
*
uniqueWorkers
;
// SArray<SMultiWorker*>
SSingleWorker
s
hared
Worker
;
int8_t
writ
eWorkerInUse
;
SArray
*
writeWroker
;
// SArray<SMultiWorker*>
SSingleWorker
s
tream
Worker
;
}
SSnodeMgmt
;
// smHandle.c
...
...
@@ -43,13 +43,14 @@ int32_t smProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg);
// smWorker.c
int32_t
smStartWorker
(
SSnodeMgmt
*
pMgmt
);
void
smStopWorker
(
SSnodeMgmt
*
pMgmt
);
int32_t
smPutMsgToQueue
(
SSnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
);
int32_t
smPutNodeMsgToMgmtQueue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
smPutNodeMsgTo
Uniqu
eQueue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
smPutNodeMsgToS
hared
Queue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
smPutNodeMsgToExecQueue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
smPutNodeMsgTo
Writ
eQueue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
smPutNodeMsgToS
tream
Queue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
void
sndEnqueueStreamDispatch
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_DND_SNODE_INT_H_*/
\ No newline at end of file
#endif
/*_TD_DND_SNODE_INT_H_*/
source/dnode/mgmt/mgmt_snode/src/smHandle.c
浏览文件 @
0035bb19
...
...
@@ -69,13 +69,13 @@ SArray *smGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DEPLOY
,
smPutNodeMsgToMgmtQueue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DROP
,
smPutNodeMsgToMgmtQueue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_RUN
,
smPutNodeMsgToS
hared
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DISPATCH
,
smPutNodeMsgToS
hared
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DISPATCH_RSP
,
smPutNodeMsgToS
hared
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_RECOVER
,
smPutNodeMsgToS
hared
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_RECOVER_RSP
,
smPutNodeMsgToS
hared
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_RETRIEVE
,
smPutNodeMsgToS
hared
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_RETRIEVE_RSP
,
smPutNodeMsgToS
hared
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_RUN
,
smPutNodeMsgToS
tream
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DISPATCH
,
smPutNodeMsgToS
tream
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_DISPATCH_RSP
,
smPutNodeMsgToS
tream
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_RECOVER
,
smPutNodeMsgToS
tream
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_TASK_RECOVER_RSP
,
smPutNodeMsgToS
tream
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_RETRIEVE
,
smPutNodeMsgToS
tream
Queue
,
1
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_STREAM_RETRIEVE_RSP
,
smPutNodeMsgToS
tream
Queue
,
1
)
==
NULL
)
goto
_OVER
;
code
=
0
;
_OVER:
...
...
source/dnode/mgmt/mgmt_snode/src/smInt.c
浏览文件 @
0035bb19
...
...
@@ -45,6 +45,7 @@ int32_t smOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
pMgmt
->
msgCb
.
putToQueueFp
=
(
PutToQueueFp
)
smPutMsgToQueue
;
SSnodeOpt
option
=
{
0
};
smInitOption
(
pMgmt
,
&
option
);
...
...
source/dnode/mgmt/mgmt_snode/src/smWorker.c
浏览文件 @
0035bb19
...
...
@@ -26,18 +26,24 @@ static inline void smSendRsp(SRpcMsg *pMsg, int32_t code) {
tmsgSendRsp
(
&
rsp
);
}
static
void
smProcess
Uniqu
eQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
smProcess
Writ
eQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SRpcMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"msg:%p, get from snode-unique queue"
,
pMsg
);
if
(
sndProcessUMsg
(
pMgmt
->
pSnode
,
pMsg
)
<
0
)
{
ASSERT
(
0
);
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
dTrace
(
"msg:%p, get from snode-write queue"
,
pMsg
);
int32_t
code
=
sndProcessWriteMsg
(
pMgmt
->
pSnode
,
pMsg
,
NULL
);
if
(
code
<
0
)
{
dGError
(
"snd, msg:%p failed to process write since %s"
,
pMsg
,
terrstr
(
code
));
if
(
pMsg
->
info
.
handle
!=
NULL
)
{
tmsgSendRsp
(
pMsg
);
}
}
else
{
smSendRsp
(
pMsg
,
0
);
}
smSendRsp
(
pMsg
,
0
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
...
...
@@ -45,13 +51,15 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
}
}
static
void
smProcessSharedQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
static
void
smProcessStreamQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
dTrace
(
"msg:%p, get from snode-shared queue"
,
pMsg
);
if
(
sndProcessSMsg
(
pMgmt
->
pSnode
,
pMsg
)
<
0
)
{
dTrace
(
"msg:%p, get from snode-stream queue"
,
pMsg
);
int32_t
code
=
sndProcessStreamMsg
(
pMgmt
->
pSnode
,
pMsg
);
if
(
code
<
0
)
{
dGError
(
"snd, msg:%p failed to process stream since %s"
,
pMsg
,
terrstr
(
code
));
smSendRsp
(
pMsg
,
terrno
);
ASSERT
(
0
);
}
dTrace
(
"msg:%p, is freed"
,
pMsg
);
...
...
@@ -60,44 +68,44 @@ static void smProcessSharedQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
}
int32_t
smStartWorker
(
SSnodeMgmt
*
pMgmt
)
{
pMgmt
->
uniqueWorkers
=
taosArrayInit
(
0
,
sizeof
(
SMultiWorker
*
));
if
(
pMgmt
->
uniqueWorkers
==
NULL
)
{
pMgmt
->
writeWroker
=
taosArrayInit
(
0
,
sizeof
(
SMultiWorker
*
));
if
(
pMgmt
->
writeWroker
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
tsNumOfSnode
Uniqu
eThreads
;
i
++
)
{
SMultiWorker
*
p
Uniqu
eWorker
=
taosMemoryMalloc
(
sizeof
(
SMultiWorker
));
if
(
p
Uniqu
eWorker
==
NULL
)
{
for
(
int32_t
i
=
0
;
i
<
tsNumOfSnode
Writ
eThreads
;
i
++
)
{
SMultiWorker
*
p
Writ
eWorker
=
taosMemoryMalloc
(
sizeof
(
SMultiWorker
));
if
(
p
Writ
eWorker
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
SMultiWorkerCfg
cfg
=
{
.
max
=
1
,
.
name
=
"snode-
uniqu
e"
,
.
fp
=
smProcess
Uniqu
eQueue
,
.
name
=
"snode-
writ
e"
,
.
fp
=
smProcess
Writ
eQueue
,
.
param
=
pMgmt
,
};
if
(
tMultiWorkerInit
(
p
Uniqu
eWorker
,
&
cfg
)
!=
0
)
{
if
(
tMultiWorkerInit
(
p
Writ
eWorker
,
&
cfg
)
!=
0
)
{
dError
(
"failed to start snode-unique worker since %s"
,
terrstr
());
return
-
1
;
}
if
(
taosArrayPush
(
pMgmt
->
uniqueWorkers
,
&
pUniqu
eWorker
)
==
NULL
)
{
if
(
taosArrayPush
(
pMgmt
->
writeWroker
,
&
pWrit
eWorker
)
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
}
SSingleWorkerCfg
cfg
=
{
.
min
=
tsNumOfSnodeS
hared
Threads
,
.
max
=
tsNumOfSnodeS
hared
Threads
,
.
name
=
"snode-s
hared
"
,
.
fp
=
(
FItem
)
smProcessS
hared
Queue
,
.
min
=
tsNumOfSnodeS
tream
Threads
,
.
max
=
tsNumOfSnodeS
tream
Threads
,
.
name
=
"snode-s
tream
"
,
.
fp
=
(
FItem
)
smProcessS
tream
Queue
,
.
param
=
pMgmt
,
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
s
hared
Worker
,
&
cfg
))
{
if
(
tSingleWorkerInit
(
&
pMgmt
->
s
tream
Worker
,
&
cfg
))
{
dError
(
"failed to start snode shared-worker since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -107,30 +115,50 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
}
void
smStopWorker
(
SSnodeMgmt
*
pMgmt
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pMgmt
->
uniqueWorkers
);
i
++
)
{
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
i
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pMgmt
->
writeWroker
);
i
++
)
{
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
writeWroker
,
i
);
tMultiWorkerCleanup
(
pWorker
);
}
taosArrayDestroy
(
pMgmt
->
uniqueWorkers
);
tSingleWorkerCleanup
(
&
pMgmt
->
s
hared
Worker
);
taosArrayDestroy
(
pMgmt
->
writeWroker
);
tSingleWorkerCleanup
(
&
pMgmt
->
s
tream
Worker
);
dDebug
(
"snode workers are closed"
);
}
static
FORCE_INLINE
int32_t
smGetSWIdFromMsg
(
SRpcMsg
*
pMsg
)
{
SMsgHead
*
pHead
=
pMsg
->
pCont
;
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
return
pHead
->
vgId
%
tsNumOfSnodeUniqueThreads
;
}
int32_t
smPutMsgToQueue
(
SSnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
)
{
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
if
(
pMsg
==
NULL
)
{
rpcFreeCont
(
pRpc
->
pCont
);
pRpc
->
pCont
=
NULL
;
return
-
1
;
}
SSnode
*
pSnode
=
pMgmt
->
pSnode
;
if
(
pSnode
==
NULL
)
{
dError
(
"snode: msg:%p failed to put into vnode queue since %s, type:%s qtype:%d"
,
pMsg
,
terrstr
(),
TMSG_INFO
(
pMsg
->
msgType
),
qtype
);
return
-
1
;
}
static
FORCE_INLINE
int32_t
smGetSWTypeFromMsg
(
SRpcMsg
*
pMsg
)
{
/*SMsgHead *pHead = pMsg->pCont;*/
/*pHead->workerType = htonl(pHead->workerType);*/
/*return pHead->workerType;*/
SMsgHead
*
pHead
=
pRpc
->
pCont
;
pHead
->
contLen
=
htonl
(
pHead
->
contLen
);
pHead
->
vgId
=
SNODE_HANDLE
;
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
switch
(
qtype
)
{
case
STREAM_QUEUE
:
smPutNodeMsgToStreamQueue
(
pMgmt
,
pMsg
);
break
;
case
WRITE_QUEUE
:
smPutNodeMsgToWriteQueue
(
pMgmt
,
pMsg
);
break
;
default:
ASSERT
(
0
);
}
return
0
;
}
int32_t
smPutNodeMsgToMgmtQueue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
0
);
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
writeWroker
,
0
);
if
(
pWorker
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
...
...
@@ -141,9 +169,8 @@ int32_t smPutNodeMsgToMgmtQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
0
;
}
int32_t
smPutNodeMsgToUniqueQueue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
index
=
smGetSWIdFromMsg
(
pMsg
);
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
index
);
int32_t
smPutNodeMsgToWriteQueue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
writeWroker
,
0
);
if
(
pWorker
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
...
...
@@ -154,19 +181,14 @@ int32_t smPutNodeMsgToUniqueQueue(SSnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
0
;
}
int32_t
smPutNodeMsgToS
hared
Queue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SSingleWorker
*
pWorker
=
&
pMgmt
->
s
hared
Worker
;
int32_t
smPutNodeMsgToS
tream
Queue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SSingleWorker
*
pWorker
=
&
pMgmt
->
s
tream
Worker
;
dTrace
(
"msg:%p, put into worker %s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
int32_t
smPutNodeMsgToExecQueue
(
SSnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
workerType
=
smGetSWTypeFromMsg
(
pMsg
);
if
(
workerType
==
SND_WORKER_TYPE__SHARED
)
{
return
smPutNodeMsgToSharedQueue
(
pMgmt
,
pMsg
);
if
(
pMsg
->
msgType
==
TDMT_STREAM_TASK_DISPATCH
)
{
sndEnqueueStreamDispatch
(
pMgmt
->
pSnode
,
pMsg
);
}
else
{
return
smPutNodeMsgToUniqueQueue
(
pMgmt
,
pMsg
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
}
return
0
;
}
source/dnode/mgmt/test/sut/inc/server.h
浏览文件 @
0035bb19
...
...
@@ -20,7 +20,8 @@ class TestServer {
public:
bool
Start
();
void
Stop
();
bool
runnning
;
private:
TdThread
threadId
;
};
...
...
source/dnode/mgmt/test/sut/src/server.cpp
浏览文件 @
0035bb19
...
...
@@ -16,8 +16,18 @@
#include "sut.h"
void
*
serverLoop
(
void
*
param
)
{
dmInit
();
dmRun
();
TestServer
*
server
=
(
TestServer
*
)
param
;
server
->
runnning
=
false
;
if
(
dmInit
()
!=
0
)
{
return
NULL
;
}
server
->
runnning
=
true
;
if
(
dmRun
()
!=
0
)
{
return
NULL
;
}
dmCleanup
();
return
NULL
;
}
...
...
@@ -26,10 +36,10 @@ bool TestServer::Start() {
TdThreadAttr
thAttr
;
taosThreadAttrInit
(
&
thAttr
);
taosThreadAttrSetDetachState
(
&
thAttr
,
PTHREAD_CREATE_JOINABLE
);
taosThreadCreate
(
&
threadId
,
&
thAttr
,
serverLoop
,
NULL
);
taosThreadCreate
(
&
threadId
,
&
thAttr
,
serverLoop
,
this
);
taosThreadAttrDestroy
(
&
thAttr
);
taosMsleep
(
2100
);
return
true
;
return
runnning
;
}
void
TestServer
::
Stop
()
{
...
...
source/dnode/mgmt/test/sut/src/sut.cpp
浏览文件 @
0035bb19
...
...
@@ -53,7 +53,10 @@ void Testbase::Init(const char* path, int16_t port) {
taosMkDir
(
path
);
InitLog
(
TD_TMP_DIR_PATH
"td"
);
server
.
Start
();
if
(
!
server
.
Start
())
{
printf
(
"failed to start server, exit
\n
"
);
exit
(
0
);
};
client
.
Init
(
"root"
,
"taosdata"
);
showRsp
=
NULL
;
}
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
0035bb19
...
...
@@ -80,8 +80,8 @@ typedef struct {
}
SProfileMgmt
;
typedef
struct
{
SRWLatch
lock
;
char
email
[
TSDB_FQDN_LEN
];
TdThreadMutex
lock
;
char
email
[
TSDB_FQDN_LEN
];
}
STelemMgmt
;
typedef
struct
{
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
0035bb19
...
...
@@ -32,7 +32,7 @@
#include "tname.h"
#include "tuuid.h"
extern
bool
ts
SchedStreamTo
Snode
;
extern
bool
ts
DeployOn
Snode
;
static
int32_t
mndAddTaskToTaskSet
(
SArray
*
pArray
,
SStreamTask
*
pTask
)
{
int32_t
childId
=
taosArrayGetSize
(
pArray
);
...
...
@@ -190,7 +190,7 @@ int32_t mndAssignTaskToSnode(SMnode* pMnode, SStreamTask* pTask, SSubplan* plan,
pTask
->
nodeId
=
SNODE_HANDLE
;
pTask
->
epSet
=
mndAcquireEpFromSnode
(
pMnode
,
pSnode
);
plan
->
execNode
.
nodeId
=
0
;
plan
->
execNode
.
nodeId
=
SNODE_HANDLE
;
plan
->
execNode
.
epSet
=
pTask
->
epSet
;
if
(
qSubPlanToString
(
plan
,
&
pTask
->
exec
.
qmsg
,
&
msgLen
)
<
0
)
{
...
...
@@ -373,7 +373,7 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) {
return
-
1
;
}
if
(
ts
SchedStreamTo
Snode
)
{
if
(
ts
DeployOn
Snode
)
{
SSnodeObj
*
pSnode
=
mndSchedFetchOneSnode
(
pMnode
);
if
(
pSnode
==
NULL
)
{
SVgObj
*
pVgroup
=
mndSchedFetchOneVg
(
pMnode
,
pStream
->
sourceDbUid
);
...
...
source/dnode/mnode/impl/src/mndTelem.c
浏览文件 @
0035bb19
...
...
@@ -127,8 +127,10 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) {
STelemMgmt
*
pMgmt
=
&
pMnode
->
telemMgmt
;
if
(
!
tsEnableTelem
)
return
0
;
taos
WLockLatch
(
&
pMgmt
->
lock
);
taos
ThreadMutexLock
(
&
pMgmt
->
lock
);
char
*
pCont
=
mndBuildTelemetryReport
(
pMnode
);
taosThreadMutexUnlock
(
&
pMgmt
->
lock
);
if
(
pCont
!=
NULL
)
{
if
(
taosSendHttpReport
(
tsTelemServer
,
tsTelemPort
,
pCont
,
strlen
(
pCont
),
HTTP_FLAT
)
!=
0
)
{
mError
(
"failed to send telemetry report"
);
...
...
@@ -137,18 +139,20 @@ static int32_t mndProcessTelemTimer(SRpcMsg* pReq) {
}
taosMemoryFree
(
pCont
);
}
taosWUnLockLatch
(
&
pMgmt
->
lock
);
return
0
;
}
int32_t
mndInitTelem
(
SMnode
*
pMnode
)
{
STelemMgmt
*
pMgmt
=
&
pMnode
->
telemMgmt
;
taos
InitRWLatch
(
&
pMgmt
->
lock
);
taos
ThreadMutexInit
(
&
pMgmt
->
lock
,
NULL
);
taosGetEmail
(
pMgmt
->
email
,
sizeof
(
pMgmt
->
email
));
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TELEM_TIMER
,
mndProcessTelemTimer
);
return
0
;
}
void
mndCleanupTelem
(
SMnode
*
pMnode
)
{}
void
mndCleanupTelem
(
SMnode
*
pMnode
)
{
STelemMgmt
*
pMgmt
=
&
pMnode
->
telemMgmt
;
taosThreadMutexDestroy
(
&
pMgmt
->
lock
);
}
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
0035bb19
...
...
@@ -60,7 +60,7 @@ int32_t mndInitVgroup(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_VND_COMPACT_RSP
,
mndTransProcessRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_REDISTRIBUTE_VGROUP
,
mndProcessRedistributeVgroupMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_
MERGE
_VGROUP
,
mndProcessSplitVgroupMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_
SPLIT
_VGROUP
,
mndProcessSplitVgroupMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_BALANCE_VGROUP
,
mndProcessBalanceVgroupMsg
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_VGROUP
,
mndRetrieveVgroups
);
...
...
@@ -617,35 +617,6 @@ SEpSet mndGetVgroupEpset(SMnode *pMnode, const SVgObj *pVgroup) {
return
epset
;
}
static
bool
mndGetVgroupMaxReplicaFp
(
SMnode
*
pMnode
,
void
*
pObj
,
void
*
p1
,
void
*
p2
,
void
*
p3
)
{
SVgObj
*
pVgroup
=
pObj
;
int64_t
uid
=
*
(
int64_t
*
)
p1
;
int8_t
*
pReplica
=
p2
;
int32_t
*
pNumOfVgroups
=
p3
;
if
(
pVgroup
->
dbUid
==
uid
)
{
*
pReplica
=
TMAX
(
*
pReplica
,
pVgroup
->
replica
);
(
*
pNumOfVgroups
)
++
;
}
return
true
;
}
static
int32_t
mndGetVgroupMaxReplica
(
SMnode
*
pMnode
,
char
*
dbName
,
int8_t
*
pReplica
,
int32_t
*
pNumOfVgroups
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
dbName
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
return
-
1
;
}
*
pReplica
=
1
;
*
pNumOfVgroups
=
0
;
sdbTraverse
(
pSdb
,
SDB_VGROUP
,
mndGetVgroupMaxReplicaFp
,
&
pDb
->
uid
,
pReplica
,
pNumOfVgroups
);
mndReleaseDb
(
pMnode
,
pDb
);
return
0
;
}
static
int32_t
mndRetrieveVgroups
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
@@ -1670,35 +1641,81 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
if
(
newVg1
.
replica
==
1
)
{
if
(
mndAddVnodeToVgroup
(
pMnode
,
&
newVg1
,
pArray
)
!=
0
)
goto
_OVER
;
if
(
mndAddCreateVnodeAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
,
&
newVg1
.
vnodeGid
[
1
])
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
,
-
1
)
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
,
newVg1
.
vnodeGid
[
0
].
dnodeId
)
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
)
!=
0
)
goto
_OVER
;
}
else
if
(
newVg1
.
replica
==
3
)
{
SVnodeGid
del1
=
{
0
};
if
(
mndRemoveVnodeFromVgroup
(
pMnode
,
&
newVg1
,
pArray
,
&
del1
)
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
,
-
1
)
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
,
newVg1
.
vnodeGid
[
0
].
dnodeId
)
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
,
newVg1
.
vnodeGid
[
1
].
dnodeId
)
!=
0
)
goto
_OVER
;
if
(
mndAddDropVnodeAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
,
&
del1
,
true
)
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
)
!=
0
)
goto
_OVER
;
}
else
{
goto
_OVER
;
}
mInfo
(
"vgId:%d, vgroup info after adjust replica, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d"
,
newVg1
.
vgId
,
newVg1
.
replica
,
newVg1
.
hashBegin
,
newVg1
.
hashEnd
,
newVg1
.
vnodeGid
[
0
].
dnodeId
);
for
(
int32_t
i
=
0
;
i
<
newVg1
.
replica
;
++
i
)
{
mInfo
(
"vgId:%d, vnode:%d dnode:%d"
,
newVg1
.
vgId
,
i
,
newVg1
.
vnodeGid
[
i
].
dnodeId
);
}
SVgObj
newVg2
=
{
0
};
memcpy
(
&
newVg
1
,
&
newVg2
,
sizeof
(
SVgObj
));
memcpy
(
&
newVg
2
,
&
newVg1
,
sizeof
(
SVgObj
));
newVg1
.
replica
=
1
;
newVg1
.
hashEnd
=
(
newVg1
.
hashBegin
+
newVg1
.
hashEnd
)
/
2
;
newVg1
.
hashEnd
=
newVg1
.
hashBegin
/
2
+
newVg1
.
hashEnd
/
2
;
memset
(
&
newVg1
.
vnodeGid
[
1
],
0
,
sizeof
(
SVnodeGid
));
newVg2
.
replica
=
1
;
newVg2
.
hashBegin
=
newVg1
.
hashEnd
+
1
;
memcpy
(
&
newVg2
.
vnodeGid
[
0
],
&
newVg2
.
vnodeGid
[
1
],
sizeof
(
SVnodeGid
));
memset
(
&
newVg1
.
vnodeGid
[
1
],
0
,
sizeof
(
SVnodeGid
));
memset
(
&
newVg2
.
vnodeGid
[
1
],
0
,
sizeof
(
SVnodeGid
));
mInfo
(
"vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d"
,
newVg1
.
vgId
,
newVg1
.
replica
,
newVg1
.
hashBegin
,
newVg1
.
hashEnd
,
newVg1
.
vnodeGid
[
0
].
dnodeId
);
mInfo
(
"vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d"
,
newVg2
.
vgId
,
newVg2
.
replica
,
newVg2
.
hashBegin
,
newVg2
.
hashEnd
,
newVg2
.
vnodeGid
[
0
].
dnodeId
);
if
(
mndAddAlterVnodeHashRangeAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg1
)
!=
0
)
goto
_OVER
;
if
(
mndAddAlterVnodeHashRangeAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg2
)
!=
0
)
goto
_OVER
;
// adjust vgroup
if
(
mndBuildAlterVgroupAction
(
pMnode
,
pTrans
,
pDb
,
pDb
,
&
newVg1
,
pArray
)
!=
0
)
goto
_OVER
;
if
(
mndBuildAlterVgroupAction
(
pMnode
,
pTrans
,
pDb
,
pDb
,
&
newVg2
,
pArray
)
!=
0
)
goto
_OVER
;
#if 0
// adjust vgroup replica
if (pDb->cfg.replications != newVg1.replica) {
if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg1, pArray) != 0) goto _OVER;
}
if (pDb->cfg.replications != newVg2.replica) {
if (mndBuildAlterVgroupAction(pMnode, pTrans, pDb, pDb, &newVg2, pArray) != 0) goto _OVER;
}
#endif
{
pRaw
=
mndVgroupActionEncode
(
&
newVg1
);
if
(
pRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
goto
_OVER
;
(
void
)
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
pRaw
=
NULL
;
}
{
pRaw
=
mndVgroupActionEncode
(
&
newVg2
);
if
(
pRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pRaw
)
!=
0
)
goto
_OVER
;
(
void
)
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
pRaw
=
NULL
;
}
mInfo
(
"vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d"
,
newVg1
.
vgId
,
newVg1
.
replica
,
newVg1
.
hashBegin
,
newVg1
.
hashEnd
,
newVg1
.
vnodeGid
[
0
].
dnodeId
);
for
(
int32_t
i
=
0
;
i
<
newVg1
.
replica
;
++
i
)
{
mInfo
(
"vgId:%d, vnode:%d dnode:%d"
,
newVg1
.
vgId
,
i
,
newVg1
.
vnodeGid
[
i
].
dnodeId
);
}
mInfo
(
"vgId:%d, vgroup info after adjust hash, replica:%d hashBegin:%u hashEnd:%u vnode:0 dnode:%d"
,
newVg2
.
vgId
,
newVg2
.
replica
,
newVg2
.
hashBegin
,
newVg2
.
hashEnd
,
newVg2
.
vnodeGid
[
0
].
dnodeId
);
for
(
int32_t
i
=
0
;
i
<
newVg1
.
replica
;
++
i
)
{
mInfo
(
"vgId:%d, vnode:%d dnode:%d"
,
newVg2
.
vgId
,
i
,
newVg2
.
vnodeGid
[
i
].
dnodeId
);
}
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
_OVER:
mndTransDrop
(
pTrans
);
...
...
source/dnode/mnode/impl/test/sdb/sdbTest.cpp
浏览文件 @
0035bb19
...
...
@@ -367,6 +367,80 @@ bool sdbTraverseFail(SMnode *pMnode, SStrObj *pObj, int32_t *p1, int32_t *p2, in
return
false
;
}
#ifndef WINDOWS
TEST_F
(
MndTestSdb
,
00
_API
)
{
SMnode
mnode
=
{
0
};
SSdbOpt
opt
=
{
0
};
opt
.
pMnode
=
&
mnode
;
opt
.
path
=
TD_TMP_DIR_PATH
"mnode_test_sdb"
;
taosRemoveDir
(
opt
.
path
);
SSdb
*
pSdb
=
sdbInit
(
&
opt
);
SSdbTable
table
=
{.
sdbType
=
SDB_USER
,
.
keyType
=
SDB_KEY_BINARY
};
sdbSetTable
(
pSdb
,
table
);
// sdbRow.c
SSdbRow
*
pRow1
=
sdbAllocRow
(
-
128
);
ASSERT_EQ
(
pRow1
==
NULL
,
1
);
void
*
pRow2
=
sdbGetRowObj
(
NULL
);
ASSERT_EQ
(
pRow2
==
NULL
,
1
);
//sdbRaw.c
SStrObj
strObj
;
SSdbRaw
*
pRaw1
=
NULL
;
strSetDefault
(
&
strObj
,
1
);
pRaw1
=
strEncode
(
&
strObj
);
int32_t
id
=
sdbGetIdFromRaw
(
pSdb
,
pRaw1
);
ASSERT_EQ
(
id
,
-
2
);
SSdbRaw
*
pRaw2
=
sdbAllocRaw
(
SDB_USER
,
1
,
-
128
);
ASSERT_EQ
(
pRaw2
==
NULL
,
1
);
ASSERT_EQ
(
sdbSetRawInt8
(
NULL
,
0
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawInt8
(
pRaw1
,
-
128
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawInt32
(
NULL
,
0
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawInt32
(
pRaw1
,
-
128
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawInt16
(
NULL
,
0
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawInt16
(
pRaw1
,
-
128
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawInt64
(
NULL
,
0
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawInt64
(
pRaw1
,
-
128
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawBinary
(
NULL
,
0
,
"12"
,
3
),
-
1
);
ASSERT_EQ
(
sdbSetRawBinary
(
pRaw1
,
9028
,
"12"
,
3
),
-
1
);
ASSERT_EQ
(
sdbSetRawDataLen
(
NULL
,
0
),
-
1
);
ASSERT_EQ
(
sdbSetRawDataLen
(
pRaw1
,
9000
),
-
1
);
ASSERT_EQ
(
sdbSetRawStatus
(
NULL
,
SDB_STATUS_READY
),
-
1
);
ASSERT_EQ
(
sdbSetRawStatus
(
pRaw1
,
SDB_STATUS_INIT
),
-
1
);
ASSERT_EQ
(
sdbGetRawInt8
(
NULL
,
0
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawInt8
(
pRaw1
,
9000
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawInt32
(
NULL
,
0
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawInt32
(
pRaw1
,
9000
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawInt16
(
NULL
,
0
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawInt16
(
pRaw1
,
9000
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawInt64
(
NULL
,
0
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawInt64
(
pRaw1
,
9000
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawBinary
(
NULL
,
0
,
0
,
4096
),
-
1
);
ASSERT_EQ
(
sdbGetRawBinary
(
pRaw1
,
9000
,
0
,
112
),
-
1
);
ASSERT_EQ
(
sdbGetRawSoftVer
(
NULL
,
0
),
-
1
);
ASSERT_EQ
(
sdbGetRawTotalSize
(
NULL
),
-
1
);
// sdbHash.c
EXPECT_STREQ
(
sdbTableName
((
ESdbType
)
100
),
"undefine"
);
EXPECT_STREQ
(
sdbStatusName
((
ESdbStatus
)
100
),
"undefine"
);
ASSERT_EQ
(
sdbGetTableVer
(
pSdb
,
(
ESdbType
)
100
),
-
1
);
SSdbRaw
*
pRaw3
=
sdbAllocRaw
((
ESdbType
)
-
12
,
1
,
128
);
ASSERT_NE
(
sdbWriteWithoutFree
(
pSdb
,
pRaw3
),
0
);
pSdb
->
hashObjs
[
1
]
=
NULL
;
SSdbRaw
*
pRaw4
=
sdbAllocRaw
((
ESdbType
)
1
,
1
,
128
);
ASSERT_NE
(
sdbWriteWithoutFree
(
pSdb
,
pRaw4
),
0
);
}
#endif
TEST_F
(
MndTestSdb
,
01
_Write_Str
)
{
void
*
pIter
=
NULL
;
int32_t
num
=
0
;
...
...
@@ -885,8 +959,8 @@ TEST_F(MndTestSdb, 01_Read_Str) {
ASSERT_EQ
(
sdbWrite
(
pSdb
,
pRaw
),
0
);
pI32Obj
=
(
SI32Obj
*
)
sdbAcquire
(
pSdb
,
SDB_VGROUP
,
&
key
);
ASSERT_EQ
(
pI32Obj
,
nullptr
);
int32_t
code
=
terrno
;
ASSERT_EQ
(
code
,
TSDB_CODE_SDB_OBJ_DROPPING
);
//
int32_t code = terrno;
//
ASSERT_EQ(code, TSDB_CODE_SDB_OBJ_DROPPING);
}
{
...
...
@@ -899,8 +973,8 @@ TEST_F(MndTestSdb, 01_Read_Str) {
ASSERT_EQ
(
sdbWrite
(
pSdb
,
pRaw
),
0
);
pI32Obj
=
(
SI32Obj
*
)
sdbAcquire
(
pSdb
,
SDB_VGROUP
,
&
key
);
ASSERT_EQ
(
pI32Obj
,
nullptr
);
int32_t
code
=
terrno
;
ASSERT_EQ
(
code
,
TSDB_CODE_SDB_OBJ_CREATING
);
//
int32_t code = terrno;
//
ASSERT_EQ(code, TSDB_CODE_SDB_OBJ_CREATING);
}
{
...
...
@@ -934,4 +1008,4 @@ TEST_F(MndTestSdb, 01_Read_Str) {
sdbCleanup
(
pSdb
);
ASSERT_EQ
(
mnode
.
insertTimes
,
9
);
ASSERT_EQ
(
mnode
.
deleteTimes
,
9
);
}
\ No newline at end of file
}
source/dnode/mnode/sdb/src/sdbFile.c
浏览文件 @
0035bb19
...
...
@@ -654,15 +654,12 @@ int32_t sdbStopWrite(SSdb *pSdb, SSdbIter *pIter, bool isApply, int64_t index, i
}
if
(
config
>
0
)
{
ASSERT
(
pSdb
->
commitConfig
==
config
);
pSdb
->
commitConfig
=
config
;
}
if
(
term
>
0
)
{
ASSERT
(
pSdb
->
commitTerm
==
term
);
pSdb
->
commitTerm
=
term
;
}
if
(
index
>
0
)
{
ASSERT
(
pSdb
->
commitIndex
==
index
);
pSdb
->
commitIndex
=
index
;
}
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
0035bb19
...
...
@@ -241,9 +241,7 @@ int32_t sdbWriteWithoutFree(SSdb *pSdb, SSdbRaw *pRaw) {
SdbDecodeFp
decodeFp
=
pSdb
->
decodeFps
[
pRaw
->
type
];
SSdbRow
*
pRow
=
(
*
decodeFp
)(
pRaw
);
if
(
pRow
==
NULL
)
{
return
terrno
;
}
if
(
pRow
==
NULL
)
return
terrno
;
pRow
->
type
=
pRaw
->
type
;
...
...
source/dnode/snode/inc/sndInt.h
浏览文件 @
0035bb19
...
...
@@ -31,7 +31,9 @@ extern "C" {
#endif
typedef
struct
SSnode
{
SMsgCb
msgCb
;
char
*
path
;
SStreamMeta
*
pMeta
;
SMsgCb
msgCb
;
}
SSnode
;
#if 0
...
...
source/dnode/snode/src/snode.c
浏览文件 @
0035bb19
...
...
@@ -15,197 +15,197 @@
#include "executor.h"
#include "sndInt.h"
#include "tstream.h"
#include "tuuid.h"
/*SSnode *sndOpen(const char *path, const SSnodeOpt *pOption) { return NULL; }*/
/*void sndClose(SSnode *pSnode) {}*/
int32_t
sndProcessUMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
return
0
;
}
int32_t
sndProcessSMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
return
0
;
}
void
sndEnqueueStreamDispatch
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
char
*
msgStr
=
pMsg
->
pCont
;
char
*
msgBody
=
POINTER_SHIFT
(
msgStr
,
sizeof
(
SMsgHead
));
int32_t
msgLen
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
int32_t
code
=
0
;
SStreamDispatchReq
req
;
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
msgBody
,
msgLen
);
if
(
tDecodeStreamDispatchReq
(
&
decoder
,
&
req
)
<
0
)
{
code
=
TSDB_CODE_MSG_DECODE_ERROR
;
tDecoderClear
(
&
decoder
);
goto
FAIL
;
}
tDecoderClear
(
&
decoder
);
int32_t
taskId
=
req
.
taskId
;
SStreamTask
*
pTask
=
streamMetaGetTask
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessDispatchReq
(
pTask
,
&
req
,
&
rsp
,
false
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
return
;
}
FAIL:
if
(
pMsg
->
info
.
handle
==
NULL
)
return
;
SRpcMsg
rsp
=
{
.
code
=
code
,
.
info
=
pMsg
->
info
,
};
tmsgSendRsp
(
&
rsp
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
}
int32_t
sndExpandTask
(
SSnode
*
pSnode
,
SStreamTask
*
pTask
,
int64_t
ver
)
{
ASSERT
(
pTask
->
taskLevel
==
TASK_LEVEL__AGG
);
ASSERT
(
taosArrayGetSize
(
pTask
->
childEpInfo
)
!=
0
);
pTask
->
schedStatus
=
TASK_SCHED_STATUS__INACTIVE
;
pTask
->
inputQueue
=
streamQueueOpen
();
pTask
->
outputQueue
=
streamQueueOpen
();
if
(
pTask
->
inputQueue
==
NULL
||
pTask
->
outputQueue
==
NULL
)
{
return
-
1
;
}
pTask
->
inputStatus
=
TASK_INPUT_STATUS__NORMAL
;
pTask
->
outputStatus
=
TASK_OUTPUT_STATUS__NORMAL
;
pTask
->
pMsgCb
=
&
pSnode
->
msgCb
;
pTask
->
startVer
=
ver
;
pTask
->
pState
=
streamStateOpen
(
pSnode
->
path
,
pTask
,
false
,
-
1
,
-
1
);
if
(
pTask
->
pState
==
NULL
)
{
return
-
1
;
}
SReadHandle
mgHandle
=
{
.
vnode
=
NULL
,
.
numOfVgroups
=
(
int32_t
)
taosArrayGetSize
(
pTask
->
childEpInfo
),
.
pStateBackend
=
pTask
->
pState
,
};
pTask
->
exec
.
executor
=
qCreateStreamExecTaskInfo
(
pTask
->
exec
.
qmsg
,
&
mgHandle
);
ASSERT
(
pTask
->
exec
.
executor
);
return
0
;
}
SSnode
*
sndOpen
(
const
char
*
path
,
const
SSnodeOpt
*
pOption
)
{
SSnode
*
pSnode
=
taosMemoryCalloc
(
1
,
sizeof
(
SSnode
));
if
(
pSnode
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
pSnode
->
path
=
strdup
(
path
);
if
(
pSnode
->
path
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
FAIL
;
}
pSnode
->
msgCb
=
pOption
->
msgCb
;
#if 0
pSnode->pMeta = s
ndMetaNew(
);
pSnode
->
pMeta
=
s
treamMetaOpen
(
path
,
pSnode
,
(
FTaskExpand
*
)
sndExpandTask
,
SNODE_HANDLE
);
if
(
pSnode
->
pMeta
==
NULL
)
{
t
aosMemoryFree(pSnode)
;
return NUL
L;
t
errno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
FAI
L
;
}
#endif
return
pSnode
;
FAIL:
taosMemoryFree
(
pSnode
->
path
);
taosMemoryFree
(
pSnode
);
return
NULL
;
}
void
sndClose
(
SSnode
*
pSnode
)
{
/*sndMetaDelete(pSnode->pMeta);*/
streamMetaClose
(
pSnode
->
pMeta
);
taosMemoryFree
(
pSnode
->
path
);
taosMemoryFree
(
pSnode
);
}
int32_t
sndGetLoad
(
SSnode
*
pSnode
,
SSnodeLoad
*
pLoad
)
{
return
0
;
}
#if 0
SStreamMeta *sndMetaNew() {
SStreamMeta *pMeta = taosMemoryCalloc(1, sizeof(SStreamMeta));
if (pMeta == NULL) {
return NULL;
}
pMeta->pHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
if (pMeta->pHash == NULL) {
taosMemoryFree(pMeta);
return NULL;
}
return pMeta;
}
void sndMetaDelete(SStreamMeta *pMeta) {
taosHashCleanup(pMeta->pHash);
taosMemoryFree(pMeta);
}
int32_t sndMetaDeployTask(SStreamMeta *pMeta, SStreamTask *pTask) {
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, NULL);
return taosHashPut(pMeta->pHash, &pTask->taskId, sizeof(int32_t), pTask, sizeof(void *));
}
SStreamTask *sndMetaGetTask(SStreamMeta *pMeta, int32_t taskId) {
return taosHashGet(pMeta->pHash, &taskId, sizeof(int32_t));
}
int32_t sndMetaRemoveTask(SStreamMeta *pMeta, int32_t taskId) {
SStreamTask *pTask = taosHashGet(pMeta->pHash, &taskId, sizeof(int32_t));
if (pTask == NULL) {
return -1;
}
taosMemoryFree(pTask->exec.qmsg);
// TODO:free executor
taosMemoryFree(pTask);
return taosHashRemove(pMeta->pHash, &taskId, sizeof(int32_t));
}
static int32_t sndProcessTaskDeployReq(SSnode *pNode, SRpcMsg *pMsg) {
SStreamMeta *pMeta = pNode->pMeta;
char *msg = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
int32_t
sndProcessTaskDeployReq
(
SSnode
*
pSnode
,
char
*
msg
,
int32_t
msgLen
)
{
int32_t
code
;
// 1.deserialize msg and build task
SStreamTask
*
pTask
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamTask
));
if
(
pTask
==
NULL
)
{
return
-
1
;
}
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msg
,
msgLen
);
if (tDecodeSStreamTask(&decoder, pTask) < 0) {
ASSERT(0);
code
=
tDecodeSStreamTask
(
&
decoder
,
pTask
);
if
(
code
<
0
)
{
tDecoderClear
(
&
decoder
);
taosMemoryFree
(
pTask
);
return
-
1
;
}
tDecoderClear
(
&
decoder
);
pTask->execStatus = TASK_EXEC_STATUS__IDLE
;
ASSERT
(
pTask
->
taskLevel
==
TASK_LEVEL__AGG
)
;
pTask->inputQueue = streamQueueOpen();
pTask->outputQueue = streamQueueOpen();
pTask->inputStatus = TASK_INPUT_STATUS__NORMAL;
pTask->outputStatus = TASK_INPUT_STATUS__NORMAL;
if (pTask->inputQueue == NULL || pTask->outputQueue == NULL) goto FAIL;
pTask->pMsgCb = &pNode->msgCb;
pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, NULL);
ASSERT(pTask->exec.executor);
streamSetupTrigger(pTask);
qInfo("deploy stream: stream id %" PRId64 " task id %d child id %d on snode", pTask->streamId, pTask->taskId,
pTask->selfChildId);
// 2.save task
code
=
streamMetaAddTask
(
pSnode
->
pMeta
,
-
1
,
pTask
);
if
(
code
<
0
)
{
return
-
1
;
}
taosHashPut(pMeta->pHash, &pTask->taskId, sizeof(int32_t), &pTask, sizeof(void *));
// 3.go through recover steps to fill history
if
(
pTask
->
fillHistory
)
{
streamSetParamForRecover
(
pTask
);
streamAggRecoverPrepare
(
pTask
);
}
return
0
;
}
FAIL:
if (pTask->inputQueue) streamQueueClose(pTask->inputQueue);
if (pTask->outputQueue) streamQueueClose(pTask->outputQueue);
if (pTask) taosMemoryFree(pTask);
return -1;
int32_t
sndProcessTaskDropReq
(
SSnode
*
pSnode
,
char
*
msg
,
int32_t
msgLen
)
{
SVDropStreamTaskReq
*
pReq
=
(
SVDropStreamTaskReq
*
)
msg
;
return
streamMetaRemoveTask
(
pSnode
->
pMeta
,
pReq
->
taskId
);
}
static int32_t sndProcessTaskRunReq(SSnode *pNode, SRpcMsg *pMsg) {
SStreamMeta *pMeta = pNode->pMeta;
int32_t
sndProcessTaskRunReq
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
SStreamTaskRunReq
*
pReq
=
pMsg
->
pCont
;
int32_t
taskId
=
pReq
->
taskId
;
SStreamTask *pTask = *(SStreamTask **)taosHashGet(pMeta->pHash, &taskId, sizeof(int32_t));
streamProcessRunReq(pTask);
return 0;
SStreamTask
*
pTask
=
streamMetaGetTask
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
streamProcessRunReq
(
pTask
);
return
0
;
}
else
{
return
-
1
;
}
}
static int32_t sndProcessTaskDispatchReq(SSnode *pNode, SRpcMsg *pMsg) {
SStreamMeta *pMeta = pNode->pMeta;
char *msgStr = pMsg->pCont;
char *msgBody = POINTER_SHIFT(msgStr, sizeof(SMsgHead));
int32_t msgLen = pMsg->contLen - sizeof(SMsgHead);
int32_t
sndProcessTaskDispatchReq
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
,
bool
exec
)
{
char
*
msgStr
=
pMsg
->
pCont
;
char
*
msgBody
=
POINTER_SHIFT
(
msgStr
,
sizeof
(
SMsgHead
));
int32_t
msgLen
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
SStreamDispatchReq
req
;
SDecoder
decoder
;
tDecoderInit(&decoder, msgBody, msgLen);
tDecoderInit
(
&
decoder
,
(
uint8_t
*
)
msgBody
,
msgLen
);
tDecodeStreamDispatchReq
(
&
decoder
,
&
req
);
int32_t taskId = req.taskId;
SStreamTask *pTask = *(SStreamTask **)taosHashGet(pMeta->pHash, &taskId, sizeof(int32_t));
SRpcMsg rsp = {
.info = pMsg->info,
.code = 0,
};
streamProcessDispatchReq(pTask, &req, &rsp, true);
return 0;
}
static int32_t sndProcessTaskRecoverReq(SSnode *pNode, SRpcMsg *pMsg) {
SStreamMeta *pMeta = pNode->pMeta;
SStreamTaskRecoverReq *pReq = pMsg->pCont;
int32_t taskId = pReq->taskId;
SStreamTask *pTask = *(SStreamTask **)taosHashGet(pMeta->pHash, &taskId, sizeof(int32_t));
streamProcessRecoverReq(pTask, pReq, pMsg);
return 0;
}
static int32_t sndProcessTaskDispatchRsp(SSnode *pNode, SRpcMsg *pMsg) {
SStreamMeta *pMeta = pNode->pMeta;
SStreamDispatchRsp *pRsp = POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead));
int32_t taskId = pRsp->taskId;
SStreamTask *pTask = *(SStreamTask **)taosHashGet(pMeta->pHash, &taskId, sizeof(int32_t));
streamProcessDispatchRsp(pTask, pRsp);
return 0;
}
static int32_t sndProcessTaskRecoverRsp(SSnode *pNode, SRpcMsg *pMsg) {
SStreamMeta *pMeta = pNode->pMeta;
SStreamTaskRecoverRsp *pRsp = pMsg->pCont;
int32_t taskId = pRsp->rspTaskId;
SStreamTask *pTask = *(SStreamTask **)taosHashGet(pMeta->pHash, &taskId, sizeof(int32_t));
streamProcessRecoverRsp(pTask, pRsp);
return 0;
}
static int32_t sndProcessTaskDropReq(SSnode *pNode, SRpcMsg *pMsg) {
SStreamMeta *pMeta = pNode->pMeta;
char *msg = pMsg->pCont;
int32_t msgLen = pMsg->contLen;
SVDropStreamTaskReq *pReq = (SVDropStreamTaskReq *)msg;
int32_t code = taosHashRemove(pMeta->pHash, &pReq->taskId, sizeof(int32_t));
ASSERT(code == 0);
if (code == 0) {
// sendrsp
int32_t
taskId
=
req
.
taskId
;
SStreamTask
*
pTask
=
streamMetaGetTask
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessDispatchReq
(
pTask
,
&
req
,
&
rsp
,
exec
);
return
0
;
}
else
{
return
-
1
;
}
return
code
;
return
0
;
}
static int32_t sndProcessTaskRetrieveReq(SSnode *pNode, SRpcMsg *pMsg) {
SStreamMeta *pMeta = pNode->pMeta;
int32_t
sndProcessTaskRetrieveReq
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
char
*
msgStr
=
pMsg
->
pCont
;
char
*
msgBody
=
POINTER_SHIFT
(
msgStr
,
sizeof
(
SMsgHead
));
int32_t
msgLen
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
...
...
@@ -213,53 +213,64 @@ static int32_t sndProcessTaskRetrieveReq(SSnode *pNode, SRpcMsg *pMsg) {
SDecoder
decoder
;
tDecoderInit
(
&
decoder
,
msgBody
,
msgLen
);
tDecodeStreamRetrieveReq
(
&
decoder
,
&
req
);
tDecoderClear
(
&
decoder
);
int32_t
taskId
=
req
.
dstTaskId
;
SStreamTask *pTask = *(SStreamTask **)taosHashGet(pMeta->pHash, &taskId, sizeof(int32_t));
if (atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) {
SStreamTask
*
pTask
=
streamMetaGetTask
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
SRpcMsg
rsp
=
{
.
info
=
pMsg
->
info
,
.
code
=
0
,
};
streamProcessRetrieveReq
(
pTask
,
&
req
,
&
rsp
);
tDeleteStreamRetrieveReq
(
&
req
);
return
0
;
}
else
{
return
-
1
;
}
}
int32_t
sndProcessTaskDispatchRsp
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
SStreamDispatchRsp
*
pRsp
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
taskId
=
pRsp
->
taskId
;
SStreamTask
*
pTask
=
streamMetaGetTask
(
pSnode
->
pMeta
,
taskId
);
if
(
pTask
)
{
streamProcessDispatchRsp
(
pTask
,
pRsp
);
return
0
;
}
else
{
return
-
1
;
}
SRpcMsg rsp = {
.info = pMsg->info,
.code = 0,
};
streamProcessRetrieveReq(pTask, &req, &rsp);
return
0
;
}
static int32_t sndProcessTaskRetrieveRsp(SSnode *pN
ode, SRpcMsg *pMsg) {
int32_t
sndProcessTaskRetrieveRsp
(
SSnode
*
pSn
ode
,
SRpcMsg
*
pMsg
)
{
//
return
0
;
}
int32_t sndProcessUMsg(SSnode *pSnode, SRpcMsg *pMsg) {
// stream deploy
// stream stop/resume
// operator exec
int32_t
sndProcessWriteMsg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
void
*
pReq
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
int32_t
len
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
switch
(
pMsg
->
msgType
)
{
case
TDMT_STREAM_TASK_DEPLOY
:
return sndProcessTaskDeployReq(pSnode, p
Msg
);
return
sndProcessTaskDeployReq
(
pSnode
,
p
Req
,
len
);
case
TDMT_STREAM_TASK_DROP
:
return sndProcessTaskDropReq(pSnode, p
Msg
);
return
sndProcessTaskDropReq
(
pSnode
,
p
Req
,
len
);
default:
ASSERT
(
0
);
}
return
0
;
}
int32_t sndProcessSMsg(SSnode *pSnode, SRpcMsg *pMsg) {
int32_t
sndProcessS
tream
Msg
(
SSnode
*
pSnode
,
SRpcMsg
*
pMsg
)
{
switch
(
pMsg
->
msgType
)
{
case
TDMT_STREAM_TASK_RUN
:
return
sndProcessTaskRunReq
(
pSnode
,
pMsg
);
case
TDMT_STREAM_TASK_DISPATCH
:
return sndProcessTaskDispatchReq(pSnode, pMsg);
case TDMT_STREAM_TASK_RECOVER:
return sndProcessTaskRecoverReq(pSnode, pMsg);
return
sndProcessTaskDispatchReq
(
pSnode
,
pMsg
,
true
);
case
TDMT_STREAM_RETRIEVE
:
return sndProcessTaskRe
cover
Req(pSnode, pMsg);
return
sndProcessTaskRe
trieve
Req
(
pSnode
,
pMsg
);
case
TDMT_STREAM_TASK_DISPATCH_RSP
:
return
sndProcessTaskDispatchRsp
(
pSnode
,
pMsg
);
case TDMT_STREAM_TASK_RECOVER_RSP:
return sndProcessTaskRecoverRsp(pSnode, pMsg);
case
TDMT_STREAM_RETRIEVE_RSP
:
return
sndProcessTaskRetrieveRsp
(
pSnode
,
pMsg
);
default:
...
...
@@ -267,4 +278,3 @@ int32_t sndProcessSMsg(SSnode *pSnode, SRpcMsg *pMsg) {
}
return
0
;
}
#endif
source/dnode/vnode/inc/vnode.h
浏览文件 @
0035bb19
...
...
@@ -152,23 +152,26 @@ typedef struct STsdbReader STsdbReader;
#define CACHESCAN_RETRIEVE_LAST_ROW 0x4
#define CACHESCAN_RETRIEVE_LAST 0x8
int32_t
tsdbSetTableList
(
STsdbReader
*
pReader
,
const
void
*
pTableList
,
int32_t
num
);
int32_t
tsdbReaderOpen
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
void
*
pTableList
,
int32_t
numOfTables
,
STsdbReader
**
ppReader
,
const
char
*
idstr
);
int32_t
tsdbSetTableId
(
STsdbReader
*
pReader
,
int64_t
uid
);
int32_t
tsdbReaderOpen
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
SArray
*
pTableList
,
STsdbReader
**
ppReader
,
const
char
*
idstr
);
void
tsdbReaderClose
(
STsdbReader
*
pReader
);
bool
tsdbNextDataBlock
(
STsdbReader
*
pReader
);
bool
tsdbTableNextDataBlock
(
STsdbReader
*
pReader
,
int64_t
uid
);
void
tsdbRetrieveDataBlockInfo
(
STsdbReader
*
pReader
,
SDataBlockInfo
*
pDataBlockInfo
);
int32_t
tsdbRetrieveDatablockSMA
(
STsdbReader
*
pReader
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
);
SArray
*
tsdbRetrieveDataBlock
(
STsdbReader
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
int32_t
tsdbReaderReset
(
STsdbReader
*
pReader
,
SQueryTableDataCond
*
pCond
);
int32_t
tsdbGetFileBlocksDistInfo
(
STsdbReader
*
pReader
,
STableBlockDistInfo
*
pTableBlockInfo
);
int64_t
tsdbGetNumOfRowsInMemTable
(
STsdbReader
*
pHandle
);
bool
tsdbIsAscendingOrder
(
STsdbReader
*
pReader
);
void
*
tsdbGetIdx
(
SMeta
*
pMeta
);
void
*
tsdbGetIvtIdx
(
SMeta
*
pMeta
);
uint64_t
getReaderMaxVersion
(
STsdbReader
*
pReader
);
int32_t
tsdbCacherowsReaderOpen
(
void
*
pVnode
,
int32_t
type
,
void
*
pTableIdList
,
int32_t
numOfTables
,
int32_t
numOfCols
,
uint64_t
suid
,
void
**
pReader
);
int32_t
tsdbCacherowsReaderOpen
(
void
*
pVnode
,
int32_t
type
,
SArray
*
pTableIdList
,
int32_t
numOfCols
,
uint64_t
suid
,
void
**
pReader
);
int32_t
tsdbRetrieveCacheRows
(
void
*
pReader
,
SSDataBlock
*
pResBlock
,
const
int32_t
*
slotIds
,
SArray
*
pTableUids
);
void
*
tsdbCacherowsReaderClose
(
void
*
pReader
);
int32_t
tsdbGetTableSchema
(
SVnode
*
pVnode
,
int64_t
uid
,
STSchema
**
pSchema
,
int64_t
*
suid
);
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
0035bb19
...
...
@@ -716,10 +716,7 @@ typedef struct SCacheRowsReader {
int32_t
numOfCols
;
int32_t
type
;
int32_t
tableIndex
;
// currently returned result tables
STableKeyInfo
*
pTableList
;
// table id list
int32_t
numOfTables
;
SArray
*
pTableList
;
// table id list
SSttBlockLoadInfo
*
pLoadInfo
;
STsdbReadSnap
*
pReadSnap
;
SDataFReader
*
pDataFReader
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
0035bb19
...
...
@@ -162,7 +162,10 @@ int tsdbInsertData(STsdb* pTsdb, int64_t version, SSubmitReq* pMsg, SSub
int32_t
tsdbInsertTableData
(
STsdb
*
pTsdb
,
int64_t
version
,
SSubmitMsgIter
*
pMsgIter
,
SSubmitBlk
*
pBlock
,
SSubmitBlkRsp
*
pRsp
);
int32_t
tsdbDeleteTableData
(
STsdb
*
pTsdb
,
int64_t
version
,
tb_uid_t
suid
,
tb_uid_t
uid
,
TSKEY
sKey
,
TSKEY
eKey
);
STsdbReader
tsdbQueryCacheLastT
(
STsdb
*
tsdb
,
SQueryTableDataCond
*
pCond
,
STableListInfo
*
tableList
,
uint64_t
qId
,
void
*
pMemRef
);
int32_t
tsdbSetKeepCfg
(
STsdb
*
pTsdb
,
STsdbCfg
*
pCfg
);
int32_t
tsdbGetStbIdList
(
SMeta
*
pMeta
,
int64_t
suid
,
SArray
*
list
);
// tq
int
tqInit
();
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
0035bb19
...
...
@@ -1272,7 +1272,6 @@ int32_t tqProcessSubmitReq(STQ* pTq, SSubmitReq* pReq, int64_t ver) {
}
int32_t
tqProcessTaskRunReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
)
{
//
SStreamTaskRunReq
*
pReq
=
pMsg
->
pCont
;
int32_t
taskId
=
pReq
->
taskId
;
SStreamTask
*
pTask
=
streamMetaGetTask
(
pTq
->
pStreamMeta
,
taskId
);
...
...
@@ -1285,7 +1284,6 @@ int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg) {
}
int32_t
tqProcessTaskDispatchReq
(
STQ
*
pTq
,
SRpcMsg
*
pMsg
,
bool
exec
)
{
ASSERT
(
0
);
char
*
msgStr
=
pMsg
->
pCont
;
char
*
msgBody
=
POINTER_SHIFT
(
msgStr
,
sizeof
(
SMsgHead
));
int32_t
msgLen
=
pMsg
->
contLen
-
sizeof
(
SMsgHead
);
...
...
@@ -1349,7 +1347,6 @@ int32_t tqProcessTaskDispatchRsp(STQ* pTq, SRpcMsg* pMsg) {
int32_t
tqProcessTaskDropReq
(
STQ
*
pTq
,
int64_t
version
,
char
*
msg
,
int32_t
msgLen
)
{
SVDropStreamTaskReq
*
pReq
=
(
SVDropStreamTaskReq
*
)
msg
;
return
streamMetaRemoveTask
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
}
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
0035bb19
...
...
@@ -42,7 +42,7 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
if
(
metaGetTableEntryByName
(
&
mr
,
name
)
<
0
)
{
metaReaderClear
(
&
mr
);
taosMemoryFree
(
name
);
return
-
1
;
continue
;
}
int64_t
uid
=
mr
.
me
.
uid
;
...
...
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
0035bb19
...
...
@@ -97,9 +97,10 @@ static void saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* pRea
}
}
int32_t
tsdbCacherowsReaderOpen
(
void
*
pVnode
,
int32_t
type
,
void
*
pTableIdList
,
int32_t
numOfTables
,
int32_t
numOfCols
,
uint64_t
suid
,
void
**
pReader
)
{
int32_t
tsdbCacherowsReaderOpen
(
void
*
pVnode
,
int32_t
type
,
SArray
*
pTableIdList
,
int32_t
numOfCols
,
uint64_t
suid
,
void
**
pReader
)
{
*
pReader
=
NULL
;
SCacheRowsReader
*
p
=
taosMemoryCalloc
(
1
,
sizeof
(
SCacheRowsReader
));
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -110,15 +111,14 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
p
->
numOfCols
=
numOfCols
;
p
->
suid
=
suid
;
if
(
numOfTables
==
0
)
{
if
(
taosArrayGetSize
(
pTableIdList
)
==
0
)
{
*
pReader
=
p
;
return
TSDB_CODE_SUCCESS
;
}
STableKeyInfo
*
pKeyInfo
=
&
((
STableKeyInfo
*
)
pTableIdList
)[
0
]
;
STableKeyInfo
*
pKeyInfo
=
taosArrayGet
(
pTableIdList
,
0
)
;
p
->
pSchema
=
metaGetTbTSchema
(
p
->
pVnode
->
pMeta
,
pKeyInfo
->
uid
,
-
1
,
1
);
p
->
pTableList
=
pTableIdList
;
p
->
numOfTables
=
numOfTables
;
p
->
transferBuf
=
taosMemoryCalloc
(
p
->
pSchema
->
numOfCols
,
POINTER_BYTES
);
if
(
p
->
transferBuf
==
NULL
)
{
...
...
@@ -205,6 +205,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
SLRUCache
*
lruCache
=
pr
->
pVnode
->
pTsdb
->
lruCache
;
LRUHandle
*
h
=
NULL
;
SArray
*
pRow
=
NULL
;
size_t
numOfTables
=
taosArrayGetSize
(
pr
->
pTableList
);
bool
hasRes
=
false
;
SArray
*
pLastCols
=
NULL
;
...
...
@@ -242,8 +243,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
// retrieve the only one last row of all tables in the uid list.
if
(
HASTYPE
(
pr
->
type
,
CACHESCAN_RETRIEVE_TYPE_SINGLE
))
{
for
(
int32_t
i
=
0
;
i
<
pr
->
numOfTables
;
++
i
)
{
STableKeyInfo
*
pKeyInfo
=
&
pr
->
pTableList
[
i
]
;
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
STableKeyInfo
*
pKeyInfo
=
taosArrayGet
(
pr
->
pTableList
,
i
)
;
code
=
doExtractCacheRow
(
pr
,
lruCache
,
pKeyInfo
->
uid
,
&
pRow
,
&
h
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -307,8 +308,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
}
}
else
if
(
HASTYPE
(
pr
->
type
,
CACHESCAN_RETRIEVE_TYPE_ALL
))
{
for
(
int32_t
i
=
pr
->
tableIndex
;
i
<
pr
->
numOfTables
;
++
i
)
{
STableKeyInfo
*
pKeyInfo
=
&
pr
->
pTableList
[
i
]
;
for
(
int32_t
i
=
pr
->
tableIndex
;
i
<
numOfTables
;
++
i
)
{
STableKeyInfo
*
pKeyInfo
=
(
STableKeyInfo
*
)
taosArrayGet
(
pr
->
pTableList
,
i
)
;
code
=
doExtractCacheRow
(
pr
,
lruCache
,
pKeyInfo
->
uid
,
&
pRow
,
&
h
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
...
...
source/dnode/vnode/src/tsdb/tsdbMergeTree.c
浏览文件 @
0035bb19
...
...
@@ -290,7 +290,7 @@ int32_t tLDataIterOpen(struct SLDataIter **pIter, SDataFReader *pReader, int32_t
// only apply to the child tables, ordinary tables will not incur this filter procedure.
size
=
taosArrayGetSize
(
pBlockLoadInfo
->
aSttBlk
);
if
(
size
>
1
)
{
if
(
size
>
=
1
)
{
SSttBlk
*
pStart
=
taosArrayGet
(
pBlockLoadInfo
->
aSttBlk
,
0
);
SSttBlk
*
pEnd
=
taosArrayGet
(
pBlockLoadInfo
->
aSttBlk
,
size
-
1
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
0035bb19
...
...
@@ -270,27 +270,24 @@ static void resetDataBlockScanInfo(SHashObj* pTableMap, int64_t ts) {
}
}
static
void
clearBlockScanInfo
(
STableBlockScanInfo
*
p
)
{
p
->
iterInit
=
false
;
p
->
iiter
.
hasVal
=
false
;
static
void
destroyBlockScanInfo
(
SHashObj
*
pTableMap
)
{
STableBlockScanInfo
*
p
=
NULL
;
if
(
p
->
iter
.
iter
!=
NULL
)
{
p
->
iter
.
iter
=
tsdbTbDataIterDestroy
(
p
->
iter
.
iter
)
;
}
while
((
p
=
taosHashIterate
(
pTableMap
,
p
))
!=
NULL
)
{
p
->
iter
Init
=
false
;
p
->
iiter
.
hasVal
=
false
;
if
(
p
->
i
iter
.
iter
!=
NULL
)
{
p
->
iiter
.
iter
=
tsdbTbDataIterDestroy
(
p
->
i
iter
.
iter
);
}
if
(
p
->
iter
.
iter
!=
NULL
)
{
p
->
iter
.
iter
=
tsdbTbDataIterDestroy
(
p
->
iter
.
iter
);
}
p
->
delSkyline
=
taosArrayDestroy
(
p
->
delSkyline
);
p
->
pBlockList
=
taosArrayDestroy
(
p
->
pBlockList
);
tMapDataClear
(
&
p
->
mapData
);
}
if
(
p
->
iiter
.
iter
!=
NULL
)
{
p
->
iiter
.
iter
=
tsdbTbDataIterDestroy
(
p
->
iiter
.
iter
);
}
static
void
destroyBlockScanInfo
(
SHashObj
*
pTableMap
)
{
STableBlockScanInfo
*
p
=
NULL
;
while
((
p
=
taosHashIterate
(
pTableMap
,
p
))
!=
NULL
)
{
clearBlockScanInfo
(
p
);
p
->
delSkyline
=
taosArrayDestroy
(
p
->
delSkyline
);
p
->
pBlockList
=
taosArrayDestroy
(
p
->
pBlockList
);
tMapDataClear
(
&
p
->
mapData
);
}
taosHashCleanup
(
pTableMap
);
...
...
@@ -3455,23 +3452,13 @@ int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t e
return
TSDB_CODE_SUCCESS
;
}
//
TODO refactor: with createDataBlockScanInfo
int32_t
tsdbSetTable
List
(
STsdbReader
*
pReader
,
const
void
*
pTableList
,
int32_t
num
)
{
//
todo refactor, use arraylist instead
int32_t
tsdbSetTable
Id
(
STsdbReader
*
pReader
,
int64_t
uid
)
{
ASSERT
(
pReader
!=
NULL
);
STableBlockScanInfo
*
p
=
NULL
;
while
((
p
=
taosHashIterate
(
pReader
->
status
.
pTableMap
,
p
))
!=
NULL
)
{
clearBlockScanInfo
(
p
);
}
taosHashClear
(
pReader
->
status
.
pTableMap
);
STableKeyInfo
*
pList
=
(
STableKeyInfo
*
)
pTableList
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
STableBlockScanInfo
info
=
{.
lastKey
=
0
,
.
uid
=
pList
[
i
].
uid
};
taosHashPut
(
pReader
->
status
.
pTableMap
,
&
info
.
uid
,
sizeof
(
uint64_t
),
&
info
,
sizeof
(
info
));
}
STableBlockScanInfo
info
=
{.
lastKey
=
0
,
.
uid
=
uid
};
taosHashPut
(
pReader
->
status
.
pTableMap
,
&
info
.
uid
,
sizeof
(
uint64_t
),
&
info
,
sizeof
(
info
));
return
TDB_CODE_SUCCESS
;
}
...
...
@@ -3507,8 +3494,8 @@ static int32_t doOpenReaderImpl(STsdbReader* pReader) {
}
// ====================================== EXPOSED APIs ======================================
int32_t
tsdbReaderOpen
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
void
*
pTableList
,
int32_t
numOfTables
,
STsdbReader
**
ppReader
,
const
char
*
idstr
)
{
int32_t
tsdbReaderOpen
(
SVnode
*
pVnode
,
SQueryTableDataCond
*
pCond
,
SArray
*
pTableList
,
STsdbReader
**
ppReader
,
const
char
*
idstr
)
{
STimeWindow
window
=
pCond
->
twindows
;
if
(
pCond
->
type
==
TIMEWINDOW_RANGE_EXTERNAL
)
{
pCond
->
twindows
.
skey
+=
1
;
...
...
@@ -3567,8 +3554,8 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
if
(
pReader
->
pSchema
==
NULL
)
{
tsdbError
(
"failed to get table schema, suid:%"
PRIu64
", ver:-1, %s"
,
pReader
->
suid
,
pReader
->
idStr
);
}
}
else
if
(
numOfTables
>
0
)
{
STableKeyInfo
*
pKey
=
pTableList
;
}
else
if
(
taosArrayGetSize
(
pTableList
)
>
0
)
{
STableKeyInfo
*
pKey
=
taosArrayGet
(
pTableList
,
0
)
;
pReader
->
pSchema
=
metaGetTbTSchema
(
pReader
->
pTsdb
->
pVnode
->
pMeta
,
pKey
->
uid
,
-
1
,
1
);
if
(
pReader
->
pSchema
==
NULL
)
{
tsdbError
(
"failed to get table schema, uid:%"
PRIu64
", ver:-1, %s"
,
pKey
->
uid
,
pReader
->
idStr
);
...
...
@@ -3577,7 +3564,8 @@ int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, void* pTableL
STsdbReader
*
p
=
pReader
->
innerReader
[
0
]
!=
NULL
?
pReader
->
innerReader
[
0
]
:
pReader
;
pReader
->
status
.
pTableMap
=
createDataBlockScanInfo
(
p
,
pTableList
,
numOfTables
);
int32_t
numOfTables
=
taosArrayGetSize
(
pTableList
);
pReader
->
status
.
pTableMap
=
createDataBlockScanInfo
(
p
,
pTableList
->
pData
,
numOfTables
);
if
(
pReader
->
status
.
pTableMap
==
NULL
)
{
tsdbReaderClose
(
pReader
);
*
ppReader
=
NULL
;
...
...
@@ -3787,7 +3775,7 @@ bool tsdbNextDataBlock(STsdbReader* pReader) {
return
false
;
}
bool
tsdbTableNextDataBlock
(
STsdbReader
*
pReader
,
u
int64_t
uid
)
{
bool
tsdbTableNextDataBlock
(
STsdbReader
*
pReader
,
int64_t
uid
)
{
STableBlockScanInfo
*
pBlockScanInfo
=
taosHashGet
(
pReader
->
status
.
pTableMap
,
&
uid
,
sizeof
(
uid
));
if
(
pBlockScanInfo
==
NULL
)
{
// no data block for the table of given uid
return
false
;
...
...
@@ -4186,3 +4174,4 @@ void tsdbUntakeReadSnap(STsdb* pTsdb, STsdbReadSnap* pSnap, const char* idStr) {
}
tsdbTrace
(
"vgId:%d, untake read snapshot, %s"
,
TD_VID
(
pTsdb
->
pVnode
),
idStr
);
}
bool
tsdbIsAscendingOrder
(
STsdbReader
*
pReader
)
{
return
ASCENDING_TRAVERSE
(
pReader
->
order
);
}
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
0035bb19
...
...
@@ -369,8 +369,8 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
return
qWorkerProcessFetchMsg
(
pVnode
,
pVnode
->
pQuery
,
pMsg
,
0
);
case
TDMT_SCH_FETCH_RSP
:
return
qWorkerProcessRspMsg
(
pVnode
,
pVnode
->
pQuery
,
pMsg
,
0
);
//case TDMT_SCH_CANCEL_TASK:
// return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg, 0);
//
case TDMT_SCH_CANCEL_TASK:
//
return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg, 0);
case
TDMT_SCH_DROP_TASK
:
return
qWorkerProcessDropMsg
(
pVnode
,
pVnode
->
pQuery
,
pMsg
,
0
);
case
TDMT_SCH_QUERY_HEARTBEAT
:
...
...
@@ -385,9 +385,10 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) {
return
tqProcessPollReq
(
pVnode
->
pTq
,
pMsg
);
case
TDMT_STREAM_TASK_RUN
:
return
tqProcessTaskRunReq
(
pVnode
->
pTq
,
pMsg
);
#if 0
case TDMT_STREAM_TASK_DISPATCH:
// return tqProcessTaskDispatchReq(pVnode->pTq, pMsg, pInfo->workerId != 0);
return tqProcessTaskDispatchReq(pVnode->pTq, pMsg, true);
#endif
/*case TDMT_STREAM_TASK_RECOVER:*/
/*return tqProcessTaskRecoverReq(pVnode->pTq, pMsg);*/
case
TDMT_STREAM_RETRIEVE
:
...
...
@@ -1163,8 +1164,10 @@ static int32_t vnodeProcessBatchDeleteReq(SVnode *pVnode, int64_t version, void
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SSingleDeleteReq
*
pOneReq
=
taosArrayGet
(
deleteReq
.
deleteReqs
,
i
);
int32_t
code
=
tsdbDeleteTableData
(
pVnode
->
pTsdb
,
version
,
deleteReq
.
suid
,
pOneReq
->
uid
,
pOneReq
->
ts
,
pOneReq
->
ts
);
if
(
code
)
{
// TODO
if
(
code
<
0
)
{
terrno
=
code
;
vError
(
"vgId:%d, delete error since %s, suid:%"
PRId64
", uid:%"
PRId64
", start ts:%"
PRId64
", end ts:%"
PRId64
,
TD_VID
(
pVnode
),
terrstr
(),
deleteReq
.
suid
,
pOneReq
->
uid
,
pOneReq
->
ts
,
pOneReq
->
ts
);
}
}
taosArrayDestroy
(
deleteReq
.
deleteReqs
);
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
0035bb19
...
...
@@ -56,6 +56,13 @@ enum {
CTGT_RSP_STBMETA
,
CTGT_RSP_MSTBMETA
,
CTGT_RSP_INDEXINFO_E
,
CTGT_RSP_USERAUTH
,
CTGT_RSP_TBLCFG
,
CTGT_RSP_TBLINDEX
,
CTGT_RSP_DBCFG
,
CTGT_RSP_QNODELIST
,
CTGT_RSP_UDF
,
CTGT_RSP_SVRVER
,
CTGT_RSP_TBMETA_NOT_EXIST
,
};
...
...
@@ -71,6 +78,10 @@ int32_t ctgTestVgVersion = 1;
int32_t
ctgTestVgNum
=
10
;
int32_t
ctgTestColNum
=
2
;
int32_t
ctgTestTagNum
=
1
;
int32_t
ctgTestQnodeNum
=
3
;
int32_t
ctgTestIndexNum
=
3
;
int32_t
ctgTestFuncNum
=
2
;
int32_t
ctgTestFuncType
=
3
;
int32_t
ctgTestSVersion
=
1
;
int32_t
ctgTestTVersion
=
1
;
int32_t
ctgTestSuid
=
2
;
...
...
@@ -82,6 +93,7 @@ char *ctgTestDbname = "1.db1";
char
*
ctgTestTablename
=
"table1"
;
char
*
ctgTestCTablename
=
"ctable1"
;
char
*
ctgTestSTablename
=
"stable1"
;
char
*
ctgTestUsername
=
"user1"
;
char
*
ctgTestCurrentCTableName
=
NULL
;
char
*
ctgTestCurrentTableName
=
NULL
;
char
*
ctgTestCurrentSTableName
=
NULL
;
...
...
@@ -311,6 +323,7 @@ void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *
strcpy
(
addr
->
fqdn
,
"a0"
);
addr
->
port
=
n
+
22
;
}
vg
.
numOfTable
=
i
%
2
;
taosArrayPush
(
usedbRsp
.
pVgroupInfos
,
&
vg
);
}
...
...
@@ -531,6 +544,197 @@ void ctgTestRspErrIndexInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMs
}
void
ctgTestRspUserAuth
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
rpcFreeCont
(
pMsg
->
pCont
);
SGetUserAuthRsp
userRsp
=
{
0
};
strcpy
(
userRsp
.
user
,
ctgTestUsername
);
userRsp
.
version
=
1
;
userRsp
.
superAuth
=
1
;
int32_t
contLen
=
tSerializeSGetUserAuthRsp
(
NULL
,
0
,
&
userRsp
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSGetUserAuthRsp
(
pReq
,
contLen
,
&
userRsp
);
pRsp
->
code
=
0
;
pRsp
->
contLen
=
contLen
;
pRsp
->
pCont
=
pReq
;
}
void
ctgTestRspTableCfg
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
rpcFreeCont
(
pMsg
->
pCont
);
static
int32_t
idx
=
1
;
STableCfgRsp
tblRsp
=
{
0
};
strcpy
(
tblRsp
.
tbName
,
ctgTestTablename
);
tblRsp
.
numOfColumns
=
ctgTestColNum
;
tblRsp
.
pSchemas
=
(
SSchema
*
)
taosMemoryMalloc
((
tblRsp
.
numOfTags
+
tblRsp
.
numOfColumns
)
*
sizeof
(
SSchema
));
SSchema
*
s
=
NULL
;
s
=
&
tblRsp
.
pSchemas
[
0
];
s
->
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
s
->
colId
=
1
;
s
->
bytes
=
8
;
strcpy
(
s
->
name
,
"ts"
);
s
=
&
tblRsp
.
pSchemas
[
1
];
s
->
type
=
TSDB_DATA_TYPE_INT
;
s
->
colId
=
2
;
s
->
bytes
=
4
;
strcpy
(
s
->
name
,
"col1"
);
int32_t
contLen
=
tSerializeSTableCfgRsp
(
NULL
,
0
,
&
tblRsp
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSTableCfgRsp
(
pReq
,
contLen
,
&
tblRsp
);
pRsp
->
code
=
0
;
pRsp
->
contLen
=
contLen
;
pRsp
->
pCont
=
pReq
;
tFreeSTableCfgRsp
(
&
tblRsp
);
}
void
ctgTestRspTableIndex
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
rpcFreeCont
(
pMsg
->
pCont
);
static
int32_t
idx
=
1
;
STableIndexRsp
tblRsp
=
{
0
};
strcpy
(
tblRsp
.
tbName
,
ctgTestSTablename
);
tblRsp
.
pIndex
=
taosArrayInit
(
ctgTestIndexNum
,
sizeof
(
STableIndexInfo
));
STableIndexInfo
info
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
ctgTestIndexNum
;
++
i
)
{
info
.
interval
=
1
+
i
;
info
.
expr
=
(
char
*
)
taosMemoryCalloc
(
1
,
10
);
taosArrayPush
(
tblRsp
.
pIndex
,
&
info
);
}
int32_t
contLen
=
tSerializeSTableIndexRsp
(
NULL
,
0
,
&
tblRsp
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSTableIndexRsp
(
pReq
,
contLen
,
&
tblRsp
);
pRsp
->
code
=
0
;
pRsp
->
contLen
=
contLen
;
pRsp
->
pCont
=
pReq
;
tFreeSTableIndexRsp
(
&
tblRsp
);
}
void
ctgTestRspDBCfg
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
rpcFreeCont
(
pMsg
->
pCont
);
static
int32_t
idx
=
1
;
SDbCfgRsp
dbRsp
=
{
0
};
dbRsp
.
numOfVgroups
=
ctgTestVgNum
;
int32_t
contLen
=
tSerializeSDbCfgRsp
(
NULL
,
0
,
&
dbRsp
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSDbCfgRsp
(
pReq
,
contLen
,
&
dbRsp
);
pRsp
->
code
=
0
;
pRsp
->
contLen
=
contLen
;
pRsp
->
pCont
=
pReq
;
}
void
ctgTestRspQnodeList
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
rpcFreeCont
(
pMsg
->
pCont
);
SQnodeListRsp
qlistRsp
=
{
0
};
qlistRsp
.
qnodeList
=
taosArrayInit
(
10
,
sizeof
(
SQueryNodeLoad
));
for
(
int32_t
i
=
0
;
i
<
ctgTestQnodeNum
;
++
i
)
{
SQueryNodeLoad
nodeLoad
=
{
0
};
nodeLoad
.
addr
.
nodeId
=
i
;
(
void
)
taosArrayPush
(
qlistRsp
.
qnodeList
,
&
nodeLoad
);
}
int32_t
rspLen
=
tSerializeSQnodeListRsp
(
NULL
,
0
,
&
qlistRsp
);
void
*
pReq
=
rpcMallocCont
(
rspLen
);
tSerializeSQnodeListRsp
(
pReq
,
rspLen
,
&
qlistRsp
);
pRsp
->
code
=
0
;
pRsp
->
contLen
=
rspLen
;
pRsp
->
pCont
=
pReq
;
tFreeSQnodeListRsp
(
&
qlistRsp
);
}
void
ctgTestRspUdfInfo
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
rpcFreeCont
(
pMsg
->
pCont
);
SRetrieveFuncRsp
funcRsp
=
{
0
};
funcRsp
.
numOfFuncs
=
1
;
funcRsp
.
pFuncInfos
=
taosArrayInit
(
1
,
sizeof
(
SFuncInfo
));
SFuncInfo
funcInfo
=
{
0
};
strcpy
(
funcInfo
.
name
,
"func1"
);
funcInfo
.
funcType
=
ctgTestFuncType
;
(
void
)
taosArrayPush
(
funcRsp
.
pFuncInfos
,
&
funcInfo
);
int32_t
rspLen
=
tSerializeSRetrieveFuncRsp
(
NULL
,
0
,
&
funcRsp
);
void
*
pReq
=
rpcMallocCont
(
rspLen
);
tSerializeSRetrieveFuncRsp
(
pReq
,
rspLen
,
&
funcRsp
);
pRsp
->
code
=
0
;
pRsp
->
contLen
=
rspLen
;
pRsp
->
pCont
=
pReq
;
tFreeSRetrieveFuncRsp
(
&
funcRsp
);
}
void
ctgTestRspSvrVer
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
rpcFreeCont
(
pMsg
->
pCont
);
SServerVerRsp
verRsp
=
{
0
};
strcpy
(
verRsp
.
ver
,
"1.0"
);
int32_t
rspLen
=
tSerializeSServerVerRsp
(
NULL
,
0
,
&
verRsp
);
void
*
pReq
=
rpcMallocCont
(
rspLen
);
tSerializeSServerVerRsp
(
pReq
,
rspLen
,
&
verRsp
);
pRsp
->
code
=
0
;
pRsp
->
contLen
=
rspLen
;
pRsp
->
pCont
=
pReq
;
}
void
ctgTestRspAuto
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
switch
(
pMsg
->
msgType
)
{
case
TDMT_MND_USE_DB
:
ctgTestRspDbVgroups
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
TDMT_VND_TABLE_CFG
:
case
TDMT_MND_TABLE_CFG
:
ctgTestRspTableCfg
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
TDMT_MND_GET_TABLE_INDEX
:
ctgTestRspTableIndex
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
TDMT_MND_GET_DB_CFG
:
ctgTestRspDBCfg
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
TDMT_MND_QNODE_LIST
:
ctgTestRspQnodeList
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
TDMT_MND_RETRIEVE_FUNC
:
ctgTestRspUdfInfo
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
TDMT_MND_SERVER_VERSION
:
ctgTestRspSvrVer
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
default:
break
;
}
return
;
}
void
ctgTestRspByIdx
(
void
*
shandle
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
switch
(
ctgTestRspFunc
[
ctgTestRspIdx
])
{
case
CTGT_RSP_VGINFO
:
...
...
@@ -551,10 +755,32 @@ void ctgTestRspByIdx(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp
case
CTGT_RSP_INDEXINFO_E
:
ctgTestRspErrIndexInfo
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_USERAUTH
:
ctgTestRspUserAuth
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_TBLCFG
:
ctgTestRspTableCfg
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_TBMETA_NOT_EXIST
:
ctgTestRspTableMetaNotExist
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_TBLINDEX
:
ctgTestRspTableIndex
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_DBCFG
:
ctgTestRspDBCfg
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_QNODELIST
:
ctgTestRspQnodeList
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_UDF
:
ctgTestRspUdfInfo
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
case
CTGT_RSP_SVRVER
:
ctgTestRspSvrVer
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
default:
ctgTestRspAuto
(
shandle
,
pEpSet
,
pMsg
,
pRsp
);
break
;
}
...
...
@@ -976,10 +1202,24 @@ TEST(tableMeta, normalTable) {
ASSERT_EQ
(
vgInfo
.
vgId
,
8
);
ASSERT_EQ
(
vgInfo
.
epSet
.
numOfEps
,
3
);
while
(
0
==
ctgdGetClusterCacheNum
(
pCtg
,
CTG_DBG_DB_NUM
))
{
taosMsleep
(
50
);
while
(
true
)
{
uint64_t
n
=
0
;
ctgdGetStatNum
(
"runtime.numOfOpDequeue"
,
(
void
*
)
&
n
);
if
(
n
!=
1
)
{
taosMsleep
(
50
);
}
else
{
break
;
}
}
memset
(
&
vgInfo
,
0
,
sizeof
(
vgInfo
));
bool
exists
=
false
;
code
=
catalogGetCachedTableHashVgroup
(
pCtg
,
mockPointer
,
&
n
,
&
vgInfo
,
&
exists
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
vgInfo
.
vgId
,
8
);
ASSERT_EQ
(
vgInfo
.
epSet
.
numOfEps
,
3
);
ASSERT_EQ
(
exists
,
true
);
ctgTestSetRspTableMeta
();
STableMeta
*
tableMeta
=
NULL
;
...
...
@@ -1020,6 +1260,18 @@ TEST(tableMeta, normalTable) {
taosMemoryFree
(
tableMeta
);
tableMeta
=
NULL
;
catalogGetCachedTableMeta
(
pCtg
,
mockPointer
,
&
n
,
&
tableMeta
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
tableMeta
->
vgId
,
8
);
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_NORMAL_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
0
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
rowSize
,
12
);
SDbVgVersion
*
dbs
=
NULL
;
SSTableVersion
*
stb
=
NULL
;
uint32_t
dbNum
=
0
,
stbNum
=
0
,
allDbNum
=
0
,
allStbNum
=
0
;
...
...
@@ -1216,6 +1468,21 @@ TEST(tableMeta, superTableCase) {
}
}
tableMeta
=
NULL
;
code
=
catalogGetCachedSTableMeta
(
pCtg
,
mockPointer
,
&
n
,
&
tableMeta
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
tableMeta
->
vgId
,
0
);
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
rowSize
,
12
);
taosMemoryFree
(
tableMeta
);
ctgTestSetRspCTableMeta
();
tableMeta
=
NULL
;
...
...
@@ -2156,6 +2423,15 @@ TEST(dbVgroup, getSetDbVgroupCase) {
code
=
catalogGetTableDistVgInfo
(
pCtg
,
mockPointer
,
&
n
,
&
vgList
);
ASSERT_TRUE
(
code
!=
0
);
int32_t
dbVer
=
0
;
int64_t
dbId
=
0
;
int32_t
tbNum
=
0
;
code
=
catalogGetDBVgVersion
(
pCtg
,
ctgTestDbname
,
&
dbVer
,
&
dbId
,
&
tbNum
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
dbVer
,
ctgTestVgVersion
);
ASSERT_EQ
(
dbId
,
ctgTestDbId
);
ASSERT_EQ
(
tbNum
,
ctgTestVgNum
/
2
);
ctgTestBuildDBVgroup
(
&
dbVgroup
);
code
=
catalogUpdateDBVgInfo
(
pCtg
,
ctgTestDbname
,
ctgTestDbId
,
dbVgroup
);
ASSERT_EQ
(
code
,
0
);
...
...
@@ -2415,6 +2691,264 @@ TEST(rentTest, allRent) {
catalogDestroy
();
}
TEST
(
apiTest
,
catalogRefreshDBVgInfo_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_VGINFO
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogRefreshDBVgInfo
(
pCtg
,
mockPointer
,
ctgTestDbname
);
ASSERT_EQ
(
code
,
0
);
catalogDestroy
();
}
TEST
(
apiTest
,
catalogChkAuth_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_USERAUTH
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
bool
pass
=
false
;
code
=
catalogChkAuth
(
pCtg
,
mockPointer
,
ctgTestUsername
,
ctgTestDbname
,
AUTH_TYPE_READ
,
&
pass
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pass
,
true
);
catalogDestroy
();
}
TEST
(
apiTest
,
catalogRefreshGetTableCfg_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_VGINFO
;
ctgTestRspFunc
[
1
]
=
CTGT_RSP_TBMETA
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
SName
n
=
{
TSDB_TABLE_NAME_T
,
1
,
{
0
},
{
0
}};
strcpy
(
n
.
dbname
,
"db1"
);
strcpy
(
n
.
tname
,
ctgTestTablename
);
STableCfg
*
pCfg
=
NULL
;
code
=
catalogRefreshGetTableCfg
(
pCtg
,
mockPointer
,
&
n
,
&
pCfg
);
ASSERT_EQ
(
code
,
0
);
ASSERT_TRUE
(
NULL
!=
pCfg
);
ASSERT_EQ
(
pCfg
->
numOfColumns
,
ctgTestColNum
);
tFreeSTableCfgRsp
((
STableCfgRsp
*
)
pCfg
);
taosMemoryFree
(
pCfg
);
catalogDestroy
();
}
TEST
(
apiTest
,
catalogGetTableIndex_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_TBLINDEX
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
SName
n
=
{
TSDB_TABLE_NAME_T
,
1
,
{
0
},
{
0
}};
strcpy
(
n
.
dbname
,
"db1"
);
strcpy
(
n
.
tname
,
ctgTestTablename
);
SArray
*
pRes
=
NULL
;
code
=
catalogGetTableIndex
(
pCtg
,
mockPointer
,
&
n
,
&
pRes
);
ASSERT_EQ
(
code
,
0
);
ASSERT_TRUE
(
NULL
!=
pRes
);
ASSERT_EQ
(
taosArrayGetSize
(
pRes
),
ctgTestIndexNum
);
taosArrayDestroyEx
(
pRes
,
tFreeSTableIndexInfo
);
catalogDestroy
();
}
TEST
(
apiTest
,
catalogGetDBCfg_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_DBCFG
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
SName
n
=
{
TSDB_TABLE_NAME_T
,
1
,
{
0
},
{
0
}};
strcpy
(
n
.
dbname
,
"db1"
);
strcpy
(
n
.
tname
,
ctgTestTablename
);
SDbCfgInfo
cfgInfo
=
{
0
};
code
=
catalogGetDBCfg
(
pCtg
,
mockPointer
,
ctgTestDbname
,
&
cfgInfo
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
cfgInfo
.
numOfVgroups
,
ctgTestVgNum
);
catalogDestroy
();
}
TEST
(
apiTest
,
catalogGetQnodeList_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_QNODELIST
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
SArray
*
qnodeList
=
taosArrayInit
(
10
,
sizeof
(
SQueryNodeLoad
));
code
=
catalogGetQnodeList
(
pCtg
,
mockPointer
,
qnodeList
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
taosArrayGetSize
(
qnodeList
),
ctgTestQnodeNum
);
for
(
int32_t
i
=
0
;
i
<
ctgTestQnodeNum
;
++
i
)
{
SQueryNodeLoad
*
pLoad
=
(
SQueryNodeLoad
*
)
taosArrayGet
(
qnodeList
,
i
);
ASSERT_EQ
(
pLoad
->
addr
.
nodeId
,
i
);
}
catalogDestroy
();
}
TEST
(
apiTest
,
catalogGetUdfInfo_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_UDF
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
SFuncInfo
funcInfo
=
{
0
};
code
=
catalogGetUdfInfo
(
pCtg
,
mockPointer
,
"func1"
,
&
funcInfo
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
funcInfo
.
funcType
,
ctgTestFuncType
);
catalogDestroy
();
}
TEST
(
apiTest
,
catalogGetServerVersion_test
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
memset
(
ctgTestRspFunc
,
0
,
sizeof
(
ctgTestRspFunc
));
ctgTestRspIdx
=
0
;
ctgTestRspFunc
[
0
]
=
CTGT_RSP_SVRVER
;
ctgTestSetRspByIdx
();
initQueryModuleMsgHandle
();
int32_t
code
=
catalogInit
(
NULL
);
ASSERT_EQ
(
code
,
0
);
code
=
catalogGetHandle
(
ctgTestClusterId
,
&
pCtg
);
ASSERT_EQ
(
code
,
0
);
char
*
ver
=
NULL
;
code
=
catalogGetServerVersion
(
pCtg
,
mockPointer
,
&
ver
);
ASSERT_EQ
(
code
,
0
);
ASSERT_TRUE
(
0
==
strcmp
(
ver
,
"1.0"
));
catalogDestroy
();
}
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
...
...
source/libs/executor/inc/executil.h
浏览文件 @
0035bb19
...
...
@@ -28,7 +28,7 @@
do { \
ASSERT((_c) != -1); \
longjmp((_obj), (_c)); \
} while (0)
} while (0)
;
#define SET_RES_WINDOW_KEY(_k, _ori, _len, _uid) \
do { \
...
...
@@ -95,25 +95,6 @@ typedef struct SColMatchInfo {
int32_t
matchType
;
// determinate the source according to col id or slot id
}
SColMatchInfo
;
// If the numOfOutputGroups is 1, the data blocks that belongs to different groups will be provided randomly
// The numOfOutputGroups is specified by physical plan. and will not be affect by numOfGroups
typedef
struct
STableListInfo
{
bool
oneTableForEachGroup
;
int32_t
numOfOuputGroups
;
// the data block will be generated one by one
int32_t
*
groupOffset
;
// keep the offset value for each group in the tableList
SArray
*
pTableList
;
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
uint64_t
suid
;
}
STableListInfo
;
void
destroyTableList
(
STableListInfo
*
pTableList
);
int32_t
getNumOfOutputGroups
(
const
STableListInfo
*
pTableList
);
bool
oneTableForEachGroup
(
const
STableListInfo
*
pTableList
);
uint64_t
getTableGroupId
(
const
STableListInfo
*
pTableList
,
uint64_t
tableUid
);
int32_t
addTableIntoTableList
(
STableListInfo
*
pTableList
,
uint64_t
uid
,
uint64_t
gid
);
int32_t
getTablesOfGroup
(
const
STableListInfo
*
pTableList
,
int32_t
ordinalIndex
,
STableKeyInfo
**
pKeyInfo
,
int32_t
*
num
);
uint64_t
getTotalTables
(
const
STableListInfo
*
pTableList
);
struct
SqlFunctionCtx
;
size_t
getResultRowSize
(
struct
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
0035bb19
...
...
@@ -174,12 +174,13 @@ typedef struct {
}
SSchemaInfo
;
typedef
struct
SExecTaskInfo
{
STaskIdInfo
id
;
uint32_t
status
;
int32_t
code
;
STimeWindow
window
;
STaskCostInfo
cost
;
int64_t
owner
;
// if it is in execution
STaskIdInfo
id
;
uint32_t
status
;
STimeWindow
window
;
STaskCostInfo
cost
;
int64_t
owner
;
// if it is in execution
int32_t
code
;
int64_t
version
;
// used for stream to record wal version
SStreamTaskInfo
streamInfo
;
SSchemaInfo
schemaInfo
;
...
...
@@ -340,23 +341,23 @@ typedef struct STableScanInfo {
}
STableScanInfo
;
typedef
struct
STableMergeScanInfo
{
STableListInfo
*
tableListInfo
;
int32_t
tableStartIndex
;
int32_t
tableEndIndex
;
bool
hasGroupId
;
uint64_t
groupId
;
SArray
*
dataReaders
;
// array of tsdbReaderT*
S
ReadHandle
readHandle
;
int32_t
bufPageSize
;
uint32_t
sortBufSize
;
// max buffer size for in-memory sort
SArray
*
pSortInfo
;
SSortHandle
*
pSortHandle
;
S
SDataBlock
*
pSortInputBlock
;
int64_t
startTs
;
// sort start time
S
Array
*
sortSourceParams
;
SLimitInfo
limitInfo
;
STableListInfo
*
tableListInfo
;
int32_t
tableStartIndex
;
int32_t
tableEndIndex
;
bool
hasGroupId
;
uint64_t
groupId
;
SArray
*
dataReaders
;
// array of tsdbReaderT*
S
Array
*
queryConds
;
// array of queryTableDataCond
STsdbReader
*
pReader
;
SReadHandle
readHandle
;
int32_t
bufPageSize
;
uint32_t
sortBufSize
;
// max buffer size for in-memory sort
S
Array
*
pSortInfo
;
SSortHandle
*
pSortHandle
;
S
SDataBlock
*
pSortInputBlock
;
int64_t
startTs
;
// sort start time
SArray
*
sortSourceParams
;
SLimitInfo
limitInfo
;
SFileBlockLoadRecorder
readRecorder
;
int64_t
numOfRows
;
SScanInfo
scanInfo
;
...
...
@@ -1076,7 +1077,7 @@ SOperatorInfo* createTableMergeScanOperatorInfo(STableScanPhysiNode* pTableScanN
void
copyUpdateDataBlock
(
SSDataBlock
*
pDest
,
SSDataBlock
*
pSource
,
int32_t
tsColIndex
);
bool
groupbyTbname
(
SNodeList
*
pGroupList
);
int32_t
generateGroupIdMap
(
STableListInfo
*
pTableListInfo
,
SReadHandle
*
pHandle
,
SNodeList
*
groupKey
,
bool
groupSort
);
int32_t
generateGroupIdMap
(
STableListInfo
*
pTableListInfo
,
SReadHandle
*
pHandle
,
SNodeList
*
groupKey
);
void
*
destroySqlFunctionCtx
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
int32_t
buildDataBlockFromGroupRes
(
SOperatorInfo
*
pOperator
,
SStreamState
*
pState
,
SSDataBlock
*
pBlock
,
SExprSupp
*
pSup
,
SGroupResInfo
*
pGroupResInfo
);
...
...
source/libs/executor/src/cachescanoperator.c
浏览文件 @
0035bb19
...
...
@@ -48,10 +48,6 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe
int32_t
numOfCols
=
0
;
code
=
extractColMatchInfo
(
pScanNode
->
scan
.
pScanCols
,
pDescNode
,
&
numOfCols
,
COL_MATCH_FROM_COL_ID
,
&
pInfo
->
matchInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
removeRedundantTsCol
(
pScanNode
,
&
pInfo
->
matchInfo
);
code
=
extractCacheScanSlotId
(
pInfo
->
matchInfo
.
pList
,
pTaskInfo
,
&
pInfo
->
pSlotIds
);
...
...
@@ -65,15 +61,11 @@ SOperatorInfo* createCacherowsScanOperator(SLastRowScanPhysiNode* pScanNode, SRe
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
pInfo
->
pUidList
=
taosArrayInit
(
4
,
sizeof
(
int64_t
));
// partition by tbname
, todo opt perf
if
(
oneTableForEachGroup
(
pTableList
)
||
(
getTotalTables
(
pTableList
)
==
1
))
{
// partition by tbname
if
(
taosArrayGetSize
(
pTableList
->
pGroupList
)
==
taosArrayGetSize
(
pTableList
->
pTableList
))
{
pInfo
->
retrieveType
=
CACHESCAN_RETRIEVE_TYPE_ALL
|
(
pScanNode
->
ignoreNull
?
CACHESCAN_RETRIEVE_LAST
:
CACHESCAN_RETRIEVE_LAST_ROW
);
STableKeyInfo
*
pList
=
taosArrayGet
(
pTableList
->
pTableList
,
0
);
size_t
num
=
taosArrayGetSize
(
pTableList
->
pTableList
);
code
=
tsdbCacherowsReaderOpen
(
pInfo
->
readHandle
.
vnode
,
pInfo
->
retrieveType
,
pList
,
num
,
code
=
tsdbCacherowsReaderOpen
(
pInfo
->
readHandle
.
vnode
,
pInfo
->
retrieveType
,
pTableList
->
pTableList
,
taosArrayGetSize
(
pInfo
->
matchInfo
.
pList
),
pTableList
->
suid
,
&
pInfo
->
pLastrowReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
...
...
@@ -175,7 +167,16 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
}
}
pInfo
->
pRes
->
info
.
groupId
=
getTableGroupId
(
pTableList
,
pInfo
->
pRes
->
info
.
uid
);
if
(
pTableList
->
map
!=
NULL
)
{
int64_t
*
groupId
=
taosHashGet
(
pTableList
->
map
,
&
pInfo
->
pRes
->
info
.
uid
,
sizeof
(
int64_t
));
if
(
groupId
!=
NULL
)
{
pInfo
->
pRes
->
info
.
groupId
=
*
groupId
;
}
}
else
{
ASSERT
(
taosArrayGetSize
(
pTableList
->
pTableList
)
==
1
);
STableKeyInfo
*
pKeyInfo
=
taosArrayGet
(
pTableList
->
pTableList
,
0
);
pInfo
->
pRes
->
info
.
groupId
=
pKeyInfo
->
groupId
;
}
pInfo
->
indexOfBufferedRes
+=
1
;
return
pInfo
->
pRes
;
...
...
@@ -184,25 +185,18 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
return
NULL
;
}
}
else
{
size_t
totalGroups
=
getNumOfOutputGroups
(
pTable
List
);
size_t
totalGroups
=
taosArrayGetSize
(
pTableList
->
pGroup
List
);
while
(
pInfo
->
currentGroupIndex
<
totalGroups
)
{
SArray
*
pGroupTableList
=
taosArrayGetP
(
pTableList
->
pGroupList
,
pInfo
->
currentGroupIndex
);
STableKeyInfo
*
pList
=
NULL
;
int32_t
num
=
0
;
int32_t
code
=
getTablesOfGroup
(
pTableList
,
pInfo
->
currentGroupIndex
,
&
pList
,
&
num
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
}
tsdbCacherowsReaderOpen
(
pInfo
->
readHandle
.
vnode
,
pInfo
->
retrieveType
,
pList
,
num
,
tsdbCacherowsReaderOpen
(
pInfo
->
readHandle
.
vnode
,
pInfo
->
retrieveType
,
pGroupTableList
,
taosArrayGetSize
(
pInfo
->
matchInfo
.
pList
),
pTableList
->
suid
,
&
pInfo
->
pLastrowReader
);
taosArrayClear
(
pInfo
->
pUidList
);
code
=
tsdbRetrieveCacheRows
(
pInfo
->
pLastrowReader
,
pInfo
->
pRes
,
pInfo
->
pSlotIds
,
pInfo
->
pUidList
);
int32_t
code
=
tsdbRetrieveCacheRows
(
pInfo
->
pLastrowReader
,
pInfo
->
pRes
,
pInfo
->
pSlotIds
,
pInfo
->
pUidList
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
T_LONG_JMP
(
pTaskInfo
->
env
,
code
);
longjmp
(
pTaskInfo
->
env
,
code
);
}
pInfo
->
currentGroupIndex
+=
1
;
...
...
@@ -212,7 +206,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
if
(
pInfo
->
pseudoExprSup
.
numOfExprs
>
0
)
{
SExprSupp
*
pSup
=
&
pInfo
->
pseudoExprSup
;
STableKeyInfo
*
pKeyInfo
=
&
((
STableKeyInfo
*
)
pTableList
)[
0
]
;
STableKeyInfo
*
pKeyInfo
=
taosArrayGet
(
pGroupTableList
,
0
)
;
pInfo
->
pRes
->
info
.
groupId
=
pKeyInfo
->
groupId
;
if
(
taosArrayGetSize
(
pInfo
->
pUidList
)
>
0
)
{
...
...
source/libs/executor/src/executil.c
浏览文件 @
0035bb19
...
...
@@ -544,7 +544,6 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
end
;
}
ctx
.
index
=
0
;
ctx
.
cInfoList
=
taosArrayInit
(
4
,
sizeof
(
SColumnInfo
));
if
(
ctx
.
cInfoList
==
NULL
)
{
...
...
@@ -607,7 +606,6 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
}
else
{
void
*
tag
=
taosHashGet
(
tags
,
uid
,
sizeof
(
int64_t
));
ASSERT
(
tag
);
STagVal
tagVal
=
{
0
};
tagVal
.
cid
=
pColInfo
->
info
.
colId
;
const
char
*
p
=
metaGetTableTagVal
(
tag
,
pColInfo
->
info
.
type
,
&
tagVal
);
...
...
@@ -638,7 +636,6 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
}
}
}
pResBlock
->
info
.
rows
=
rows
;
// int64_t st1 = taosGetTimestampUs();
...
...
@@ -664,12 +661,10 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
}
break
;
}
default:
code
=
TSDB_CODE_OPS_NOT_SUPPORT
;
goto
end
;
}
if
(
nodeType
(
pNode
)
==
QUERY_NODE_COLUMN
)
{
SColumnNode
*
pSColumnNode
=
(
SColumnNode
*
)
pNode
;
SColumnInfoData
*
pColInfo
=
(
SColumnInfoData
*
)
taosArrayGet
(
pResBlock
->
pDataBlock
,
pSColumnNode
->
slotId
);
...
...
@@ -679,12 +674,10 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
}
else
{
code
=
scalarCalculate
(
pNode
,
pBlockList
,
&
output
);
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
releaseColInfoData
(
output
.
columnData
);
goto
end
;
}
taosArrayPush
(
groupData
,
&
output
.
columnData
);
}
...
...
@@ -703,7 +696,6 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
end
;
}
for
(
int
i
=
0
;
i
<
rows
;
i
++
)
{
STableKeyInfo
*
info
=
taosArrayGet
(
pTableListInfo
->
pTableList
,
i
);
...
...
@@ -825,86 +817,38 @@ static int32_t removeInvalidTable(SArray* uids, SHashObj* tags) {
taosArrayDestroy
(
validUid
);
return
0
;
}
static
int32_t
nameComparFn
(
const
void
*
p1
,
const
void
*
p2
)
{
const
char
*
pName1
=
*
(
const
char
**
)
p1
;
const
char
*
pName2
=
*
(
const
char
**
)
p2
;
int32_t
ret
=
strcmp
(
pName1
,
pName2
);
if
(
ret
==
0
)
{
return
0
;
}
else
{
return
(
ret
>
0
)
?
1
:-
1
;
}
}
static
SArray
*
getTableNameList
(
const
SNodeListNode
*
pList
)
{
int32_t
len
=
LIST_LENGTH
(
pList
->
pNodeList
);
SListCell
*
cell
=
pList
->
pNodeList
->
pHead
;
SArray
*
pTbList
=
taosArrayInit
(
len
,
POINTER_BYTES
);
for
(
int
i
=
0
;
i
<
pList
->
pNodeList
->
length
;
i
++
)
{
SValueNode
*
valueNode
=
(
SValueNode
*
)
cell
->
pNode
;
if
(
!
IS_VAR_DATA_TYPE
(
valueNode
->
node
.
resType
.
type
))
{
terrno
=
TSDB_CODE_INVALID_PARA
;
taosArrayDestroy
(
pTbList
);
return
NULL
;
}
char
*
name
=
varDataVal
(
valueNode
->
datum
.
p
);
taosArrayPush
(
pTbList
,
&
name
);
cell
=
cell
->
pNext
;
}
size_t
numOfTables
=
taosArrayGetSize
(
pTbList
);
// order the name
taosArraySort
(
pTbList
,
nameComparFn
);
// remove the duplicates
SArray
*
pNewList
=
taosArrayInit
(
taosArrayGetSize
(
pTbList
),
sizeof
(
void
*
));
taosArrayPush
(
pNewList
,
taosArrayGet
(
pTbList
,
0
));
for
(
int32_t
i
=
1
;
i
<
numOfTables
;
++
i
)
{
char
**
name
=
taosArrayGetLast
(
pNewList
);
char
**
nameInOldList
=
taosArrayGet
(
pTbList
,
i
);
if
(
strcmp
(
*
name
,
*
nameInOldList
)
==
0
)
{
continue
;
}
taosArrayPush
(
pNewList
,
nameInOldList
);
}
taosArrayDestroy
(
pTbList
);
return
pNewList
;
}
static
int32_t
optimizeTbnameInCondImpl
(
void
*
metaHandle
,
int64_t
suid
,
SArray
*
list
,
SNode
*
pTagCond
)
{
if
(
nodeType
(
pTagCond
)
!=
QUERY_NODE_OPERATOR
)
{
return
-
1
;
}
SOperatorNode
*
pNode
=
(
SOperatorNode
*
)
pTagCond
;
if
(
pNode
->
opType
!=
OP_TYPE_IN
)
{
return
-
1
;
}
if
((
pNode
->
pLeft
!=
NULL
&&
nodeType
(
pNode
->
pLeft
)
==
QUERY_NODE_COLUMN
&&
((
SColumnNode
*
)
pNode
->
pLeft
)
->
colType
==
COLUMN_TYPE_TBNAME
)
&&
(
pNode
->
pRight
!=
NULL
&&
nodeType
(
pNode
->
pRight
)
==
QUERY_NODE_NODE_LIST
))
{
SNodeListNode
*
pList
=
(
SNodeListNode
*
)
pNode
->
pRight
;
int32_t
len
=
LIST_LENGTH
(
pList
->
pNodeList
);
if
(
len
<=
0
)
{
return
-
1
;
}
if
(
len
<=
0
)
return
-
1
;
SArray
*
pTbList
=
getTableNameList
(
pList
);
int32_t
numOfTables
=
taosArrayGetSize
(
pTbList
);
SListCell
*
cell
=
pList
->
pNodeList
->
pHead
;
for
(
int
i
=
0
;
i
<
numOfTables
;
i
++
)
{
char
*
name
=
taosArrayGetP
(
pTbList
,
i
);
SArray
*
pTbList
=
taosArrayInit
(
len
,
sizeof
(
void
*
));
for
(
int
i
=
0
;
i
<
pList
->
pNodeList
->
length
;
i
++
)
{
SValueNode
*
valueNode
=
(
SValueNode
*
)
cell
->
pNode
;
if
(
!
IS_VAR_DATA_TYPE
(
valueNode
->
node
.
resType
.
type
))
{
taosArrayDestroy
(
pTbList
);
return
-
1
;
}
char
*
name
=
varDataVal
(
valueNode
->
datum
.
p
);
taosArrayPush
(
pTbList
,
&
name
);
cell
=
cell
->
pNext
;
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pTbList
);
i
++
)
{
char
*
name
=
taosArrayGetP
(
pTbList
,
i
);
uint64_t
uid
=
0
;
if
(
metaGetTableUidByName
(
metaHandle
,
name
,
&
uid
)
==
0
)
{
ETableType
tbType
=
TSDB_TABLE_MAX
;
...
...
@@ -919,14 +863,11 @@ static int32_t optimizeTbnameInCondImpl(void* metaHandle, int64_t suid, SArray*
terrno
=
0
;
}
}
taosArrayDestroy
(
pTbList
);
return
0
;
}
return
-
1
;
}
int32_t
getTableList
(
void
*
metaHandle
,
void
*
pVnode
,
SScanPhysiNode
*
pScanNode
,
SNode
*
pTagCond
,
SNode
*
pTagIndexCond
,
STableListInfo
*
pListInfo
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -1005,6 +946,14 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
}
taosArrayDestroy
(
res
);
pListInfo
->
pGroupList
=
taosArrayInit
(
4
,
POINTER_BYTES
);
if
(
pListInfo
->
pGroupList
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
// put into list as default group, remove it if grouping sorting is required later
taosArrayPush
(
pListInfo
->
pGroupList
,
&
pListInfo
->
pTableList
);
return
code
;
}
...
...
@@ -1737,4 +1686,4 @@ void destroyTableList(STableListInfo* pTableqinfoList) {
pTableqinfoList
->
pTableList
=
NULL
;
pTableqinfoList
->
map
=
NULL
;
}
\ No newline at end of file
}
source/libs/executor/src/executor.c
浏览文件 @
0035bb19
...
...
@@ -293,7 +293,9 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
qDebug
(
"add %d tables id into query list, %s"
,
(
int32_t
)
taosArrayGetSize
(
tableIdList
),
pTaskInfo
->
id
.
str
);
}
if
(
pListInfo
->
map
==
NULL
)
{
pListInfo
->
map
=
taosHashInit
(
32
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_ENTRY_LOCK
);
}
// traverse to the stream scanner node to add this table id
SOperatorInfo
*
pInfo
=
pTaskInfo
->
pRoot
;
...
...
@@ -305,10 +307,8 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
SStreamScanInfo
*
pScanInfo
=
pInfo
->
info
;
if
(
isAdd
)
{
// add new table id
SArray
*
qa
=
filterUnqualifiedTables
(
pScanInfo
,
tableIdList
,
GET_TASKID
(
pTaskInfo
));
int32_t
numOfQualifiedTables
=
taosArrayGetSize
(
qa
);
qDebug
(
" %d qualified child tables added into stream scanner"
,
numOfQualifiedTables
);
qDebug
(
" %d qualified child tables added into stream scanner"
,
(
int32_t
)
taosArrayGetSize
(
qa
));
code
=
tqReaderAddTbUidList
(
pScanInfo
->
tqReader
,
qa
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
taosArrayDestroy
(
qa
);
...
...
@@ -328,9 +328,7 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
}
}
STableListInfo
*
pTableListInfo
=
&
pTaskInfo
->
tableqinfoList
;
for
(
int32_t
i
=
0
;
i
<
numOfQualifiedTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
qa
);
++
i
)
{
uint64_t
*
uid
=
taosArrayGet
(
qa
,
i
);
STableKeyInfo
keyInfo
=
{.
uid
=
*
uid
,
.
groupId
=
0
};
...
...
@@ -360,7 +358,8 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo
if (!exists) {
#endif
addTableIntoTableList
(
pTableListInfo
,
keyInfo
.
uid
,
keyInfo
.
groupId
);
taosArrayPush
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
&
keyInfo
);
taosHashPut
(
pTaskInfo
->
tableqinfoList
.
map
,
uid
,
sizeof
(
*
uid
),
&
keyInfo
.
groupId
,
sizeof
(
keyInfo
.
groupId
));
}
if
(
keyBuf
!=
NULL
)
{
...
...
@@ -936,7 +935,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
/*if (pTaskInfo->streamInfo.lastStatus.type != TMQ_OFFSET__SNAPSHOT_DATA ||*/
/*pTaskInfo->streamInfo.lastStatus.uid != uid || pTaskInfo->streamInfo.lastStatus.ts != ts) {*/
STableScanInfo
*
pTableScanInfo
=
pInfo
->
pTableScanOp
->
info
;
int32_t
numOfTables
=
getTotalTables
(
&
pTaskInfo
->
tableqinfo
List
);
int32_t
tableSz
=
taosArrayGetSize
(
pTaskInfo
->
tableqinfoList
.
pTable
List
);
#ifndef NDEBUG
qDebug
(
"switch to next table %"
PRId64
" (cursor %d), %"
PRId64
" rows returned"
,
uid
,
...
...
@@ -945,7 +944,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
#endif
bool
found
=
false
;
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
tableSz
;
i
++
)
{
STableKeyInfo
*
pTableInfo
=
taosArrayGet
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
i
);
if
(
pTableInfo
->
uid
==
uid
)
{
found
=
true
;
...
...
@@ -958,17 +957,14 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
ASSERT
(
found
);
if
(
pTableScanInfo
->
dataReader
==
NULL
)
{
STableKeyInfo
*
pList
=
taosArrayGet
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
0
);
int32_t
num
=
getTotalTables
(
&
pTaskInfo
->
tableqinfoList
);
if
(
tsdbReaderOpen
(
pTableScanInfo
->
readHandle
.
vnode
,
&
pTableScanInfo
->
cond
,
pList
,
num
,
&
pTableScanInfo
->
dataReader
,
NULL
)
<
0
||
pTableScanInfo
->
dataReader
==
NULL
)
{
if
(
tsdbReaderOpen
(
pTableScanInfo
->
readHandle
.
vnode
,
&
pTableScanInfo
->
cond
,
pTaskInfo
->
tableqinfoList
.
pTableList
,
&
pTableScanInfo
->
dataReader
,
NULL
)
<
0
||
pTableScanInfo
->
dataReader
==
NULL
)
{
ASSERT
(
0
);
}
}
STableKeyInfo
tki
=
{.
uid
=
uid
};
tsdbSetTableList
(
pTableScanInfo
->
dataReader
,
&
tki
,
1
);
tsdbSetTableId
(
pTableScanInfo
->
dataReader
,
uid
);
int64_t
oldSkey
=
pTableScanInfo
->
cond
.
twindows
.
skey
;
pTableScanInfo
->
cond
.
twindows
.
skey
=
ts
+
1
;
tsdbReaderReset
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
);
...
...
@@ -976,7 +972,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
pTableScanInfo
->
scanTimes
=
0
;
qDebug
(
"tsdb reader offset seek to uid %"
PRId64
" ts %"
PRId64
", table cur set to %d , all table num %d"
,
uid
,
ts
,
pTableScanInfo
->
currentTable
,
numOfTables
);
ts
,
pTableScanInfo
->
currentTable
,
tableSz
);
/*}*/
}
else
{
ASSERT
(
0
);
...
...
@@ -998,15 +994,9 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
initQueryTableDataCondForTmq
(
&
pTaskInfo
->
streamInfo
.
tableCond
,
sContext
,
&
mtInfo
);
pTaskInfo
->
streamInfo
.
tableCond
.
twindows
.
skey
=
pOffset
->
ts
;
STableListInfo
*
pListInfo
=
&
pTaskInfo
->
tableqinfoList
;
pListInfo
->
pTableList
=
taosArrayInit
(
1
,
sizeof
(
STableKeyInfo
));
taosArrayPush
(
pListInfo
->
pTableList
,
&
(
STableKeyInfo
){.
uid
=
mtInfo
.
uid
,
.
groupId
=
0
});
STableKeyInfo
*
pList
=
taosArrayGet
(
pListInfo
->
pTableList
,
0
);
tsdbReaderOpen
(
pInfo
->
vnode
,
&
pTaskInfo
->
streamInfo
.
tableCond
,
pList
,
taosArrayGetSize
(
pListInfo
->
pTableList
),
pTaskInfo
->
tableqinfoList
.
pTableList
=
taosArrayInit
(
1
,
sizeof
(
STableKeyInfo
));
taosArrayPush
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
&
(
STableKeyInfo
){.
uid
=
mtInfo
.
uid
,
.
groupId
=
0
});
tsdbReaderOpen
(
pInfo
->
vnode
,
&
pTaskInfo
->
streamInfo
.
tableCond
,
pTaskInfo
->
tableqinfoList
.
pTableList
,
&
pInfo
->
dataReader
,
NULL
);
cleanupQueryTableDataCond
(
&
pTaskInfo
->
streamInfo
.
tableCond
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
0035bb19
...
...
@@ -1739,6 +1739,8 @@ int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t
return
TSDB_CODE_SUCCESS
;
}
static
void
doDestroyTableList
(
STableListInfo
*
pTableqinfoList
);
typedef
struct
SFetchRspHandleWrapper
{
uint32_t
exchangeId
;
int32_t
sourceIndex
;
...
...
@@ -3364,116 +3366,62 @@ static void cleanupTableSchemaInfo(SSchemaInfo* pSchemaInfo) {
static
void
cleanupStreamInfo
(
SStreamTaskInfo
*
pStreamInfo
)
{
tDeleteSSchemaWrapper
(
pStreamInfo
->
schema
);
}
static
int32_t
orderbyGroupIdComparFn
(
const
void
*
p1
,
const
void
*
p2
)
{
STableKeyInfo
*
pInfo1
=
(
STableKeyInfo
*
)
p1
;
STableKeyInfo
*
pInfo2
=
(
STableKeyInfo
*
)
p2
;
if
(
pInfo1
->
groupId
==
pInfo2
->
groupId
)
{
return
0
;
}
else
{
return
pInfo1
->
groupId
<
pInfo2
->
groupId
?
-
1
:
1
;
}
}
static
int32_t
sortTableGroup
(
STableListInfo
*
pTableListInfo
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
taosArraySort
(
pTableListInfo
->
pTableList
,
orderbyGroupIdComparFn
);
int32_t
size
=
getTotalTables
(
pTableListInfo
);
SArray
*
pList
=
taosArrayInit
(
4
,
sizeof
(
int32_t
));
STableKeyInfo
*
pInfo
=
taosArrayGet
(
pTableListInfo
->
pTableList
,
0
);
uint64_t
gid
=
pInfo
->
groupId
;
int32_t
start
=
0
;
taosArrayPush
(
pList
,
&
start
);
for
(
int32_t
i
=
1
;
i
<
size
;
++
i
)
{
pInfo
=
taosArrayGet
(
pTableListInfo
->
pTableList
,
i
);
if
(
pInfo
->
groupId
!=
gid
)
{
taosArrayPush
(
pList
,
&
i
);
gid
=
pInfo
->
groupId
;
}
}
pTableListInfo
->
numOfOuputGroups
=
taosArrayGetSize
(
pList
);
pTableListInfo
->
groupOffset
=
taosMemoryMalloc
(
sizeof
(
int32_t
)
*
pTableListInfo
->
numOfOuputGroups
);
memcpy
(
pTableListInfo
->
groupOffset
,
taosArrayGet
(
pList
,
0
),
sizeof
(
int32_t
)
*
pTableListInfo
->
numOfOuputGroups
);
taosArrayDestroy
(
pList
);
# if 0
taosArrayClear
(
pTableListInfo
->
pGroupList
);
SArray
*
sortSupport
=
taosArrayInit
(
16
,
sizeof
(
uint64_t
));
if
(
sortSupport
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
size_t
num
=
taosArrayGetSize
(
pTableListInfo
->
pTableList
);
for
(
int32_t
i
=
0
;
i
<
num
;
i
++
)
{
if
(
sortSupport
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pTableListInfo
->
pTableList
);
i
++
)
{
STableKeyInfo
*
info
=
taosArrayGet
(
pTableListInfo
->
pTableList
,
i
);
uint64_t
*
groupId
=
taosHashGet
(
pTableListInfo
->
map
,
&
info
->
uid
,
sizeof
(
uint64_t
));
int32_t
index
=
taosArraySearchIdx
(
sortSupport
,
groupId
,
compareUint64Val
,
TD_EQ
);
if
(
index
==
-
1
)
{
void
*
p
=
taosArraySearch
(
sortSupport
,
groupId
,
compareUint64Val
,
TD_GT
);
SArray
*
tGroup
=
taosArrayInit
(
8
,
sizeof
(
STableKeyInfo
));
if
(
tGroup
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
taosArrayDestroy
(
sortSupport
)
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
taosArrayPush
(
tGroup
,
info
)
==
NULL
)
{
qError
(
"taos push info array error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
taosArrayDestroy
(
sortSupport
)
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
if
(
p
==
NULL
)
{
if
(
taosArrayPush
(
sortSupport
,
groupId
)
==
NULL
)
{
qError
(
"taos push support array error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
taosArrayDestroy
(
sortSupport
)
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
if
(
taosArrayPush
(
pTableListInfo
->
pGroupList
,
&
tGroup
)
==
NULL
)
{
qError
(
"taos push group array error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
taosArrayDestroy
(
sortSupport
)
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
}
else
{
int32_t
pos
=
TARRAY_ELEM_IDX
(
sortSupport
,
p
);
if
(
taosArrayInsert
(
sortSupport
,
pos
,
groupId
)
==
NULL
)
{
qError
(
"taos insert support array error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
taosArrayDestroy
(
sortSupport
)
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
if
(
taosArrayInsert
(
pTableListInfo
->
pGroupList
,
pos
,
&
tGroup
)
==
NULL
)
{
qError
(
"taos insert group array error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
taosArrayDestroy
(
sortSupport
)
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
}
}
else
{
SArray
*
tGroup
=
(
SArray
*
)
taosArrayGetP
(
pTableListInfo
->
pGroupList
,
index
);
if
(
taosArrayPush
(
tGroup
,
info
)
==
NULL
)
{
qError
(
"taos push uid array error"
);
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_error
;
taosArrayDestroy
(
sortSupport
)
;
return
TSDB_CODE_QRY_APP_ERROR
;
}
}
}
taosArrayDestroy
(
sortSupport
);
#endif
return
TDB_CODE_SUCCESS
;
_error:
// taosArrayDestroy(sortSupport);
return
code
;
}
bool
groupbyTbname
(
SNodeList
*
pGroupList
)
{
...
...
@@ -3489,44 +3437,38 @@ bool groupbyTbname(SNodeList* pGroupList) {
return
bytbname
;
}
int32_t
generateGroupIdMap
(
STableListInfo
*
pTableListInfo
,
SReadHandle
*
pHandle
,
SNodeList
*
group
,
bool
groupSort
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
generateGroupIdMap
(
STableListInfo
*
pTableListInfo
,
SReadHandle
*
pHandle
,
SNodeList
*
group
)
{
if
(
group
==
NULL
)
{
return
code
;
return
TDB_CODE_SUCCESS
;
}
pTableListInfo
->
map
=
taosHashInit
(
32
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_ENTRY_LOCK
);
if
(
pTableListInfo
->
map
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
bool
assignUid
=
groupbyTbname
(
group
);
bool
assignUid
=
groupbyTbname
(
group
);
size_t
numOfTables
=
taosArrayGetSize
(
pTableListInfo
->
pTableList
);
if
(
assignUid
)
{
// in case of group/partition by tbname, the group id is equalled to the uid of table
if
(
assignUid
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
i
++
)
{
STableKeyInfo
*
info
=
taosArrayGet
(
pTableListInfo
->
pTableList
,
i
);
info
->
groupId
=
info
->
uid
;
taosHashPut
(
pTableListInfo
->
map
,
&
(
info
->
uid
),
sizeof
(
uint64_t
),
&
info
->
groupId
,
sizeof
(
uint64_t
));
}
pTableListInfo
->
oneTableForEachGroup
=
true
;
if
(
groupSort
)
{
pTableListInfo
->
numOfOuputGroups
=
numOfTables
;
}
}
else
{
code
=
getColInfoResultForGroupby
(
pHandle
->
meta
,
group
,
pTableListInfo
);
int32_t
code
=
getColInfoResultForGroupby
(
pHandle
->
meta
,
group
,
pTableListInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
}
if
(
groupSort
)
{
code
=
sortTableGroup
(
pTableListInfo
);
}
if
(
pTableListInfo
->
needSortTableByGroupId
)
{
return
sortTableGroup
(
pTableListInfo
);
}
return
code
;
return
TDB_CODE_SUCCESS
;
}
static
int32_t
initTableblockDistQueryCond
(
uint64_t
uid
,
SQueryTableDataCond
*
pCond
)
{
...
...
@@ -3563,12 +3505,6 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
==
type
)
{
STableScanPhysiNode
*
pTableScanNode
=
(
STableScanPhysiNode
*
)
pPhyNode
;
// NOTE: this is an patch to fix the physical plan
// TODO remove it later
if
(
pTableScanNode
->
scan
.
node
.
pLimit
!=
NULL
)
{
pTableScanNode
->
groupSort
=
true
;
}
int32_t
code
=
createScanTableListInfo
(
&
pTableScanNode
->
scan
,
pTableScanNode
->
pGroupTags
,
pTableScanNode
->
groupSort
,
pHandle
,
pTableListInfo
,
pTagCond
,
pTagIndexCond
,
GET_TASKID
(
pTaskInfo
));
...
...
@@ -3627,10 +3563,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t
sz
=
taosArrayGetSize
(
pTableListInfo
->
pTableList
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
STableKeyInfo
*
pKeyInfo
=
taosArrayGet
(
pTableListInfo
->
pTableList
,
i
);
qDebug
(
"creating stream task: add table
uid:%"
PRIu
64
,
pKeyInfo
->
uid
);
qDebug
(
"creating stream task: add table
%"
PRId
64
,
pKeyInfo
->
uid
);
}
qDebug
(
"table in hashmap, %d"
,
(
int32_t
)
getTotalTables
(
pTableListInfo
));
#endif
}
...
...
@@ -3665,20 +3599,13 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
}
SQueryTableDataCond
cond
=
{
0
};
int32_t
code
=
initTableblockDistQueryCond
(
pBlockNode
->
suid
,
&
cond
);
int32_t
code
=
initTableblockDistQueryCond
(
pBlockNode
->
suid
,
&
cond
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
NULL
;
}
size_t
num
=
getTotalTables
(
pTableListInfo
);
void
*
pList
=
NULL
;
if
(
num
>
0
)
{
pList
=
taosArrayGet
(
pTableListInfo
->
pTableList
,
0
);
}
STsdbReader
*
pReader
=
NULL
;
tsdbReaderOpen
(
pHandle
->
vnode
,
&
cond
,
p
List
,
num
,
&
pReader
,
""
);
tsdbReaderOpen
(
pHandle
->
vnode
,
&
cond
,
p
TableListInfo
->
pTableList
,
&
pReader
,
""
);
cleanupQueryTableDataCond
(
&
cond
);
pOperator
=
createDataBlockInfoScanOperator
(
pReader
,
pHandle
,
cond
.
suid
,
pBlockNode
,
pTaskInfo
);
...
...
@@ -3712,8 +3639,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
return
pOperator
;
}
size_t
size
=
LIST_LENGTH
(
pPhyNode
->
pChildren
);
size_t
size
=
LIST_LENGTH
(
pPhyNode
->
pChildren
);
SOperatorInfo
**
ops
=
taosMemoryCalloc
(
size
,
POINTER_BYTES
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SPhysiNode
*
pChildNode
=
(
SPhysiNode
*
)
nodesListGetNode
(
pPhyNode
->
pChildren
,
i
);
...
...
@@ -4049,10 +3975,28 @@ _complete:
return
code
;
}
void
doDestroyTableList
(
STableListInfo
*
pTableqinfoList
)
{
taosArrayDestroy
(
pTableqinfoList
->
pTableList
);
taosHashCleanup
(
pTableqinfoList
->
map
);
if
(
pTableqinfoList
->
needSortTableByGroupId
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pTableqinfoList
->
pGroupList
);
i
++
)
{
SArray
*
tmp
=
taosArrayGetP
(
pTableqinfoList
->
pGroupList
,
i
);
if
(
tmp
==
pTableqinfoList
->
pTableList
)
{
continue
;
}
taosArrayDestroy
(
tmp
);
}
}
taosArrayDestroy
(
pTableqinfoList
->
pGroupList
);
pTableqinfoList
->
pTableList
=
NULL
;
pTableqinfoList
->
map
=
NULL
;
}
void
doDestroyTask
(
SExecTaskInfo
*
pTaskInfo
)
{
qDebug
(
"%s execTask is freed"
,
GET_TASKID
(
pTaskInfo
));
destroyTableList
(
&
pTaskInfo
->
tableqinfoList
);
d
oD
estroyTableList
(
&
pTaskInfo
->
tableqinfoList
);
destroyOperatorInfo
(
pTaskInfo
->
pRoot
);
cleanupTableSchemaInfo
(
&
pTaskInfo
->
schemaInfo
);
cleanupStreamInfo
(
&
pTaskInfo
->
streamInfo
);
...
...
source/libs/executor/src/projectoperator.c
浏览文件 @
0035bb19
...
...
@@ -159,7 +159,6 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S
// reset the value for a new group data
// existing rows that belongs to previous group.
// TODO refactor with doTableScan
pLimitInfo
->
numOfOutputRows
=
0
;
pLimitInfo
->
remainOffset
=
pLimitInfo
->
limit
.
offset
;
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
source/libs/executor/src/sortoperator.c
浏览文件 @
0035bb19
...
...
@@ -38,7 +38,8 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
SExprInfo
*
pExprInfo
=
createExprInfo
(
pSortNode
->
pExprs
,
NULL
,
&
numOfCols
);
int32_t
numOfOutputCols
=
0
;
int32_t
code
=
extractColMatchInfo
(
pSortNode
->
pTargets
,
pDescNode
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
,
&
pInfo
->
matchInfo
);
int32_t
code
=
extractColMatchInfo
(
pSortNode
->
pTargets
,
pDescNode
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
,
&
pInfo
->
matchInfo
);
pOperator
->
exprSupp
.
pCtx
=
createSqlFunctionCtx
(
pExprInfo
,
numOfCols
,
&
pOperator
->
exprSupp
.
rowEntryInfoOffset
);
...
...
@@ -62,8 +63,8 @@ SOperatorInfo* createSortOperatorInfo(SOperatorInfo* downstream, SSortPhysiNode*
// there are headers, so pageSize = rowSize + header pInfo->sortBufSize = pInfo->bufPageSize * 16;
// TODO dynamic set the available sort buffer
pOperator
->
fpSet
=
createOperatorFpSet
(
doOpenSortOperator
,
doSort
,
NULL
,
NULL
,
destroyOrderOperatorInfo
,
getExplainExecInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
doOpenSortOperator
,
doSort
,
NULL
,
NULL
,
destroyOrderOperatorInfo
,
getExplainExecInfo
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -126,7 +127,7 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
int32_t
numOfCols
=
taosArrayGetSize
(
pColMatchInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColMatchItem
*
pmInfo
=
taosArrayGet
(
pColMatchInfo
,
i
);
// ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID);
// ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
dstSlotId
);
...
...
@@ -316,7 +317,7 @@ SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo
int32_t
numOfCols
=
taosArrayGetSize
(
pColMatchInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColMatchItem
*
pmInfo
=
taosArrayGet
(
pColMatchInfo
,
i
);
// ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID);
// ASSERT(pmInfo->matchType == COL_MATCH_FROM_SLOT_ID);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
dstSlotId
);
...
...
@@ -592,7 +593,7 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
blockDataEnsureCapacity
(
p
,
capacity
);
_retry:
_retry:
while
(
1
)
{
STupleHandle
*
pTupleHandle
=
NULL
;
if
(
pInfo
->
groupSort
)
{
...
...
@@ -647,13 +648,12 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
int32_t
numOfCols
=
taosArrayGetSize
(
pColMatchInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColMatchItem
*
pmInfo
=
taosArrayGet
(
pColMatchInfo
,
i
);
// ASSERT(pColMatchInfo-> == COL_MATCH_FROM_SLOT_ID);
// ASSERT(pColMatchInfo-> == COL_MATCH_FROM_SLOT_ID);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
dstSlotId
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
,
&
pDataBlock
->
info
);
}
pInfo
->
limitInfo
.
numOfOutputRows
+=
p
->
info
.
rows
;
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
groupId
=
pInfo
->
groupId
;
...
...
@@ -735,7 +735,8 @@ SOperatorInfo* createMultiwayMergeOperatorInfo(SOperatorInfo** downStreams, size
SArray
*
pSortInfo
=
createSortInfo
(
pMergePhyNode
->
pMergeKeys
);
int32_t
numOfOutputCols
=
0
;
code
=
extractColMatchInfo
(
pMergePhyNode
->
pTargets
,
pDescNode
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
,
&
pInfo
->
matchInfo
);
code
=
extractColMatchInfo
(
pMergePhyNode
->
pTargets
,
pDescNode
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
,
&
pInfo
->
matchInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
...
...
source/libs/function/src/builtins.c
浏览文件 @
0035bb19
...
...
@@ -1651,7 +1651,7 @@ static int32_t translateMode(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
static
int32_t
translateDiff
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
int32_t
numOfParams
=
LIST_LENGTH
(
pFunc
->
pParameterList
);
if
(
numOfParams
==
0
||
numOfParams
>
2
)
{
if
(
numOfParams
>
2
)
{
return
invaildFuncParaNumErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
0035bb19
...
...
@@ -380,7 +380,7 @@ typedef struct SGroupKeyInfo {
numOfElem += 1; \
pStddevRes->count -= 1; \
sumT -= plist[i]; \
pStddevRes->quadraticISum -=
plist[i] * plist[i];
\
pStddevRes->quadraticISum -=
(int64_t)(plist[i] * plist[i]);
\
} \
} while (0)
...
...
@@ -2526,8 +2526,9 @@ int32_t apercentileFunction(SqlFunctionCtx* pCtx) {
// might be a race condition here that pHisto can be overwritten or setup function
// has not been called, need to relink the buffer pHisto points to.
buildHistogramInfo
(
pInfo
);
qDebug
(
"%s before add %d elements into histogram, total:%"
PRId64
", numOfEntry:%d, pHisto:%p, elems: %p"
,
__FUNCTION__
,
numOfElems
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
,
pInfo
->
pHisto
->
elems
);
qDebug
(
"%s before add %d elements into histogram, total:%"
PRId64
", numOfEntry:%d, pHisto:%p, elems: %p"
,
__FUNCTION__
,
numOfElems
,
pInfo
->
pHisto
->
numOfElems
,
pInfo
->
pHisto
->
numOfEntries
,
pInfo
->
pHisto
,
pInfo
->
pHisto
->
elems
);
for
(
int32_t
i
=
start
;
i
<
pInput
->
numOfRows
+
start
;
++
i
)
{
if
(
colDataIsNull_f
(
pCol
->
nullbitmap
,
i
))
{
continue
;
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
0035bb19
...
...
@@ -111,6 +111,8 @@ const char* nodesNodeName(ENodeType type) {
return
"DropSuperTableStmt"
;
case
QUERY_NODE_ALTER_TABLE_STMT
:
return
"AlterTableStmt"
;
case
QUERY_NODE_ALTER_SUPER_TABLE_STMT
:
return
"AlterSuperTableStmt"
;
case
QUERY_NODE_CREATE_USER_STMT
:
return
"CreateUserStmt"
;
case
QUERY_NODE_ALTER_USER_STMT
:
...
...
@@ -669,7 +671,7 @@ static int32_t logicProjectNodeToJson(const void* pObj, SJson* pJson) {
code
=
nodeListToJson
(
pJson
,
jkProjectLogicPlanProjections
,
pNode
->
pProjections
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAdd
Integer
ToObject
(
pJson
,
jkProjectLogicPlanIgnoreGroupId
,
pNode
->
ignoreGroupId
);
code
=
tjsonAdd
Bool
ToObject
(
pJson
,
jkProjectLogicPlanIgnoreGroupId
,
pNode
->
ignoreGroupId
);
}
return
code
;
...
...
@@ -2632,6 +2634,7 @@ static const char* jkSubplanRootNode = "RootNode";
static
const
char
*
jkSubplanDataSink
=
"DataSink"
;
static
const
char
*
jkSubplanTagCond
=
"TagCond"
;
static
const
char
*
jkSubplanTagIndexCond
=
"TagIndexCond"
;
static
const
char
*
jkSubplanShowRewrite
=
"ShowRewrite"
;
static
int32_t
subplanToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SSubplan
*
pNode
=
(
const
SSubplan
*
)
pObj
;
...
...
@@ -2667,6 +2670,9 @@ static int32_t subplanToJson(const void* pObj, SJson* pJson) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkSubplanTagIndexCond
,
nodeToJson
,
pNode
->
pTagIndexCond
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddBoolToObject
(
pJson
,
jkSubplanShowRewrite
,
pNode
->
showRewrite
);
}
return
code
;
}
...
...
@@ -2705,6 +2711,9 @@ static int32_t jsonToSubplan(const SJson* pJson, void* pObj) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkSubplanTagIndexCond
,
(
SNode
**
)
&
pNode
->
pTagIndexCond
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetBoolValue
(
pJson
,
jkSubplanShowRewrite
,
&
pNode
->
showRewrite
);
}
return
code
;
}
...
...
@@ -2758,6 +2767,20 @@ static int32_t logicAggNodeToJson(const void* pObj, SJson* pJson) {
return
code
;
}
static
int32_t
jsonToLogicAggNode
(
const
SJson
*
pJson
,
void
*
pObj
)
{
SAggLogicNode
*
pNode
=
(
SAggLogicNode
*
)
pObj
;
int32_t
code
=
jsonToLogicPlanNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkAggLogicPlanGroupKeys
,
&
pNode
->
pGroupKeys
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkAggLogicPlanAggFuncs
,
&
pNode
->
pAggFuncs
);
}
return
code
;
}
static
const
char
*
jkDataTypeType
=
"Type"
;
static
const
char
*
jkDataTypePrecision
=
"Precision"
;
static
const
char
*
jkDataTypeScale
=
"Scale"
;
...
...
@@ -4735,6 +4758,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return
jsonToDeleteStmt
(
pJson
,
pObj
);
case
QUERY_NODE_LOGIC_PLAN_SCAN
:
return
jsonToLogicScanNode
(
pJson
,
pObj
);
case
QUERY_NODE_LOGIC_PLAN_AGG
:
return
jsonToLogicAggNode
(
pJson
,
pObj
);
case
QUERY_NODE_LOGIC_PLAN_PROJECT
:
return
jsonToLogicProjectNode
(
pJson
,
pObj
);
case
QUERY_NODE_LOGIC_PLAN_VNODE_MODIFY
:
...
...
source/libs/nodes/src/nodesMsgFuncs.c
浏览文件 @
0035bb19
...
...
@@ -1969,7 +1969,12 @@ static int32_t msgToPhysiScanNode(STlvDecoder* pDecoder, void* pObj) {
return
code
;
}
enum
{
PHY_LAST_ROW_SCAN_CODE_SCAN
=
1
,
PHY_LAST_ROW_SCAN_CODE_GROUP_TAGS
,
PHY_LAST_ROW_SCAN_CODE_GROUP_SORT
,
PHY_LAST_ROW_SCAN_CODE_IGNULL
};
enum
{
PHY_LAST_ROW_SCAN_CODE_SCAN
=
1
,
PHY_LAST_ROW_SCAN_CODE_GROUP_TAGS
,
PHY_LAST_ROW_SCAN_CODE_GROUP_SORT
,
PHY_LAST_ROW_SCAN_CODE_IGNULL
};
static
int32_t
physiLastRowScanNodeToMsg
(
const
void
*
pObj
,
STlvEncoder
*
pEncoder
)
{
const
SLastRowScanPhysiNode
*
pNode
=
(
const
SLastRowScanPhysiNode
*
)
pObj
;
...
...
@@ -3433,6 +3438,9 @@ static int32_t subplanInlineToMsg(const void* pObj, STlvEncoder* pEncoder) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
queryNodeAddrInlineToMsg
(
&
pNode
->
execNode
,
pEncoder
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tlvEncodeValueBool
(
pEncoder
,
pNode
->
showRewrite
);
}
return
code
;
}
...
...
@@ -3479,6 +3487,9 @@ static int32_t msgToSubplanInline(STlvDecoder* pDecoder, void* pObj) {
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
msgToQueryNodeAddrInline
(
pDecoder
,
&
pNode
->
execNode
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tlvDecodeValueBool
(
pDecoder
,
&
pNode
->
showRewrite
);
}
return
code
;
}
...
...
source/libs/nodes/src/nodesTraverseFuncs.c
浏览文件 @
0035bb19
...
...
@@ -438,210 +438,3 @@ void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewrit
return
;
}
static
EDealRes
walkPhysiNode
(
SPhysiNode
*
pNode
,
ETraversalOrder
order
,
FNodeWalker
walker
,
void
*
pContext
)
{
EDealRes
res
=
walkPhysiPlan
((
SNode
*
)
pNode
->
pOutputDataBlockDesc
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlan
(
pNode
->
pConditions
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pNode
->
pChildren
,
order
,
walker
,
pContext
);
}
return
res
;
}
static
EDealRes
walkScanPhysi
(
SScanPhysiNode
*
pScan
,
ETraversalOrder
order
,
FNodeWalker
walker
,
void
*
pContext
)
{
EDealRes
res
=
walkPhysiNode
((
SPhysiNode
*
)
pScan
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pScan
->
pScanCols
,
order
,
walker
,
pContext
);
}
return
res
;
}
static
EDealRes
walkTableScanPhysi
(
STableScanPhysiNode
*
pScan
,
ETraversalOrder
order
,
FNodeWalker
walker
,
void
*
pContext
)
{
EDealRes
res
=
walkScanPhysi
((
SScanPhysiNode
*
)
pScan
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pScan
->
pDynamicScanFuncs
,
order
,
walker
,
pContext
);
}
return
res
;
}
static
EDealRes
walkWindowPhysi
(
SWinodwPhysiNode
*
pWindow
,
ETraversalOrder
order
,
FNodeWalker
walker
,
void
*
pContext
)
{
EDealRes
res
=
walkPhysiNode
((
SPhysiNode
*
)
pWindow
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pWindow
->
pExprs
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pWindow
->
pFuncs
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlan
(
pWindow
->
pTspk
,
order
,
walker
,
pContext
);
}
return
res
;
}
static
EDealRes
dispatchPhysiPlan
(
SNode
*
pNode
,
ETraversalOrder
order
,
FNodeWalker
walker
,
void
*
pContext
)
{
EDealRes
res
=
DEAL_RES_CONTINUE
;
switch
(
nodeType
(
pNode
))
{
case
QUERY_NODE_NODE_LIST
:
res
=
walkPhysiPlans
(((
SNodeListNode
*
)
pNode
)
->
pNodeList
,
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
:
res
=
walkScanPhysi
((
SScanPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
:
res
=
walkTableScanPhysi
((
STableScanPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN
:
res
=
walkTableScanPhysi
((
STableScanPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
:
res
=
walkScanPhysi
((
SScanPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
:
res
=
walkScanPhysi
((
SScanPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_PROJECT
:
{
SProjectPhysiNode
*
pProject
=
(
SProjectPhysiNode
*
)
pNode
;
res
=
walkPhysiNode
((
SPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pProject
->
pProjections
,
order
,
walker
,
pContext
);
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN
:
{
SSortMergeJoinPhysiNode
*
pJoin
=
(
SSortMergeJoinPhysiNode
*
)
pNode
;
res
=
walkPhysiNode
((
SPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlan
(
pJoin
->
pMergeCondition
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlan
(
pJoin
->
pOnConditions
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pJoin
->
pTargets
,
order
,
walker
,
pContext
);
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_HASH_AGG
:
{
SAggPhysiNode
*
pAgg
=
(
SAggPhysiNode
*
)
pNode
;
res
=
walkPhysiNode
((
SPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pAgg
->
pExprs
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pAgg
->
pGroupKeys
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pAgg
->
pAggFuncs
,
order
,
walker
,
pContext
);
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
:
{
SExchangePhysiNode
*
pExchange
=
(
SExchangePhysiNode
*
)
pNode
;
res
=
walkPhysiNode
((
SPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pExchange
->
pSrcEndPoints
,
order
,
walker
,
pContext
);
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_SORT
:
case
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT
:
{
SSortPhysiNode
*
pSort
=
(
SSortPhysiNode
*
)
pNode
;
res
=
walkPhysiNode
((
SPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pSort
->
pExprs
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pSort
->
pSortKeys
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pSort
->
pTargets
,
order
,
walker
,
pContext
);
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
:
res
=
walkWindowPhysi
((
SWinodwPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION
:
res
=
walkWindowPhysi
((
SWinodwPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE
:
{
SStateWinodwPhysiNode
*
pState
=
(
SStateWinodwPhysiNode
*
)
pNode
;
res
=
walkWindowPhysi
((
SWinodwPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlan
(
pState
->
pStateKey
,
order
,
walker
,
pContext
);
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_PARTITION
:
case
QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION
:
{
SPartitionPhysiNode
*
pPart
=
(
SPartitionPhysiNode
*
)
pNode
;
res
=
walkPhysiNode
((
SPhysiNode
*
)
pNode
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pPart
->
pExprs
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pPart
->
pPartitionKeys
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlans
(
pPart
->
pTargets
,
order
,
walker
,
pContext
);
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_DISPATCH
:
res
=
walkPhysiPlan
((
SNode
*
)(((
SDataSinkNode
*
)
pNode
)
->
pInputDataBlockDesc
),
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_PLAN_INSERT
:
res
=
walkPhysiPlan
((
SNode
*
)(((
SDataSinkNode
*
)
pNode
)
->
pInputDataBlockDesc
),
order
,
walker
,
pContext
);
break
;
case
QUERY_NODE_PHYSICAL_SUBPLAN
:
{
SSubplan
*
pSubplan
=
(
SSubplan
*
)
pNode
;
res
=
walkPhysiPlans
(
pSubplan
->
pChildren
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlan
((
SNode
*
)
pSubplan
->
pNode
,
order
,
walker
,
pContext
);
}
if
(
DEAL_RES_ERROR
!=
res
&&
DEAL_RES_END
!=
res
)
{
res
=
walkPhysiPlan
((
SNode
*
)
pSubplan
->
pDataSink
,
order
,
walker
,
pContext
);
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN
:
{
SQueryPlan
*
pPlan
=
(
SQueryPlan
*
)
pNode
;
if
(
NULL
!=
pPlan
->
pSubplans
)
{
// only need to walk the top-level subplans, because they will recurse to all the subplans below
walkPhysiPlan
(
nodesListGetNode
(
pPlan
->
pSubplans
,
0
),
order
,
walker
,
pContext
);
}
break
;
}
default:
res
=
dispatchExpr
(
pNode
,
order
,
walker
,
pContext
);
break
;
}
return
res
;
}
static
EDealRes
walkPhysiPlan
(
SNode
*
pNode
,
ETraversalOrder
order
,
FNodeWalker
walker
,
void
*
pContext
)
{
return
walkNode
(
pNode
,
order
,
walker
,
pContext
,
dispatchPhysiPlan
);
}
static
EDealRes
walkPhysiPlans
(
SNodeList
*
pNodeList
,
ETraversalOrder
order
,
FNodeWalker
walker
,
void
*
pContext
)
{
SNode
*
node
;
FOREACH
(
node
,
pNodeList
)
{
EDealRes
res
=
walkPhysiPlan
(
node
,
order
,
walker
,
pContext
);
if
(
DEAL_RES_ERROR
==
res
||
DEAL_RES_END
==
res
)
{
return
res
;
}
}
return
DEAL_RES_CONTINUE
;
}
void
nodesWalkPhysiPlan
(
SNode
*
pNode
,
FNodeWalker
walker
,
void
*
pContext
)
{
(
void
)
walkPhysiPlan
(
pNode
,
TRAVERSAL_PREORDER
,
walker
,
pContext
);
}
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
0035bb19
...
...
@@ -328,6 +328,7 @@ SNode* nodesMakeNode(ENodeType type) {
case
QUERY_NODE_DROP_SUPER_TABLE_STMT
:
return
makeNode
(
type
,
sizeof
(
SDropSuperTableStmt
));
case
QUERY_NODE_ALTER_TABLE_STMT
:
case
QUERY_NODE_ALTER_SUPER_TABLE_STMT
:
return
makeNode
(
type
,
sizeof
(
SAlterTableStmt
));
case
QUERY_NODE_CREATE_USER_STMT
:
return
makeNode
(
type
,
sizeof
(
SCreateUserStmt
));
...
...
source/libs/nodes/test/CMakeLists.txt
浏览文件 @
0035bb19
MESSAGE
(
STATUS
"build nodes unit test"
)
# GoogleTest requires at least C++11
SET
(
CMAKE_CXX_STANDARD 11
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
ADD_EXECUTABLE
(
nodesTest
${
SOURCE_LIST
}
)
TARGET_INCLUDE_DIRECTORIES
(
IF
(
NOT TD_DARWIN
)
# GoogleTest requires at least C++11
SET
(
CMAKE_CXX_STANDARD 11
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
ADD_EXECUTABLE
(
nodesTest
${
SOURCE_LIST
}
)
TARGET_INCLUDE_DIRECTORIES
(
nodesTest
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/nodes/"
PRIVATE
"
${
TD_SOURCE_DIR
}
/source/nodes/inc"
)
TARGET_LINK_LIBRARIES
(
)
TARGET_LINK_LIBRARIES
(
nodesTest
PUBLIC os util common nodes gtest
)
PUBLIC os util common nodes qcom gtest
)
add_test
(
NAME nodesTest
COMMAND nodesTest
)
ENDIF
()
source/libs/nodes/test/nodesCloneTest.cpp
0 → 100644
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
source/libs/nodes/test/nodesTest.cpp
→
source/libs/nodes/test/nodesTest
Main
.cpp
浏览文件 @
0035bb19
文件已移动
source/libs/parser/inc/sql.y
浏览文件 @
0035bb19
...
...
@@ -518,6 +518,7 @@ stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE.
stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)B)->pDelay = releaseRawExprNode(pCxt, C); A = B; }
stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; }
stream_options(A) ::= stream_options(B) IGNORE EXPIRED NK_INTEGER(C). { ((SStreamOptions*)B)->ignoreExpired = taosStr2Int8(C.z, NULL, 10); A = B; }
stream_options(A) ::= stream_options(B) FILL_HISTORY NK_INTEGER(C). { ((SStreamOptions*)B)->fillHistory = taosStr2Int8(C.z, NULL, 10); A = B; }
subtable_opt(A) ::= . { A = NULL; }
subtable_opt(A) ::= SUBTABLE NK_LP expression(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
0035bb19
...
...
@@ -1702,6 +1702,7 @@ SNode* createStreamOptions(SAstCreateContext* pCxt) {
SStreamOptions
*
pOptions
=
(
SStreamOptions
*
)
nodesMakeNode
(
QUERY_NODE_STREAM_OPTIONS
);
CHECK_OUT_OF_MEM
(
pOptions
);
pOptions
->
triggerType
=
STREAM_TRIGGER_AT_ONCE
;
pOptions
->
fillHistory
=
STREAM_DEFAULT_FILL_HISTORY
;
pOptions
->
ignoreExpired
=
STREAM_DEFAULT_IGNORE_EXPIRED
;
return
(
SNode
*
)
pOptions
;
}
...
...
source/libs/parser/src/parTokenizer.c
浏览文件 @
0035bb19
...
...
@@ -92,6 +92,7 @@ static SKeyword keywordTable[] = {
{
"EVERY"
,
TK_EVERY
},
{
"FILE"
,
TK_FILE
},
{
"FILL"
,
TK_FILL
},
{
"FILL_HISTORY"
,
TK_FILL_HISTORY
},
{
"FIRST"
,
TK_FIRST
},
{
"FLOAT"
,
TK_FLOAT
},
{
"FLUSH"
,
TK_FLUSH
},
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
0035bb19
...
...
@@ -5542,6 +5542,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt*
pReq
->
triggerType
=
pStmt
->
pOptions
->
triggerType
;
pReq
->
maxDelay
=
(
NULL
!=
pStmt
->
pOptions
->
pDelay
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pDelay
)
->
datum
.
i
:
0
);
pReq
->
watermark
=
(
NULL
!=
pStmt
->
pOptions
->
pWatermark
?
((
SValueNode
*
)
pStmt
->
pOptions
->
pWatermark
)
->
datum
.
i
:
0
);
pReq
->
fillHistory
=
pStmt
->
pOptions
->
fillHistory
;
pReq
->
igExpired
=
pStmt
->
pOptions
->
ignoreExpired
;
columnDefNodeToField
(
pStmt
->
pTags
,
&
pReq
->
pTags
);
pReq
->
numOfTags
=
LIST_LENGTH
(
pStmt
->
pTags
);
...
...
source/libs/parser/src/sql.c
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
0035bb19
...
...
@@ -576,10 +576,10 @@ TEST_F(ParserInitialCTest, createStream) {
memset
(
&
expect
,
0
,
sizeof
(
SCMCreateStreamReq
));
};
auto
setCreateStreamReq
Func
=
[
&
](
const
char
*
pStream
,
const
char
*
pSrcDb
,
const
char
*
pSql
,
const
char
*
pDstStb
,
int8_t
igExists
=
0
,
int8_t
triggerType
=
STREAM_TRIGGER_AT_ONCE
,
int64_t
maxDelay
=
0
,
int64_t
watermark
=
0
,
int8_t
igExpired
=
STREAM_DEFAULT_IGNORE_EXPIRED
)
{
auto
setCreateStreamReq
=
[
&
](
const
char
*
pStream
,
const
char
*
pSrcDb
,
const
char
*
pSql
,
const
char
*
pDstStb
,
int8_t
igExists
=
0
,
int8_t
triggerType
=
STREAM_TRIGGER_AT_ONCE
,
int64_t
maxDelay
=
0
,
int64_t
watermark
=
0
,
int8_t
igExpired
=
STREAM_DEFAULT_IGNORE_EXPIRED
,
int8_t
fillHistory
=
STREAM_DEFAULT_FILL_HISTORY
)
{
snprintf
(
expect
.
name
,
sizeof
(
expect
.
name
),
"0.%s"
,
pStream
);
snprintf
(
expect
.
sourceDB
,
sizeof
(
expect
.
sourceDB
),
"0.%s"
,
pSrcDb
);
snprintf
(
expect
.
targetStbFullName
,
sizeof
(
expect
.
targetStbFullName
),
"0.test.%s"
,
pDstStb
);
...
...
@@ -588,6 +588,7 @@ TEST_F(ParserInitialCTest, createStream) {
expect
.
triggerType
=
triggerType
;
expect
.
maxDelay
=
maxDelay
;
expect
.
watermark
=
watermark
;
expect
.
fillHistory
=
fillHistory
;
expect
.
igExpired
=
igExpired
;
};
...
...
@@ -619,6 +620,7 @@ TEST_F(ParserInitialCTest, createStream) {
ASSERT_EQ
(
req
.
triggerType
,
expect
.
triggerType
);
ASSERT_EQ
(
req
.
maxDelay
,
expect
.
maxDelay
);
ASSERT_EQ
(
req
.
watermark
,
expect
.
watermark
);
ASSERT_EQ
(
req
.
fillHistory
,
expect
.
fillHistory
);
ASSERT_EQ
(
req
.
igExpired
,
expect
.
igExpired
);
ASSERT_EQ
(
req
.
numOfTags
,
expect
.
numOfTags
);
if
(
expect
.
numOfTags
>
0
)
{
...
...
@@ -636,24 +638,24 @@ TEST_F(ParserInitialCTest, createStream) {
tFreeSCMCreateStreamReq
(
&
req
);
});
setCreateStreamReq
Func
(
"s1"
,
"test"
,
"create stream s1 into st1 as select count(*) from t1 interval(10s)"
,
"st1"
);
setCreateStreamReq
(
"s1"
,
"test"
,
"create stream s1 into st1 as select count(*) from t1 interval(10s)"
,
"st1"
);
run
(
"CREATE STREAM s1 INTO st1 AS SELECT COUNT(*) FROM t1 INTERVAL(10S)"
);
clearCreateStreamReq
();
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 into st1 "
"as select count(*) from t1 interval(10s)"
,
"st1"
,
1
,
STREAM_TRIGGER_MAX_DELAY
,
20
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_SECOND
,
0
);
run
(
"CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 INTO st1 AS SELECT COUNT(*) "
setCreateStreamReq
(
"s1"
,
"test"
,
"create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired 0 fill_history 1 into st1 "
"as select count(*) from t1 interval(10s)"
,
"st1"
,
1
,
STREAM_TRIGGER_MAX_DELAY
,
20
*
MILLISECOND_PER_SECOND
,
10
*
MILLISECOND_PER_SECOND
,
0
,
1
);
run
(
"CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED 0 FILL_HISTORY 1 INTO st1 AS "
"SELECT COUNT(*) "
"FROM t1 INTERVAL(10S)"
);
clearCreateStreamReq
();
setCreateStreamReqFunc
(
"s1"
,
"test"
,
"create stream s1 into st3 tags(tname varchar(10), id int) subtable(concat('new-', tname)) as "
"select _wstart wstart, count(*) cnt from st1 partition by tbname tname, tag1 id interval(10s)"
,
"st3"
);
setCreateStreamReq
(
"s1"
,
"test"
,
"create stream s1 into st3 tags(tname varchar(10), id int) subtable(concat('new-', tname)) as "
"select _wstart wstart, count(*) cnt from st1 partition by tbname tname, tag1 id interval(10s)"
,
"st3"
);
addTag
(
"tname"
,
TSDB_DATA_TYPE_VARCHAR
,
10
+
VARSTR_HEADER_SIZE
);
addTag
(
"id"
,
TSDB_DATA_TYPE_INT
);
run
(
"CREATE STREAM s1 INTO st3 TAGS(tname VARCHAR(10), id INT) SUBTABLE(CONCAT('new-', tname)) "
...
...
source/libs/parser/test/parTestUtil.cpp
浏览文件 @
0035bb19
...
...
@@ -295,6 +295,10 @@ class ParserTestBaseImpl {
char
*
pStr
=
NULL
;
int32_t
len
=
0
;
DO_WITH_THROW
(
nodesNodeToString
,
pRoot
,
false
,
&
pStr
,
&
len
)
// check toObject
SNode
*
pCopy
=
NULL
;
DO_WITH_THROW
(
nodesStringToNode
,
pStr
,
&
pCopy
)
nodesDestroyNode
(
pCopy
);
string
str
(
pStr
);
taosMemoryFreeClear
(
pStr
);
return
str
;
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
0035bb19
...
...
@@ -339,29 +339,6 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
return
code
;
}
static
int32_t
createColumnByLastRow
(
SNodeList
*
pFuncs
,
SNodeList
**
pOutput
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNodeList
*
pCols
=
NULL
;
SNode
*
pFunc
=
NULL
;
FOREACH
(
pFunc
,
pFuncs
)
{
SFunctionNode
*
pLastRow
=
(
SFunctionNode
*
)
pFunc
;
SColumnNode
*
pCol
=
(
SColumnNode
*
)
nodesListGetNode
(
pLastRow
->
pParameterList
,
0
);
snprintf
(
pCol
->
colName
,
sizeof
(
pCol
->
colName
),
"%s"
,
pLastRow
->
node
.
aliasName
);
snprintf
(
pCol
->
node
.
aliasName
,
sizeof
(
pCol
->
colName
),
"%s"
,
pLastRow
->
node
.
aliasName
);
NODES_CLEAR_LIST
(
pLastRow
->
pParameterList
);
code
=
nodesListMakeStrictAppend
(
&
pCols
,
(
SNode
*
)
pCol
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
break
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pOutput
=
pCols
;
}
else
{
nodesDestroyList
(
pCols
);
}
return
code
;
}
static
int32_t
createSubqueryLogicNode
(
SLogicPlanContext
*
pCxt
,
SSelectStmt
*
pSelect
,
STempTableNode
*
pTable
,
SLogicNode
**
pLogicNode
)
{
return
createQueryLogicNode
(
pCxt
,
pTable
->
pSubquery
,
pLogicNode
);
...
...
@@ -491,20 +468,6 @@ static SNode* createGroupingSetNode(SNode* pExpr) {
return
(
SNode
*
)
pGroupingSet
;
}
static
int32_t
createGroupKeysFromPartKeys
(
SNodeList
*
pPartKeys
,
SNodeList
**
pOutput
)
{
SNodeList
*
pGroupKeys
=
NULL
;
SNode
*
pPartKey
=
NULL
;
FOREACH
(
pPartKey
,
pPartKeys
)
{
int32_t
code
=
nodesListMakeStrictAppend
(
&
pGroupKeys
,
createGroupingSetNode
(
pPartKey
));
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesDestroyList
(
pGroupKeys
);
return
code
;
}
}
*
pOutput
=
pGroupKeys
;
return
TSDB_CODE_SUCCESS
;
}
static
EGroupAction
getGroupAction
(
SLogicPlanContext
*
pCxt
,
SSelectStmt
*
pSelect
)
{
return
(
pCxt
->
pPlanCxt
->
streamQuery
||
NULL
!=
pSelect
->
pLimit
||
NULL
!=
pSelect
->
pSlimit
)
?
GROUP_ACTION_KEEP
:
GROUP_ACTION_NONE
;
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
0035bb19
...
...
@@ -584,6 +584,7 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pSubplan
->
showRewrite
=
pScanLogicNode
->
showRewrite
;
pScan
->
showRewrite
=
pScanLogicNode
->
showRewrite
;
pScan
->
accountId
=
pCxt
->
pPlanCxt
->
acctId
;
pScan
->
sysInfo
=
pCxt
->
pPlanCxt
->
sysInfo
;
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
0035bb19
...
...
@@ -1419,7 +1419,8 @@ typedef struct SQnodeSplitInfo {
static
bool
qndSplFindSplitNode
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
SLogicNode
*
pNode
,
SQnodeSplitInfo
*
pInfo
)
{
if
(
QUERY_NODE_LOGIC_PLAN_SCAN
==
nodeType
(
pNode
)
&&
NULL
!=
pNode
->
pParent
&&
((
SScanLogicNode
*
)
pNode
)
->
scanSeq
[
0
]
<
1
&&
((
SScanLogicNode
*
)
pNode
)
->
scanSeq
[
1
]
<
1
)
{
QUERY_NODE_LOGIC_PLAN_INTERP_FUNC
!=
nodeType
(
pNode
->
pParent
)
&&
((
SScanLogicNode
*
)
pNode
)
->
scanSeq
[
0
]
<=
1
&&
((
SScanLogicNode
*
)
pNode
)
->
scanSeq
[
1
]
<=
1
)
{
pInfo
->
pSplitNode
=
pNode
;
pInfo
->
pSubplan
=
pSubplan
;
return
true
;
...
...
source/libs/planner/src/planner.c
浏览文件 @
0035bb19
...
...
@@ -142,15 +142,6 @@ int32_t qMsgToSubplan(const char* pStr, int32_t len, SSubplan** pSubplan) {
return
nodesMsgToNode
(
pStr
,
len
,
(
SNode
**
)
pSubplan
);
}
char
*
qQueryPlanToString
(
const
SQueryPlan
*
pPlan
)
{
char
*
pStr
=
NULL
;
int32_t
len
=
0
;
if
(
TSDB_CODE_SUCCESS
!=
nodesNodeToString
((
SNode
*
)
pPlan
,
false
,
&
pStr
,
&
len
))
{
return
NULL
;
}
return
pStr
;
}
SQueryPlan
*
qStringToQueryPlan
(
const
char
*
pStr
)
{
SQueryPlan
*
pPlan
=
NULL
;
if
(
TSDB_CODE_SUCCESS
!=
nodesStringToNode
(
pStr
,
(
SNode
**
)
&
pPlan
))
{
...
...
source/libs/planner/test/planTestUtil.cpp
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
source/libs/stream/src/streamState.c
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
source/libs/wal/src/walMeta.c
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
source/os/src/osDir.c
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/parallel_test/container_build.sh
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/pytest/util/dnodes.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/api/makefile
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/api/stopquery.c
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/jenkins/basic.txt
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/test.sh
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/tmp/monitor.sim
浏览文件 @
0035bb19
...
...
@@ -24,3 +24,5 @@ print =============== create drop qnode 1
sql create qnode on dnode 1
#sql create snode on dnode 1
sleep 10000
system sh/exec.sh -n dnode1 -s stop
tests/script/tsim/dnode/split_vgroup_replica1.sim
0 → 100644
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/tsim/dnode/split_vgroup_replica3.sim
0 → 100644
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/tsim/insert/basic.sim
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/tsim/parser/limit1_stb.sim
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/tsim/parser/limit_stb.sim
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/tsim/stream/partitionbyColumnInterval.sim
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/script/tsim/stream/schedSnode.sim
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/0-others/taosdShell.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/1-insert/block_wise.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/1-insert/database_pre_suf.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/1-insert/keep_expired.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/2-query/diff.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/2-query/elapsed.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/2-query/histogram.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/2-query/last.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/2-query/select_index.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/2-query/unique.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqDnodeRestart.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqDnodeRestart1.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqError.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqShow.py
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
tools/CMakeLists.txt
浏览文件 @
0035bb19
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录