chore: merge 3.0
|
@ -156,6 +156,9 @@ pcre2_grep_test.sh
|
||||||
pcre2_chartables.c
|
pcre2_chartables.c
|
||||||
geos-config
|
geos-config
|
||||||
config.h
|
config.h
|
||||||
|
!contrib/xml2-cmake
|
||||||
|
!contrib/xml2-cmake/linux_x86_64/include/config.h
|
||||||
|
!contrib/xml2-cmake/CMakeLists.txt
|
||||||
pcre2.h
|
pcre2.h
|
||||||
zconf.h
|
zconf.h
|
||||||
version.h
|
version.h
|
||||||
|
|
|
@ -11,36 +11,29 @@ if(NOT DEFINED TD_SOURCE_DIR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR})
|
SET(TD_COMMUNITY_DIR ${PROJECT_SOURCE_DIR})
|
||||||
|
|
||||||
set(TD_SUPPORT_DIR "${TD_SOURCE_DIR}/cmake")
|
set(TD_SUPPORT_DIR "${TD_SOURCE_DIR}/cmake")
|
||||||
set(TD_CONTRIB_DIR "${TD_SOURCE_DIR}/contrib")
|
set(TD_CONTRIB_DIR "${TD_SOURCE_DIR}/contrib")
|
||||||
|
|
||||||
include(${TD_SUPPORT_DIR}/cmake.platform)
|
include(${TD_SUPPORT_DIR}/cmake.platform)
|
||||||
include(${TD_SUPPORT_DIR}/cmake.define)
|
|
||||||
include(${TD_SUPPORT_DIR}/cmake.options)
|
include(${TD_SUPPORT_DIR}/cmake.options)
|
||||||
|
include(${TD_SUPPORT_DIR}/cmake.define)
|
||||||
include(${TD_SUPPORT_DIR}/cmake.version)
|
include(${TD_SUPPORT_DIR}/cmake.version)
|
||||||
|
include(${TD_SUPPORT_DIR}/cmake.install)
|
||||||
# contrib
|
|
||||||
add_subdirectory(contrib)
|
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES OFF)
|
set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES OFF)
|
||||||
|
|
||||||
# api
|
|
||||||
add_library(api INTERFACE)
|
add_library(api INTERFACE)
|
||||||
target_include_directories(api INTERFACE "include/client")
|
target_include_directories(api INTERFACE "include/client")
|
||||||
|
|
||||||
# src
|
add_subdirectory(contrib)
|
||||||
if(${BUILD_TEST})
|
|
||||||
include(CTest)
|
|
||||||
enable_testing()
|
|
||||||
endif(${BUILD_TEST})
|
|
||||||
|
|
||||||
add_subdirectory(source)
|
add_subdirectory(source)
|
||||||
add_subdirectory(tools)
|
add_subdirectory(tools)
|
||||||
add_subdirectory(utils)
|
add_subdirectory(utils)
|
||||||
add_subdirectory(examples/c)
|
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
include(${TD_SUPPORT_DIR}/cmake.install)
|
|
||||||
|
|
||||||
# docs
|
|
||||||
add_subdirectory(docs/doxgen)
|
add_subdirectory(docs/doxgen)
|
||||||
|
|
||||||
|
if(${BUILD_TEST})
|
||||||
|
include(CTest)
|
||||||
|
enable_testing()
|
||||||
|
add_subdirectory(examples/c)
|
||||||
|
endif(${BUILD_TEST})
|
82
README-CN.md
|
@ -15,23 +15,23 @@
|
||||||
1. [TDengine 简介](#1-tdengine-简介)
|
1. [TDengine 简介](#1-tdengine-简介)
|
||||||
1. [文档](#2-文档)
|
1. [文档](#2-文档)
|
||||||
1. [必备工具](#3-必备工具)
|
1. [必备工具](#3-必备工具)
|
||||||
- [3.1 Linux预备](#31-linux系统)
|
- [3.1 Linux 预备](#31-Linux系统)
|
||||||
- [3.2 macOS预备](#32-macos系统)
|
- [3.2 macOS 预备](#32-macOS系统)
|
||||||
- [3.3 Windows预备](#33-windows系统)
|
- [3.3 Windows 预备](#3.3-Windows系统)
|
||||||
- [3.4 克隆仓库](#34-克隆仓库)
|
- [3.4 克隆仓库](#34-克隆仓库)
|
||||||
1. [构建](#4-构建)
|
1. [构建](#4-构建)
|
||||||
- [4.1 Linux系统上构建](#41-linux系统上构建)
|
- [4.1 Linux 系统上构建](#41-Linux系统上构建)
|
||||||
- [4.2 macOS系统上构建](#42-macos系统上构建)
|
- [4.2 macOS 系统上构建](#42-macOS系统上构建)
|
||||||
- [4.3 Windows系统上构建](#43-windows系统上构建)
|
- [4.3 Windows 系统上构建](#43-Windows系统上构建)
|
||||||
1. [打包](#5-打包)
|
1. [打包](#5-打包)
|
||||||
1. [安装](#6-安装)
|
1. [安装](#6-安装)
|
||||||
- [6.1 Linux系统上安装](#61-linux系统上安装)
|
- [6.1 Linux 系统上安装](#61-Linux系统上安装)
|
||||||
- [6.2 macOS系统上安装](#62-macos系统上安装)
|
- [6.2 macOS 系统上安装](#62-macOS系统上安装)
|
||||||
- [6.3 Windows系统上安装](#63-windows系统上安装)
|
- [6.3 Windows 系统上安装](#63-Windows系统上安装)
|
||||||
1. [快速运行](#7-快速运行)
|
1. [快速运行](#7-快速运行)
|
||||||
- [7.1 Linux系统上运行](#71-linux系统上运行)
|
- [7.1 Linux 系统上运行](#71-Linux系统上运行)
|
||||||
- [7.2 macOS系统上运行](#72-macos系统上运行)
|
- [7.2 macOS 系统上运行](#72-macOS系统上运行)
|
||||||
- [7.3 Windows系统上运行](#73-windows系统上运行)
|
- [7.3 Windows 系统上运行](#73-Windows系统上运行)
|
||||||
1. [测试](#8-测试)
|
1. [测试](#8-测试)
|
||||||
1. [版本发布](#9-版本发布)
|
1. [版本发布](#9-版本发布)
|
||||||
1. [工作流](#10-工作流)
|
1. [工作流](#10-工作流)
|
||||||
|
@ -63,11 +63,11 @@ TDengine 是一款开源、高性能、云原生的时序数据库 (Time-Series
|
||||||
|
|
||||||
用户可根据需求选择通过 [容器](https://docs.taosdata.com/get-started/docker/)、[安装包](https://docs.taosdata.com/get-started/package/)、[Kubernetes](https://docs.taosdata.com/deployment/k8s/) 来安装或直接使用无需安装部署的 [云服务](https://cloud.taosdata.com/)。本快速指南是面向想自己编译、打包、测试的开发者的。
|
用户可根据需求选择通过 [容器](https://docs.taosdata.com/get-started/docker/)、[安装包](https://docs.taosdata.com/get-started/package/)、[Kubernetes](https://docs.taosdata.com/deployment/k8s/) 来安装或直接使用无需安装部署的 [云服务](https://cloud.taosdata.com/)。本快速指南是面向想自己编译、打包、测试的开发者的。
|
||||||
|
|
||||||
如果想编译或测试TDengine连接器,请访问以下仓库: [JDBC连接器](https://github.com/taosdata/taos-connector-jdbc), [Go连接器](https://github.com/taosdata/driver-go), [Python连接器](https://github.com/taosdata/taos-connector-python), [Node.js连接器](https://github.com/taosdata/taos-connector-node), [C#连接器](https://github.com/taosdata/taos-connector-dotnet), [Rust连接器](https://github.com/taosdata/taos-connector-rust).
|
如果想编译或测试 TDengine 连接器,请访问以下仓库:[JDBC连接器](https://github.com/taosdata/taos-connector-jdbc)、[Go连接器](https://github.com/taosdata/driver-go)、[Python连接器](https://github.com/taosdata/taos-connector-python)、[Node.js连接器](https://github.com/taosdata/taos-connector-node)、[C#连接器](https://github.com/taosdata/taos-connector-dotnet)、[Rust连接器](https://github.com/taosdata/taos-connector-rust)。
|
||||||
|
|
||||||
# 3. 前置条件
|
# 3. 前置条件
|
||||||
|
|
||||||
TDengine 目前可以在 Linux、 Windows、macOS 等平台上安装和运行。任何 OS 的应用也可以选择 taosAdapter 的 RESTful 接口连接服务端 taosd。CPU 支持 X64/ARM64,后续会支持 MIPS64、Alpha64、ARM32、RISC-V 等 CPU 架构。目前不支持使用交叉编译器构建。
|
TDengine 目前可以在 Linux、 Windows、macOS 等平台上安装和运行。任何 OS 的应用也可以选择 taosAdapter 的 RESTful 接口连接服务端 taosd。CPU 支持 X64、ARM64,后续会支持 MIPS64、Alpha64、ARM32、RISC-V 等 CPU 架构。目前不支持使用交叉编译器构建。
|
||||||
|
|
||||||
如果你想要编译 taosAdapter 或者 taosKeeper,需要安装 Go 1.18 及以上版本。
|
如果你想要编译 taosAdapter 或者 taosKeeper,需要安装 Go 1.18 及以上版本。
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ yum install -y zlib-static xz-devel snappy-devel jansson-devel pkgconfig libatom
|
||||||
|
|
||||||
<summary>安装 macOS 必备工具</summary>
|
<summary>安装 macOS 必备工具</summary>
|
||||||
|
|
||||||
根据提示安装依赖工具 [brew](https://brew.sh/).
|
根据提示安装依赖工具 [brew](https://brew.sh/)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install argp-standalone gflags pkgconfig
|
brew install argp-standalone gflags pkgconfig
|
||||||
|
@ -122,7 +122,7 @@ brew install argp-standalone gflags pkgconfig
|
||||||
|
|
||||||
## 3.4 克隆仓库
|
## 3.4 克隆仓库
|
||||||
|
|
||||||
通过如下命令将TDengine仓库克隆到指定计算机:
|
通过如下命令将 TDengine 仓库克隆到指定计算机:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/taosdata/TDengine.git
|
git clone https://github.com/taosdata/TDengine.git
|
||||||
|
@ -131,9 +131,9 @@ cd TDengine
|
||||||
|
|
||||||
# 4. 构建
|
# 4. 构建
|
||||||
|
|
||||||
TDengine 还提供一组辅助工具软件 taosTools,目前它包含 taosBenchmark(曾命名为 taosdemo)和 taosdump 两个软件。默认 TDengine 编译不包含 taosTools, 您可以在编译 TDengine 时使用`cmake .. -DBUILD_TOOLS=true` 来同时编译 taosTools。
|
TDengine 还提供一组辅助工具软件 taosTools,目前它包含 taosBenchmark(曾命名为 taosdemo)和 taosdump 两个软件。默认 TDengine 编译不包含 taosTools,您可以在编译 TDengine 时使用 `cmake .. -DBUILD_TOOLS=true` 来同时编译 taosTools。
|
||||||
|
|
||||||
为了构建TDengine, 请使用 [CMake](https://cmake.org/) 3.13.0 或者更高版本。
|
为了构建 TDengine,请使用 [CMake](https://cmake.org/) 3.13.0 或者更高版本。
|
||||||
|
|
||||||
## 4.1 Linux 系统上构建
|
## 4.1 Linux 系统上构建
|
||||||
|
|
||||||
|
@ -141,13 +141,13 @@ TDengine 还提供一组辅助工具软件 taosTools,目前它包含 taosBench
|
||||||
|
|
||||||
<summary>Linux 系统上构建步骤</summary>
|
<summary>Linux 系统上构建步骤</summary>
|
||||||
|
|
||||||
可以通过以下命令使用脚本 `build.sh` 编译TDengine和taosTools,包括taosBenchmark和taosdump:
|
可以通过以下命令使用脚本 `build.sh` 编译 TDengine 和 taosTools,包括 taosBenchmark 和 taosdump。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build.sh
|
./build.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
也可以通过以下命令进行构建:
|
也可以通过以下命令进行构建:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir debug && cd debug
|
mkdir debug && cd debug
|
||||||
|
@ -157,15 +157,15 @@ make
|
||||||
|
|
||||||
如果你想要编译 taosAdapter,需要添加 `-DBUILD_HTTP=false` 选项。
|
如果你想要编译 taosAdapter,需要添加 `-DBUILD_HTTP=false` 选项。
|
||||||
|
|
||||||
如果你想要编译 taosKeeper,需要添加 `--DBUILD_KEEPER=true` 选项。
|
如果你想要编译 taosKeeper,需要添加 `-DBUILD_KEEPER=true` 选项。
|
||||||
|
|
||||||
可以使用Jemalloc作为内存分配器,而不是使用glibc:
|
可以使用 Jemalloc 作为内存分配器,而不是使用 glibc:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cmake .. -DJEMALLOC_ENABLED=true
|
cmake .. -DJEMALLOC_ENABLED=ON
|
||||||
```
|
```
|
||||||
TDengine 构建脚本可以自动检测 x86、x86-64、arm64 平台上主机的体系结构。
|
TDengine 构建脚本可以自动检测 x86、x86-64、arm64 平台上主机的体系结构。
|
||||||
您也可以通过CPUTYPE选项手动指定架构:
|
您也可以通过 CPUTYPE 选项手动指定架构:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cmake .. -DCPUTYPE=aarch64 && cmake --build .
|
cmake .. -DCPUTYPE=aarch64 && cmake --build .
|
||||||
|
@ -208,19 +208,19 @@ cmake .. -G "NMake Makefiles"
|
||||||
nmake
|
nmake
|
||||||
```
|
```
|
||||||
|
|
||||||
如果您使用Visual Studio 2019或2017:
|
如果您使用 Visual Studio 2019 或 2017:
|
||||||
|
|
||||||
请执行 “cmd.exe” 打开命令窗口执行如下命令。
|
请执行 “cmd.exe” 打开命令窗口执行如下命令。
|
||||||
执行 vcvarsall.bat 时,64 位的 Windows 请指定 “x64”,32 位的 Windows 请指定 “x86”。
|
执行 vcvarsall.bat 时,64 位的 Windows 请指定 “x64”,32 位的 Windows 请指定 “x86”。
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
mkdir debug && cd debug
|
mkdir debug && cd debug
|
||||||
"c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" < x64 | x86 >
|
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" < x64 | x86 >
|
||||||
cmake .. -G "NMake Makefiles"
|
cmake .. -G "NMake Makefiles"
|
||||||
nmake
|
nmake
|
||||||
```
|
```
|
||||||
|
|
||||||
或者,您可以通过点击Windows开始菜单打开命令窗口->“Visual Studio < 2019 | 2017 >”文件夹->“x64原生工具命令提示符VS < 2019 | 2017 >”或“x86原生工具命令提示符VS < 2019 | 2017 >”取决于你的Windows是什么架构,然后执行命令如下:
|
或者,您可以通过点击 Windows 开始菜单打开命令窗口 -> `Visual Studio < 2019 | 2017 >` 文件夹 -> `x64 原生工具命令提示符 VS < 2019 | 2017 >` 或 `x86 原生工具命令提示符 < 2019 | 2017 >` 取决于你的 Windows 是什么架构,然后执行命令如下:
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
mkdir debug && cd debug
|
mkdir debug && cd debug
|
||||||
|
@ -242,7 +242,7 @@ nmake
|
||||||
|
|
||||||
<summary>Linux 系统上安装详细步骤</summary>
|
<summary>Linux 系统上安装详细步骤</summary>
|
||||||
|
|
||||||
构建成功后,TDengine可以通过以下命令进行安装:
|
构建成功后,TDengine 可以通过以下命令进行安装:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo make install
|
sudo make install
|
||||||
|
@ -257,7 +257,7 @@ sudo make install
|
||||||
|
|
||||||
<summary>macOS 系统上安装详细步骤</summary>
|
<summary>macOS 系统上安装详细步骤</summary>
|
||||||
|
|
||||||
构建成功后,TDengine可以通过以下命令进行安装:
|
构建成功后,TDengine可以通过以下命令进行安装:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo make install
|
sudo make install
|
||||||
|
@ -271,7 +271,7 @@ sudo make install
|
||||||
|
|
||||||
<summary>Windows 系统上安装详细步骤</summary>
|
<summary>Windows 系统上安装详细步骤</summary>
|
||||||
|
|
||||||
构建成功后,TDengine可以通过以下命令进行安装:
|
构建成功后,TDengine 可以通过以下命令进行安装:
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
nmake install
|
nmake install
|
||||||
|
@ -287,12 +287,12 @@ nmake install
|
||||||
|
|
||||||
<summary>Linux 系统上运行详细步骤</summary>
|
<summary>Linux 系统上运行详细步骤</summary>
|
||||||
|
|
||||||
在Linux系统上安装TDengine完成后,在终端运行如下命令启动服务:
|
在Linux 系统上安装 TDengine 完成后,在终端运行如下命令启动服务:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo systemctl start taosd
|
sudo systemctl start taosd
|
||||||
```
|
```
|
||||||
然后用户可以通过如下命令使用TDengine命令行连接TDengine服务:
|
然后用户可以通过如下命令使用 TDengine 命令行连接 TDengine 服务:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
taos
|
taos
|
||||||
|
@ -300,13 +300,13 @@ taos
|
||||||
|
|
||||||
如果 TDengine 命令行连接服务器成功,系统将打印欢迎信息和版本信息。否则,将显示连接错误信息。
|
如果 TDengine 命令行连接服务器成功,系统将打印欢迎信息和版本信息。否则,将显示连接错误信息。
|
||||||
|
|
||||||
如果您不想将TDengine作为服务运行,您可以在当前终端中运行它。例如,要在构建完成后快速启动TDengine服务器,在终端中运行以下命令:(我们以Linux为例,Windows上的命令为 `taosd.exe`)
|
如果您不想将 TDengine 作为服务运行,您可以在当前终端中运行它。例如,要在构建完成后快速启动 TDengine 服务器,在终端中运行以下命令:(以 Linux 为例,Windows 上的命令为 `taosd.exe`)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/bin/taosd -c test/cfg
|
./build/bin/taosd -c test/cfg
|
||||||
```
|
```
|
||||||
|
|
||||||
在另一个终端上,使用TDengine命令行连接服务器:
|
在另一个终端上,使用 TDengine 命令行连接服务器:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./build/bin/taos -c test/cfg
|
./build/bin/taos -c test/cfg
|
||||||
|
@ -322,13 +322,13 @@ taos
|
||||||
|
|
||||||
<summary>macOS 系统上运行详细步骤</summary>
|
<summary>macOS 系统上运行详细步骤</summary>
|
||||||
|
|
||||||
在macOS上安装完成后启动服务,双击/applications/TDengine启动程序,或者在终端中执行如下命令:
|
在 macOS 上安装完成后启动服务,双击 `/applications/TDengine` 启动程序,或者在终端中执行如下命令:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo launchctl start com.tdengine.taosd
|
sudo launchctl start com.tdengine.taosd
|
||||||
```
|
```
|
||||||
|
|
||||||
然后在终端中使用如下命令通过TDengine命令行连接TDengine服务器:
|
然后在终端中使用如下命令通过 TDengine 命令行连接 TDengine 服务器:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
taos
|
taos
|
||||||
|
@ -345,13 +345,13 @@ taos
|
||||||
|
|
||||||
<summary>Windows 系统上运行详细步骤</summary>
|
<summary>Windows 系统上运行详细步骤</summary>
|
||||||
|
|
||||||
您可以使用以下命令在Windows平台上启动TDengine服务器:
|
您可以使用以下命令在 Windows 平台上启动 TDengine 服务器:
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
.\build\bin\taosd.exe -c test\cfg
|
.\build\bin\taosd.exe -c test\cfg
|
||||||
```
|
```
|
||||||
|
|
||||||
在另一个终端上,使用TDengine命令行连接服务器:
|
在另一个终端上,使用 TDengine 命令行连接服务器:
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
.\build\bin\taos.exe -c test\cfg
|
.\build\bin\taos.exe -c test\cfg
|
||||||
|
@ -371,7 +371,7 @@ TDengine发布版本的完整列表,请参考 [版本列表](https://github.co
|
||||||
|
|
||||||
# 10. 工作流
|
# 10. 工作流
|
||||||
|
|
||||||
TDengine构建检查工作流可以在参考 [Github Action](https://github.com/taosdata/TDengine/actions/workflows/taosd-ci-build.yml), 更多的工作流正在创建中,将很快可用。
|
TDengine 构建检查工作流可以在参考 [Github Action](https://github.com/taosdata/TDengine/actions/workflows/taosd-ci-build.yml),更多的工作流正在创建中,将很快可用。
|
||||||
|
|
||||||
# 11. 覆盖率
|
# 11. 覆盖率
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ TDengine构建检查工作流可以在参考 [Github Action](https://github.com/
|
||||||
|
|
||||||
<summary>如何在本地运行测试覆盖率报告?</summary>
|
<summary>如何在本地运行测试覆盖率报告?</summary>
|
||||||
|
|
||||||
在本地创建测试覆盖率报告(HTML格式),请运行以下命令:
|
在本地创建测试覆盖率报告(HTML 格式),请运行以下命令:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd tests
|
cd tests
|
||||||
|
@ -389,7 +389,7 @@ bash setup-lcov.sh -v 1.16 && ./run_local_coverage.sh -b main -c task
|
||||||
# on main branch and run cases in longtimeruning_cases.task
|
# on main branch and run cases in longtimeruning_cases.task
|
||||||
# for more infomation about options please refer to ./run_local_coverage.sh -h
|
# for more infomation about options please refer to ./run_local_coverage.sh -h
|
||||||
```
|
```
|
||||||
> **注意:**
|
> **注意**:
|
||||||
> 请注意,-b 和 -i 选项将使用 -DCOVER=true 选项重新编译 TDengine,这可能需要花费一些时间。
|
> 请注意,-b 和 -i 选项将使用 -DCOVER=true 选项重新编译 TDengine,这可能需要花费一些时间。
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
|
@ -177,7 +177,7 @@ If you want to compile taosKeeper, you need to add the `--DBUILD_KEEPER=true` op
|
||||||
You can use Jemalloc as memory allocator instead of glibc:
|
You can use Jemalloc as memory allocator instead of glibc:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cmake .. -DJEMALLOC_ENABLED=true
|
cmake .. -DJEMALLOC_ENABLED=ON
|
||||||
```
|
```
|
||||||
|
|
||||||
TDengine build script can auto-detect the host machine's architecture on x86, x86-64, arm64 platform.
|
TDengine build script can auto-detect the host machine's architecture on x86, x86-64, arm64 platform.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
ExternalProject_Add(azure
|
ExternalProject_Add(azure
|
||||||
URL https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-storage-blobs_12.13.0-beta.1.tar.gz
|
URL https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/azure-storage-blobs_12.13.0-beta.1.tar.gz
|
||||||
URL_HASH SHA256=3eca486fd60e3522d0a633025ecd652a71515b1e944799b2e8ee31fd590305a9
|
URL_HASH SHA256=3eca486fd60e3522d0a633025ecd652a71515b1e944799b2e8ee31fd590305a9
|
||||||
|
DEPENDS xml2
|
||||||
DOWNLOAD_NO_PROGRESS 1
|
DOWNLOAD_NO_PROGRESS 1
|
||||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||||
SOURCE_DIR "${TD_CONTRIB_DIR}/azure-sdk-for-cpp-azure-storage-blobs_12.13.0-beta.1"
|
SOURCE_DIR "${TD_CONTRIB_DIR}/azure-sdk-for-cpp-azure-storage-blobs_12.13.0-beta.1"
|
||||||
|
|
|
@ -116,9 +116,6 @@ ELSE()
|
||||||
set(VAR_TSZ "TSZ" CACHE INTERNAL "global variant tsz")
|
set(VAR_TSZ "TSZ" CACHE INTERNAL "global variant tsz")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# force set all platform to JEMALLOC_ENABLED = false
|
|
||||||
# SET(JEMALLOC_ENABLED OFF)
|
|
||||||
|
|
||||||
IF(TD_WINDOWS)
|
IF(TD_WINDOWS)
|
||||||
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
|
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
|
||||||
|
|
||||||
|
@ -259,10 +256,16 @@ ELSE()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
|
IF(TD_LINUX_64)
|
||||||
IF(${JEMALLOC_ENABLED})
|
IF(${JEMALLOC_ENABLED})
|
||||||
MESSAGE(STATUS "JEMALLOC_ENABLED Enabled")
|
MESSAGE(STATUS "JEMALLOC Enabled")
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=attributes")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=attributes")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=attributes")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=attributes")
|
||||||
|
SET(LINK_JEMALLOC "-L${CMAKE_BINARY_DIR}/build/lib -ljemalloc")
|
||||||
|
ADD_DEFINITIONS(-DTD_JEMALLOC_ENABLED -I${CMAKE_BINARY_DIR}/build/include -L${CMAKE_BINARY_DIR}/build/lib -Wl,-rpath,${CMAKE_BINARY_DIR}/build/lib)
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE(STATUS "JEMALLOC_ENABLED Disabled")
|
MESSAGE(STATUS "JEMALLOC Disabled")
|
||||||
|
SET(LINK_JEMALLOC "")
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
|
@ -12,7 +12,7 @@ ExternalProject_Add(curl2
|
||||||
BUILD_IN_SOURCE TRUE
|
BUILD_IN_SOURCE TRUE
|
||||||
BUILD_ALWAYS 1
|
BUILD_ALWAYS 1
|
||||||
UPDATE_COMMAND ""
|
UPDATE_COMMAND ""
|
||||||
CONFIGURE_COMMAND ${CONTRIB_CONFIG_ENV} ./configure --prefix=$ENV{HOME}/.cos-local.2 --with-ssl=$ENV{HOME}/.cos-local.2 --enable-websockets --enable-shared=no --disable-ldap --disable-ldaps --without-brotli --without-zstd --without-libidn2 --without-nghttp2 --without-libpsl #--enable-debug
|
CONFIGURE_COMMAND ${CONTRIB_CONFIG_ENV} ./configure --prefix=$ENV{HOME}/.cos-local.2 --with-ssl=$ENV{HOME}/.cos-local.2 --enable-websockets --enable-shared=no --disable-ldap --disable-ldaps --without-brotli --without-zstd --without-libidn2 --without-nghttp2 --without-libpsl --without-librtmp #--enable-debug
|
||||||
BUILD_COMMAND make -j
|
BUILD_COMMAND make -j
|
||||||
INSTALL_COMMAND make install
|
INSTALL_COMMAND make install
|
||||||
TEST_COMMAND ""
|
TEST_COMMAND ""
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taosadapter
|
# taosadapter
|
||||||
ExternalProject_Add(taosadapter
|
ExternalProject_Add(taosadapter
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||||
GIT_TAG main
|
GIT_TAG 3.0
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
|
|
||||||
# xml2
|
# xml2
|
||||||
ExternalProject_Add(xml2
|
ExternalProject_Add(xml2
|
||||||
URL https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.5.tar.xz
|
URL https://github.com/GNOME/libxml2/archive/refs/tags/v2.10.4.tar.gz
|
||||||
URL_HASH SHA256=3727b078c360ec69fa869de14bd6f75d7ee8d36987b071e6928d4720a28df3a6
|
URL_HASH SHA256=6f6fb27f91bb65f9d7196e3c616901b3e18a7dea31ccc2ae857940b125faa780
|
||||||
#https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.5.tar.gz
|
|
||||||
#GIT_REPOSITORY https://github.com/GNOME/libxml2
|
|
||||||
#GIT_TAG v2.11.5
|
|
||||||
DOWNLOAD_NO_PROGRESS 1
|
DOWNLOAD_NO_PROGRESS 1
|
||||||
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
DOWNLOAD_DIR "${TD_CONTRIB_DIR}/deps-download"
|
||||||
SOURCE_DIR "${TD_CONTRIB_DIR}/xml2"
|
SOURCE_DIR "${TD_CONTRIB_DIR}/libxml2"
|
||||||
#BINARY_DIR ""
|
#BINARY_DIR ""
|
||||||
BUILD_IN_SOURCE TRUE
|
BUILD_IN_SOURCE TRUE
|
||||||
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.2 --enable-shared=no --enable-static=yes --without-python --without-lzma
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND make -j
|
BUILD_COMMAND ""
|
||||||
INSTALL_COMMAND make install && ln -sf $ENV{HOME}/.cos-local.2/include/libxml2/libxml $ENV{HOME}/.cos-local.2/include/libxml
|
INSTALL_COMMAND ""
|
||||||
TEST_COMMAND ""
|
TEST_COMMAND ""
|
||||||
GIT_SHALLOW true
|
GIT_SHALLOW true
|
||||||
)
|
)
|
||||||
|
|
|
@ -159,7 +159,6 @@ elseif(${BUILD_WITH_COS})
|
||||||
# cat("${TD_SUPPORT_DIR}/mxml_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
# cat("${TD_SUPPORT_DIR}/mxml_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
# cat("${TD_SUPPORT_DIR}/apr_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
# cat("${TD_SUPPORT_DIR}/apr_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
# cat("${TD_SUPPORT_DIR}/apr-util_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
# cat("${TD_SUPPORT_DIR}/apr-util_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
# cat("${TD_SUPPORT_DIR}/curl_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
|
||||||
cat("${TD_SUPPORT_DIR}/cos_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
cat("${TD_SUPPORT_DIR}/cos_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
|
||||||
add_definitions(-DUSE_COS)
|
add_definitions(-DUSE_COS)
|
||||||
endif()
|
endif()
|
||||||
|
@ -665,7 +664,12 @@ if(${BUILD_PCRE2})
|
||||||
endif(${BUILD_PCRE2})
|
endif(${BUILD_PCRE2})
|
||||||
|
|
||||||
if(${TD_LINUX} AND ${BUILD_WITH_S3})
|
if(${TD_LINUX} AND ${BUILD_WITH_S3})
|
||||||
add_subdirectory(azure-cmake EXCLUDE_FROM_ALL)
|
set(ORIG_CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||||
|
string(REPLACE " -Werror " " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||||
|
add_subdirectory(xml2-cmake)
|
||||||
|
set(CMAKE_C_FLAGS ${ORIG_CMAKE_C_FLAGS})
|
||||||
|
|
||||||
|
add_subdirectory(azure-cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
IF(TD_LINUX)
|
IF(TD_LINUX)
|
||||||
|
|
|
@ -36,10 +36,6 @@ target_include_directories(
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(CURL_LIBRARY curl $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
find_library(CURL_LIBRARY curl $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||||
find_library(XML2_LIBRARY xml2 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
|
||||||
|
|
||||||
# find_library(CURL_LIBRARY curl)
|
|
||||||
# find_library(XML2_LIBRARY xml2)
|
|
||||||
find_library(SSL_LIBRARY ssl $ENV{HOME}/.cos-local.2/lib64 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
find_library(SSL_LIBRARY ssl $ENV{HOME}/.cos-local.2/lib64 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||||
find_library(CRYPTO_LIBRARY crypto $ENV{HOME}/.cos-local.2/lib64 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
find_library(CRYPTO_LIBRARY crypto $ENV{HOME}/.cos-local.2/lib64 $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||||
|
|
||||||
|
@ -50,9 +46,8 @@ target_link_libraries(
|
||||||
PRIVATE ${CURL_LIBRARY}
|
PRIVATE ${CURL_LIBRARY}
|
||||||
PRIVATE ${SSL_LIBRARY}
|
PRIVATE ${SSL_LIBRARY}
|
||||||
PRIVATE ${CRYPTO_LIBRARY}
|
PRIVATE ${CRYPTO_LIBRARY}
|
||||||
PRIVATE ${XML2_LIBRARY}
|
|
||||||
|
|
||||||
# PRIVATE xml2
|
PRIVATE _libxml2
|
||||||
PRIVATE zlib
|
PRIVATE zlib
|
||||||
|
|
||||||
# PRIVATE ${CoreFoundation_Library}
|
# PRIVATE ${CoreFoundation_Library}
|
||||||
|
|
|
@ -20,9 +20,9 @@ if(${BUILD_WITH_SQLITE})
|
||||||
add_subdirectory(sqlite)
|
add_subdirectory(sqlite)
|
||||||
endif(${BUILD_WITH_SQLITE})
|
endif(${BUILD_WITH_SQLITE})
|
||||||
|
|
||||||
if(${BUILD_S3})
|
# if(${BUILD_S3})
|
||||||
add_subdirectory(azure)
|
# add_subdirectory(azure)
|
||||||
endif()
|
# endif()
|
||||||
|
|
||||||
add_subdirectory(tdev)
|
add_subdirectory(tdev)
|
||||||
add_subdirectory(lz4)
|
add_subdirectory(lz4)
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
set(LIBXML2_SOURCE_DIR "${TD_CONTRIB_DIR}/libxml2")
|
||||||
|
|
||||||
|
set(SRCS
|
||||||
|
"${LIBXML2_SOURCE_DIR}/SAX.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/entities.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/encoding.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/error.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/parserInternals.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/parser.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/tree.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/hash.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/list.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlIO.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlmemory.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/uri.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/valid.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xlink.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/HTMLparser.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/HTMLtree.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/debugXML.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xpath.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xpointer.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xinclude.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/nanohttp.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/nanoftp.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/catalog.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/globals.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/threads.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/c14n.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlstring.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/buf.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlregexp.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlschemas.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlschemastypes.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlunicode.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/triostr.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlreader.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/relaxng.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/dict.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/SAX2.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlwriter.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/legacy.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/chvalid.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/pattern.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlsave.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xmlmodule.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/schematron.c"
|
||||||
|
"${LIBXML2_SOURCE_DIR}/xzlib.c"
|
||||||
|
)
|
||||||
|
add_library(_libxml2 ${SRCS})
|
||||||
|
|
||||||
|
#target_link_libraries(_libxml2 PRIVATE td_contrib::zlib)
|
||||||
|
target_link_libraries(_libxml2 PRIVATE zlib)
|
||||||
|
|
||||||
|
target_include_directories(_libxml2 BEFORE PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/include")
|
||||||
|
target_include_directories(_libxml2 BEFORE PUBLIC "${LIBXML2_SOURCE_DIR}/include")
|
||||||
|
|
||||||
|
add_library(td_contrib::libxml2 ALIAS _libxml2)
|
|
@ -0,0 +1,285 @@
|
||||||
|
/* config.h. Generated from config.h.in by configure. */
|
||||||
|
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||||
|
|
||||||
|
/* Type cast for the gethostbyname() argument */
|
||||||
|
#define GETHOSTBYNAME_ARG_CAST /**/
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||||
|
#define HAVE_ARPA_INET_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <arpa/nameser.h> header file. */
|
||||||
|
#define HAVE_ARPA_NAMESER_H 1
|
||||||
|
|
||||||
|
/* Whether struct sockaddr::__ss_family exists */
|
||||||
|
/* #undef HAVE_BROKEN_SS_FAMILY */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ctype.h> header file. */
|
||||||
|
#define HAVE_CTYPE_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dirent.h> header file. */
|
||||||
|
#define HAVE_DIRENT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||||
|
#define HAVE_DLFCN_H 1
|
||||||
|
|
||||||
|
/* Have dlopen based dso */
|
||||||
|
#define HAVE_DLOPEN /**/
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <dl.h> header file. */
|
||||||
|
/* #undef HAVE_DL_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <errno.h> header file. */
|
||||||
|
#define HAVE_ERRNO_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||||
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <float.h> header file. */
|
||||||
|
#define HAVE_FLOAT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fprintf' function. */
|
||||||
|
#define HAVE_FPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `ftime' function. */
|
||||||
|
#define HAVE_FTIME 1
|
||||||
|
|
||||||
|
/* Define if getaddrinfo is there */
|
||||||
|
#define HAVE_GETADDRINFO /**/
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `gettimeofday' function. */
|
||||||
|
#define HAVE_GETTIMEOFDAY 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
|
#define HAVE_INTTYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `isascii' function. */
|
||||||
|
#define HAVE_ISASCII 1
|
||||||
|
|
||||||
|
/* Define if isinf is there */
|
||||||
|
#define HAVE_ISINF /**/
|
||||||
|
|
||||||
|
/* Define if isnan is there */
|
||||||
|
#define HAVE_ISNAN /**/
|
||||||
|
|
||||||
|
/* Define if history library is there (-lhistory) */
|
||||||
|
/* #undef HAVE_LIBHISTORY */
|
||||||
|
|
||||||
|
/* Define if pthread library is there (-lpthread) */
|
||||||
|
#define HAVE_LIBPTHREAD /**/
|
||||||
|
|
||||||
|
/* Define if readline library is there (-lreadline) */
|
||||||
|
/* #undef HAVE_LIBREADLINE */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <limits.h> header file. */
|
||||||
|
#define HAVE_LIMITS_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `localtime' function. */
|
||||||
|
#define HAVE_LOCALTIME 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <lzma.h> header file. */
|
||||||
|
/* #undef HAVE_LZMA_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <malloc.h> header file. */
|
||||||
|
#define HAVE_MALLOC_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <math.h> header file. */
|
||||||
|
#define HAVE_MATH_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
|
#define HAVE_MEMORY_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mmap' function. */
|
||||||
|
#define HAVE_MMAP 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `munmap' function. */
|
||||||
|
#define HAVE_MUNMAP 1
|
||||||
|
|
||||||
|
/* mmap() is no good without munmap() */
|
||||||
|
#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
|
||||||
|
# undef /**/ HAVE_MMAP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||||
|
/* #undef HAVE_NDIR_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <netdb.h> header file. */
|
||||||
|
#define HAVE_NETDB_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||||
|
#define HAVE_NETINET_IN_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <poll.h> header file. */
|
||||||
|
#define HAVE_POLL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `printf' function. */
|
||||||
|
#define HAVE_PRINTF 1
|
||||||
|
|
||||||
|
/* Define if <pthread.h> is there */
|
||||||
|
#define HAVE_PTHREAD_H /**/
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `putenv' function. */
|
||||||
|
#define HAVE_PUTENV 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `rand' function. */
|
||||||
|
#define HAVE_RAND 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `rand_r' function. */
|
||||||
|
#define HAVE_RAND_R 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <resolv.h> header file. */
|
||||||
|
#define HAVE_RESOLV_H 1
|
||||||
|
|
||||||
|
/* Have shl_load based dso */
|
||||||
|
/* #undef HAVE_SHLLOAD */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `signal' function. */
|
||||||
|
#define HAVE_SIGNAL 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <signal.h> header file. */
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `snprintf' function. */
|
||||||
|
#define HAVE_SNPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sprintf' function. */
|
||||||
|
#define HAVE_SPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `srand' function. */
|
||||||
|
#define HAVE_SRAND 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `sscanf' function. */
|
||||||
|
#define HAVE_SSCANF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `stat' function. */
|
||||||
|
#define HAVE_STAT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||||
|
#define HAVE_STDARG_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#define HAVE_STDINT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
|
#define HAVE_STDLIB_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strftime' function. */
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
|
#define HAVE_STRINGS_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
|
#define HAVE_STRING_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||||
|
*/
|
||||||
|
/* #undef HAVE_SYS_DIR_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||||
|
#define HAVE_SYS_MMAN_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||||
|
*/
|
||||||
|
/* #undef HAVE_SYS_NDIR_H */
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||||
|
#define HAVE_SYS_SELECT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||||
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||||
|
#define HAVE_SYS_STAT_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/timeb.h> header file. */
|
||||||
|
#define HAVE_SYS_TIMEB_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||||
|
#define HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
|
#define HAVE_SYS_TYPES_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `time' function. */
|
||||||
|
#define HAVE_TIME 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <time.h> header file. */
|
||||||
|
#define HAVE_TIME_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
|
#define HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Whether va_copy() is available */
|
||||||
|
#define HAVE_VA_COPY 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vfprintf' function. */
|
||||||
|
#define HAVE_VFPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vsnprintf' function. */
|
||||||
|
#define HAVE_VSNPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `vsprintf' function. */
|
||||||
|
#define HAVE_VSPRINTF 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <zlib.h> header file. */
|
||||||
|
/* #undef HAVE_ZLIB_H */
|
||||||
|
|
||||||
|
/* Whether __va_copy() is available */
|
||||||
|
/* #undef HAVE___VA_COPY */
|
||||||
|
|
||||||
|
/* Define as const if the declaration of iconv() needs const. */
|
||||||
|
#define ICONV_CONST
|
||||||
|
|
||||||
|
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||||
|
#define LT_OBJDIR ".libs/"
|
||||||
|
|
||||||
|
/* Name of package */
|
||||||
|
#define PACKAGE "libxml2"
|
||||||
|
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#define PACKAGE_BUGREPORT ""
|
||||||
|
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#define PACKAGE_NAME ""
|
||||||
|
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#define PACKAGE_STRING ""
|
||||||
|
|
||||||
|
/* Define to the one symbol short name of this package. */
|
||||||
|
#define PACKAGE_TARNAME ""
|
||||||
|
|
||||||
|
/* Define to the home page for this package. */
|
||||||
|
#define PACKAGE_URL ""
|
||||||
|
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#define PACKAGE_VERSION ""
|
||||||
|
|
||||||
|
/* Type cast for the send() function 2nd arg */
|
||||||
|
#define SEND_ARG2_CAST /**/
|
||||||
|
|
||||||
|
/* Define to 1 if you have the ANSI C header files. */
|
||||||
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
|
/* Support for IPv6 */
|
||||||
|
#define SUPPORT_IP6 /**/
|
||||||
|
|
||||||
|
/* Define if va_list is an array type */
|
||||||
|
#define VA_LIST_IS_ARRAY 1
|
||||||
|
|
||||||
|
/* Version number of package */
|
||||||
|
#define VERSION "2.9.8"
|
||||||
|
|
||||||
|
/* Determine what socket length (socklen_t) data type is */
|
||||||
|
#define XML_SOCKLEN_T socklen_t
|
||||||
|
|
||||||
|
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
|
||||||
|
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
||||||
|
#define below would cause a syntax error. */
|
||||||
|
/* #undef _UINT32_T */
|
||||||
|
|
||||||
|
/* ss_family is not defined here, use __ss_family instead */
|
||||||
|
/* #undef ss_family */
|
||||||
|
|
||||||
|
/* Define to the type of an unsigned integer type of width exactly 32 bits if
|
||||||
|
such a type exists and the standard includes do not define it. */
|
||||||
|
/* #undef uint32_t */
|
|
@ -0,0 +1,501 @@
|
||||||
|
/*
|
||||||
|
* Summary: compile-time version information
|
||||||
|
* Description: compile-time version information for the XML library
|
||||||
|
*
|
||||||
|
* Copy: See Copyright for the status of this software.
|
||||||
|
*
|
||||||
|
* Author: Daniel Veillard
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XML_VERSION_H__
|
||||||
|
#define __XML_VERSION_H__
|
||||||
|
|
||||||
|
#include <libxml/xmlexports.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* use those to be sure nothing nasty will happen if
|
||||||
|
* your library and includes mismatch
|
||||||
|
*/
|
||||||
|
#ifndef LIBXML2_COMPILING_MSCCDEF
|
||||||
|
XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
||||||
|
#endif /* LIBXML2_COMPILING_MSCCDEF */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_DOTTED_VERSION:
|
||||||
|
*
|
||||||
|
* the version string like "1.2.3"
|
||||||
|
*/
|
||||||
|
#define LIBXML_DOTTED_VERSION "2.10.3"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_VERSION:
|
||||||
|
*
|
||||||
|
* the version number: 1.2.3 value is 10203
|
||||||
|
*/
|
||||||
|
#define LIBXML_VERSION 21003
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_VERSION_STRING:
|
||||||
|
*
|
||||||
|
* the version number string, 1.2.3 value is "10203"
|
||||||
|
*/
|
||||||
|
#define LIBXML_VERSION_STRING "21003"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_VERSION_EXTRA:
|
||||||
|
*
|
||||||
|
* extra version information, used to show a git commit description
|
||||||
|
*/
|
||||||
|
#define LIBXML_VERSION_EXTRA ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_TEST_VERSION:
|
||||||
|
*
|
||||||
|
* Macro to check that the libxml version in use is compatible with
|
||||||
|
* the version the software has been compiled against
|
||||||
|
*/
|
||||||
|
#define LIBXML_TEST_VERSION xmlCheckVersion(21003);
|
||||||
|
|
||||||
|
#ifndef VMS
|
||||||
|
#if 0
|
||||||
|
/**
|
||||||
|
* WITH_TRIO:
|
||||||
|
*
|
||||||
|
* defined if the trio support need to be configured in
|
||||||
|
*/
|
||||||
|
#define WITH_TRIO
|
||||||
|
#else
|
||||||
|
/**
|
||||||
|
* WITHOUT_TRIO:
|
||||||
|
*
|
||||||
|
* defined if the trio support should not be configured in
|
||||||
|
*/
|
||||||
|
#define WITHOUT_TRIO
|
||||||
|
#endif
|
||||||
|
#else /* VMS */
|
||||||
|
/**
|
||||||
|
* WITH_TRIO:
|
||||||
|
*
|
||||||
|
* defined if the trio support need to be configured in
|
||||||
|
*/
|
||||||
|
#define WITH_TRIO 1
|
||||||
|
#endif /* VMS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_THREAD_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the thread support is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_THREAD_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_THREAD_ALLOC_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the allocation hooks are per-thread
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_THREAD_ALLOC_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_TREE_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the DOM like tree manipulation API support is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_TREE_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_OUTPUT_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the serialization/saving support is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_OUTPUT_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_PUSH_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the push parsing interfaces are configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_PUSH_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_READER_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the xmlReader parsing interface is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_READER_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_PATTERN_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the xmlPattern node selection interface is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_PATTERN_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_WRITER_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the xmlWriter saving interface is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_WRITER_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_SAX1_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the older SAX1 interface is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_SAX1_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_FTP_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the FTP support is configured in
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_FTP_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_HTTP_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the HTTP support is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_HTTP_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_VALID_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the DTD validation support is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_VALID_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_HTML_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the HTML support is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_HTML_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_LEGACY_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the deprecated APIs are compiled in for compatibility
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_LEGACY_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_C14N_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the Canonicalization support is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_C14N_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_CATALOG_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the Catalog support is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_CATALOG_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_XPATH_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether XPath is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_XPATH_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_XPTR_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether XPointer is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_XPTR_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_XPTR_LOCS_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether support for XPointer locations is configured in
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_XPTR_LOCS_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_XINCLUDE_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether XInclude is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_XINCLUDE_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_ICONV_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether iconv support is available
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_ICONV_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_ICU_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether icu support is available
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_ICU_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_ISO8859X_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether ISO-8859-* support is made available in case iconv is not
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_ISO8859X_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_DEBUG_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether Debugging module is configured in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_DEBUG_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DEBUG_MEMORY_LOCATION:
|
||||||
|
*
|
||||||
|
* Whether the memory debugging is configured in
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define DEBUG_MEMORY_LOCATION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_DEBUG_RUNTIME:
|
||||||
|
*
|
||||||
|
* Whether the runtime debugging is configured in
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_DEBUG_RUNTIME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_UNICODE_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the Unicode related interfaces are compiled in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_UNICODE_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_REGEXP_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the regular expressions interfaces are compiled in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_REGEXP_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_AUTOMATA_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the automata interfaces are compiled in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_AUTOMATA_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_EXPR_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the formal expressions interfaces are compiled in
|
||||||
|
*
|
||||||
|
* This code is unused and disabled unconditionally for now.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_EXPR_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_SCHEMAS_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the Schemas validation interfaces are compiled in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_SCHEMAS_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_SCHEMATRON_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the Schematron validation interfaces are compiled in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_SCHEMATRON_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_MODULES_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the module interfaces are compiled in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_MODULES_ENABLED
|
||||||
|
/**
|
||||||
|
* LIBXML_MODULE_EXTENSION:
|
||||||
|
*
|
||||||
|
* the string suffix used by dynamic modules (usually shared libraries)
|
||||||
|
*/
|
||||||
|
#define LIBXML_MODULE_EXTENSION ".so"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_ZLIB_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the Zlib support is compiled in
|
||||||
|
*/
|
||||||
|
#if 1
|
||||||
|
#define LIBXML_ZLIB_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_LZMA_ENABLED:
|
||||||
|
*
|
||||||
|
* Whether the Lzma support is compiled in
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
|
#define LIBXML_LZMA_ENABLED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ATTRIBUTE_UNUSED:
|
||||||
|
*
|
||||||
|
* Macro used to signal to GCC unused function parameters
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ATTRIBUTE_UNUSED
|
||||||
|
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
|
||||||
|
# define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||||
|
# else
|
||||||
|
# define ATTRIBUTE_UNUSED
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_ATTR_ALLOC_SIZE:
|
||||||
|
*
|
||||||
|
* Macro used to indicate to GCC this is an allocator function
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LIBXML_ATTR_ALLOC_SIZE
|
||||||
|
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
|
||||||
|
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
|
||||||
|
# else
|
||||||
|
# define LIBXML_ATTR_ALLOC_SIZE(x)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define LIBXML_ATTR_ALLOC_SIZE(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LIBXML_ATTR_FORMAT:
|
||||||
|
*
|
||||||
|
* Macro used to indicate to GCC the parameter are printf like
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LIBXML_ATTR_FORMAT
|
||||||
|
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
|
||||||
|
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
|
||||||
|
# else
|
||||||
|
# define LIBXML_ATTR_FORMAT(fmt,args)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define LIBXML_ATTR_FORMAT(fmt,args)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef XML_DEPRECATED
|
||||||
|
# ifdef IN_LIBXML
|
||||||
|
# define XML_DEPRECATED
|
||||||
|
# else
|
||||||
|
/* Available since at least GCC 3.1 */
|
||||||
|
# define XML_DEPRECATED __attribute__((deprecated))
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* ! __GNUC__ */
|
||||||
|
/**
|
||||||
|
* ATTRIBUTE_UNUSED:
|
||||||
|
*
|
||||||
|
* Macro used to signal to GCC unused function parameters
|
||||||
|
*/
|
||||||
|
#define ATTRIBUTE_UNUSED
|
||||||
|
/**
|
||||||
|
* LIBXML_ATTR_ALLOC_SIZE:
|
||||||
|
*
|
||||||
|
* Macro used to indicate to GCC this is an allocator function
|
||||||
|
*/
|
||||||
|
#define LIBXML_ATTR_ALLOC_SIZE(x)
|
||||||
|
/**
|
||||||
|
* LIBXML_ATTR_FORMAT:
|
||||||
|
*
|
||||||
|
* Macro used to indicate to GCC the parameter are printf like
|
||||||
|
*/
|
||||||
|
#define LIBXML_ATTR_FORMAT(fmt,args)
|
||||||
|
/**
|
||||||
|
* XML_DEPRECATED:
|
||||||
|
*
|
||||||
|
* Macro used to indicate that a function, variable, type or struct member
|
||||||
|
* is deprecated.
|
||||||
|
*/
|
||||||
|
#ifndef XML_DEPRECATED
|
||||||
|
#define XML_DEPRECATED
|
||||||
|
#endif
|
||||||
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
#endif
|
|
@ -145,20 +145,19 @@ Query OK, 10 row(s) in set (2.415961s)
|
||||||
|
|
||||||
In TDengine, you can use the window clause to perform aggregation queries by time window partitioning, which is particularly suitable for scenarios requiring analysis of large amounts of time-series data, such as smart meters collecting data every 10s but needing to query the average temperature every 1min.
|
In TDengine, you can use the window clause to perform aggregation queries by time window partitioning, which is particularly suitable for scenarios requiring analysis of large amounts of time-series data, such as smart meters collecting data every 10s but needing to query the average temperature every 1min.
|
||||||
|
|
||||||
The window clause allows you to partition the queried data set by windows and aggregate the data within each window, including:
|
The window clause allows you to partition the queried data set by windows and aggregate the data within each window. The logic of window partitioning is shown in the following image:
|
||||||
|
|
||||||
- Time window (time window)
|
|
||||||
- State window (status window)
|
|
||||||
- Session window (session window)
|
|
||||||
- Event window (event window)
|
|
||||||
|
|
||||||
The logic of window partitioning is shown in the following image:
|
|
||||||
|
|
||||||
<figure>
|
<figure>
|
||||||
<Image img={windowModel} alt="Windowing description"/>
|
<Image img={windowModel} alt="Windowing description"/>
|
||||||
<figcaption>Figure 1. Windowing logic</figcaption>
|
<figcaption>Figure 1. Windowing logic</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
|
- Time Window: Data is divided based on time intervals, supporting sliding and tumbling time windows, suitable for data aggregation over fixed time periods.
|
||||||
|
- Status Window: Windows are divided based on changes in device status values, with data of the same status value grouped into one window, which closes when the status value changes.
|
||||||
|
- Session Window: Sessions are divided based on the differences in record timestamps, with records having a timestamp interval less than the predefined value belonging to the same session.
|
||||||
|
- Event Window: Windows are dynamically divided based on the start and end conditions of events, opening when the start condition is met and closing when the end condition is met.
|
||||||
|
- Count Window: Windows are divided based on the number of data rows, with each window consisting of a specified number of rows for aggregation calculations.
|
||||||
|
|
||||||
The syntax for the window clause is as follows:
|
The syntax for the window clause is as follows:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
|
|
@ -44,6 +44,9 @@ There are many parameters for creating consumers, which flexibly support various
|
||||||
| `enable.replay` | boolean | Whether to enable data replay function | Default is off |
|
| `enable.replay` | boolean | Whether to enable data replay function | Default is off |
|
||||||
| `session.timeout.ms` | integer | Timeout after consumer heartbeat is lost, after which rebalance logic is triggered, and upon success, that consumer will be removed (supported from version 3.3.3.0) | Default is 12000, range [6000, 1800000] |
|
| `session.timeout.ms` | integer | Timeout after consumer heartbeat is lost, after which rebalance logic is triggered, and upon success, that consumer will be removed (supported from version 3.3.3.0) | Default is 12000, range [6000, 1800000] |
|
||||||
| `max.poll.interval.ms` | integer | The longest time interval for consumer poll data fetching, exceeding this time will be considered as the consumer being offline, triggering rebalance logic, and upon success, that consumer will be removed (supported from version 3.3.3.0) | Default is 300000, range [1000, INT32_MAX] |
|
| `max.poll.interval.ms` | integer | The longest time interval for consumer poll data fetching, exceeding this time will be considered as the consumer being offline, triggering rebalance logic, and upon success, that consumer will be removed (supported from version 3.3.3.0) | Default is 300000, range [1000, INT32_MAX] |
|
||||||
|
| `fetch.max.wait.ms` | integer | The maximum time it takes for the server to return data once (supported from version 3.3.6.0) | Default is 1000, range [1, INT32_MAX] |
|
||||||
|
| `min.poll.rows` | integer | The minimum number of data returned by the server once (supported from version 3.3.6.0) | Default is 4096, range [1, INT32_MAX]
|
||||||
|
| `msg.consume.rawdata` | integer | When consuming data, the data type pulled is binary and cannot be parsed. It is an internal parameter and is only used for taosx data migration(supported from version 3.3.6.0) | The default value of 0 indicates that it is not effective, and non-zero indicates that it is effective |
|
||||||
|
|
||||||
Below are the connection parameters for connectors in various languages:
|
Below are the connection parameters for connectors in various languages:
|
||||||
<Tabs defaultValue="java" groupId="lang">
|
<Tabs defaultValue="java" groupId="lang">
|
||||||
|
|
|
@ -495,10 +495,10 @@ taos> select myfun(v1, v2) from t;
|
||||||
DB error: udf function execution failure (0.011088s)
|
DB error: udf function execution failure (0.011088s)
|
||||||
```
|
```
|
||||||
|
|
||||||
Unfortunately, the execution failed. What could be the reason? Check the udfd process logs.
|
Unfortunately, the execution failed. What could be the reason? Check the taosudf process logs.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
tail -10 /var/log/taos/udfd.log
|
tail -10 /var/log/taos/taosudf.log
|
||||||
```
|
```
|
||||||
|
|
||||||
Found the following error messages.
|
Found the following error messages.
|
||||||
|
|
|
@ -16,8 +16,10 @@ TDengine is designed for various writing scenarios, and many of these scenarios
|
||||||
### Syntax
|
### Syntax
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
COMPACT DATABASE db_name [start with 'XXXX'] [end with 'YYYY'];
|
COMPACT DATABASE db_name [start with 'XXXX'] [end with 'YYYY'] [META_ONLY];
|
||||||
SHOW COMPACTS [compact_id];
|
COMPACT [db_name.]VGROUPS IN (vgroup_id1, vgroup_id2, ...) [start with 'XXXX'] [end with 'YYYY'] [META_ONLY];
|
||||||
|
SHOW COMPACTS;
|
||||||
|
SHOW COMPACT compact_id;
|
||||||
KILL COMPACT compact_id;
|
KILL COMPACT compact_id;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -28,6 +30,7 @@ KILL COMPACT compact_id;
|
||||||
- COMPACT will merge multiple STT files
|
- COMPACT will merge multiple STT files
|
||||||
- You can specify the start time of the COMPACT data with the start with keyword
|
- You can specify the start time of the COMPACT data with the start with keyword
|
||||||
- You can specify the end time of the COMPACT data with the end with keyword
|
- You can specify the end time of the COMPACT data with the end with keyword
|
||||||
|
- You can specify the META_ONLY keyword to only compact the meta data which are not compacted by default
|
||||||
- The COMPACT command will return the ID of the COMPACT task
|
- The COMPACT command will return the ID of the COMPACT task
|
||||||
- COMPACT tasks are executed asynchronously in the background, and you can view the progress of COMPACT tasks using the SHOW COMPACTS command
|
- COMPACT tasks are executed asynchronously in the background, and you can view the progress of COMPACT tasks using the SHOW COMPACTS command
|
||||||
- The SHOW command will return the ID of the COMPACT task, and you can terminate the COMPACT task using the KILL COMPACT command
|
- The SHOW command will return the ID of the COMPACT task, and you can terminate the COMPACT task using the KILL COMPACT command
|
||||||
|
|
|
@ -18,7 +18,10 @@ create user user_name pass'password' [sysinfo {1|0}] [createdb {1|0}]
|
||||||
The parameters are explained as follows.
|
The parameters are explained as follows.
|
||||||
|
|
||||||
- user_name: Up to 23 B long.
|
- user_name: Up to 23 B long.
|
||||||
- password: The password must be between 8 and 16 characters long and include at least three types of characters from the following: uppercase letters, lowercase letters, numbers, and special characters. Special characters include `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? | ~ , .`.
|
- password: The password must be between 8 and 255 characters long. The password include at least three types of characters from the following: uppercase letters, lowercase letters, numbers, and special characters, special characters include `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? | ~ , .`, and this reqirement is able to be closed by adding enableStrongPassword 0 in taos.cfg, or by the following SQL:
|
||||||
|
```sql
|
||||||
|
alter all dnode 'EnableStrongPassword' '0'
|
||||||
|
```
|
||||||
- sysinfo: Whether the user can view system information. 1 means they can view it, 0 means they cannot. System information includes server configuration information, various node information such as dnode, query node (qnode), etc., as well as storage-related information, etc. The default is to view system information.
|
- sysinfo: Whether the user can view system information. 1 means they can view it, 0 means they cannot. System information includes server configuration information, various node information such as dnode, query node (qnode), etc., as well as storage-related information, etc. The default is to view system information.
|
||||||
- createdb: Whether the user can create databases. 1 means they can create databases, 0 means they cannot. The default value is 0. // Supported starting from TDengine Enterprise version 3.3.2.0
|
- createdb: Whether the user can create databases. 1 means they can create databases, 0 means they cannot. The default value is 0. // Supported starting from TDengine Enterprise version 3.3.2.0
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ It is not necessary to configure your cluster specifically for active-active mod
|
||||||
- The sink endpoint is the FQDN of TDengine on the secondary node.
|
- The sink endpoint is the FQDN of TDengine on the secondary node.
|
||||||
- You can use the native connection (port 6030) or WebSocket connection (port 6041).
|
- You can use the native connection (port 6030) or WebSocket connection (port 6041).
|
||||||
- You can specify one or more databases to replicate only the data contained in those databases. If you do not specify a database, all databases on the node are replicated except for `information_schema`, `performance_schema`, `log`, and `audit`.
|
- You can specify one or more databases to replicate only the data contained in those databases. If you do not specify a database, all databases on the node are replicated except for `information_schema`, `performance_schema`, `log`, and `audit`.
|
||||||
|
- New databases in both sides will be detected periodically to start replication, with optional `--new-database-checking-interval <SECONDS>` argument.
|
||||||
|
- New databases checking will be disabled with `--no-new-databases`.
|
||||||
|
|
||||||
When the command is successful, the replica ID is displayed. You can use this ID to add other databases to the replication task if necessary.
|
When the command is successful, the replica ID is displayed. You can use this ID to add other databases to the replication task if necessary.
|
||||||
|
|
||||||
|
@ -97,7 +99,6 @@ You can manage your active-active deployment with the following commands:
|
||||||
:::note
|
:::note
|
||||||
- This command cannot create duplicate tasks. It only adds the specified databases to the specified task.
|
- This command cannot create duplicate tasks. It only adds the specified databases to the specified task.
|
||||||
- The replica ID is globally unique within a taosX instance and is independent of the source/sink combination.
|
- The replica ID is globally unique within a taosX instance and is independent of the source/sink combination.
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
2. Check the status of a task:
|
2. Check the status of a task:
|
||||||
|
@ -124,6 +125,8 @@ You can manage your active-active deployment with the following commands:
|
||||||
|
|
||||||
If you specify a database, replication for that database is stopped. If you do not specify a database, all replication tasks on the ID are stopped. If you do not specify an ID, all replication tasks on the instance are stopped.
|
If you specify a database, replication for that database is stopped. If you do not specify a database, all replication tasks on the ID are stopped. If you do not specify an ID, all replication tasks on the instance are stopped.
|
||||||
|
|
||||||
|
Use `--no-new-databases` to not stop new-databases checking.
|
||||||
|
|
||||||
4. Restart a replication task:
|
4. Restart a replication task:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
@ -132,6 +135,14 @@ You can manage your active-active deployment with the following commands:
|
||||||
|
|
||||||
If you specify a database, replication for that database is restarted. If you do not specify a database, all replication tasks in the instance are restarted. If you do not specify an ID, all replication tasks on the instance are restarted.
|
If you specify a database, replication for that database is restarted. If you do not specify a database, all replication tasks in the instance are restarted. If you do not specify an ID, all replication tasks on the instance are restarted.
|
||||||
|
|
||||||
|
5. Update new databases checking interval:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
taosx replica update id --new-database-checking-interval <SECONDS>
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will only update the checking interval for new databases.
|
||||||
|
|
||||||
5. Check the progress of a replication task:
|
5. Check the progress of a replication task:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
|
@ -231,6 +231,7 @@ The effective value of charset is UTF-8.
|
||||||
|udf | |Supported, effective after restart|Whether to start UDF service; 0: do not start, 1: start; default value 0 |
|
|udf | |Supported, effective after restart|Whether to start UDF service; 0: do not start, 1: start; default value 0 |
|
||||||
|udfdResFuncs | |Supported, effective after restart|Internal parameter, for setting UDF result sets|
|
|udfdResFuncs | |Supported, effective after restart|Internal parameter, for setting UDF result sets|
|
||||||
|udfdLdLibPath | |Supported, effective after restart|Internal parameter, indicates the library path for loading UDF|
|
|udfdLdLibPath | |Supported, effective after restart|Internal parameter, indicates the library path for loading UDF|
|
||||||
|
|enableStrongPassword | After 3.3.5.0 |Supported, effective after restart|The password include at least three types of characters from the following: uppercase letters, lowercase letters, numbers, and special characters, special characters include `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? \| ~ , .`; 0: disable, 1: enable; default value 1 |
|
||||||
|
|
||||||
### Stream Computing Parameters
|
### Stream Computing Parameters
|
||||||
|
|
||||||
|
@ -243,6 +244,8 @@ The effective value of charset is UTF-8.
|
||||||
| concurrentCheckpoint | |Supported, effective immediately | Internal parameter, whether to check checkpoints concurrently |
|
| concurrentCheckpoint | |Supported, effective immediately | Internal parameter, whether to check checkpoints concurrently |
|
||||||
| maxStreamBackendCache | |Supported, effective immediately | Internal parameter, maximum cache used by stream computing |
|
| maxStreamBackendCache | |Supported, effective immediately | Internal parameter, maximum cache used by stream computing |
|
||||||
| streamSinkDataRate | |Supported, effective after restart| Internal parameter, used to control the write speed of stream computing results |
|
| streamSinkDataRate | |Supported, effective after restart| Internal parameter, used to control the write speed of stream computing results |
|
||||||
|
| streamNotifyMessageSize | After 3.3.6.0 | Not supported | Internal parameter, controls the message size for event notifications, default value is 8192 |
|
||||||
|
| streamNotifyFrameSize | After 3.3.6.0 | Not supported | Internal parameter, controls the underlying frame size when sending event notification messages, default value is 256 |
|
||||||
|
|
||||||
### Log Related
|
### Log Related
|
||||||
|
|
||||||
|
|
|
@ -188,9 +188,12 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
||||||
|
|
||||||
The parameters listed in this section apply to all functional modes.
|
The parameters listed in this section apply to all functional modes.
|
||||||
|
|
||||||
- **filetype**: The function to test, possible values are `insert`, `query`, and `subscribe`. Corresponding to insert, query, and subscribe functions. Only one can be specified in each configuration file.
|
- **filetype**: The function to test, possible values are `insert`, `query`, `subscribe` and `csvfile`. Corresponding to insert, query, subscribe and generate csv file functions. Only one can be specified in each configuration file.
|
||||||
|
|
||||||
- **cfgdir**: Directory where the TDengine client configuration file is located, default path is /etc/taos.
|
- **cfgdir**: Directory where the TDengine client configuration file is located, default path is /etc/taos.
|
||||||
|
|
||||||
|
- **output_dir**: The directory specified for output files. When the feature category is csvfile, it refers to the directory where the generated csv files will be saved. The default value is ./output/.
|
||||||
|
|
||||||
- **host**: Specifies the FQDN of the TDengine server to connect to, default value is localhost.
|
- **host**: Specifies the FQDN of the TDengine server to connect to, default value is localhost.
|
||||||
|
|
||||||
- **port**: The port number of the TDengine server to connect to, default value is 6030.
|
- **port**: The port number of the TDengine server to connect to, default value is 6030.
|
||||||
|
@ -283,6 +286,27 @@ Parameters related to supertable creation are configured in the `super_tables` s
|
||||||
- **repeat_ts_max** : Numeric type, when composite primary key is enabled, specifies the maximum number of records with the same timestamp to be generated
|
- **repeat_ts_max** : Numeric type, when composite primary key is enabled, specifies the maximum number of records with the same timestamp to be generated
|
||||||
- **sqls** : Array of strings type, specifies the array of sql to be executed after the supertable is successfully created, the table name specified in sql must be prefixed with the database name, otherwise an unspecified database error will occur
|
- **sqls** : Array of strings type, specifies the array of sql to be executed after the supertable is successfully created, the table name specified in sql must be prefixed with the database name, otherwise an unspecified database error will occur
|
||||||
|
|
||||||
|
- **csv_file_prefix**: String type, sets the prefix for the names of the generated csv files. Default value is "data".
|
||||||
|
|
||||||
|
- **csv_ts_format**: String type, sets the format of the time string in the names of the generated csv files, following the `strftime` format standard. If not set, files will not be split by time intervals. Supported patterns include:
|
||||||
|
- %Y: Year as a four-digit number (e.g., 2025)
|
||||||
|
- %m: Month as a two-digit number (01 to 12)
|
||||||
|
- %d: Day of the month as a two-digit number (01 to 31)
|
||||||
|
- %H: Hour in 24-hour format as a two-digit number (00 to 23)
|
||||||
|
- %M: Minute as a two-digit number (00 to 59)
|
||||||
|
- %S: Second as a two-digit number (00 to 59)
|
||||||
|
|
||||||
|
- **csv_ts_interval**: String type, sets the time interval for splitting generated csv file names. Supports daily, hourly, minute, and second intervals such as 1d/2h/30m/40s. The default value is "1d".
|
||||||
|
|
||||||
|
- **csv_output_header**: String type, sets whether the generated csv files should contain column header descriptions. The default value is "yes".
|
||||||
|
|
||||||
|
- **csv_tbname_alias**: String type, sets the alias for the tbname field in the column header descriptions of csv files. The default value is "device_id".
|
||||||
|
|
||||||
|
- **csv_compress_level**: String type, sets the compression level for generating csv-encoded data and automatically compressing it into gzip file. This process directly encodes and compresses the data, rather than first generating a csv file and then compressing it. Possible values are:
|
||||||
|
- none: No compression
|
||||||
|
- fast: gzip level 1 compression
|
||||||
|
- balance: gzip level 6 compression
|
||||||
|
- best: gzip level 9 compression
|
||||||
|
|
||||||
#### Tag and Data Columns
|
#### Tag and Data Columns
|
||||||
|
|
||||||
|
@ -478,6 +502,17 @@ Note: Data types in the taosBenchmark configuration file must be in lowercase to
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### Export CSV File Example
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>csv-export.json</summary>
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include /TDengine/tools/taos-tools/example/csv-export.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
Other json examples see [here](https://github.com/taosdata/TDengine/tree/main/tools/taos-tools/example)
|
Other json examples see [here](https://github.com/taosdata/TDengine/tree/main/tools/taos-tools/example)
|
||||||
|
|
||||||
## Output Performance Indicators
|
## Output Performance Indicators
|
||||||
|
|
|
@ -55,14 +55,13 @@ join_clause:
|
||||||
|
|
||||||
window_clause: {
|
window_clause: {
|
||||||
SESSION(ts_col, tol_val)
|
SESSION(ts_col, tol_val)
|
||||||
| STATE_WINDOW(col)
|
| STATE_WINDOW(col) [TRUE_FOR(true_for_duration)]
|
||||||
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)]
|
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)]
|
||||||
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition
|
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition [TRUE_FOR(true_for_duration)]
|
||||||
| COUNT_WINDOW(count_val[, sliding_val])
|
| COUNT_WINDOW(count_val[, sliding_val])
|
||||||
|
|
||||||
interp_clause:
|
interp_clause:
|
||||||
RANGE(ts_val [, ts_val]) EVERY(every_val) FILL(fill_mod_and_val)
|
RANGE(ts_val [, ts_val] [, surrounding_time_val]) EVERY(every_val) FILL(fill_mod_and_val)
|
||||||
| RANGE(ts_val, surrounding_time_val) FILL(fill_mod_and_val)
|
|
||||||
|
|
||||||
partition_by_clause:
|
partition_by_clause:
|
||||||
PARTITION BY partition_by_expr [, partition_by_expr] ...
|
PARTITION BY partition_by_expr [, partition_by_expr] ...
|
||||||
|
|
|
@ -1967,7 +1967,7 @@ ignore_null_values: {
|
||||||
- For queries on tables with composite primary keys, if there are data with the same timestamp, only the data with the smallest composite primary key participates in the calculation.
|
- For queries on tables with composite primary keys, if there are data with the same timestamp, only the data with the smallest composite primary key participates in the calculation.
|
||||||
- INTERP query supports NEAR FILL mode, i.e., when FILL is needed, it uses the data closest to the current time point for interpolation. When the timestamps before and after are equally close to the current time slice, FILL the previous row's value. This mode is not supported in stream computing and window queries. For example: SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00', '2023-01-01 00:10:00') FILL(NEAR).(Supported from version 3.3.4.9).
|
- INTERP query supports NEAR FILL mode, i.e., when FILL is needed, it uses the data closest to the current time point for interpolation. When the timestamps before and after are equally close to the current time slice, FILL the previous row's value. This mode is not supported in stream computing and window queries. For example: SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00', '2023-01-01 00:10:00') FILL(NEAR).(Supported from version 3.3.4.9).
|
||||||
- INTERP can only use the pseudocolumn `_irowts_origin` when using FILL PREV/NEXT/NEAR modes. `_irowts_origin` is supported from version 3.3.4.9.
|
- INTERP can only use the pseudocolumn `_irowts_origin` when using FILL PREV/NEXT/NEAR modes. `_irowts_origin` is supported from version 3.3.4.9.
|
||||||
- INTERP `RANGE` clause supports the expansion of the time range (supported from version 3.3.4.9), such as `RANGE('2023-01-01 00:00:00', 10s)` means to find data 10s before and after the time point '2023-01-01 00:00:00' for interpolation, FILL PREV/NEXT/NEAR respectively means to look for data forward/backward/around the time point, if there is no data around the time point, then use the value specified by FILL for interpolation, therefore the FILL clause must specify a value at this time. For example: SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00', 10s) FILL(PREV, 1). Currently, only the combination of time point and time range is supported, not the combination of time interval and time range, i.e., RANGE('2023-01-01 00:00:00', '2023-02-01 00:00:00', 1h) is not supported. The specified time range rules are similar to EVERY, the unit cannot be year or month, the value cannot be 0, and cannot have quotes. When using this extension, other FILL modes except FILL PREV/NEXT/NEAR are not supported, and the EVERY clause cannot be specified.
|
- INTERP `RANGE` clause supports the expansion of the time range (supported from version 3.3.4.9), For example, `RANGE('2023-01-01 00:00:00', 10s)` means that only data within 10s around the time point '2023-01-01 00:00:00' can be used for interpolation. `FILL PREV/NEXT/NEAR` respectively means to look for data forward/backward/around the time point. If there is no data around the time point, the default value specified by `FILL` is used for interpolation. Therefore the `FILL` clause must specify the default value at the same time. For example: SELECT INTERP(col) FROM tb RANGE('2023-01-01 00:00:00', 10s) FILL(PREV, 1). Starting from the 3.3.6.0 version, the combination of time period and time range is supported. When interpolating for each point within the time period, the time range requirement must be met. Prior versions only supported single time point and its time range. The available values for time range are similar to `EVERY`, the unit cannot be year or month, the value must be greater than 0, and cannot be in quotes. When using this extension, `FILL` modes other than `PREV/NEXT/NEAR` are not supported.
|
||||||
|
|
||||||
### LAST
|
### LAST
|
||||||
|
|
||||||
|
@ -2125,6 +2125,28 @@ UNIQUE(expr)
|
||||||
|
|
||||||
**Applicable to**: Tables and supertables.
|
**Applicable to**: Tables and supertables.
|
||||||
|
|
||||||
|
### COLS
|
||||||
|
|
||||||
|
```sql
|
||||||
|
COLS(func(expr), output_expr1, [, output_expr2] ... )
|
||||||
|
```
|
||||||
|
|
||||||
|
**Function Description**: On the data row where the execution result of function func(expr) is located, execute the expression output_expr1, [, output_expr2], return its result, and the result of func (expr) is not output.
|
||||||
|
|
||||||
|
**Return Data Type**: Returns multiple columns of data, and the data type of each column is the type of the result returned by the corresponding expression.
|
||||||
|
|
||||||
|
**Applicable Data Types**: All type fields.
|
||||||
|
|
||||||
|
**Applicable to**: Tables and Super Tables.
|
||||||
|
|
||||||
|
**Usage Instructions**:
|
||||||
|
- Func function type: must be a single-line selection function (output result is a single-line selection function, for example, last is a single-line selection function, but top is a multi-line selection function).
|
||||||
|
- Mainly used to obtain the associated columns of multiple selection function results in a single SQL query. For example: select cols(max(c0), ts), cols(max(c1), ts) from ... can be used to get the different ts values of the maximum values of columns c0 and c1.
|
||||||
|
- The result of the parameter func is not returned. If you need to output the result of func, you can add additional output columns, such as: select first(ts), cols(first(ts), c1) from ..
|
||||||
|
- When there is only one column in the output, you can set an alias for the function. For example, you can do it like this: "select cols(first (ts), c1) as c11 from ...".
|
||||||
|
- Output one or more columns, and you can set an alias for each output column of the function. For example, you can do it like this: "select (first (ts), c1 as c11, c2 as c22) from ...".
|
||||||
|
|
||||||
|
|
||||||
## Time-Series Specific Functions
|
## Time-Series Specific Functions
|
||||||
|
|
||||||
Time-Series specific functions are tailor-made by TDengine to meet the query scenarios of time-series data. In general databases, implementing similar functionalities usually requires complex query syntax and is inefficient. TDengine has built these functionalities into functions, greatly reducing the user's cost of use.
|
Time-Series specific functions are tailor-made by TDengine to meet the query scenarios of time-series data. In general databases, implementing similar functionalities usually requires complex query syntax and is inefficient. TDengine has built these functionalities into functions, greatly reducing the user's cost of use.
|
||||||
|
|
|
@ -53,9 +53,9 @@ The syntax for the window clause is as follows:
|
||||||
```sql
|
```sql
|
||||||
window_clause: {
|
window_clause: {
|
||||||
SESSION(ts_col, tol_val)
|
SESSION(ts_col, tol_val)
|
||||||
| STATE_WINDOW(col)
|
| STATE_WINDOW(col) [TRUE_FOR(true_for_duration)]
|
||||||
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)]
|
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)]
|
||||||
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition
|
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition [TRUE_FOR(true_for_duration)]
|
||||||
| COUNT_WINDOW(count_val[, sliding_val])
|
| COUNT_WINDOW(count_val[, sliding_val])
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -177,6 +177,12 @@ TDengine also supports using CASE expressions in state quantities, which can exp
|
||||||
SELECT tbname, _wstart, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END status FROM meters PARTITION BY tbname STATE_WINDOW(CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END);
|
SELECT tbname, _wstart, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END status FROM meters PARTITION BY tbname STATE_WINDOW(CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The state window supports using the TRUE_FOR parameter to set its minimum duration. If the window's duration is less than the specified value, it will be discarded automatically and no result will be returned. For example, setting the minimum duration to 3 seconds:
|
||||||
|
|
||||||
|
```
|
||||||
|
SELECT COUNT(*), FIRST(ts), status FROM temp_tb_1 STATE_WINDOW(status) TRUE_FOR (3s);
|
||||||
|
```
|
||||||
|
|
||||||
### Session Window
|
### Session Window
|
||||||
|
|
||||||
The session window is determined based on the timestamp primary key values of the records. As shown in the diagram below, if the continuous interval of the timestamps is set to be less than or equal to 12 seconds, the following 6 records form 2 session windows, which are: [2019-04-28 14:22:10, 2019-04-28 14:22:30] and [2019-04-28 14:23:10, 2019-04-28 14:23:30]. This is because the interval between 2019-04-28 14:22:30 and 2019-04-28 14:23:10 is 40 seconds, exceeding the continuous interval (12 seconds).
|
The session window is determined based on the timestamp primary key values of the records. As shown in the diagram below, if the continuous interval of the timestamps is set to be less than or equal to 12 seconds, the following 6 records form 2 session windows, which are: [2019-04-28 14:22:10, 2019-04-28 14:22:30] and [2019-04-28 14:23:10, 2019-04-28 14:23:30]. This is because the interval between 2019-04-28 14:22:30 and 2019-04-28 14:23:10 is 40 seconds, exceeding the continuous interval (12 seconds).
|
||||||
|
@ -212,6 +218,12 @@ select _wstart, _wend, count(*) from t event_window start with c1 > 0 end with c
|
||||||
<Image img={imgStep04} alt=""/>
|
<Image img={imgStep04} alt=""/>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
||||||
|
The event window supports using the TRUE_FOR parameter to set its minimum duration. If the window's duration is less than the specified value, it will be discarded automatically and no result will be returned. For example, setting the minimum duration to 3 seconds:
|
||||||
|
|
||||||
|
```
|
||||||
|
select _wstart, _wend, count(*) from t event_window start with c1 > 0 end with c2 < 10 true_for (3s);
|
||||||
|
```
|
||||||
|
|
||||||
### Count Window
|
### Count Window
|
||||||
|
|
||||||
Count windows divide data into windows based on a fixed number of data rows. By default, data is sorted by timestamp, then divided into multiple windows based on the value of count_val, and aggregate calculations are performed. count_val represents the maximum number of data rows in each count window; if the total number of data rows is not divisible by count_val, the last window will have fewer rows than count_val. sliding_val is a constant that represents the number of rows the window slides, similar to the SLIDING in interval.
|
Count windows divide data into windows based on a fixed number of data rows. By default, data is sorted by timestamp, then divided into multiple windows based on the value of count_val, and aggregate calculations are performed. count_val represents the maximum number of data rows in each count window; if the total number of data rows is not divisible by count_val, the last window will have fewer rows than count_val. sliding_val is a constant that represents the number of rows the window slides, similar to the SLIDING in interval.
|
||||||
|
|
|
@ -9,7 +9,7 @@ import imgStream from './assets/stream-processing-01.png';
|
||||||
## Creating Stream Computing
|
## Creating Stream Computing
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE STREAM [IF NOT EXISTS] stream_name [stream_options] INTO stb_name[(field1_name, field2_name [PRIMARY KEY], ...)] [TAGS (create_definition [, create_definition] ...)] SUBTABLE(expression) AS subquery
|
CREATE STREAM [IF NOT EXISTS] stream_name [stream_options] INTO stb_name[(field1_name, field2_name [PRIMARY KEY], ...)] [TAGS (create_definition [, create_definition] ...)] SUBTABLE(expression) AS subquery [notification_definition]
|
||||||
stream_options: {
|
stream_options: {
|
||||||
TRIGGER [AT_ONCE | WINDOW_CLOSE | MAX_DELAY time | FORCE_WINDOW_CLOSE]
|
TRIGGER [AT_ONCE | WINDOW_CLOSE | MAX_DELAY time | FORCE_WINDOW_CLOSE]
|
||||||
WATERMARK time
|
WATERMARK time
|
||||||
|
@ -85,6 +85,8 @@ CREATE STREAM streams1 IGNORE EXPIRED 1 WATERMARK 100s INTO streamt1 AS
|
||||||
SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname COUNT_WINDOW(10);
|
SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname COUNT_WINDOW(10);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
notification_definition clause specifies the addresses to which notifications should be sent when designated events occur during window computations, such as window opening or closing. For more details, see [Stream Computing Event Notifications](#stream-computing-event-notifications).
|
||||||
|
|
||||||
## Stream Computation Partitioning
|
## Stream Computation Partitioning
|
||||||
|
|
||||||
You can use `PARTITION BY TBNAME`, tags, regular columns, or expressions to partition a stream for multi-partition computation. Each partition's timeline and window are independent, aggregating separately, and writing into different subtables of the target table.
|
You can use `PARTITION BY TBNAME`, tags, regular columns, or expressions to partition a stream for multi-partition computation. Each partition's timeline and window are independent, aggregating separately, and writing into different subtables of the target table.
|
||||||
|
@ -305,3 +307,223 @@ CREATE SNODE ON DNODE [id]
|
||||||
|
|
||||||
The id is the serial number of the dnode in the cluster. Please be mindful of the selected dnode, as the intermediate state of stream computing will automatically be backed up on it.
|
The id is the serial number of the dnode in the cluster. Please be mindful of the selected dnode, as the intermediate state of stream computing will automatically be backed up on it.
|
||||||
Starting from version 3.3.4.0, in a multi-replica environment, creating a stream will perform an **existence check** of snode, requiring the snode to be created first. If the snode does not exist, the stream cannot be created.
|
Starting from version 3.3.4.0, in a multi-replica environment, creating a stream will perform an **existence check** of snode, requiring the snode to be created first. If the snode does not exist, the stream cannot be created.
|
||||||
|
|
||||||
|
## Stream Computing Event Notifications
|
||||||
|
|
||||||
|
### User Guide
|
||||||
|
|
||||||
|
Stream computing supports sending event notifications to external systems when windows open or close. Users can specify the events to be notified and the target addresses for receiving notification messages using the notification_definition clause.
|
||||||
|
|
||||||
|
```sql
|
||||||
|
notification_definition:
|
||||||
|
NOTIFY (url [, url] ...) ON (event_type [, event_type] ...) [notification_options]
|
||||||
|
|
||||||
|
event_type:
|
||||||
|
'WINDOW_OPEN'
|
||||||
|
| 'WINDOW_CLOSE'
|
||||||
|
|
||||||
|
notification_options: {
|
||||||
|
NOTIFY_HISTORY [0|1]
|
||||||
|
ON_FAILURE [DROP|PAUSE]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The rules for the syntax above are as follows:
|
||||||
|
1. `url`: Specifies the target address for the notification. It must include the protocol, IP or domain name, port, and may include a path and parameters. Currently, only the websocket protocol is supported. For example: 'ws://localhost:8080', 'ws://localhost:8080/notify', 'wss://localhost:8080/notify?key=foo'.
|
||||||
|
2. `event_type`: Defines the events that trigger notifications. Supported event types include:
|
||||||
|
1. 'WINDOW_OPEN': Window open event; triggered when any type of window opens.
|
||||||
|
2. 'WINDOW_CLOSE': Window close event; triggered when any type of window closes.
|
||||||
|
3. `NOTIFY_HISTORY`: Controls whether to trigger notifications during the computation of historical data. The default value is 0, which means no notifications are sent.
|
||||||
|
4. `ON_FAILURE`: Determines whether to allow dropping some events if sending notifications fails (e.g., in poor network conditions). The default value is `PAUSE`:
|
||||||
|
1. PAUSE means that the stream computing task is paused if sending a notification fails. taosd will retry until the notification is successfully delivered and the task resumes.
|
||||||
|
2. DROP means that if sending a notification fails, the event information is discarded, and the stream computing task continues running unaffected.
|
||||||
|
|
||||||
|
For example, the following creates a stream that computes the per-minute average current from electric meters and sends notifications to two target addresses when the window opens and closes. It does not send notifications for historical data and does not allow dropping notifications on failure:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE STREAM avg_current_stream FILL_HISTORY 1
|
||||||
|
AS SELECT _wstart, _wend, AVG(current) FROM meters
|
||||||
|
INTERVAL (1m)
|
||||||
|
NOTIFY ('ws://localhost:8080/notify', 'wss://192.168.1.1:8080/notify?key=foo')
|
||||||
|
ON ('WINDOW_OPEN', 'WINDOW_CLOSE');
|
||||||
|
NOTIFY_HISTORY 0
|
||||||
|
ON_FAILURE PAUSE;
|
||||||
|
```
|
||||||
|
|
||||||
|
When the specified events are triggered, taosd will send a POST request to the given URL(s) with a JSON message body. A single request may contain events from several streams, and the event types may differ.
|
||||||
|
|
||||||
|
The details of the event information depend on the type of window:
|
||||||
|
|
||||||
|
1. Time Window: At the opening, the start time is sent; at the closing, the start time, end time, and computation result are sent.
|
||||||
|
2. State Window: At the opening, the start time, previous window's state, and current window's state are sent; at closing, the start time, end time, computation result, current window state, and next window state are sent.
|
||||||
|
3. Session Window: At the opening, the start time is sent; at the closing, the start time, end time, and computation result are sent.
|
||||||
|
4. Event Window: At the opening, the start time along with the data values and corresponding condition index that triggered the window opening are sent; at the closing, the start time, end time, computation result, and the triggering data value and condition index for window closure are sent.
|
||||||
|
5. Count Window: At the opening, the start time is sent; at the closing, the start time, end time, and computation result are sent.
|
||||||
|
|
||||||
|
An example structure for the notification message is shown below:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"messageId": "unique-message-id-12345",
|
||||||
|
"timestamp": 1733284887203,
|
||||||
|
"streams": [
|
||||||
|
{
|
||||||
|
"streamName": "avg_current_stream",
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"tableName": "t_a667a16127d3b5a18988e32f3e76cd30",
|
||||||
|
"eventType": "WINDOW_OPEN",
|
||||||
|
"eventTime": 1733284887097,
|
||||||
|
"windowId": "window-id-67890",
|
||||||
|
"windowType": "Time",
|
||||||
|
"windowStart": 1733284800000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "t_a667a16127d3b5a18988e32f3e76cd30",
|
||||||
|
"eventType": "WINDOW_CLOSE",
|
||||||
|
"eventTime": 1733284887197,
|
||||||
|
"windowId": "window-id-67890",
|
||||||
|
"windowType": "Time",
|
||||||
|
"windowStart": 1733284800000,
|
||||||
|
"windowEnd": 1733284860000,
|
||||||
|
"result": {
|
||||||
|
"_wstart": 1733284800000,
|
||||||
|
"avg(current)": 1.3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"streamName": "max_voltage_stream",
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"tableName": "t_96f62b752f36e9b16dc969fe45363748",
|
||||||
|
"eventType": "WINDOW_OPEN",
|
||||||
|
"eventTime": 1733284887231,
|
||||||
|
"windowId": "window-id-13579",
|
||||||
|
"windowType": "Event",
|
||||||
|
"windowStart": 1733284800000,
|
||||||
|
"triggerCondition": {
|
||||||
|
"conditionIndex": 0,
|
||||||
|
"fieldValue": {
|
||||||
|
"c1": 10,
|
||||||
|
"c2": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "t_96f62b752f36e9b16dc969fe45363748",
|
||||||
|
"eventType": "WINDOW_CLOSE",
|
||||||
|
"eventTime": 1733284887231,
|
||||||
|
"windowId": "window-id-13579",
|
||||||
|
"windowType": "Event",
|
||||||
|
"windowStart": 1733284800000,
|
||||||
|
"windowEnd": 1733284810000,
|
||||||
|
"triggerCondition": {
|
||||||
|
"conditionIndex": 1,
|
||||||
|
"fieldValue": {
|
||||||
|
"c1": 20
|
||||||
|
"c2": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"_wstart": 1733284800000,
|
||||||
|
"max(voltage)": 220
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The following sections explain the fields in the notification message.
|
||||||
|
|
||||||
|
### Root-Level Field Descriptions
|
||||||
|
|
||||||
|
1. "messageId": A string that uniquely identifies the notification message. It ensures that the entire message can be tracked and de-duplicated.
|
||||||
|
2. "timestamp": A long integer timestamp representing the time when the notification message was generated, accurate to the millisecond (i.e., the number of milliseconds since '00:00, Jan 1 1970 UTC').
|
||||||
|
3. "streams": An array containing the event information for multiple stream tasks. (See the following sections for details.)
|
||||||
|
|
||||||
|
### "stream" Object Field Descriptions
|
||||||
|
|
||||||
|
1. "streamName": A string representing the name of the stream task, used to identify which stream the events belong to.
|
||||||
|
2. "events": An array containing the list of event objects for the stream task. Each event object includes detailed information. (See the next sections for details.)
|
||||||
|
|
||||||
|
### "event" Object Field Descriptions
|
||||||
|
|
||||||
|
#### Common Fields
|
||||||
|
|
||||||
|
These fields are common to all event objects.
|
||||||
|
1. "tableName": A string indicating the name of the target subtable.
|
||||||
|
2. "eventType": A string representing the event type ("WINDOW_OPEN", "WINDOW_CLOSE", or "WINDOW_INVALIDATION").
|
||||||
|
3. "eventTime": A long integer timestamp that indicates when the event was generated, accurate to the millisecond (i.e., the number of milliseconds since '00:00, Jan 1 1970 UTC').
|
||||||
|
4. "windowId": A string representing the unique identifier for the window. This ID ensures that the open and close events for the same window can be correlated. In the case that taosd restarts due to a fault, some events may be sent repeatedly, but the windowId remains constant for the same window.
|
||||||
|
5. "windowType": A string that indicates the window type ("Time", "State", "Session", "Event", or "Count").
|
||||||
|
|
||||||
|
#### Fields for Time Windows
|
||||||
|
|
||||||
|
These fields are present only when "windowType" is "Time".
|
||||||
|
1. When "eventType" is "WINDOW_OPEN", the following field is included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window, matching the time precision of the result table.
|
||||||
|
2. When "eventType" is "WINDOW_CLOSE", the following fields are included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
1. "windowEnd": A long integer timestamp representing the end time of the window.
|
||||||
|
1. "result": An object containing key-value pairs of the computed result columns and their corresponding values.
|
||||||
|
|
||||||
|
#### Fields for State Windows
|
||||||
|
|
||||||
|
These fields are present only when "windowType" is "State".
|
||||||
|
1. When "eventType" is "WINDOW_OPEN", the following fields are included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
1. "prevState": A value of the same type as the state column, representing the state of the previous window. If there is no previous window (i.e., this is the first window), it will be NULL.
|
||||||
|
1. "curState": A value of the same type as the state column, representing the current window's state.
|
||||||
|
2. When "eventType" is "WINDOW_CLOSE", the following fields are included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
1. "windowEnd": A long integer timestamp representing the end time of the window.
|
||||||
|
1. "curState": The current window's state.
|
||||||
|
1. "nextState": The state for the next window.
|
||||||
|
1. "result": An object containing key-value pairs of the computed result columns and their corresponding values.
|
||||||
|
|
||||||
|
#### Fields for Session Windows
|
||||||
|
|
||||||
|
These fields are present only when "windowType" is "Session".
|
||||||
|
1. When "eventType" is "WINDOW_OPEN", the following field is included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
2. When "eventType" is "WINDOW_CLOSE", the following fields are included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
1. "windowEnd": A long integer timestamp representing the end time of the window.
|
||||||
|
1. "result": An object containing key-value pairs of the computed result columns and their corresponding values.
|
||||||
|
|
||||||
|
#### Fields for Event Windows
|
||||||
|
|
||||||
|
These fields are present only when "windowType" is "Event".
|
||||||
|
1. When "eventType" is "WINDOW_OPEN", the following fields are included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
1. "triggerCondition": An object that provides information about the condition that triggered the window to open. It includes:
|
||||||
|
1. "conditionIndex": An integer representing the index of the condition that triggered the window, starting from 0.
|
||||||
|
1. "fieldValue": An object containing key-value pairs of the column names related to the condition and their respective values.
|
||||||
|
2. When "eventType" is "WINDOW_CLOSE", the following fields are included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
1. "windowEnd": A long integer timestamp representing the end time of the window.
|
||||||
|
1. "triggerCondition": An object that provides information about the condition that triggered the window to close. It includes:
|
||||||
|
1. "conditionIndex": An integer representing the index of the condition that triggered the closure, starting from 0.
|
||||||
|
1. "fieldValue": An object containing key-value pairs of the related column names and their respective values.
|
||||||
|
1. "result": An object containing key-value pairs of the computed result columns and their corresponding values.
|
||||||
|
|
||||||
|
#### Fields for Count Windows
|
||||||
|
|
||||||
|
These fields are present only when "windowType" is "Count".
|
||||||
|
1. When "eventType" is "WINDOW_OPEN", the following field is included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
2. When "eventType" is "WINDOW_CLOSE", the following fields are included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
1. "windowEnd": A long integer timestamp representing the end time of the window.
|
||||||
|
1. "result": An object containing key-value pairs of the computed result columns and their corresponding values.
|
||||||
|
|
||||||
|
#### Fields for Window Invalidation
|
||||||
|
|
||||||
|
Due to scenarios such as data disorder, updates, or deletions during stream computing, windows that have already been generated might be removed or their results need to be recalculated. In such cases, a notification with the eventType "WINDOW_INVALIDATION" is sent to inform which windows have been invalidated.
|
||||||
|
For events with "eventType" as "WINDOW_INVALIDATION", the following fields are included:
|
||||||
|
1. "windowStart": A long integer timestamp representing the start time of the window.
|
||||||
|
1. "windowEnd": A long integer timestamp representing the end time of the window.
|
||||||
|
|
|
@ -43,7 +43,8 @@ TDengine supports `UNION ALL` and `UNION` operators. UNION ALL combines the resu
|
||||||
| 9 | LIKE | BINARY, NCHAR, and VARCHAR | Matches the specified pattern string with wildcard |
|
| 9 | LIKE | BINARY, NCHAR, and VARCHAR | Matches the specified pattern string with wildcard |
|
||||||
| 10 | NOT LIKE | BINARY, NCHAR, and VARCHAR | Does not match the specified pattern string with wildcard |
|
| 10 | NOT LIKE | BINARY, NCHAR, and VARCHAR | Does not match the specified pattern string with wildcard |
|
||||||
| 11 | MATCH, NMATCH | BINARY, NCHAR, and VARCHAR | Regular expression match |
|
| 11 | MATCH, NMATCH | BINARY, NCHAR, and VARCHAR | Regular expression match |
|
||||||
| 12 | CONTAINS | JSON | Whether a key exists in JSON |
|
| 12 | REGEXP, NOT REGEXP | BINARY, NCHAR, and VARCHAR | Regular expression match |
|
||||||
|
| 13 | CONTAINS | JSON | Whether a key exists in JSON |
|
||||||
|
|
||||||
LIKE conditions use wildcard strings for matching checks, with the following rules:
|
LIKE conditions use wildcard strings for matching checks, with the following rules:
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ LIKE conditions use wildcard strings for matching checks, with the following rul
|
||||||
- If you want to match an underscore character that is originally in the string, you can write it as \_ in the wildcard string, i.e., add a backslash to escape it.
|
- If you want to match an underscore character that is originally in the string, you can write it as \_ in the wildcard string, i.e., add a backslash to escape it.
|
||||||
- The wildcard string cannot exceed 100 bytes in length. It is not recommended to use too long wildcard strings, as it may severely affect the performance of the LIKE operation.
|
- The wildcard string cannot exceed 100 bytes in length. It is not recommended to use too long wildcard strings, as it may severely affect the performance of the LIKE operation.
|
||||||
|
|
||||||
MATCH and NMATCH conditions use regular expressions for matching, with the following rules:
|
MATCH/REGEXP and NMATCH/NOT REGEXP conditions use regular expressions for matching, with the following rules:
|
||||||
|
|
||||||
- Supports regular expressions that comply with the POSIX standard, see Regular Expressions for specific standards.
|
- Supports regular expressions that comply with the POSIX standard, see Regular Expressions for specific standards.
|
||||||
- When MATCH matches a regular expression, it returns TRUE. When NMATCH does not match a regular expression, it returns TRUE.
|
- When MATCH matches a regular expression, it returns TRUE. When NMATCH does not match a regular expression, it returns TRUE.
|
||||||
|
|
|
@ -37,6 +37,6 @@ Removed `` ‘“`\ `` (single and double quotes, apostrophe, backslash, space)
|
||||||
- Number of databases, supertables, and tables are not limited by the system, only by system resources
|
- Number of databases, supertables, and tables are not limited by the system, only by system resources
|
||||||
- Number of replicas for a database can only be set to 1 or 3
|
- Number of replicas for a database can only be set to 1 or 3
|
||||||
- Maximum length of username is 23 bytes
|
- Maximum length of username is 23 bytes
|
||||||
- Maximum length of user password is 31 bytes
|
- Maximum length of user password is 255 bytes
|
||||||
- Total number of data rows depends on available resources
|
- Total number of data rows depends on available resources
|
||||||
- Maximum number of virtual nodes for a single database is 1024
|
- Maximum number of virtual nodes for a single database is 1024
|
||||||
|
|
|
@ -23,11 +23,11 @@ The list of keywords is as follows:
|
||||||
| ALIVE | |
|
| ALIVE | |
|
||||||
| ALL | |
|
| ALL | |
|
||||||
| ALTER | |
|
| ALTER | |
|
||||||
| ANALYZE | Version 3.3.4.3 and later |
|
| ANALYZE | 3.3.4.3+ |
|
||||||
| AND | |
|
| AND | |
|
||||||
| ANODE | Version 3.3.4.3 and later |
|
| ANODE | 3.3.4.3+ |
|
||||||
| ANODES | Version 3.3.4.3 and later |
|
| ANODES | 3.3.4.3+ |
|
||||||
| ANOMALY_WINDOW | Version 3.3.4.3 and later |
|
| ANOMALY_WINDOW | 3.3.4.3+ |
|
||||||
| ANTI | |
|
| ANTI | |
|
||||||
| APPS | |
|
| APPS | |
|
||||||
| ARBGROUPS | |
|
| ARBGROUPS | |
|
||||||
|
@ -37,6 +37,8 @@ The list of keywords is as follows:
|
||||||
| ASOF | |
|
| ASOF | |
|
||||||
| AT_ONCE | |
|
| AT_ONCE | |
|
||||||
| ATTACH | |
|
| ATTACH | |
|
||||||
|
| AUTO | 3.3.5.0+ |
|
||||||
|
| ASSIGN | 3.3.6.0+ |
|
||||||
|
|
||||||
### B
|
### B
|
||||||
|
|
||||||
|
@ -78,12 +80,16 @@ The list of keywords is as follows:
|
||||||
| CLIENT_VERSION | |
|
| CLIENT_VERSION | |
|
||||||
| CLUSTER | |
|
| CLUSTER | |
|
||||||
| COLON | |
|
| COLON | |
|
||||||
|
| COLS | 3.3.6.0+ |
|
||||||
| COLUMN | |
|
| COLUMN | |
|
||||||
| COMMA | |
|
| COMMA | |
|
||||||
| COMMENT | |
|
| COMMENT | |
|
||||||
| COMP | |
|
| COMP | |
|
||||||
| COMPACT | |
|
| COMPACT | |
|
||||||
| COMPACTS | |
|
| COMPACTS | |
|
||||||
|
| COMPACT_INTERVAL | 3.3.5.0+ |
|
||||||
|
| COMPACT_TIME_OFFSET | 3.3.5.0+ |
|
||||||
|
| COMPACT_TIME_RANGE | 3.3.5.0+ |
|
||||||
| CONCAT | |
|
| CONCAT | |
|
||||||
| CONFLICT | |
|
| CONFLICT | |
|
||||||
| CONNECTION | |
|
| CONNECTION | |
|
||||||
|
@ -114,6 +120,7 @@ The list of keywords is as follows:
|
||||||
| DESC | |
|
| DESC | |
|
||||||
| DESCRIBE | |
|
| DESCRIBE | |
|
||||||
| DETACH | |
|
| DETACH | |
|
||||||
|
| DISK_INFO | 3.3.5.0+ |
|
||||||
| DISTINCT | |
|
| DISTINCT | |
|
||||||
| DISTRIBUTED | |
|
| DISTRIBUTED | |
|
||||||
| DIVIDE | |
|
| DIVIDE | |
|
||||||
|
@ -148,19 +155,19 @@ The list of keywords is as follows:
|
||||||
|Keyword|Description|
|
|Keyword|Description|
|
||||||
|----------------------|-|
|
|----------------------|-|
|
||||||
| FAIL | |
|
| FAIL | |
|
||||||
| FHIGH | Version 3.3.4.3 and later |
|
| FHIGH | 3.3.4.3+ |
|
||||||
| FILE | |
|
| FILE | |
|
||||||
| FILL | |
|
| FILL | |
|
||||||
| FILL_HISTORY | |
|
| FILL_HISTORY | |
|
||||||
| FIRST | |
|
| FIRST | |
|
||||||
| FLOAT | |
|
| FLOAT | |
|
||||||
| FLOW | Version 3.3.4.3 and later |
|
| FLOW | 3.3.4.3+ |
|
||||||
| FLUSH | |
|
| FLUSH | |
|
||||||
| FOR | |
|
| FOR | |
|
||||||
| FORCE | |
|
| FORCE | |
|
||||||
| FORCE_WINDOW_CLOSE | Version 3.3.4.3 and later |
|
| FORCE_WINDOW_CLOSE | 3.3.4.3+ |
|
||||||
| FROM | |
|
| FROM | |
|
||||||
| FROWTS | Version 3.3.4.3 and later |
|
| FROWTS | 3.3.4.3+ |
|
||||||
| FULL | |
|
| FULL | |
|
||||||
| FUNCTION | |
|
| FUNCTION | |
|
||||||
| FUNCTIONS | |
|
| FUNCTIONS | |
|
||||||
|
@ -209,6 +216,7 @@ The list of keywords is as follows:
|
||||||
| INTO | |
|
| INTO | |
|
||||||
| IPTOKEN | |
|
| IPTOKEN | |
|
||||||
| IROWTS | |
|
| IROWTS | |
|
||||||
|
| IROWTS_ORIGIN | 3.3.5.0+ |
|
||||||
| IS | |
|
| IS | |
|
||||||
| IS_IMPORT | |
|
| IS_IMPORT | |
|
||||||
| ISFILLED | |
|
| ISFILLED | |
|
||||||
|
@ -242,6 +250,7 @@ The list of keywords is as follows:
|
||||||
| LEADER | |
|
| LEADER | |
|
||||||
| LEADING | |
|
| LEADING | |
|
||||||
| LEFT | |
|
| LEFT | |
|
||||||
|
| LEVEL | 3.3.0.0 - 3.3.2.11 |
|
||||||
| LICENCES | |
|
| LICENCES | |
|
||||||
| LIKE | |
|
| LIKE | |
|
||||||
| LIMIT | |
|
| LIMIT | |
|
||||||
|
@ -263,6 +272,7 @@ The list of keywords is as follows:
|
||||||
| MEDIUMBLOB | |
|
| MEDIUMBLOB | |
|
||||||
| MERGE | |
|
| MERGE | |
|
||||||
| META | |
|
| META | |
|
||||||
|
| META_ONLY | 3.3.6.0+ |
|
||||||
| MINROWS | |
|
| MINROWS | |
|
||||||
| MINUS | |
|
| MINUS | |
|
||||||
| MNODE | |
|
| MNODE | |
|
||||||
|
@ -281,6 +291,8 @@ The list of keywords is as follows:
|
||||||
| NONE | |
|
| NONE | |
|
||||||
| NORMAL | |
|
| NORMAL | |
|
||||||
| NOT | |
|
| NOT | |
|
||||||
|
| NOTIFY | 3.3.6.0+ |
|
||||||
|
| NOTIFY_HISTORY | 3.3.6.0+ |
|
||||||
| NOTNULL | |
|
| NOTNULL | |
|
||||||
| NOW | |
|
| NOW | |
|
||||||
| NULL | |
|
| NULL | |
|
||||||
|
@ -295,6 +307,7 @@ The list of keywords is as follows:
|
||||||
| OFFSET | |
|
| OFFSET | |
|
||||||
| ON | |
|
| ON | |
|
||||||
| ONLY | |
|
| ONLY | |
|
||||||
|
| ON_FAILURE | 3.3.6.0+ |
|
||||||
| OR | |
|
| OR | |
|
||||||
| ORDER | |
|
| ORDER | |
|
||||||
| OUTER | |
|
| OUTER | |
|
||||||
|
@ -345,6 +358,7 @@ The list of keywords is as follows:
|
||||||
| RATIO | |
|
| RATIO | |
|
||||||
| READ | |
|
| READ | |
|
||||||
| RECURSIVE | |
|
| RECURSIVE | |
|
||||||
|
| REGEXP | 3.3.6.0+ |
|
||||||
| REDISTRIBUTE | |
|
| REDISTRIBUTE | |
|
||||||
| REM | |
|
| REM | |
|
||||||
| REPLACE | |
|
| REPLACE | |
|
||||||
|
@ -418,7 +432,7 @@ The list of keywords is as follows:
|
||||||
| TABLE_PREFIX | |
|
| TABLE_PREFIX | |
|
||||||
| TABLE_SUFFIX | |
|
| TABLE_SUFFIX | |
|
||||||
| TABLES | |
|
| TABLES | |
|
||||||
| tag | |
|
| TAG | |
|
||||||
| TAGS | |
|
| TAGS | |
|
||||||
| TBNAME | |
|
| TBNAME | |
|
||||||
| THEN | |
|
| THEN | |
|
||||||
|
@ -435,6 +449,7 @@ The list of keywords is as follows:
|
||||||
| TRANSACTIONS | |
|
| TRANSACTIONS | |
|
||||||
| TRIGGER | |
|
| TRIGGER | |
|
||||||
| TRIM | |
|
| TRIM | |
|
||||||
|
| TRUE_FOR | 3.3.6.0+ |
|
||||||
| TSDB_PAGESIZE | |
|
| TSDB_PAGESIZE | |
|
||||||
| TSERIES | |
|
| TSERIES | |
|
||||||
| TSMA | |
|
| TSMA | |
|
||||||
|
|
|
@ -127,10 +127,11 @@ Displays created indexes.
|
||||||
## SHOW LOCAL VARIABLES
|
## SHOW LOCAL VARIABLES
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SHOW LOCAL VARIABLES;
|
SHOW LOCAL VARIABLES [like pattern];
|
||||||
```
|
```
|
||||||
|
|
||||||
Displays the runtime values of configuration parameters for the current client.
|
Displays the runtime values of configuration parameters for the current client.
|
||||||
|
You can use the like pattern to filter by name.
|
||||||
|
|
||||||
## SHOW MNODES
|
## SHOW MNODES
|
||||||
|
|
||||||
|
@ -304,9 +305,10 @@ Displays information about all topics in the current database.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SHOW TRANSACTIONS;
|
SHOW TRANSACTIONS;
|
||||||
|
SHOW TRANSACTION [tranaction_id];
|
||||||
```
|
```
|
||||||
|
|
||||||
Displays information about transactions currently being executed in the system (these transactions are only for metadata level, not for regular tables).
|
Displays information about one of or all transaction(s) currently being executed in the system (these transactions are only for metadata level, not for regular tables).
|
||||||
|
|
||||||
## SHOW USERS
|
## SHOW USERS
|
||||||
|
|
||||||
|
@ -319,11 +321,11 @@ Displays information about all users in the current system, including user-defin
|
||||||
## SHOW CLUSTER VARIABLES (before version 3.0.1.6 it was SHOW VARIABLES)
|
## SHOW CLUSTER VARIABLES (before version 3.0.1.6 it was SHOW VARIABLES)
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SHOW CLUSTER VARIABLES;
|
SHOW CLUSTER VARIABLES [like pattern];
|
||||||
SHOW DNODE dnode_id VARIABLES;
|
SHOW DNODE dnode_id VARIABLES [like pattern];
|
||||||
```
|
```
|
||||||
|
|
||||||
Displays the runtime values of configuration parameters that need to be the same across nodes in the current system, or you can specify a DNODE to view its configuration parameters.
|
Displays the runtime values of configuration parameters that need to be the same across nodes in the current system, or you can specify a DNODE to view its configuration parameters. And you can use the like pattern to filter by name.
|
||||||
|
|
||||||
## SHOW VGROUPS
|
## SHOW VGROUPS
|
||||||
|
|
||||||
|
|
|
@ -510,7 +510,6 @@ For the OpenTSDB text protocol, the parsing of timestamps follows its official p
|
||||||
- tmq: [Input] Points to a valid ws_tmq_t structure pointer, which represents a TMQ consumer object.
|
- tmq: [Input] Points to a valid ws_tmq_t structure pointer, which represents a TMQ consumer object.
|
||||||
- timeout: [Input] Polling timeout in milliseconds, a negative number indicates a default timeout of 1 second.
|
- timeout: [Input] Polling timeout in milliseconds, a negative number indicates a default timeout of 1 second.
|
||||||
- **Return Value**: Non-`NULL`: Success, returns a pointer to a WS_RES structure, which contains the received message. `NULL`: indicates no data, the error code can be obtained through ws_errno (NULL), please refer to the reference manual for specific error message. WS_RES results are consistent with taos_query results, and information in WS_RES can be obtained through various query interfaces, such as schema, etc.
|
- **Return Value**: Non-`NULL`: Success, returns a pointer to a WS_RES structure, which contains the received message. `NULL`: indicates no data, the error code can be obtained through ws_errno (NULL), please refer to the reference manual for specific error message. WS_RES results are consistent with taos_query results, and information in WS_RES can be obtained through various query interfaces, such as schema, etc.
|
||||||
|
|
||||||
- `int32_t ws_tmq_consumer_close(ws_tmq_t *tmq)`
|
- `int32_t ws_tmq_consumer_close(ws_tmq_t *tmq)`
|
||||||
- **Interface Description**: Used to close the ws_tmq_t structure. Must be used in conjunction with ws_tmq_consumer_new.
|
- **Interface Description**: Used to close the ws_tmq_t structure. Must be used in conjunction with ws_tmq_consumer_new.
|
||||||
- tmq: [Input] Points to a valid ws_tmq_t structure pointer, which represents a TMQ consumer object.
|
- tmq: [Input] Points to a valid ws_tmq_t structure pointer, which represents a TMQ consumer object.
|
||||||
|
|
|
@ -458,6 +458,12 @@ This document details the server error codes that may be encountered when using
|
||||||
| 0x80002665 | The _TAGS pseudocolumn can only be used for subtable and supertable queries | Illegal tag column query | Check and correct the SQL statement |
|
| 0x80002665 | The _TAGS pseudocolumn can only be used for subtable and supertable queries | Illegal tag column query | Check and correct the SQL statement |
|
||||||
| 0x80002666 | Subquery does not output primary timestamp column | Check and correct the SQL statement | |
|
| 0x80002666 | Subquery does not output primary timestamp column | Check and correct the SQL statement | |
|
||||||
| 0x80002667 | Invalid usage of expr: %s | Illegal expression | Check and correct the SQL statement |
|
| 0x80002667 | Invalid usage of expr: %s | Illegal expression | Check and correct the SQL statement |
|
||||||
|
| 0x80002687 | True_for duration cannot be negative | Use negative value as true_for duration | Check and correct the SQL statement |
|
||||||
|
| 0x80002688 | Cannot use 'year' or 'month' as true_for duration | Use year or month as true_for_duration | Check and correct the SQL statement |
|
||||||
|
| 0x80002689 | Invalid using cols function | Illegal using cols function | Check and correct the SQL statement |
|
||||||
|
| 0x8000268A | Cols function's first param must be a select function that output a single row | The first parameter of the cols function should be a selection function | Check and correct the SQL statement |
|
||||||
|
| 0x8000268B | Invalid using cols function with multiple output columns | Illegal using the cols function for multiple column output | Check and correct the SQL statement |
|
||||||
|
| 0x8000268C | Invalid using alias for cols function | Illegal cols function alias | Check and correct the SQL statement |
|
||||||
| 0x800026FF | Parser internal error | Internal error in parser | Preserve the scene and logs, report issue on GitHub |
|
| 0x800026FF | Parser internal error | Internal error in parser | Preserve the scene and logs, report issue on GitHub |
|
||||||
| 0x80002700 | Planner internal error | Internal error in planner | Preserve the scene and logs, report issue on GitHub |
|
| 0x80002700 | Planner internal error | Internal error in planner | Preserve the scene and logs, report issue on GitHub |
|
||||||
| 0x80002701 | Expect ts equal | JOIN condition validation failed | Preserve the scene and logs, report issue on GitHub |
|
| 0x80002701 | Expect ts equal | JOIN condition validation failed | Preserve the scene and logs, report issue on GitHub |
|
||||||
|
@ -479,10 +485,10 @@ This document details the server error codes that may be encountered when using
|
||||||
| Error Code | Description | Possible Scenarios or Reasons | Recommended Actions |
|
| Error Code | Description | Possible Scenarios or Reasons | Recommended Actions |
|
||||||
| ---------- | ---------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
| ---------- | ---------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||||
| 0x80002901 | udf is stopping | udf call received when dnode exits | Stop executing udf queries |
|
| 0x80002901 | udf is stopping | udf call received when dnode exits | Stop executing udf queries |
|
||||||
| 0x80002902 | udf pipe read error | Error occurred when taosd reads from udfd pipe | udfd unexpectedly exits, 1) C udf crash 2) udfd crash |
|
| 0x80002902 | udf pipe read error | Error occurred when taosd reads from taosudf pipe | taosudf unexpectedly exits, 1) C udf crash 2) taosudf crash |
|
||||||
| 0x80002903 | udf pipe connect error | Error establishing pipe connection to udfd in taosd | 1) Corresponding udfd not started in taosd. Restart taosd |
|
| 0x80002903 | udf pipe connect error | Error establishing pipe connection to taosudf in taosd | 1) Corresponding taosudf not started in taosd. Restart taosd |
|
||||||
| 0x80002904 | udf pipe not exist | Connection error occurs between two phases of udf setup, call, and teardown, causing the connection to disappear, subsequent phases continue | udfd unexpectedly exits, 1) C udf crash 2) udfd crash |
|
| 0x80002904 | udf pipe not exist | Connection error occurs between two phases of udf setup, call, and teardown, causing the connection to disappear, subsequent phases continue | taosudf unexpectedly exits, 1) C udf crash 2) taosudf crash |
|
||||||
| 0x80002905 | udf load failure | Error loading udf in udfd | 1) udf does not exist in mnode 2) Error in udf loading. Check logs |
|
| 0x80002905 | udf load failure | Error loading udf in taosudf | 1) udf does not exist in mnode 2) Error in udf loading. Check logs |
|
||||||
| 0x80002906 | udf invalid function input | udf input check | udf function does not accept input, such as wrong column type |
|
| 0x80002906 | udf invalid function input | udf input check | udf function does not accept input, such as wrong column type |
|
||||||
| 0x80002907 | udf invalid bufsize | Intermediate result in udf aggregation function exceeds specified bufsize | Increase bufsize, or reduce intermediate result size |
|
| 0x80002907 | udf invalid bufsize | Intermediate result in udf aggregation function exceeds specified bufsize | Increase bufsize, or reduce intermediate result size |
|
||||||
| 0x80002908 | udf invalid output type | udf output type differs from the type specified when creating udf | Modify udf, or the type when creating udf, to match the result |
|
| 0x80002908 | udf invalid output type | udf output type differs from the type specified when creating udf | Modify udf, or the type when creating udf, to match the result |
|
||||||
|
@ -531,8 +537,11 @@ This document details the server error codes that may be encountered when using
|
||||||
|
|
||||||
| Error Code | Description | Possible Error Scenarios or Reasons | Recommended Actions for Users |
|
| Error Code | Description | Possible Error Scenarios or Reasons | Recommended Actions for Users |
|
||||||
| ---------- | --------------------- | ------------------------------------------------------------ | -------------------------------------------- |
|
| ---------- | --------------------- | ------------------------------------------------------------ | -------------------------------------------- |
|
||||||
|
| 0x800003E6 | Consumer not exist | Consumer timeout offline | rebuild consumer to subscribe data again |
|
||||||
|
| 0x800003EA | Consumer not ready | Consumer rebalancing | retry after 2s |
|
||||||
| 0x80004000 | Invalid message | The subscribed data is illegal, generally does not occur | Check the client-side error logs for details |
|
| 0x80004000 | Invalid message | The subscribed data is illegal, generally does not occur | Check the client-side error logs for details |
|
||||||
| 0x80004001 | Consumer mismatch | The vnode requested for subscription and the reassigned vnode are inconsistent, usually occurs when new consumers join the same consumer group | Internal error, not exposed to users |
|
| 0x80004001 | Consumer mismatch | The vnode requested for subscription and the reassigned vnode are inconsistent, usually occurs when new consumers join the same consumer group | Internal error |
|
||||||
| 0x80004002 | Consumer closed | The consumer no longer exists | Check if it has already been closed |
|
| 0x80004002 | Consumer closed | The consumer no longer exists | Check if it has already been closed |
|
||||||
| 0x80004017 | Invalid status, please subscribe topic first | tmq status invalidate | Without calling subscribe, directly poll data |
|
| 0x80004017 | Invalid status, please subscribe topic first | tmq status invalidate | Without calling subscribe, directly poll data |
|
||||||
| 0x80004100 | Stream task not exist | The stream computing task does not exist | Check the server-side error logs |
|
| 0x80004100 | Stream task not exist | The stream computing task does not exist | Check the server-side error logs |
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 103 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 95 KiB |
|
@ -58,12 +58,13 @@ static int DemoInsertData() {
|
||||||
taos_cleanup();
|
taos_cleanup();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
taos_free_result(result);
|
|
||||||
|
|
||||||
// you can check affectedRows here
|
// you can check affectedRows here
|
||||||
int rows = taos_affected_rows(result);
|
int rows = taos_affected_rows(result);
|
||||||
fprintf(stdout, "Successfully inserted %d rows into power.meters.\n", rows);
|
fprintf(stdout, "Successfully inserted %d rows into power.meters.\n", rows);
|
||||||
|
|
||||||
|
taos_free_result(result);
|
||||||
|
|
||||||
// close & clean
|
// close & clean
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
taos_cleanup();
|
taos_cleanup();
|
||||||
|
|
|
@ -140,17 +140,16 @@ Query OK, 10 row(s) in set (2.415961s)
|
||||||
|
|
||||||
在 TDengine 中,你可以使用窗口子句来实现按时间窗口切分方式进行聚合结果查询,这种查询方式特别适用于需要对大量时间序列数据进行分析的场景,例如智能电表每 10s 采集一次数据,但需要查询每隔 1min 的温度平均值。
|
在 TDengine 中,你可以使用窗口子句来实现按时间窗口切分方式进行聚合结果查询,这种查询方式特别适用于需要对大量时间序列数据进行分析的场景,例如智能电表每 10s 采集一次数据,但需要查询每隔 1min 的温度平均值。
|
||||||
|
|
||||||
窗口子句允许你针对查询的数据集合按照窗口进行切分,并对每个窗口内的数据进行聚合,包含:
|
窗口子句允许你针对查询的数据集合按照窗口进行切分,并对每个窗口内的数据进行聚合。窗口划分逻辑如下图所示。
|
||||||
- 时间窗口(time window)
|
|
||||||
- 状态窗口(status window)
|
|
||||||
- 会话窗口(session window)
|
|
||||||
- 事件窗口(event window)
|
|
||||||
- 计数窗口(count window)
|
|
||||||
|
|
||||||
窗口划分逻辑如下图所示:
|
|
||||||
|
|
||||||
<img src={win} width="500" alt="常用窗口划分逻辑" />
|
<img src={win} width="500" alt="常用窗口划分逻辑" />
|
||||||
|
|
||||||
|
- 时间窗口(time window):根据时间间隔划分数据,支持滑动时间窗口和翻转时间窗口,适用于按固定时间周期进行数据聚合。
|
||||||
|
- 状态窗口(status window):基于设备状态值的变化划分窗口,相同状态值的数据归为一个窗口,状态值改变时窗口关闭。
|
||||||
|
- 会话窗口(session window):根据记录的时间戳差异划分会话,时间戳间隔小于预设值的记录属于同一会话。
|
||||||
|
- 事件窗口(event window):基于事件的开始条件和结束条件动态划分窗口,满足开始条件时窗口开启,满足结束条件时窗口关闭。
|
||||||
|
- 计数窗口(count window):根据数据行数划分窗口,每达到指定行数即为一个窗口,并进行聚合计算。
|
||||||
|
|
||||||
窗口子句语法如下:
|
窗口子句语法如下:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
|
|
|
@ -65,6 +65,8 @@ TDengine 可以通过 MQTT 连接器从 MQTT 代理订阅数据并将其写入 T
|
||||||
|
|
||||||
在 **订阅主题及 QoS 配置** 中填写要消费的 Topic 名称和 QoS。使用如下格式设置: `{topic_name}::{qos}`(如:`my_topic::0`)。MQTT 协议 5.0 支持共享订阅,可以通过多个客户端订阅同一个 Topic 实现负载均衡,使用如下格式: `$share/{group_name}/{topic_name}::{qos}`,其中,`$share` 是固定前缀,表示启用共享订阅,`group_name` 是分组名称,类似 kafka 的消费者组。
|
在 **订阅主题及 QoS 配置** 中填写要消费的 Topic 名称和 QoS。使用如下格式设置: `{topic_name}::{qos}`(如:`my_topic::0`)。MQTT 协议 5.0 支持共享订阅,可以通过多个客户端订阅同一个 Topic 实现负载均衡,使用如下格式: `$share/{group_name}/{topic_name}::{qos}`,其中,`$share` 是固定前缀,表示启用共享订阅,`group_name` 是分组名称,类似 kafka 的消费者组。
|
||||||
|
|
||||||
|
在 **主题解析** 中填写 MQTT 主题解析规则,格式与 MQTT Topic 相同,将 MQTT Topic 各层级内容解析为对应变量名,`_` 表示解析时忽略当前层级。例如:MQTT Topic `a/+/c` 对应解析规则如果设置为 `v1/v2/_`,代表将第一层级的 `a` 赋值给变量 `v1`,第二层级的值(这里通配符 `+` 代表任意值)复制给变量 `v2`,第三层级的值 `c` 忽略,不会赋值给任何变量。在下方的 `payload 解析` 中,Topic 解析得到的变量同样可以参与各种转换和计算。
|
||||||
|
|
||||||
在 **数据压缩** 中,配置消息体压缩算法,taosX 在接收到消息后,使用对应的压缩算法对消息体进行解压缩获取原始数据。可选项 none(不压缩), gzip, snappy, lz4 和 zstd,默认为 none。
|
在 **数据压缩** 中,配置消息体压缩算法,taosX 在接收到消息后,使用对应的压缩算法对消息体进行解压缩获取原始数据。可选项 none(不压缩), gzip, snappy, lz4 和 zstd,默认为 none。
|
||||||
|
|
||||||
在 **字符编码** 中,配置消息体编码格式,taosX 在接收到消息后,使用对应的编码格式对消息体进行解码获取原始数据。可选项 UTF_8, GBK, GB18030, BIG5,默认为 UTF_8
|
在 **字符编码** 中,配置消息体编码格式,taosX 在接收到消息后,使用对应的编码格式对消息体进行解码获取原始数据。可选项 UTF_8, GBK, GB18030, BIG5,默认为 UTF_8
|
||||||
|
@ -138,7 +140,11 @@ json 数据支持 JSONObject 或者 JSONArray,使用 json 解析器可以解
|
||||||
|
|
||||||
#### 6.4 表映射
|
#### 6.4 表映射
|
||||||
|
|
||||||
在 **目标超级表** 的下拉列表中选择一个目标超级表,也可以先点击右侧的 **创建超级表** 按钮
|
在 **目标超级表** 的下拉列表中选择一个目标超级表,也可以先点击右侧的 **创建超级表** 按钮创建新的超级表。
|
||||||
|
|
||||||
|
当超级表需要根据消息动态生成时,可以选择 **创建模板**。其中,超级表名称,列名,列类型等均可以使用模板变量,当接收到数据后,程序会自动计算模板变量并生成对应的超级表模板,当数据库中超级表不存在时,会使用此模板创建超级表;对于已创建的超级表,如果缺少通过模板变量计算得到的列,也会自动创建对应列。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
在 **映射** 中,填写目标超级表中的子表名称,例如:`t_{id}`。根据需求填写映射规则,其中 mapping 支持设置缺省值。
|
在 **映射** 中,填写目标超级表中的子表名称,例如:`t_{id}`。根据需求填写映射规则,其中 mapping 支持设置缺省值。
|
||||||
|
|
||||||
|
@ -148,6 +154,16 @@ json 数据支持 JSONObject 或者 JSONArray,使用 json 解析器可以解
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
如果超级表列为模板变量,在子表映射时会进行 pivot 操作,其中模板变量的值展开为列名,列的值为对应的映射列
|
||||||
|
|
||||||
|
例如:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
预览结果为:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### 7. 高级选项
|
### 7. 高级选项
|
||||||
|
|
||||||
在 **消息等待队列大小** 中填写接收 MQTT 消息的缓存队列大小,当队列满时,新到达的数据会直接丢弃。可设置为 0,即不缓存。
|
在 **消息等待队列大小** 中填写接收 MQTT 消息的缓存队列大小,当队列满时,新到达的数据会直接丢弃。可设置为 0,即不缓存。
|
||||||
|
|
|
@ -152,7 +152,11 @@ let v3 = data["voltage"].split(",");
|
||||||
|
|
||||||
使用 json 规则解析出的电压是字符串表达的带单位形式,最终入库希望能使用 int 类型记录电压值和电流值,便于统计分析,此时就需要对电压进一步拆分;另外日期期望拆分为日期和时间入库。
|
使用 json 规则解析出的电压是字符串表达的带单位形式,最终入库希望能使用 int 类型记录电压值和电流值,便于统计分析,此时就需要对电压进一步拆分;另外日期期望拆分为日期和时间入库。
|
||||||
|
|
||||||
如下图所示可以对源字段`ts`使用 split 规则拆分成日期和时间,对字段`voltage`使用 regex 提取出电压值和电压单位。split 规则需要设置**分隔符**和**拆分数量**,拆分后的字段命名规则为`{原字段名}_{顺序号}`,Regex 规则同解析过程中的一样,使用**命名捕获组**命名提取字段。
|
如下图所示
|
||||||
|
|
||||||
|
* 对字段 `ts` 使用 split 规则拆分成日期和时间。split 规则需要设置 **分隔符** 和 **拆分数量**,拆分后的字段命名规则为 `{原字段名}_{顺序号}`。
|
||||||
|
* 对字段 `voltage` 使用正则表达式 `^(?<voltage>[0-9]+)(?<voltage_unit>[a-zA-Z]+)$` 提取出电压值和电压单位,Regex 规则同解析过程中的一样,使用 **命名捕获组** 命名提取字段。
|
||||||
|
* 对字段 `location` 使用 convert 转换,填写一个 JSON map 对象,其中 key 为字段 `current` 的值,`value` 为转换后的值。如图,`location` 字段的值 `"beijing.chaoyang.datun"` 被转换为 `"beijing.chaoyang.datunludong"`。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 170 KiB |
|
@ -141,5 +141,5 @@ gen_figure = true
|
||||||
|
|
||||||
如果设置了 `gen_figure` 为 true,分析结果中还会有绘制的分析预测结果图(如下图所示)。
|
如果设置了 `gen_figure` 为 true,分析结果中还会有绘制的分析预测结果图(如下图所示)。
|
||||||
|
|
||||||
<img src={fc_result_figure} width="760" alt="预测对比结果" />
|
<img src={fc_result_figure} width="540" alt="预测对比结果" />
|
||||||
|
|
||||||
|
|
|
@ -102,5 +102,5 @@ lof={"algo":"auto", "n_neighbor": 3}
|
||||||
|
|
||||||
如果设置了 `gen_figure` 为 `true`,比较程序会自动将每个参与比较的算法分析结果采用图片方式呈现出来(如下图所示为 ksigma 的异常检测结果标注)。
|
如果设置了 `gen_figure` 为 `true`,比较程序会自动将每个参与比较的算法分析结果采用图片方式呈现出来(如下图所示为 ksigma 的异常检测结果标注)。
|
||||||
|
|
||||||
<img src={ad_result_figure} width="760" alt="异常检测标注图" />
|
<img src={ad_result_figure} width="540" alt="异常检测标注图" />
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ TDengine 消费者的概念跟 Kafka 类似,消费者通过订阅主题来接
|
||||||
#### msg.with.table.name
|
#### msg.with.table.name
|
||||||
- 说明:是否允许从消息中解析表名
|
- 说明:是否允许从消息中解析表名
|
||||||
- 类型:boolean
|
- 类型:boolean
|
||||||
- 备注:不适用于列订阅(列订阅时可将 tbname 作为列写入 subquery 语句),默认关闭。从 3.2.0.0 版本该参数废弃。
|
- 备注:不适用于列订阅(列订阅时可将 tbname 作为列写入 subquery 语句),默认关闭。v3.2.0.0 该参数废弃。
|
||||||
|
|
||||||
#### enable.replay
|
#### enable.replay
|
||||||
- 说明:是否开启数据回放功能
|
- 说明:是否开启数据回放功能
|
||||||
|
@ -83,12 +83,27 @@ TDengine 消费者的概念跟 Kafka 类似,消费者通过订阅主题来接
|
||||||
#### session.timeout.ms
|
#### session.timeout.ms
|
||||||
- 说明:consumer 心跳丢失后超时时间
|
- 说明:consumer 心跳丢失后超时时间
|
||||||
- 类型:integer
|
- 类型:integer
|
||||||
- 备注:超时后会触发 rebalance 逻辑,成功后该 consumer 会被删除(从 3.3.3.0 版本开始支持)。默认值为 12000,取值范围 [6000,1800000]。
|
- 备注:超时后会触发 rebalance 逻辑,成功后该 consumer 会被删除。默认值为 12000,取值范围 [6000,1800000]。v3.3.3.0 开始支持)
|
||||||
|
|
||||||
#### max.poll.interval.ms
|
#### max.poll.interval.ms
|
||||||
- 说明:consumer poll 拉取数据间隔的最长时间
|
- 说明:consumer poll 拉取数据间隔的最长时间
|
||||||
- 类型:integer
|
- 类型:integer
|
||||||
- 备注:超过该时间,会认为该 consumer 离线,触发 rebalance 逻辑,成功后该 consumer 会被删除(从 3.3.3.0 版本开始支持)。默认值为 300000,[1000,INT32_MAX] 。
|
- 备注:超过该时间,会认为该 consumer 离线,触发 rebalance 逻辑,成功后该 consumer 会被删除。默认值为 300000,[1000,INT32_MAX]。v3.3.3.0 开始支持。
|
||||||
|
|
||||||
|
#### fetch.max.wait.ms
|
||||||
|
- 说明:服务端单次返回数据的最大耗时
|
||||||
|
- 类型:integer
|
||||||
|
- 备注:默认值为 1000,[1,INT32_MAX]。v3.3.6.0 开始支持。
|
||||||
|
|
||||||
|
#### min.poll.rows
|
||||||
|
- 说明:服务端单次返回数据的最小条数
|
||||||
|
- 类型:integer
|
||||||
|
- 备注:默认值为 4096,[1,INT32_MAX]。v3.3.6.0 开始支持。
|
||||||
|
|
||||||
|
#### msg.consume.rawdata
|
||||||
|
- 说明:消费数据时拉取数据类型为二进制类型,不可做解析操作 `内部参数,只用于 taosX 数据迁移`
|
||||||
|
- 类型:integer
|
||||||
|
- 备注:默认值为 0 表示不起效,非 0 为起效。v3.3.6.0 开始支持。
|
||||||
|
|
||||||
下面是各语言连接器创建参数:
|
下面是各语言连接器创建参数:
|
||||||
<Tabs defaultValue="java" groupId="lang">
|
<Tabs defaultValue="java" groupId="lang">
|
||||||
|
|
|
@ -472,10 +472,10 @@ taos> select myfun(v1, v2) from t;
|
||||||
DB error: udf function execution failure (0.011088s)
|
DB error: udf function execution failure (0.011088s)
|
||||||
```
|
```
|
||||||
|
|
||||||
不幸的是执行失败了,什么原因呢?查看 udfd 进程的日志。
|
不幸的是执行失败了,什么原因呢?查看 taosudf 进程的日志。
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
tail -10 /var/log/taos/udfd.log
|
tail -10 /var/log/taos/taosudf.log
|
||||||
```
|
```
|
||||||
|
|
||||||
发现以下错误信息。
|
发现以下错误信息。
|
||||||
|
|
|
@ -17,11 +17,11 @@ TDengine 面向多种写入场景,而很多写入场景下,TDengine 的存
|
||||||
### 语法
|
### 语法
|
||||||
|
|
||||||
```SQL
|
```SQL
|
||||||
compact DATABASE db_name [start with 'XXXX'] [end with 'YYYY'];
|
compact DATABASE db_name [start with 'XXXX'] [end with 'YYYY'] [META_ONLY];
|
||||||
compact [db_name.]vgroups IN (vgroup_id1, vgroup_id2, ...) [start with 'XXXX'] [end with 'YYYY'];
|
compact [db_name.]vgroups IN (vgroup_id1, vgroup_id2, ...) [start with 'XXXX'] [end with 'YYYY'] [META_ONLY];
|
||||||
show compacts;
|
show compacts;
|
||||||
show compact compact_id;
|
show compact compact_id;
|
||||||
kill compact compact_id;
|
kill compact compact_id;
|
||||||
```
|
```
|
||||||
|
|
||||||
### 效果
|
### 效果
|
||||||
|
@ -32,6 +32,7 @@ kill compact compact_id;
|
||||||
- compact 会合并多个 STT 文件
|
- compact 会合并多个 STT 文件
|
||||||
- 可通过 start with 关键字指定 compact 数据的起始时间
|
- 可通过 start with 关键字指定 compact 数据的起始时间
|
||||||
- 可通过 end with 关键字指定 compact 数据的终止时间
|
- 可通过 end with 关键字指定 compact 数据的终止时间
|
||||||
|
- 可通过 `META_ONLY` 关键字指定只 compact 元数据。元数据默认情况下不会 compact。
|
||||||
- compact 命令会返回 compact 任务的 ID
|
- compact 命令会返回 compact 任务的 ID
|
||||||
- compact 任务会在后台异步执行,可以通过 show compacts 命令查看 compact 任务的进度
|
- compact 任务会在后台异步执行,可以通过 show compacts 命令查看 compact 任务的进度
|
||||||
- show 命令会返回 compact 任务的 ID,可以通过 kill compact 命令终止 compact 任务
|
- show 命令会返回 compact 任务的 ID,可以通过 kill compact 命令终止 compact 任务
|
||||||
|
|
|
@ -127,7 +127,7 @@ s3migrate database <db_name>;
|
||||||
|
|
||||||
当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 512M 字节 (`s3_chunkpages * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上传到对象存储服务。
|
当 TSDB 时序数据超过 `s3_keeplocal` 参数指定的时间,相关的数据文件会被切分成多个文件块,每个文件块的默认大小是 512M 字节 (`s3_chunkpages * tsdb_pagesize`)。除了最后一个文件块保留在本地文件系统外,其余的文件块会被上传到对象存储服务。
|
||||||
|
|
||||||
```math
|
```text
|
||||||
上传次数 = 数据文件大小 / (s3_chunkpages * tsdb_pagesize) - 1
|
上传次数 = 数据文件大小 / (s3_chunkpages * tsdb_pagesize) - 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ s3migrate database <db_name>;
|
||||||
|
|
||||||
相邻的多个数据页会作为一个数据块从对象存储下载一次,以减少从对象存储下载的次数。每个数据页的大小,在创建数据库时,通过 `tsdb_pagesize` 参数指定,默认 4K 字节。
|
相邻的多个数据页会作为一个数据块从对象存储下载一次,以减少从对象存储下载的次数。每个数据页的大小,在创建数据库时,通过 `tsdb_pagesize` 参数指定,默认 4K 字节。
|
||||||
|
|
||||||
```math
|
```text
|
||||||
下载次数 = 查询需要的数据块数量 - 已缓存的数据块数量
|
下载次数 = 查询需要的数据块数量 - 已缓存的数据块数量
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,14 @@ create user user_name pass'password' [sysinfo {1|0}] [createdb {1|0}]
|
||||||
|
|
||||||
相关参数说明如下。
|
相关参数说明如下。
|
||||||
- user_name:用户名最长不超过 23 个字节。
|
- user_name:用户名最长不超过 23 个字节。
|
||||||
- password:密码长度必须为 8 到 16 位,并且至少包含大写字母、小写字母、数字、特殊字符中的三类。特殊字符包括 `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? | ~ , .`。(始自 3.3.5.0 版本)
|
- password:密码长度必须为 8 到 255 个字节。密码至少包含大写字母、小写字母、数字、特殊字符中的三类。特殊字符包括 `! @ # $ % ^ & * ( ) - _ + = [ ] { } : ; > < ? | ~ , .`(始自 v3.3.5.0),可以通过在 taos.cfg 中添加参数 `enableStrongPassword 0` 关闭此强制要求,或者通过如下 SQL 关闭(始自 v3.3.6.0)。
|
||||||
|
```sql
|
||||||
|
alter all dnode 'EnableStrongPassword' '0'
|
||||||
|
```
|
||||||
- sysinfo:用户是否可以查看系统信息。1 表示可以查看,0 表示不可以查看。系统信息包括服务端配置信息、服务端各种节点信息,如 dnode、查询节点(qnode)等,以及与存储相关的信息等。默认为可以查看系统信息。
|
- sysinfo:用户是否可以查看系统信息。1 表示可以查看,0 表示不可以查看。系统信息包括服务端配置信息、服务端各种节点信息,如 dnode、查询节点(qnode)等,以及与存储相关的信息等。默认为可以查看系统信息。
|
||||||
- createdb:用户是否可以创建数据库。1 表示可以创建,0 表示不可以创建。缺省值为 0。// 从 TDengine 企业版 3.3.2.0 开始支持
|
- createdb:用户是否可以创建数据库。1 表示可以创建,0 表示不可以创建。缺省值为 0。从企业版 v3.3.2.0 开始支持。
|
||||||
|
|
||||||
如下 SQL 可以创建密码为 abc123!@# 且可以查看系统信息的用户 test。
|
如下 SQL 可以创建密码为 `abc123!@#` 且可以查看系统信息的用户 test。
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
create user test pass 'abc123!@#' sysinfo 1
|
create user test pass 'abc123!@#' sysinfo 1
|
||||||
|
@ -56,7 +59,7 @@ alter_user_clause: {
|
||||||
- pass:修改用户密码。
|
- pass:修改用户密码。
|
||||||
- enable:是否启用用户。1 表示启用此用户,0 表示禁用此用户。
|
- enable:是否启用用户。1 表示启用此用户,0 表示禁用此用户。
|
||||||
- sysinfo:用户是否可查看系统信息。1 表示可以查看系统信息,0 表示不可以查看系统信息
|
- sysinfo:用户是否可查看系统信息。1 表示可以查看系统信息,0 表示不可以查看系统信息
|
||||||
- createdb:用户是否可创建数据库。1 表示可以创建数据库,0 表示不可以创建数据库。从 TDengine 企业版 3.3.2.0 开始支持。
|
- createdb:用户是否可创建数据库。1 表示可以创建数据库,0 表示不可以创建数据库。从企业版 v3.3.2.0 开始支持。
|
||||||
|
|
||||||
如下 SQL 禁用 test 用户。
|
如下 SQL 禁用 test 用户。
|
||||||
```sql
|
```sql
|
||||||
|
|
|
@ -69,9 +69,13 @@ alter database <dbname> replica 2|1
|
||||||
| ------- | ------ |
|
| ------- | ------ |
|
||||||
| 没有 Vnode 发生故障:Arbitrator 故障(Mnode 宕机节点超过一个,导致 Mnode 无法选主)| **持续提供服务** |
|
| 没有 Vnode 发生故障:Arbitrator 故障(Mnode 宕机节点超过一个,导致 Mnode 无法选主)| **持续提供服务** |
|
||||||
| 仅一个 Vnode 故障:VGroup 已经达成同步后,某一个 Vnode 才发生故障的 | **持续提供服务** |
|
| 仅一个 Vnode 故障:VGroup 已经达成同步后,某一个 Vnode 才发生故障的 | **持续提供服务** |
|
||||||
|
| 仅一个 Vnode 故障:2 个 Vnode 同时故障,故障前 VGroup 达成同步,但是只有一个 Vnode 从故障中恢复服务,另一个 Vnode 服务故障 | **通过下面的命令,强制指定 leader, 继续提供服务** |
|
||||||
| 仅一个 Vnode 故障:离线 Vnode 启动后,VGroup 未达成同步前,另一个 Vnode 服务故障的 | **无法提供服务** |
|
| 仅一个 Vnode 故障:离线 Vnode 启动后,VGroup 未达成同步前,另一个 Vnode 服务故障的 | **无法提供服务** |
|
||||||
| 两个 Vnode 都发生故障 | **无法提供服务** |
|
| 两个 Vnode 都发生故障 | **无法提供服务** |
|
||||||
|
|
||||||
|
```sql
|
||||||
|
ASSIGN LEADER FORCE;
|
||||||
|
```
|
||||||
|
|
||||||
## 常见问题
|
## 常见问题
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,12 @@ taosx replica start -f source_endpoint -t sink_endpoint [database...]
|
||||||
taosx replica start -f td1:6030 -t td2:6030
|
taosx replica start -f td1:6030 -t td2:6030
|
||||||
```
|
```
|
||||||
|
|
||||||
该示例命令会自动创建除 information_schema、performance_schema、log、audit 库之外的同步任务。可以使用 `http://td2:6041` 指定该 endpoint 使用 websocket 接口(默认是原生接口)。也可以指定数据库同步:taosx replica start -f td1:6030 -t td2:6030 db1 仅创建指定的数据库同步任务。
|
该示例命令会自动创建除 information_schema、performance_schema、log、audit 库之外的同步任务,并持续监听新增的数据库,当 td1 和 td2 中新增同名数据库时可自动启动新增数据库的数据复制任务。需要说明的是:
|
||||||
|
|
||||||
|
- 可以使用 `http://td2:6041` 指定该 endpoint 使用 websocket 接口(默认是原生接口)。
|
||||||
|
- 可以使用 `--new-database-checking-interval <SECONDS>` 指定新增数据库的检查间隔,默认为 30 分钟。
|
||||||
|
- 可以使用 `--no-new-databases` 禁用监听行为。
|
||||||
|
- 也可以指定数据库同步:taosx replica start -f td1:6030 -t td2:6030 db1 仅创建指定的数据库同步任务。此时相当于配置了 `--no-new-databases`,不会开启新增数据库自动同步。
|
||||||
|
|
||||||
2. 方法二
|
2. 方法二
|
||||||
|
|
||||||
|
@ -121,6 +126,7 @@ taosx replica stop id [db...]
|
||||||
该命令作用如下:
|
该命令作用如下:
|
||||||
1. 停止指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
1. 停止指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||||
2. 使用 `taosx replica stop id1 db1` 表示停止 id1 replica 下 db1的同步任务。
|
2. 使用 `taosx replica stop id1 db1` 表示停止 id1 replica 下 db1的同步任务。
|
||||||
|
3. `--no-new-databases` 选项启用时,不停止新增数据库监听任务,仅停止当前同步中的数据库。
|
||||||
|
|
||||||
### 重启双活任务
|
### 重启双活任务
|
||||||
|
|
||||||
|
@ -145,7 +151,7 @@ taosx replica diff id [db....]
|
||||||
| replica | database | source | sink | vgroup_id | current | latest | diff |
|
| replica | database | source | sink | vgroup_id | current | latest | diff |
|
||||||
+---------+----------+----------+----------+-----------+---------+---------+------+
|
+---------+----------+----------+----------+-----------+---------+---------+------+
|
||||||
| a | opc | td1:6030 | td2:6030 | 2 | 17600 | 17600 | 0 |
|
| a | opc | td1:6030 | td2:6030 | 2 | 17600 | 17600 | 0 |
|
||||||
| ad | opc | td2:6030 | td2:6030 | 3 | 17600 | 17600 | 0 |
|
| a | opc | td2:6030 | td2:6030 | 3 | 17600 | 17600 | 0 |
|
||||||
```
|
```
|
||||||
|
|
||||||
### 删除双活任务
|
### 删除双活任务
|
||||||
|
@ -156,6 +162,16 @@ taosx replica remove id [--force]
|
||||||
|
|
||||||
删除当前所有双活同步任务。正常情况下要想删除同步任务,需要先 stop 该任务;但当 --force 启用时,会强制停止并清除任务。
|
删除当前所有双活同步任务。正常情况下要想删除同步任务,需要先 stop 该任务;但当 --force 启用时,会强制停止并清除任务。
|
||||||
|
|
||||||
|
`--no-new-databases` 选项启用时,不会删除新增数据库同步任务,仅删除当前数据库的同步任务。当 taosx 重启后,如果删除的数据库任务对应的数据库仍然存在,则会继续创建同步任务;不重启 taosx 或者不更新双活监听任务时,也不会再新建这些数据库的同步任务。
|
||||||
|
|
||||||
|
### 更新双活新增数据库检查间隔
|
||||||
|
|
||||||
|
```shell
|
||||||
|
taosx replica update id --new-database-checking-interval <SECONDS>
|
||||||
|
```
|
||||||
|
|
||||||
|
更新双活新增数据库的检查间隔,单位为秒。
|
||||||
|
|
||||||
### 推荐使用步骤
|
### 推荐使用步骤
|
||||||
|
|
||||||
1. 假定在机器 A 上运行,需要首先使用 taosx replica start 来配置 taosX,其输入参数是待同步的源端和目标端服务器地址 ,在完成配置后会自动启动同步服务和任务。此处假定 taosx 服务使用标准端口,同步任务使用原生连接。
|
1. 假定在机器 A 上运行,需要首先使用 taosx replica start 来配置 taosX,其输入参数是待同步的源端和目标端服务器地址 ,在完成配置后会自动启动同步服务和任务。此处假定 taosx 服务使用标准端口,同步任务使用原生连接。
|
||||||
|
|
|
@ -3,7 +3,7 @@ title: taosX-Agent 参考手册
|
||||||
sidebar_label: taosX-Agent
|
sidebar_label: taosX-Agent
|
||||||
---
|
---
|
||||||
|
|
||||||
本节讲述如何部署 `Agent` (for `taosX`)。使用之前需要安装 TDengine Enterprise 安装包之后,taosX-Agent 用于在部分数据接入场景,如 Pi, OPC UA, OPC DA 等对访问数据源有一定限制或者网络环境特殊的场景下,可以将 taosX-Agent 部署在靠近数据源的环境中甚至与数据源在相同的服务器上,由 taosX-Agent 负责从数据源读取数据并发送给 taosX。
|
本节讲述如何部署 `Agent` (for `taosX`)。使用之前需要安装 TDengine Enterprise 安装包之后,taosX-Agent 用于在部分数据接入场景,如 Pi、OPC UA、OPC DA 等对访问数据源有一定限制或者网络环境特殊的场景下,可以将 taosX-Agent 部署在靠近数据源的环境中甚至与数据源在相同的服务器上,由 taosX-Agent 负责从数据源读取数据并发送给 taosX。
|
||||||
|
|
||||||
## 配置
|
## 配置
|
||||||
|
|
||||||
|
@ -12,12 +12,14 @@ sidebar_label: taosX-Agent
|
||||||
- `endpoint`:必填,`taosX` 的 GRPC 服务地址。
|
- `endpoint`:必填,`taosX` 的 GRPC 服务地址。
|
||||||
- `token`:必填,在 `Explorer` 上创建 `Agent` 时,产生的 Token。
|
- `token`:必填,在 `Explorer` 上创建 `Agent` 时,产生的 Token。
|
||||||
- `instanceId`:当前 taosx-agent 服务的实例 ID,如果同一台机器上启动了多个 taosx-agent 实例,必须保证各个实例的实例 ID 互不相同。
|
- `instanceId`:当前 taosx-agent 服务的实例 ID,如果同一台机器上启动了多个 taosx-agent 实例,必须保证各个实例的实例 ID 互不相同。
|
||||||
- `compression`:非必填,可配置为 `true` 或 `false`, 默认为 `false`。配置为`true`, 则开启 `Agent` 和 `taosX` 通信数据压缩。
|
- `compression`:非必填,可配置为 `true` 或 `false`,默认为 `false`。配置为`true`,则开启 `Agent` 和 `taosX` 通信数据压缩。
|
||||||
- `in_memory_cache_capacity`:非必填,表示可在内存中缓存的最大消息批次数,可配置为大于 0 的整数。默认为 `64`。
|
- `in_memory_cache_capacity`:非必填,表示可在内存中缓存的最大消息批次数,可配置为大于 0 的整数。默认为 `64`。
|
||||||
- `log_level`:非必填,日志级别,默认为 `info`, 同 `taosX` 一样,支持 `error`,`warn`,`info`,`debug`,`trace` 五级。已弃用,请使用 `log.level` 代替。
|
- `client_port_range.min`:非必填,取值范围 `[49152-65535]`,默认为 `49152`,当 agent 向 taosx 创建 socket 连接时,socket 客户端会随机监听一个端口,此配置限制了端口范围的最小值。
|
||||||
|
- `client_port_range.max`:非必填,取值范围 `[49152-65535]`,默认为 `65535`,此配置限制了端口范围的最大值。
|
||||||
|
- `log_level`:非必填,日志级别,默认为 `info`,同 `taosX` 一样,支持 `error`、`warn`、`info`、`debug`、`trace` 五级。已弃用,请使用 `log.level` 代替。
|
||||||
- `log_keep_days`:非必填,日志保存天数,默认为 `30` 天。已弃用,请使用 `log.keepDays` 代替。
|
- `log_keep_days`:非必填,日志保存天数,默认为 `30` 天。已弃用,请使用 `log.keepDays` 代替。
|
||||||
- `log.path`:日志文件存放的目录。
|
- `log.path`:日志文件存放的目录。
|
||||||
- `log.level`:日志级别,可选值为 "error", "warn", "info", "debug", "trace"。
|
- `log.level`:日志级别,可选值为 "error"、"warn"、"info"、"debug"、"trace"。
|
||||||
- `log.compress`:日志文件滚动后的文件是否进行压缩。
|
- `log.compress`:日志文件滚动后的文件是否进行压缩。
|
||||||
- `log.rotationCount`:日志文件目录下最多保留的文件数,超出数量的旧文件被删除。
|
- `log.rotationCount`:日志文件目录下最多保留的文件数,超出数量的旧文件被删除。
|
||||||
- `log.rotationSize`:触发日志文件滚动的文件大小(单位为字节),当日志文件超出此大小后会生成一个新文件,新的日志会写入新文件。
|
- `log.rotationSize`:触发日志文件滚动的文件大小(单位为字节),当日志文件超出此大小后会生成一个新文件,新的日志会写入新文件。
|
||||||
|
@ -49,6 +51,15 @@ sidebar_label: taosX-Agent
|
||||||
#
|
#
|
||||||
#in_memory_cache_capacity = 64
|
#in_memory_cache_capacity = 64
|
||||||
|
|
||||||
|
[client_port_range]
|
||||||
|
# Minimum boundary of listening port of agent, can not less than 49152
|
||||||
|
#
|
||||||
|
# min = 49152
|
||||||
|
|
||||||
|
# Maximum boundary of listening port of agent, can not greater than 65535
|
||||||
|
#
|
||||||
|
# max = 65535
|
||||||
|
|
||||||
# log configuration
|
# log configuration
|
||||||
[log]
|
[log]
|
||||||
# All log files are stored in this directory
|
# All log files are stored in this directory
|
||||||
|
|
|
@ -25,7 +25,7 @@ taosBenchmark
|
||||||
```
|
```
|
||||||
|
|
||||||
在无参数运行时,taosBenchmark 默认连接 `/etc/taos/taos.cfg` 中指定的 TDengine 集群。
|
在无参数运行时,taosBenchmark 默认连接 `/etc/taos/taos.cfg` 中指定的 TDengine 集群。
|
||||||
连接成功后,会默认创建智能电表示例数据库 test,创建超级表 meters, 创建子表 1 万,每子写入数据 1 万条,若 test 库已存在,默认会先删再建。
|
连接成功后,会默认创建智能电表示例数据库 test,创建超级表 meters,创建子表 1 万,每子写入数据 1 万条,若 test 库已存在,默认会先删再建。
|
||||||
|
|
||||||
### 命令行模式
|
### 命令行模式
|
||||||
|
|
||||||
|
@ -65,15 +65,15 @@ taosBenchmark -f <json file>
|
||||||
| -S/--timestampstep \<stepLength> | 每个子表中插入数据的时间戳步长,单位是 ms,默认值是 1 |
|
| -S/--timestampstep \<stepLength> | 每个子表中插入数据的时间戳步长,单位是 ms,默认值是 1 |
|
||||||
| -n/--records \<recordNum> | 每个子表插入的记录数,默认值为 10000 |
|
| -n/--records \<recordNum> | 每个子表插入的记录数,默认值为 10000 |
|
||||||
| -d/--database \<dbName> | 所使用的数据库的名称,默认值为 test |
|
| -d/--database \<dbName> | 所使用的数据库的名称,默认值为 test |
|
||||||
| -b/--data-type \<colType> | 指定超级表普通列数据类型, 多个使用逗号分隔,默认值:"FLOAT,INT,FLOAT" 如:`taosBenchmark -b "FLOAT,BINARY(8),NCHAR(16)"`|
|
| -b/--data-type \<colType> | 指定超级表普通列数据类型,多个使用逗号分隔,默认值:"FLOAT,INT,FLOAT" 如:`taosBenchmark -b "FLOAT,BINARY(8),NCHAR(16)"`|
|
||||||
| -A/--tag-type \<tagType> | 指定超级表标签列数据类型,多个使用逗号分隔,默认值:"INT,BINARY(24)" 如:`taosBenchmark -A "INT,BINARY(8),NCHAR(8)"`|
|
| -A/--tag-type \<tagType> | 指定超级表标签列数据类型,多个使用逗号分隔,默认值:"INT,BINARY(24)" 如:`taosBenchmark -A "INT,BINARY(8),NCHAR(8)"`|
|
||||||
| -l/--columns \<colNum> | 超级表的数据列的总数量。如果同时设置了该参数和 `-b/--data-type`,则最后的结果列数为两者取大。如果本参数指定的数量大于 `-b/--data-type` 指定的列数,则未指定的列类型默认为 INT, 例如: `-l 5 -b float,double`, 那么最后的列为 `FLOAT,DOUBLE,INT,INT,INT`。如果 columns 指定的数量小于或等于 `-b/--data-type` 指定的列数,则结果为 `-b/--data-type` 指定的列和类型,例如:`-l 3 -b float,double,float,bigint`,那么最后的列为 `FLOAT,DOUBLE,FLOAT,BIGINT` |
|
| -l/--columns \<colNum> | 超级表的数据列的总数量。如果同时设置了该参数和 `-b/--data-type`,则最后的结果列数为两者取大。如果本参数指定的数量大于 `-b/--data-type` 指定的列数,则未指定的列类型默认为 INT,例如 `-l 5 -b float,double`,那么最后的列为 `FLOAT,DOUBLE,INT,INT,INT`。如果 columns 指定的数量小于或等于 `-b/--data-type` 指定的列数,则结果为 `-b/--data-type` 指定的列和类型,例如:`-l 3 -b float,double,float,bigint`,那么最后的列为 `FLOAT,DOUBLE,FLOAT,BIGINT` |
|
||||||
| -L/--partial-col-num \<colNum> | 指定某些列写入数据,其他列数据为 NULL。默认所有列都写入数据 |
|
| -L/--partial-col-num \<colNum> | 指定某些列写入数据,其他列数据为 NULL。默认所有列都写入数据 |
|
||||||
| -w/--binwidth \<length> | nchar 和 binary 类型的默认长度,默认值为 64 |
|
| -w/--binwidth \<length> | nchar 和 binary 类型的默认长度,默认值为 64 |
|
||||||
| -m/--table-prefix \<tablePrefix> | 子表名称的前缀,默认值为 "d" |
|
| -m/--table-prefix \<tablePrefix> | 子表名称的前缀,默认值为 "d" |
|
||||||
| -E/--escape-character | 开关参数,指定在超级表和子表名称中是否使用转义字符。默认值为不使用 |
|
| -E/--escape-character | 开关参数,指定在超级表和子表名称中是否使用转义字符。默认值为不使用 |
|
||||||
| -C/--chinese | 开关参数,指定 nchar 和 binary 是否使用 Unicode 中文字符。默认值为不使用 |
|
| -C/--chinese | 开关参数,指定 nchar 和 binary 是否使用 Unicode 中文字符。默认值为不使用 |
|
||||||
| -N/--normal-table | 开关参数,指定只创建普通表,不创建超级表。默认值为 false。仅当插入模式为 taosc, stmt, rest 模式下可以使用 |
|
| -N/--normal-table | 开关参数,指定只创建普通表,不创建超级表。默认值为 false。仅当插入模式为 taosc、stmt、rest 模式下可以使用 |
|
||||||
| -M/--random | 开关参数,插入数据为生成的随机值。默认值为 false。若配置此参数,则随机生成要插入的数据。对于数值类型的 标签列/数据列,其值为该类型取值范围内的随机值。对于 NCHAR 和 BINARY 类型的 标签列/数据列,其值为指定长度范围内的随机字符串 |
|
| -M/--random | 开关参数,插入数据为生成的随机值。默认值为 false。若配置此参数,则随机生成要插入的数据。对于数值类型的 标签列/数据列,其值为该类型取值范围内的随机值。对于 NCHAR 和 BINARY 类型的 标签列/数据列,其值为指定长度范围内的随机字符串 |
|
||||||
| -x/--aggr-func | 开关参数,指示插入后查询聚合函数。默认值为 false |
|
| -x/--aggr-func | 开关参数,指示插入后查询聚合函数。默认值为 false |
|
||||||
| -y/--answer-yes | 开关参数,要求用户在提示后确认才能继续 |默认值为 false 。
|
| -y/--answer-yes | 开关参数,要求用户在提示后确认才能继续 |默认值为 false 。
|
||||||
|
@ -93,14 +93,17 @@ taosBenchmark -f <json file>
|
||||||
|
|
||||||
本节所列参数适用于所有功能模式。
|
本节所列参数适用于所有功能模式。
|
||||||
|
|
||||||
- **filetype**:功能分类,可选值为 `insert`, `query` 和 `subscribe`。分别对应插入、查询和订阅功能。每个配置文件中只能指定其中之一。
|
- **filetype**:功能分类,可选值为 `insert`、`query`、`subscribe` 和 `csvfile`。分别对应插入、查询、订阅和生成 csv 文件功能。每个配置文件中只能指定其中之一。
|
||||||
|
|
||||||
- **cfgdir**:TDengine 客户端配置文件所在的目录,默认路径是 /etc/taos 。
|
- **cfgdir**:TDengine 客户端配置文件所在的目录,默认路径是 /etc/taos 。
|
||||||
|
|
||||||
|
- **output_dir**:指定输出文件的目录,当功能分类是 `csvfile` 时,指生成的 csv 文件的保存目录,默认值为 ./output/ 。
|
||||||
|
|
||||||
- **host**:指定要连接的 TDengine 服务端的 FQDN,默认值为 localhost 。
|
- **host**:指定要连接的 TDengine 服务端的 FQDN,默认值为 localhost 。
|
||||||
|
|
||||||
- **port**:要连接的 TDengine 服务器的端口号,默认值为 6030 。
|
- **port**:要连接的 TDengine 服务器的端口号,默认值为 6030 。
|
||||||
|
|
||||||
- **user**:用于连接 TDengine 服务端的用户名,默认为 root 。
|
- **user**:用于连接 TDengine 服务端的用户名,默认值为 root 。
|
||||||
|
|
||||||
- **password**:用于连接 TDengine 服务端的密码,默认值为 taosdata。
|
- **password**:用于连接 TDengine 服务端的密码,默认值为 taosdata。
|
||||||
|
|
||||||
|
@ -115,9 +118,9 @@ taosBenchmark -f <json file>
|
||||||
|
|
||||||
- **continue_if_fail**:允许用户定义失败后行为。
|
- **continue_if_fail**:允许用户定义失败后行为。
|
||||||
|
|
||||||
“continue_if_fail”:“no”, 失败 taosBenchmark 自动退出,默认行为。
|
“continue_if_fail”:“no”,失败 taosBenchmark 自动退出,默认行为。
|
||||||
“continue_if_fail”:“yes”, 失败 taosBenchmark 警告用户,并继续写入。
|
“continue_if_fail”:“yes”,失败 taosBenchmark 警告用户,并继续写入。
|
||||||
“continue_if_fail”:“smart”, 如果子表不存在失败,taosBenchmark 会建立子表并继续写入。
|
“continue_if_fail”:“smart”,如果子表不存在失败,taosBenchmark 会建立子表并继续写入。
|
||||||
|
|
||||||
#### 数据库相关
|
#### 数据库相关
|
||||||
|
|
||||||
|
@ -125,7 +128,7 @@ taosBenchmark -f <json file>
|
||||||
|
|
||||||
- **name**:数据库名。
|
- **name**:数据库名。
|
||||||
|
|
||||||
- **drop**:数据库已存在时是否删除,可选项为 "yes" 或 "no", 默认为 “yes” 。
|
- **drop**:数据库已存在时是否删除,可选项为 "yes" 或 "no",默认为 “yes” 。
|
||||||
|
|
||||||
#### 超级表相关
|
#### 超级表相关
|
||||||
|
|
||||||
|
@ -141,17 +144,17 @@ taosBenchmark -f <json file>
|
||||||
|
|
||||||
- **escape_character**:超级表和子表名称中是否包含转义字符,默认值为 "no",可选值为 "yes" 或 "no" 。
|
- **escape_character**:超级表和子表名称中是否包含转义字符,默认值为 "no",可选值为 "yes" 或 "no" 。
|
||||||
|
|
||||||
- **auto_create_table**:仅当 insert_mode 为 taosc, rest, stmt 并且 child_table_exists 为 "no" 时生效,该参数为 "yes" 表示 taosBenchmark 在插入数据时会自动创建不存在的表;为 "no" 则表示先提前建好所有表再进行插入。
|
- **auto_create_table**:仅当 insert_mode 为 taosc、rest、stmt 并且 child_table_exists 为 "no" 时生效,该参数为 "yes" 表示 taosBenchmark 在插入数据时会自动创建不存在的表;为 "no" 则表示先提前建好所有表再进行插入。
|
||||||
|
|
||||||
- **batch_create_tbl_num**:创建子表时每批次的建表数量,默认为 10。注:实际的批数不一定与该值相同,当执行的 SQL 语句大于支持的最大长度时,会自动截断再执行,继续创建。
|
- **batch_create_tbl_num**:创建子表时每批次的建表数量,默认为 10。注:实际的批数不一定与该值相同,当执行的 SQL 语句大于支持的最大长度时,会自动截断再执行,继续创建。
|
||||||
|
|
||||||
- **data_source**:数据的来源,默认为 taosBenchmark 随机产生,可以配置为 "rand" 和 "sample"。为 "sample" 时使用 sample_file 参数指定的文件内的数据。
|
- **data_source**:数据的来源,默认为 taosBenchmark 随机产生,可以配置为 "rand" 和 "sample"。为 "sample" 时使用 sample_file 参数指定的文件内的数据。
|
||||||
|
|
||||||
- **insert_mode**:插入模式,可选项有 taosc, rest, stmt, sml, sml-rest, 分别对应普通写入、restful 接口写入、参数绑定接口写入、schemaless 接口写入、restful schemaless 接口写入 (由 taosAdapter 提供)。默认值为 taosc 。
|
- **insert_mode**:插入模式,可选项有 taosc、rest、stmt、sml、sml-rest,分别对应普通写入、restful 接口写入、参数绑定接口写入、schemaless 接口写入、restful schemaless 接口写入 (由 taosAdapter 提供)。默认值为 taosc 。
|
||||||
|
|
||||||
- **non_stop_mode**:指定是否持续写入,若为 "yes" 则 insert_rows 失效,直到 Ctrl + C 停止程序,写入才会停止。默认值为 "no",即写入指定数量的记录后停止。注:即使在持续写入模式下 insert_rows 失效,但其也必须被配置为一个非零正整数。
|
- **non_stop_mode**:指定是否持续写入,若为 "yes" 则 insert_rows 失效,直到 Ctrl + C 停止程序,写入才会停止。默认值为 "no",即写入指定数量的记录后停止。注:即使在持续写入模式下 insert_rows 失效,但其也必须被配置为一个非零正整数。
|
||||||
|
|
||||||
- **line_protocol**:使用行协议插入数据,仅当 insert_mode 为 sml 或 sml-rest 时生效,可选项为 line, telnet, json 。
|
- **line_protocol**:使用行协议插入数据,仅当 insert_mode 为 sml 或 sml-rest 时生效,可选项为 line、telnet、json 。
|
||||||
|
|
||||||
- **tcp_transfer**:telnet 模式下的通信协议,仅当 insert_mode 为 sml-rest 并且 line_protocol 为 telnet 时生效。如果不配置,则默认为 http 协议。
|
- **tcp_transfer**:telnet 模式下的通信协议,仅当 insert_mode 为 sml-rest 并且 line_protocol 为 telnet 时生效。如果不配置,则默认为 http 协议。
|
||||||
|
|
||||||
|
@ -181,13 +184,37 @@ taosBenchmark -f <json file>
|
||||||
|
|
||||||
- **use_sample_ts**:仅当 data_source 为 sample 时生效,表示 sample_file 指定的 csv 文件内是否包含第一列时间戳,默认为 no。若设置为 yes,则使用 csv 文件第一列作为时间戳,由于同一子表时间戳不能重复,生成的数据量取决于 csv 文件内的数据行数相同,此时 insert_rows 失效。
|
- **use_sample_ts**:仅当 data_source 为 sample 时生效,表示 sample_file 指定的 csv 文件内是否包含第一列时间戳,默认为 no。若设置为 yes,则使用 csv 文件第一列作为时间戳,由于同一子表时间戳不能重复,生成的数据量取决于 csv 文件内的数据行数相同,此时 insert_rows 失效。
|
||||||
|
|
||||||
- **tags_file**:仅当 insert_mode 为 taosc, rest 的模式下生效。最终的 tag 的数值与 childtable_count 有关,如果 csv 文件内的 tag 数据行小于给定的子表数量,那么会循环读取 csv 文件数据直到生成 childtable_count 指定的子表数量;否则则只会读取 childtable_count 行 tag 数据。也即最终生成的子表数量为二者取小。
|
- **tags_file**:仅当 insert_mode 为 taosc,rest 的模式下生效。最终的 tag 的数值与 childtable_count 有关,如果 csv 文件内的 tag 数据行小于给定的子表数量,那么会循环读取 csv 文件数据直到生成 childtable_count 指定的子表数量;否则则只会读取 childtable_count 行 tag 数据。也即最终生成的子表数量为二者取小。
|
||||||
|
|
||||||
- **primary_key**:指定超级表是否有复合主键,取值 1 和 0,复合主键列只能是超级表的第二列,指定生成复合主键后要确保第二列符合复合主键的数据类型,否则会报错。
|
- **primary_key**:指定超级表是否有复合主键,取值 1 和 0,复合主键列只能是超级表的第二列,指定生成复合主键后要确保第二列符合复合主键的数据类型,否则会报错。
|
||||||
- **repeat_ts_min**:数值类型,复合主键开启情况下指定生成相同时间戳记录的最小个数,生成相同时间戳记录的个数是在范围[repeat_ts_min, repeat_ts_max] 内的随机值, 最小值等于最大值时为固定个数。
|
|
||||||
|
- **repeat_ts_min**:数值类型,复合主键开启情况下指定生成相同时间戳记录的最小个数,生成相同时间戳记录的个数是在范围[repeat_ts_min, repeat_ts_max] 内的随机值,最小值等于最大值时为固定个数。
|
||||||
|
|
||||||
- **repeat_ts_max**:数值类型,复合主键开启情况下指定生成相同时间戳记录的最大个数。
|
- **repeat_ts_max**:数值类型,复合主键开启情况下指定生成相同时间戳记录的最大个数。
|
||||||
|
|
||||||
- **sqls**:字符串数组类型,指定超级表创建成功后要执行的 sql 数组,sql 中指定表名前面要带数据库名,否则会报未指定数据库错误。
|
- **sqls**:字符串数组类型,指定超级表创建成功后要执行的 sql 数组,sql 中指定表名前面要带数据库名,否则会报未指定数据库错误。
|
||||||
|
|
||||||
|
- **csv_file_prefix**:字符串类型,设置生成的 csv 文件名称的前缀,默认值为 data 。
|
||||||
|
|
||||||
|
- **csv_ts_format**:字符串类型,设置生成的 csv 文件名称中时间字符串的格式,格式遵循 `strftime` 格式标准,如果没有设置表示不按照时间段切分文件。支持的模式有:
|
||||||
|
- %Y: 年份,四位数表示(例如:2025)
|
||||||
|
- %m: 月份,两位数表示(01到12)
|
||||||
|
- %d: 一个月中的日子,两位数表示(01到31)
|
||||||
|
- %H: 小时,24小时制,两位数表示(00到23)
|
||||||
|
- %M: 分钟,两位数表示(00到59)
|
||||||
|
- %S: 秒,两位数表示(00到59)
|
||||||
|
|
||||||
|
- **csv_ts_interval**:字符串类型,设置生成的 csv 文件名称中时间段间隔,支持天、小时、分钟、秒级间隔,如 1d/2h/30m/40s,默认值为 1d 。
|
||||||
|
|
||||||
|
- **csv_output_header**:字符串类型,设置生成的 csv 文件是否包含列头描述,默认值为 yes 。
|
||||||
|
|
||||||
|
- **csv_tbname_alias**:字符串类型,设置 csv 文件列头描述中 tbname 字段的别名,默认值为 device_id 。
|
||||||
|
|
||||||
|
- **csv_compress_level**:字符串类型,设置生成 csv 编码数据并自动压缩成 gzip 格式文件的压缩等级。此过程直接编码并压缩,而非先生成 csv 文件再压缩。可选值为:
|
||||||
|
- none:不压缩
|
||||||
|
- fast:gzip 1级压缩
|
||||||
|
- balance:gzip 6级压缩
|
||||||
|
- best:gzip 9级压缩
|
||||||
|
|
||||||
#### 标签列与数据列
|
#### 标签列与数据列
|
||||||
|
|
||||||
|
@ -200,7 +227,7 @@ taosBenchmark -f <json file>
|
||||||
|
|
||||||
- **count**:指定该类型列连续出现的数量,例如 "count":4096 即可生成 4096 个指定类型的列。
|
- **count**:指定该类型列连续出现的数量,例如 "count":4096 即可生成 4096 个指定类型的列。
|
||||||
|
|
||||||
- **name**:列的名字,若与 count 同时使用,比如 "name":"current", "count":3, 则 3 个列的名字分别为 current、current_2、current_3。
|
- **name**:列的名字,若与 count 同时使用,比如 "name":"current","count":3,则 3 个列的名字分别为 current、current_2、current_3。
|
||||||
|
|
||||||
- **min**:数据类型的 列/标签 的最小值。生成的值将大于或等于最小值。
|
- **min**:数据类型的 列/标签 的最小值。生成的值将大于或等于最小值。
|
||||||
|
|
||||||
|
@ -208,7 +235,7 @@ taosBenchmark -f <json file>
|
||||||
|
|
||||||
- **scalingFactor**:浮点数精度增强因子,仅当数据类型是 float/double 时生效,有效值范围为 1 至 1000000 的正整数。用于增强生成浮点数的精度,特别是在 min 或 max 值较小的情况下。此属性按 10 的幂次增强小数点后的精度:scalingFactor 为 10 表示增强 1 位小数精度,100 表示增强 2 位,依此类推。
|
- **scalingFactor**:浮点数精度增强因子,仅当数据类型是 float/double 时生效,有效值范围为 1 至 1000000 的正整数。用于增强生成浮点数的精度,特别是在 min 或 max 值较小的情况下。此属性按 10 的幂次增强小数点后的精度:scalingFactor 为 10 表示增强 1 位小数精度,100 表示增强 2 位,依此类推。
|
||||||
|
|
||||||
- **fun**:此列数据以函数填充,目前只支持 sin 和 cos 两函数,输入参数为时间戳换算成角度值,换算公式:角度 x = 输入的时间列ts值 % 360。同时支持系数调节,随机波动因子调节,以固定格式的表达式展现,如 fun=“10\*sin(x)+100\*random(5)” , x 表示角度,取值 0 ~ 360度,增长步长与时间列步长一致。10 表示乘的系数,100 表示加或减的系数,5 表示波动幅度在 5% 的随机范围内。目前支持的数据类型为 int, bigint, float, double 四种数据类型。注意:表达式为固定模式,不可前后颠倒。
|
- **fun**:此列数据以函数填充,目前只支持 sin 和 cos 两函数,输入参数为时间戳换算成角度值,换算公式:角度 x = 输入的时间列ts值 % 360。同时支持系数调节,随机波动因子调节,以固定格式的表达式展现,如 fun=“10\*sin(x)+100\*random(5)” , x 表示角度,取值 0 ~ 360度,增长步长与时间列步长一致。10 表示乘的系数,100 表示加或减的系数,5 表示波动幅度在 5% 的随机范围内。目前支持的数据类型为 int、bigint、float、double 四种数据类型。注意:表达式为固定模式,不可前后颠倒。
|
||||||
|
|
||||||
- **values**:nchar/binary 列/标签的值域,将从值中随机选择。
|
- **values**:nchar/binary 列/标签的值域,将从值中随机选择。
|
||||||
|
|
||||||
|
@ -220,15 +247,15 @@ taosBenchmark -f <json file>
|
||||||
|
|
||||||
- **level**:字符串类型,指定此列两级压缩中的第二级加密算法的压缩率高低,详细参见创建超级表。
|
- **level**:字符串类型,指定此列两级压缩中的第二级加密算法的压缩率高低,详细参见创建超级表。
|
||||||
|
|
||||||
- **gen**:字符串类型,指定此列生成数据的方式,不指定为随机,若指定为 “order”, 会按自然数顺序增长。
|
- **gen**:字符串类型,指定此列生成数据的方式,不指定为随机,若指定为 “order”,会按自然数顺序增长。
|
||||||
|
|
||||||
- **fillNull**:字符串类型,指定此列是否随机插入 NULL 值,可指定为 “true” 或 "false", 只有当 generate_row_rule 为 2 时有效。
|
- **fillNull**:字符串类型,指定此列是否随机插入 NULL 值,可指定为 “true” 或 "false",只有当 generate_row_rule 为 2 时有效。
|
||||||
|
|
||||||
#### 写入行为相关
|
#### 写入行为相关
|
||||||
|
|
||||||
- **thread_count**:插入数据的线程数量,默认为 8。
|
- **thread_count**:插入数据的线程数量,默认为 8。
|
||||||
|
|
||||||
- **thread_bind_vgroup**:写入时 vgroup 是否和写入线程绑定,绑定后可提升写入速度, 取值为 "yes" 或 "no",默认值为 “no”, 设置为 “no” 后与原来行为一致。当设为 “yes” 时,如果 thread_count 大于写入数据库 vgroups 数量, thread_count 自动调整为 vgroups 数量;如果 thread_count 小于 vgroups 数量,写入线程数量不做调整,一个线程写完一个 vgroup 数据后再写下一个,同时保持一个 vgroup 同时只能由一个线程写入的规则。
|
- **thread_bind_vgroup**:写入时 vgroup 是否和写入线程绑定,绑定后可提升写入速度,取值为 "yes" 或 "no",默认值为 “no”,设置为 “no” 后与原来行为一致。当设为 “yes” 时,如果 thread_count 大于写入数据库 vgroups 数量,thread_count 自动调整为 vgroups 数量;如果 thread_count 小于 vgroups 数量,写入线程数量不做调整,一个线程写完一个 vgroup 数据后再写下一个,同时保持一个 vgroup 同时只能由一个线程写入的规则。
|
||||||
|
|
||||||
- **create_table_thread_count**:建表的线程数量,默认为 8。
|
- **create_table_thread_count**:建表的线程数量,默认为 8。
|
||||||
|
|
||||||
|
@ -267,7 +294,7 @@ interval 控制休眠时间,避免持续查询慢查询消耗 CPU,单位为
|
||||||
- **mixed_query**:查询模式
|
- **mixed_query**:查询模式
|
||||||
“yes”:`混合查询`
|
“yes”:`混合查询`
|
||||||
"no"(默认值):`普通查询`
|
"no"(默认值):`普通查询`
|
||||||
`普通查询`:`sqls` 中每个 sql 启动 `threads` 个线程查询此 sql, 执行完 `query_times` 次查询后退出,执行此 sql 的所有线程都完成后进入下一个 sql
|
`普通查询`:`sqls` 中每个 sql 启动 `threads` 个线程查询此 sql,执行完 `query_times` 次查询后退出,执行此 sql 的所有线程都完成后进入下一个 sql
|
||||||
`查询总次数` = `sqls` 个数 * `query_times` * `threads`
|
`查询总次数` = `sqls` 个数 * `query_times` * `threads`
|
||||||
|
|
||||||
`混合查询`:`sqls` 中所有 sql 分成 `threads` 个组,每个线程执行一组,每个 sql 都需执行 `query_times` 次查询
|
`混合查询`:`sqls` 中所有 sql 分成 `threads` 个组,每个线程执行一组,每个 sql 都需执行 `query_times` 次查询
|
||||||
|
@ -308,7 +335,7 @@ interval 控制休眠时间,避免持续查询慢查询消耗 CPU,单位为
|
||||||
- **group_mode**:生成消费者 groupId 模式,可取值 share:所有消费者只生成一个 groupId,independent:每个消费者生成一个独立的 groupId,如果 `group.id` 未设置,此项为必填项,无默认值。
|
- **group_mode**:生成消费者 groupId 模式,可取值 share:所有消费者只生成一个 groupId,independent:每个消费者生成一个独立的 groupId,如果 `group.id` 未设置,此项为必填项,无默认值。
|
||||||
- **poll_delay**:调用 tmq_consumer_poll 传入的轮询超时时间,单位为毫秒,负数表示默认超时 1 秒。
|
- **poll_delay**:调用 tmq_consumer_poll 传入的轮询超时时间,单位为毫秒,负数表示默认超时 1 秒。
|
||||||
- **enable.manual.commit**:是否允许手动提交,可取值 true:允许手动提交,每次消费完消息后手动调用 tmq_commit_sync 完成提交,false:不进行提交,默认值:false。
|
- **enable.manual.commit**:是否允许手动提交,可取值 true:允许手动提交,每次消费完消息后手动调用 tmq_commit_sync 完成提交,false:不进行提交,默认值:false。
|
||||||
- **rows_file**:存储消费数据的文件,可以为全路径或相对路径,带文件名。实际保存的文件会在后面加上消费者序号,如 rows_file 为 result, 实际文件名为 result_1(消费者 1) result_2(消费者 2) ...
|
- **rows_file**:存储消费数据的文件,可以为全路径或相对路径,带文件名。实际保存的文件会在后面加上消费者序号,如 rows_file 为 result,实际文件名为 result_1(消费者 1) result_2(消费者 2) ...
|
||||||
- **expect_rows**:期望每个消费者消费的行数,数据类型,当消费达到这个数,消费会退出,不设置会一直消费。
|
- **expect_rows**:期望每个消费者消费的行数,数据类型,当消费达到这个数,消费会退出,不设置会一直消费。
|
||||||
- **topic_list**:指定消费的 topic 列表,数组类型。topic 列表格式示例:`{"name": "topic1", "sql": "select * from test.meters;"}`,name:指定 topic 名,sql:指定创建 topic 的 sql 语句,需保证 sql 正确,框架会自动创建出 topic。
|
- **topic_list**:指定消费的 topic 列表,数组类型。topic 列表格式示例:`{"name": "topic1", "sql": "select * from test.meters;"}`,name:指定 topic 名,sql:指定创建 topic 的 sql 语句,需保证 sql 正确,框架会自动创建出 topic。
|
||||||
|
|
||||||
|
@ -383,6 +410,17 @@ interval 控制休眠时间,避免持续查询慢查询消耗 CPU,单位为
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### 生成 CSV 文件 JSON 示例
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>csv-export.json</summary>
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include /TDengine/tools/taos-tools/example/csv-export.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
查看更多 json 配置文件示例可 [点击这里](https://github.com/taosdata/TDengine/tree/main/tools/taos-tools/example)
|
查看更多 json 配置文件示例可 [点击这里](https://github.com/taosdata/TDengine/tree/main/tools/taos-tools/example)
|
||||||
|
|
||||||
## 输出性能指标
|
## 输出性能指标
|
||||||
|
@ -411,7 +449,7 @@ SUCC: insert delay, min: 19.6780ms, avg: 64.9390ms, p90: 94.6900ms, p95: 105.187
|
||||||
|
|
||||||
#### 查询指标
|
#### 查询指标
|
||||||
|
|
||||||
查询性能测试主要输出查询请求速度 QPS 指标, 输出格式如下:
|
查询性能测试主要输出查询请求速度 QPS 指标,输出格式如下:
|
||||||
``` bash
|
``` bash
|
||||||
complete query with 3 threads and 10000 query delay avg: 0.002686s min: 0.001182s max: 0.012189s p90: 0.002977s p95: 0.003493s p99: 0.004645s SQL command: select ...
|
complete query with 3 threads and 10000 query delay avg: 0.002686s min: 0.001182s max: 0.012189s p90: 0.002977s p95: 0.003493s p99: 0.004645s SQL command: select ...
|
||||||
INFO: Spend 26.9530 second completed total queries: 30000, the QPS of all threads: 1113.049
|
INFO: Spend 26.9530 second completed total queries: 30000, the QPS of all threads: 1113.049
|
||||||
|
|
|
@ -56,14 +56,13 @@ join_clause:
|
||||||
|
|
||||||
window_clause: {
|
window_clause: {
|
||||||
SESSION(ts_col, tol_val)
|
SESSION(ts_col, tol_val)
|
||||||
| STATE_WINDOW(col)
|
| STATE_WINDOW(col) [TRUE_FOR(true_for_duration)]
|
||||||
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)]
|
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [WATERMARK(watermark_val)] [FILL(fill_mod_and_val)]
|
||||||
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition
|
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition [TRUE_FOR(true_for_duration)]
|
||||||
| COUNT_WINDOW(count_val[, sliding_val])
|
| COUNT_WINDOW(count_val[, sliding_val])
|
||||||
|
|
||||||
interp_clause:
|
interp_clause:
|
||||||
RANGE(ts_val [, ts_val]) EVERY(every_val) FILL(fill_mod_and_val)
|
RANGE(ts_val [, ts_val] [, surrounding_time_val]) EVERY(every_val) FILL(fill_mod_and_val)
|
||||||
| RANGE(ts_val, surrounding_time_val) FILL(fill_mod_and_val)
|
|
||||||
|
|
||||||
partition_by_clause:
|
partition_by_clause:
|
||||||
PARTITION BY partition_by_expr [, partition_by_expr] ...
|
PARTITION BY partition_by_expr [, partition_by_expr] ...
|
||||||
|
|
|
@ -46,9 +46,9 @@ TDengine 支持按时间窗口切分方式进行聚合结果查询,比如温
|
||||||
```sql
|
```sql
|
||||||
window_clause: {
|
window_clause: {
|
||||||
SESSION(ts_col, tol_val)
|
SESSION(ts_col, tol_val)
|
||||||
| STATE_WINDOW(col)
|
| STATE_WINDOW(col) [TRUE_FOR(true_for_duration)]
|
||||||
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)]
|
| INTERVAL(interval_val [, interval_offset]) [SLIDING (sliding_val)] [FILL(fill_mod_and_val)]
|
||||||
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition
|
| EVENT_WINDOW START WITH start_trigger_condition END WITH end_trigger_condition [TRUE_FOR(true_for_duration)]
|
||||||
| COUNT_WINDOW(count_val[, sliding_val])
|
| COUNT_WINDOW(count_val[, sliding_val])
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -76,7 +76,7 @@ window_clause: {
|
||||||
FILL 语句指定某一窗口区间数据缺失的情况下的填充模式。填充模式包括以下几种:
|
FILL 语句指定某一窗口区间数据缺失的情况下的填充模式。填充模式包括以下几种:
|
||||||
|
|
||||||
1. 不进行填充:NONE(默认填充模式)。
|
1. 不进行填充:NONE(默认填充模式)。
|
||||||
2. VALUE 填充:固定值填充,此时需要指定填充的数值。例如 FILL(VALUE, 1.23)。这里需要注意,最终填充的值受由相应列的类型决定,如 FILL(VALUE, 1.23),相应列为 INT 类型,则填充值为 1,若查询列表中有多列需要 FILL,则需要给每一个 FILL 列指定 VALUE,如 `SELECT _wstart, min(c1), max(c1) FROM ... FILL(VALUE, 0, 0)`,注意,SELECT 表达式中只有包含普通列时才需要指定 FILL VALUE,如 `_wstart`、`_wstart+1a`、`now`、`1+1` 以及使用 partition by 时的 partition key (如 tbname)都不需要指定 VALUE,如 `timediff(last(ts), _wstart)` 则需要指定 VALUE。
|
2. VALUE 填充:固定值填充,此时需要指定填充的数值。例如 `FILL(VALUE, 1.23)`。这里需要注意,最终填充的值受由相应列的类型决定,如 `FILL(VALUE, 1.23)`,相应列为 INT 类型,则填充值为 1,若查询列表中有多列需要 FILL,则需要给每一个 FILL 列指定 VALUE,如 `SELECT _wstart, min(c1), max(c1) FROM ... FILL(VALUE, 0, 0)`,注意,SELECT 表达式中只有包含普通列时才需要指定 FILL VALUE,如 `_wstart`、`_wstart+1a`、`now`、`1+1` 以及使用 `partition by` 时的 `partition key` (如 tbname)都不需要指定 VALUE,如 `timediff(last(ts), _wstart)` 则需要指定 VALUE。
|
||||||
3. PREV 填充:使用前一个非 NULL 值填充数据。例如 FILL(PREV)。
|
3. PREV 填充:使用前一个非 NULL 值填充数据。例如 FILL(PREV)。
|
||||||
4. NULL 填充:使用 NULL 填充数据。例如 FILL(NULL)。
|
4. NULL 填充:使用 NULL 填充数据。例如 FILL(NULL)。
|
||||||
5. LINEAR 填充:根据前后距离最近的非 NULL 值做线性插值填充。例如 FILL(LINEAR)。
|
5. LINEAR 填充:根据前后距离最近的非 NULL 值做线性插值填充。例如 FILL(LINEAR)。
|
||||||
|
@ -165,6 +165,12 @@ TDengine 还支持将 CASE 表达式用在状态量,可以表达某个状态
|
||||||
SELECT tbname, _wstart, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END status FROM meters PARTITION BY tbname STATE_WINDOW(CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END);
|
SELECT tbname, _wstart, CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END status FROM meters PARTITION BY tbname STATE_WINDOW(CASE WHEN voltage >= 205 and voltage <= 235 THEN 1 ELSE 0 END);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
状态窗口支持使用 TRUE_FOR 参数来设定窗口的最小持续时长。如果某个状态窗口的宽度低于该设定值,则会自动舍弃,不返回任何计算结果。例如,设置最短持续时长为 3s。
|
||||||
|
|
||||||
|
```
|
||||||
|
SELECT COUNT(*), FIRST(ts), status FROM temp_tb_1 STATE_WINDOW(status) TRUE_FOR (3s);
|
||||||
|
```
|
||||||
|
|
||||||
### 会话窗口
|
### 会话窗口
|
||||||
|
|
||||||
会话窗口根据记录的时间戳主键的值来确定是否属于同一个会话。如下图所示,如果设置时间戳的连续的间隔小于等于 12 秒,则以下 6 条记录构成 2 个会话窗口,分别是 [2019-04-28 14:22:10,2019-04-28 14:22:30] 和 [2019-04-28 14:23:10,2019-04-28 14:23:30]。因为 2019-04-28 14:22:30 与 2019-04-28 14:23:10 之间的时间间隔是 40 秒,超过了连续时间间隔(12 秒)。
|
会话窗口根据记录的时间戳主键的值来确定是否属于同一个会话。如下图所示,如果设置时间戳的连续的间隔小于等于 12 秒,则以下 6 条记录构成 2 个会话窗口,分别是 [2019-04-28 14:22:10,2019-04-28 14:22:30] 和 [2019-04-28 14:23:10,2019-04-28 14:23:30]。因为 2019-04-28 14:22:30 与 2019-04-28 14:23:10 之间的时间间隔是 40 秒,超过了连续时间间隔(12 秒)。
|
||||||
|
@ -196,6 +202,12 @@ select _wstart, _wend, count(*) from t event_window start with c1 > 0 end with c
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
事件窗口支持使用 TRUE_FOR 参数来设定窗口的最小持续时长。如果某个事件窗口的宽度低于该设定值,则会自动舍弃,不返回任何计算结果。例如,设置最短持续时长为 3s。
|
||||||
|
|
||||||
|
```
|
||||||
|
select _wstart, _wend, count(*) from t event_window start with c1 > 0 end with c2 < 10 true_for (3s);
|
||||||
|
```
|
||||||
|
|
||||||
### 计数窗口
|
### 计数窗口
|
||||||
|
|
||||||
计数窗口按固定的数据行数来划分窗口。默认将数据按时间戳排序,再按照 count_val 的值,将数据划分为多个窗口,然后做聚合计算。count_val 表示每个 count window 包含的最大数据行数,总数据行数不能整除 count_val 时,最后一个窗口的行数会小于 count_val。sliding_val 是常量,表示窗口滑动的数量,类似于 interval 的 SLIDING。
|
计数窗口按固定的数据行数来划分窗口。默认将数据按时间戳排序,再按照 count_val 的值,将数据划分为多个窗口,然后做聚合计算。count_val 表示每个 count window 包含的最大数据行数,总数据行数不能整除 count_val 时,最后一个窗口的行数会小于 count_val。sliding_val 是常量,表示窗口滑动的数量,类似于 interval 的 SLIDING。
|
||||||
|
@ -211,7 +223,7 @@ select _wstart, _wend, count(*) from t count_window(4);
|
||||||
|
|
||||||
### 时间戳伪列
|
### 时间戳伪列
|
||||||
|
|
||||||
窗口聚合查询结果中,如果 SQL 语句中没有指定输出查询结果中的时间戳列,那么最终结果中不会自动包含窗口的时间列信息。如果需要在结果中输出聚合结果所对应的时间窗口信息,需要在 SELECT 子句中使用时间戳相关的伪列: 时间窗口起始时间 (\_WSTART), 时间窗口结束时间 (\_WEND), 时间窗口持续时间 (\_WDURATION), 以及查询整体窗口相关的伪列:查询窗口起始时间(\_QSTART) 和查询窗口结束时间(\_QEND)。需要注意的是时间窗口起始时间和结束时间均是闭区间,时间窗口持续时间是数据当前时间分辨率下的数值。例如,如果当前数据库的时间分辨率是毫秒,那么结果中 500 就表示当前时间窗口的持续时间是 500毫秒 (500 ms)。
|
窗口聚合查询结果中,如果 SQL 语句中没有指定输出查询结果中的时间戳列,那么最终结果中不会自动包含窗口的时间列信息。如果需要在结果中输出聚合结果所对应的时间窗口信息,需要在 SELECT 子句中使用时间戳相关的伪列:时间窗口起始时间 (\_WSTART),时间窗口结束时间 (\_WEND),时间窗口持续时间 (\_WDURATION),以及查询整体窗口相关的伪列:查询窗口起始时间(\_QSTART) 和查询窗口结束时间(\_QEND)。需要注意的是时间窗口起始时间和结束时间均是闭区间,时间窗口持续时间是数据当前时间分辨率下的数值。例如,如果当前数据库的时间分辨率是毫秒,那么结果中 500 就表示当前时间窗口的持续时间是 500毫秒 (500 ms)。
|
||||||
|
|
||||||
### 示例
|
### 示例
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ description: 流式计算的相关 SQL 的详细语法
|
||||||
## 创建流式计算
|
## 创建流式计算
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE STREAM [IF NOT EXISTS] stream_name [stream_options] INTO stb_name[(field1_name, field2_name [PRIMARY KEY], ...)] [TAGS (create_definition [, create_definition] ...)] SUBTABLE(expression) AS subquery
|
CREATE STREAM [IF NOT EXISTS] stream_name [stream_options] INTO stb_name[(field1_name, field2_name [PRIMARY KEY], ...)] [TAGS (create_definition [, create_definition] ...)] SUBTABLE(expression) AS subquery [notification_definition]
|
||||||
stream_options: {
|
stream_options: {
|
||||||
TRIGGER [AT_ONCE | WINDOW_CLOSE | MAX_DELAY time | FORCE_WINDOW_CLOSE]
|
TRIGGER [AT_ONCE | WINDOW_CLOSE | MAX_DELAY time | FORCE_WINDOW_CLOSE]
|
||||||
WATERMARK time
|
WATERMARK time
|
||||||
|
@ -85,6 +85,8 @@ CREATE STREAM streams1 IGNORE EXPIRED 1 WATERMARK 100s INTO streamt1 AS
|
||||||
SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname COUNT_WINDOW(10);
|
SELECT _wstart, count(*), avg(voltage) from meters PARTITION BY tbname COUNT_WINDOW(10);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
notification_definition 子句定义了窗口计算过程中,在窗口打开/关闭等指定事件发生时,需要向哪些地址发送通知。详见 [流式计算的事件通知](#流式计算的事件通知)
|
||||||
|
|
||||||
## 流式计算的 partition
|
## 流式计算的 partition
|
||||||
|
|
||||||
可以使用 PARTITION BY TBNAME,tag,普通列或者表达式,对一个流进行多分区的计算,每个分区的时间线与时间窗口是独立的,会各自聚合,并写入到目的表中的不同子表。
|
可以使用 PARTITION BY TBNAME,tag,普通列或者表达式,对一个流进行多分区的计算,每个分区的时间线与时间窗口是独立的,会各自聚合,并写入到目的表中的不同子表。
|
||||||
|
@ -298,4 +300,223 @@ RESUME STREAM [IF EXISTS] [IGNORE UNTREATED] stream_name;
|
||||||
CREATE SNODE ON DNODE [id]
|
CREATE SNODE ON DNODE [id]
|
||||||
```
|
```
|
||||||
其中的 id 是集群中的 dnode 的序号。请注意选择的dnode,流计算的中间状态将自动在其上进行备份。
|
其中的 id 是集群中的 dnode 的序号。请注意选择的dnode,流计算的中间状态将自动在其上进行备份。
|
||||||
从 3.3.4.0 版本开始,在多副本环境中创建流会进行 snode 的**存在性检查**,要求首先创建 snode。如果 snode 不存在,无法创建流。
|
从 v3.3.4.0 开始,在多副本环境中创建流会进行 snode 的**存在性检查**,要求首先创建 snode。如果 snode 不存在,无法创建流。
|
||||||
|
|
||||||
|
## 流式计算的事件通知
|
||||||
|
|
||||||
|
### 使用说明
|
||||||
|
|
||||||
|
流式计算支持在窗口打开/关闭时,向外部系统发送相关的事件通知。用户通过 `notification_definition` 来指定需要通知的事件,以及用于接收通知消息的目标地址。
|
||||||
|
|
||||||
|
```sql
|
||||||
|
notification_definition:
|
||||||
|
NOTIFY (url [, url] ...) ON (event_type [, event_type] ...) [notification_options]
|
||||||
|
|
||||||
|
event_type:
|
||||||
|
'WINDOW_OPEN'
|
||||||
|
| 'WINDOW_CLOSE'
|
||||||
|
|
||||||
|
notification_options: {
|
||||||
|
NOTIFY_HISTORY [0|1]
|
||||||
|
ON_FAILURE [DROP|PAUSE]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
上述语法中的相关规则含义如下:
|
||||||
|
1. `url`:指定通知的目标地址,必须包括协议、IP 或域名、端口号,并允许包含路径、参数。目前仅支持 websocket 协议。例如:`ws://localhost:8080`、`ws://localhost:8080/notify`、`wss://localhost:8080/notify?key=foo`。
|
||||||
|
1. `event_type`:定义需要通知的事件,支持的事件类型有:
|
||||||
|
1. WINDOW_OPEN:窗口打开事件,所有类型的窗口打开时都会触发。
|
||||||
|
1. WINDOW_CLOSE:窗口关闭事件,所有类型的窗口关闭时都会触发。
|
||||||
|
1. `NOTIFY_HISTORY`:控制是否在计算历史数据时触发通知,默认值为 0,即不触发。
|
||||||
|
1. `ON_FAILURE`:向通知地址发送通知失败时(比如网络不佳场景)是否允许丢弃部分事件,默认值为 `PAUSE`。
|
||||||
|
1. PAUSE 表示发送通知失败时暂停流计算任务。taosd 会重试发送通知,直到发送成功后,任务自动恢复运行。
|
||||||
|
1. DROP 表示发送通知失败时直接丢弃事件信息,流计算任务继续运行,不受影响。
|
||||||
|
|
||||||
|
比如,以下示例创建一个流,计算电表电流的每分钟平均值,并在窗口打开、关闭时向两个通知地址发送通知,计算历史数据时不发送通知,不允许在通知发送失败时丢弃通知:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE STREAM avg_current_stream FILL_HISTORY 1
|
||||||
|
AS SELECT _wstart, _wend, AVG(current) FROM meters
|
||||||
|
INTERVAL (1m)
|
||||||
|
NOTIFY ('ws://localhost:8080/notify', 'wss://192.168.1.1:8080/notify?key=foo')
|
||||||
|
ON ('WINDOW_OPEN', 'WINDOW_CLOSE');
|
||||||
|
NOTIFY_HISTORY 0
|
||||||
|
ON_FAILURE PAUSE;
|
||||||
|
```
|
||||||
|
|
||||||
|
当触发指定的事件时,taosd 会向指定的 URL 发送 POST 请求,消息体为 JSON 格式。一个请求可能包含若干个流的若干个事件,且事件类型不一定相同。
|
||||||
|
事件信息视窗口类型而定:
|
||||||
|
|
||||||
|
1. 时间窗口:开始时发送起始时间;结束时发送起始时间、结束时间、计算结果。
|
||||||
|
1. 状态窗口:开始时发送起始时间、前一个窗口的状态值、当前窗口的状态值;结束时发送起始时间、结束时间、计算结果、当前窗口的状态值、下一个窗口的状态值。
|
||||||
|
1. 会话窗口:开始时发送起始时间;结束时发送起始时间、结束时间、计算结果。
|
||||||
|
1. 事件窗口:开始时发送起始时间,触发窗口打开的数据值和对应条件编号;结束时发送起始时间、结束时间、计算结果、触发窗口关闭的数据值和对应条件编号。
|
||||||
|
1. 计数窗口:开始时发送起始时间;结束时发送起始时间、结束时间、计算结果。
|
||||||
|
|
||||||
|
通知消息的结构示例如下:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"messageId": "unique-message-id-12345",
|
||||||
|
"timestamp": 1733284887203,
|
||||||
|
"streams": [
|
||||||
|
{
|
||||||
|
"streamName": "avg_current_stream",
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"tableName": "t_a667a16127d3b5a18988e32f3e76cd30",
|
||||||
|
"eventType": "WINDOW_OPEN",
|
||||||
|
"eventTime": 1733284887097,
|
||||||
|
"windowId": "window-id-67890",
|
||||||
|
"windowType": "Time",
|
||||||
|
"windowStart": 1733284800000
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "t_a667a16127d3b5a18988e32f3e76cd30",
|
||||||
|
"eventType": "WINDOW_CLOSE",
|
||||||
|
"eventTime": 1733284887197,
|
||||||
|
"windowId": "window-id-67890",
|
||||||
|
"windowType": "Time",
|
||||||
|
"windowStart": 1733284800000,
|
||||||
|
"windowEnd": 1733284860000,
|
||||||
|
"result": {
|
||||||
|
"_wstart": 1733284800000,
|
||||||
|
"avg(current)": 1.3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"streamName": "max_voltage_stream",
|
||||||
|
"events": [
|
||||||
|
{
|
||||||
|
"tableName": "t_96f62b752f36e9b16dc969fe45363748",
|
||||||
|
"eventType": "WINDOW_OPEN",
|
||||||
|
"eventTime": 1733284887231,
|
||||||
|
"windowId": "window-id-13579",
|
||||||
|
"windowType": "Event",
|
||||||
|
"windowStart": 1733284800000,
|
||||||
|
"triggerCondition": {
|
||||||
|
"conditionIndex": 0,
|
||||||
|
"fieldValue": {
|
||||||
|
"c1": 10,
|
||||||
|
"c2": 15
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "t_96f62b752f36e9b16dc969fe45363748",
|
||||||
|
"eventType": "WINDOW_CLOSE",
|
||||||
|
"eventTime": 1733284887231,
|
||||||
|
"windowId": "window-id-13579",
|
||||||
|
"windowType": "Event",
|
||||||
|
"windowStart": 1733284800000,
|
||||||
|
"windowEnd": 1733284810000,
|
||||||
|
"triggerCondition": {
|
||||||
|
"conditionIndex": 1,
|
||||||
|
"fieldValue": {
|
||||||
|
"c1": 20
|
||||||
|
"c2": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"_wstart": 1733284800000,
|
||||||
|
"max(voltage)": 220
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
后续小节是通知消息中各个字段的说明。
|
||||||
|
|
||||||
|
### 根级字段说明
|
||||||
|
|
||||||
|
1. messageId:字符串类型,是通知消息的唯一标识符,确保整条消息可以被追踪和去重。
|
||||||
|
1. timestamp:长整型时间戳,表示通知消息生成的时间,精确到毫秒,即: '00:00, Jan 1 1970 UTC' 以来的毫秒数。
|
||||||
|
1. streams:对象数组,包含多个流任务的事件信息。(详细信息见下节)
|
||||||
|
|
||||||
|
### stream 对象的字段说明
|
||||||
|
|
||||||
|
1. streamName:字符串类型,流任务的名称,用于标识事件所属的流。
|
||||||
|
1. events:对象数组,该流任务下的事件列表,包含一个或多个事件对象。(详细信息见下节)
|
||||||
|
|
||||||
|
### event 对象的字段说明
|
||||||
|
|
||||||
|
#### 通用字段
|
||||||
|
|
||||||
|
这部分是所有 event 对象所共有的字段。
|
||||||
|
1. tableName:字符串类型,是对应目标子表的表名。
|
||||||
|
1. eventType:字符串类型,表示事件类型,支持 WINDOW_OPEN、WINDOW_CLOSE、WINDOW_INVALIDATION 三种类型。
|
||||||
|
1. eventTime:长整型时间戳,表示事件生成时间,精确到毫秒,即:'00:00, Jan 1 1970 UTC' 以来的毫秒数。
|
||||||
|
1. windowId:字符串类型,窗口的唯一标识符,确保打开和关闭事件的 ID 一致,便于外部系统将两者关联。如果 taosd 发生故障重启,部分事件可能会重复发送,会保证同一窗口的 windowId 保持不变。
|
||||||
|
1. windowType:字符串类型,表示窗口类型,支持 Time、State、Session、Event、Count 五种类型。
|
||||||
|
|
||||||
|
#### 时间窗口相关字段
|
||||||
|
|
||||||
|
这部分是 windowType 为 Time 时 event 对象才有的字段。
|
||||||
|
1. 如果 eventType 为 WINDOW_OPEN,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. 如果 eventType 为 WINDOW_CLOSE,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. windowEnd:长整型时间戳,表示窗口的结束时间,精度与结果表的时间精度一致。
|
||||||
|
1. result:计算结果,为键值对形式,包含窗口计算的结果列列名及其对应的值。
|
||||||
|
|
||||||
|
#### 状态窗口相关字段
|
||||||
|
|
||||||
|
这部分是 windowType 为 State 时 event 对象才有的字段。
|
||||||
|
1. 如果 eventType 为 WINDOW_OPEN,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. prevState:与状态列的类型相同,表示上一个窗口的状态值。如果没有上一个窗口(即:现在是第一个窗口),则为 NULL。
|
||||||
|
1. curState:与状态列的类型相同,表示当前窗口的状态值。
|
||||||
|
1. 如果 eventType 为 WINDOW_CLOSE,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. windowEnd:长整型时间戳,表示窗口的结束时间,精度与结果表的时间精度一致。
|
||||||
|
1. curState:与状态列的类型相同,表示当前窗口的状态值。
|
||||||
|
1. nextState:与状态列的类型相同,表示下一个窗口的状态值。
|
||||||
|
1. result:计算结果,为键值对形式,包含窗口计算的结果列列名及其对应的值。
|
||||||
|
|
||||||
|
#### 会话窗口相关字段
|
||||||
|
|
||||||
|
这部分是 windowType 为 Session 时 event 对象才有的字段。
|
||||||
|
1. 如果 eventType 为 WINDOW_OPEN,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. 如果 eventType 为 WINDOW_CLOSE,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. windowEnd:长整型时间戳,表示窗口的结束时间,精度与结果表的时间精度一致。
|
||||||
|
1. result:计算结果,为键值对形式,包含窗口计算的结果列列名及其对应的值。
|
||||||
|
|
||||||
|
#### 事件窗口相关字段
|
||||||
|
|
||||||
|
这部分是 windowType 为 Event 时 event 对象才有的字段。
|
||||||
|
1. 如果 eventType 为 WINDOW_OPEN,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. triggerCondition:触发窗口开始的条件信息,包括以下字段:
|
||||||
|
1. conditionIndex:整型,表示满足的触发窗口开始的条件的索引,从0开始编号。
|
||||||
|
1. fieldValue:键值对形式,包含条件列列名及其对应的值。
|
||||||
|
1. 如果 eventType 为 WINDOW_CLOSE,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. windowEnd:长整型时间戳,表示窗口的结束时间,精度与结果表的时间精度一致。
|
||||||
|
1. triggerCondition:触发窗口关闭的条件信息,包括以下字段:
|
||||||
|
1. conditionIndex:整型,表示满足的触发窗口关闭的条件的索引,从0开始编号。
|
||||||
|
1. fieldValue:键值对形式,包含条件列列名及其对应的值。
|
||||||
|
1. result:计算结果,为键值对形式,包含窗口计算的结果列列名及其对应的值。
|
||||||
|
|
||||||
|
#### 计数窗口相关字段
|
||||||
|
|
||||||
|
这部分是 windowType 为 Count 时 event 对象才有的字段。
|
||||||
|
1. 如果 eventType 为 WINDOW_OPEN,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. 如果 eventType 为 WINDOW_CLOSE,则包含如下字段:
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. windowEnd:长整型时间戳,表示窗口的结束时间,精度与结果表的时间精度一致。
|
||||||
|
1. result:计算结果,为键值对形式,包含窗口计算的结果列列名及其对应的值。
|
||||||
|
|
||||||
|
#### 窗口失效相关字段
|
||||||
|
|
||||||
|
因为流计算过程中会遇到数据乱序、更新、删除等情况,可能造成已生成的窗口被删除,或者结果需要重新计算。此时会向通知地址发送一条 WINDOW_INVALIDATION 的通知,说明哪些窗口已经被删除。
|
||||||
|
这部分是 eventType 为 WINDOW_INVALIDATION 时,event 对象才有的字段。
|
||||||
|
1. windowStart:长整型时间戳,表示窗口的开始时间,精度与结果表的时间精度一致。
|
||||||
|
1. windowEnd: 长整型时间戳,表示窗口的结束时间,精度与结果表的时间精度一致。
|
||||||
|
|
|
@ -45,7 +45,8 @@ TDengine 支持 `UNION ALL` 和 `UNION` 操作符。UNION ALL 将查询返回的
|
||||||
| 9 | LIKE | BINARY、NCHAR 和 VARCHAR | 通配符匹配所指定的模式串 |
|
| 9 | LIKE | BINARY、NCHAR 和 VARCHAR | 通配符匹配所指定的模式串 |
|
||||||
| 10 | NOT LIKE | BINARY、NCHAR 和 VARCHAR | 通配符不匹配所指定的模式串 |
|
| 10 | NOT LIKE | BINARY、NCHAR 和 VARCHAR | 通配符不匹配所指定的模式串 |
|
||||||
| 11 | MATCH, NMATCH | BINARY、NCHAR 和 VARCHAR | 正则表达式匹配 |
|
| 11 | MATCH, NMATCH | BINARY、NCHAR 和 VARCHAR | 正则表达式匹配 |
|
||||||
| 12 | CONTAINS | JSON | JSON 中是否存在某键 |
|
| 12 | REGEXP, NOT REGEXP | BINARY、NCHAR 和 VARCHAR | 正则表达式匹配 |
|
||||||
|
| 13 | CONTAINS | JSON | JSON 中是否存在某键 |
|
||||||
|
|
||||||
LIKE 条件使用通配符字符串进行匹配检查,规则如下:
|
LIKE 条件使用通配符字符串进行匹配检查,规则如下:
|
||||||
|
|
||||||
|
@ -53,10 +54,10 @@ LIKE 条件使用通配符字符串进行匹配检查,规则如下:
|
||||||
- 如果希望匹配字符串中原本就带有的 \_(下划线)字符,那么可以在通配符字符串中写作 \_,即加一个反斜线来进行转义。
|
- 如果希望匹配字符串中原本就带有的 \_(下划线)字符,那么可以在通配符字符串中写作 \_,即加一个反斜线来进行转义。
|
||||||
- 通配符字符串最长不能超过 100 字节。不建议使用太长的通配符字符串,否则将有可能严重影响 LIKE 操作的执行性能。
|
- 通配符字符串最长不能超过 100 字节。不建议使用太长的通配符字符串,否则将有可能严重影响 LIKE 操作的执行性能。
|
||||||
|
|
||||||
MATCH 条件和 NMATCH 条件使用正则表达式进行匹配,规则如下:
|
MATCH/REGEXP 条件和 NMATCH/NOT REGEXP 条件使用正则表达式进行匹配,规则如下:
|
||||||
|
|
||||||
- 支持符合 POSIX 规范的正则表达式,具体规范内容可参见 Regular Expressions。
|
- 支持符合 POSIX 规范的正则表达式,具体规范内容可参见 Regular Expressions。
|
||||||
- MATCH 和正则表达式匹配时, 返回 TURE. NMATCH 和正则表达式不匹配时, 返回 TRUE.
|
- MATCH 和正则表达式匹配时,返回 TURE。NMATCH 和正则表达式不匹配时,返回 TRUE.
|
||||||
- 只能针对子表名(即 tbname)、字符串类型的标签值进行正则表达式过滤,不支持普通列的过滤。
|
- 只能针对子表名(即 tbname)、字符串类型的标签值进行正则表达式过滤,不支持普通列的过滤。
|
||||||
- 正则匹配字符串长度不能超过 128 字节。可以通过参数 maxRegexStringLen 设置和调整最大允许的正则匹配字符串,该参数是客户端配置参数,需要重启客户端才能生效
|
- 正则匹配字符串长度不能超过 128 字节。可以通过参数 maxRegexStringLen 设置和调整最大允许的正则匹配字符串,该参数是客户端配置参数,需要重启客户端才能生效
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ description: 对 JSON 类型如何使用的详细说明
|
||||||
|
|
||||||
## 支持的操作
|
## 支持的操作
|
||||||
|
|
||||||
1. 在 where 条件中时,支持函数 match/nmatch/between and/like/and/or/is null/is not null,不支持 in
|
1. 在 where 条件中时,支持函数 `match`、`nmatch`、`between and`、`like`、`and`、`or`、`is null`、`is not null`,不支持 `in`
|
||||||
|
|
||||||
```
|
```
|
||||||
select * from s1 where info->'k1' match 'v*';
|
select * from s1 where info->'k1' match 'v*';
|
||||||
|
@ -47,7 +47,7 @@ description: 对 JSON 类型如何使用的详细说明
|
||||||
|
|
||||||
2. 支持 json tag 放在 group by、order by、join 子句、union all 以及子查询中,比如 group by json->'key'
|
2. 支持 json tag 放在 group by、order by、join 子句、union all 以及子查询中,比如 group by json->'key'
|
||||||
|
|
||||||
3. 支持 distinct 操作.
|
3. 支持 distinct 操作
|
||||||
|
|
||||||
```
|
```
|
||||||
select distinct info->'k1' from s1
|
select distinct info->'k1' from s1
|
||||||
|
@ -69,7 +69,7 @@ description: 对 JSON 类型如何使用的详细说明
|
||||||
|
|
||||||
3. json 格式限制:
|
3. json 格式限制:
|
||||||
|
|
||||||
1. json 输入字符串可以为空("","\t"," "或 null)或 object,不能为非空的字符串,布尔型和数组。
|
1. json 输入字符串可以为空(""、"\t"、" " 或 null)或 object,不能为非空的字符串,布尔型和数组。
|
||||||
2. object 可为 {},如果 object 为 {},则整个 json 串记为空。key 可为 "",若 key 为 "",则 json 串中忽略该 k-v 对。
|
2. object 可为 {},如果 object 为 {},则整个 json 串记为空。key 可为 "",若 key 为 "",则 json 串中忽略该 k-v 对。
|
||||||
3. value 可以为数字(int/double)或字符串或 bool 或 null,暂不可以为数组。不允许嵌套。
|
3. value 可以为数字(int/double)或字符串或 bool 或 null,暂不可以为数组。不允许嵌套。
|
||||||
4. 若 json 字符串中出现两个相同的 key,则第一个生效。
|
4. 若 json 字符串中出现两个相同的 key,则第一个生效。
|
||||||
|
|
|
@ -12,7 +12,7 @@ description: 合法字符集和命名中的限制规则
|
||||||
1. 不能是 [保留关键字](./20-keywords.md)。
|
1. 不能是 [保留关键字](./20-keywords.md)。
|
||||||
1. 转义后表(列)名规则:
|
1. 转义后表(列)名规则:
|
||||||
为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`"。使用转义字符以后:
|
为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`"。使用转义字符以后:
|
||||||
- 不再对转义字符中的内容进行大小写统一,即可以保留用户指定表名中的大小写属性,例如:\`aBc\` 和 \`abc\` 是不同的表(列)名,但是 abc 和 aBc 是相同的表(列)名。
|
- 不再对转义字符中的内容进行大小写统一,即可以保留用户指定表名中的大小写属性,例如 \`aBc\` 和 \`abc\` 是不同的表(列)名,但是 abc 和 aBc 是相同的表(列)名。
|
||||||
- 可以创建包含字母、数字和下划线以外字符的表(列)名,例如:\`abc@TD\`,但是转义后名称中仍然不能包含`.`,否则会提示`The table name cannot contain '.'`。
|
- 可以创建包含字母、数字和下划线以外字符的表(列)名,例如:\`abc@TD\`,但是转义后名称中仍然不能包含`.`,否则会提示`The table name cannot contain '.'`。
|
||||||
- 可以创建以数字开头的表(列)名,例如 \`1970\`。
|
- 可以创建以数字开头的表(列)名,例如 \`1970\`。
|
||||||
- 可以创建以 [保留关键字](./20-keywords.md) 命名的表(列)名,例如 \`select\`。
|
- 可以创建以 [保留关键字](./20-keywords.md) 命名的表(列)名,例如 \`select\`。
|
||||||
|
@ -27,7 +27,7 @@ description: 合法字符集和命名中的限制规则
|
||||||
|
|
||||||
- 数据库名最大长度为 64 字节
|
- 数据库名最大长度为 64 字节
|
||||||
- 表名最大长度为 192 字节,不包括数据库名前缀和分隔符
|
- 表名最大长度为 192 字节,不包括数据库名前缀和分隔符
|
||||||
- 每行数据最大长度 48KB(从 3.0.5.0 版本开始为 64KB) (注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)
|
- 每行数据最大长度 48KB(从 v3.0.5.0 开始为 64KB)(注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)
|
||||||
- 列名最大长度为 64 字节
|
- 列名最大长度为 64 字节
|
||||||
- 最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。
|
- 最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。
|
||||||
- 标签名最大长度为 64 字节
|
- 标签名最大长度为 64 字节
|
||||||
|
@ -37,6 +37,6 @@ description: 合法字符集和命名中的限制规则
|
||||||
- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制
|
- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制
|
||||||
- 数据库的副本数只能设置为 1 或 3
|
- 数据库的副本数只能设置为 1 或 3
|
||||||
- 用户名的最大长度是 23 字节
|
- 用户名的最大长度是 23 字节
|
||||||
- 用户密码的长度范围是 8-16 字节
|
- 用户密码的长度范围是 8-255 字节
|
||||||
- 总数据行数取决于可用资源
|
- 总数据行数取决于可用资源
|
||||||
- 单个数据库的虚拟结点数上限为 1024
|
- 单个数据库的虚拟结点数上限为 1024
|
||||||
|
|
|
@ -23,11 +23,11 @@ description: TDengine 保留关键字的详细列表
|
||||||
| ALIVE | |
|
| ALIVE | |
|
||||||
| ALL | |
|
| ALL | |
|
||||||
| ALTER | |
|
| ALTER | |
|
||||||
| ANALYZE | 3.3.4.3 及后续版本 |
|
| ANALYZE | 3.3.4.3+ |
|
||||||
| AND | |
|
| AND | |
|
||||||
| ANODE | 3.3.4.3 及后续版本 |
|
| ANODE | 3.3.4.3+ |
|
||||||
| ANODES | 3.3.4.3 及后续版本 |
|
| ANODES | 3.3.4.3+ |
|
||||||
| ANOMALY_WINDOW | 3.3.4.3 及后续版本 |
|
| ANOMALY_WINDOW | 3.3.4.3+ |
|
||||||
| ANTI | |
|
| ANTI | |
|
||||||
| APPS | |
|
| APPS | |
|
||||||
| ARBGROUPS | |
|
| ARBGROUPS | |
|
||||||
|
@ -37,6 +37,8 @@ description: TDengine 保留关键字的详细列表
|
||||||
| ASOF | |
|
| ASOF | |
|
||||||
| AT_ONCE | |
|
| AT_ONCE | |
|
||||||
| ATTACH | |
|
| ATTACH | |
|
||||||
|
| AUTO | 3.3.5.0+ |
|
||||||
|
| ASSIGN | 3.3.6.0+ |
|
||||||
|
|
||||||
### B
|
### B
|
||||||
|关键字|说明|
|
|关键字|说明|
|
||||||
|
@ -76,12 +78,16 @@ description: TDengine 保留关键字的详细列表
|
||||||
| CLIENT_VERSION | |
|
| CLIENT_VERSION | |
|
||||||
| CLUSTER | |
|
| CLUSTER | |
|
||||||
| COLON | |
|
| COLON | |
|
||||||
|
| COLS | 3.3.6.0+ |
|
||||||
| COLUMN | |
|
| COLUMN | |
|
||||||
| COMMA | |
|
| COMMA | |
|
||||||
| COMMENT | |
|
| COMMENT | |
|
||||||
| COMP | |
|
| COMP | |
|
||||||
| COMPACT | |
|
| COMPACT | |
|
||||||
| COMPACTS | |
|
| COMPACTS | |
|
||||||
|
| COMPACT_INTERVAL | 3.3.5.0+ |
|
||||||
|
| COMPACT_TIME_OFFSET | 3.3.5.0+ |
|
||||||
|
| COMPACT_TIME_RANGE | 3.3.5.0+ |
|
||||||
| CONCAT | |
|
| CONCAT | |
|
||||||
| CONFLICT | |
|
| CONFLICT | |
|
||||||
| CONNECTION | |
|
| CONNECTION | |
|
||||||
|
@ -111,6 +117,7 @@ description: TDengine 保留关键字的详细列表
|
||||||
| DESC | |
|
| DESC | |
|
||||||
| DESCRIBE | |
|
| DESCRIBE | |
|
||||||
| DETACH | |
|
| DETACH | |
|
||||||
|
| DISK_INFO | 3.3.5.0+ |
|
||||||
| DISTINCT | |
|
| DISTINCT | |
|
||||||
| DISTRIBUTED | |
|
| DISTRIBUTED | |
|
||||||
| DIVIDE | |
|
| DIVIDE | |
|
||||||
|
@ -143,19 +150,19 @@ description: TDengine 保留关键字的详细列表
|
||||||
|关键字|说明|
|
|关键字|说明|
|
||||||
|----------------------|-|
|
|----------------------|-|
|
||||||
| FAIL | |
|
| FAIL | |
|
||||||
| FHIGH | 3.3.4.3 及后续版本 |
|
| FHIGH | 3.3.4.3+ |
|
||||||
| FILE | |
|
| FILE | |
|
||||||
| FILL | |
|
| FILL | |
|
||||||
| FILL_HISTORY | |
|
| FILL_HISTORY | |
|
||||||
| FIRST | |
|
| FIRST | |
|
||||||
| FLOAT | |
|
| FLOAT | |
|
||||||
| FLOW | 3.3.4.3 及后续版本 |
|
| FLOW | 3.3.4.3+ |
|
||||||
| FLUSH | |
|
| FLUSH | |
|
||||||
| FOR | |
|
| FOR | |
|
||||||
| FORCE | |
|
| FORCE | |
|
||||||
| FORCE_WINDOW_CLOSE | 3.3.4.3 及后续版本 |
|
| FORCE_WINDOW_CLOSE | 3.3.4.3+ |
|
||||||
| FROM | |
|
| FROM | |
|
||||||
| FROWTS | 3.3.4.3 及后续版本 |
|
| FROWTS | 3.3.4.3+ |
|
||||||
| FULL | |
|
| FULL | |
|
||||||
| FUNCTION | |
|
| FUNCTION | |
|
||||||
| FUNCTIONS | |
|
| FUNCTIONS | |
|
||||||
|
@ -201,6 +208,7 @@ description: TDengine 保留关键字的详细列表
|
||||||
| INTO | |
|
| INTO | |
|
||||||
| IPTOKEN | |
|
| IPTOKEN | |
|
||||||
| IROWTS | |
|
| IROWTS | |
|
||||||
|
| IROWTS_ORIGIN | 3.3.5.0+ |
|
||||||
| IS | |
|
| IS | |
|
||||||
| IS_IMPORT | |
|
| IS_IMPORT | |
|
||||||
| ISFILLED | |
|
| ISFILLED | |
|
||||||
|
@ -252,6 +260,7 @@ description: TDengine 保留关键字的详细列表
|
||||||
| MEDIUMBLOB | |
|
| MEDIUMBLOB | |
|
||||||
| MERGE | |
|
| MERGE | |
|
||||||
| META | |
|
| META | |
|
||||||
|
| META_ONLY | 3.3.6.0+ |
|
||||||
| MINROWS | |
|
| MINROWS | |
|
||||||
| MINUS | |
|
| MINUS | |
|
||||||
| MNODE | |
|
| MNODE | |
|
||||||
|
@ -269,6 +278,8 @@ description: TDengine 保留关键字的详细列表
|
||||||
| NONE | |
|
| NONE | |
|
||||||
| NORMAL | |
|
| NORMAL | |
|
||||||
| NOT | |
|
| NOT | |
|
||||||
|
| NOTIFY | 3.3.6.0+ |
|
||||||
|
| NOTIFY_HISTORY | 3.3.6.0+ |
|
||||||
| NOTNULL | |
|
| NOTNULL | |
|
||||||
| NOW | |
|
| NOW | |
|
||||||
| NULL | |
|
| NULL | |
|
||||||
|
@ -282,6 +293,7 @@ description: TDengine 保留关键字的详细列表
|
||||||
| OFFSET | |
|
| OFFSET | |
|
||||||
| ON | |
|
| ON | |
|
||||||
| ONLY | |
|
| ONLY | |
|
||||||
|
| ON_FAILURE | 3.3.6.0+ |
|
||||||
| OR | |
|
| OR | |
|
||||||
| ORDER | |
|
| ORDER | |
|
||||||
| OUTER | |
|
| OUTER | |
|
||||||
|
@ -329,6 +341,7 @@ description: TDengine 保留关键字的详细列表
|
||||||
| RATIO | |
|
| RATIO | |
|
||||||
| READ | |
|
| READ | |
|
||||||
| RECURSIVE | |
|
| RECURSIVE | |
|
||||||
|
| REGEXP | 3.3.6.0+ |
|
||||||
| REDISTRIBUTE | |
|
| REDISTRIBUTE | |
|
||||||
| REM | |
|
| REM | |
|
||||||
| REPLACE | |
|
| REPLACE | |
|
||||||
|
@ -417,6 +430,7 @@ description: TDengine 保留关键字的详细列表
|
||||||
| TRANSACTIONS | |
|
| TRANSACTIONS | |
|
||||||
| TRIGGER | |
|
| TRIGGER | |
|
||||||
| TRIM | |
|
| TRIM | |
|
||||||
|
| TRUE_FOR | 3.3.6.0+ |
|
||||||
| TSDB_PAGESIZE | |
|
| TSDB_PAGESIZE | |
|
||||||
| TSERIES | |
|
| TSERIES | |
|
||||||
| TSMA | |
|
| TSMA | |
|
||||||
|
|
|
@ -44,27 +44,27 @@ ALTER DNODE dnode_id dnode_option
|
||||||
ALTER ALL DNODES dnode_option
|
ALTER ALL DNODES dnode_option
|
||||||
```
|
```
|
||||||
|
|
||||||
对于支持动态修改的配置参数,您可以使用 ALTER DNODE 或 ALTER ALL DNODES 语法修改 dnode 中配置参数的值,自 3.3.4.0 后,修改的配置参数将自动持久化,即便数据库服务重启后仍然生效。
|
对于支持动态修改的配置参数,您可以使用 ALTER DNODE 或 ALTER ALL DNODES 语法修改 dnode 中配置参数的值,自 v3.3.4.0 后,修改的配置参数将自动持久化,即便数据库服务重启后仍然生效。
|
||||||
|
|
||||||
对于一个配置参数是否支持动态修改,请您参考以下页面:[taosd 参考手册](../01-components/01-taosd.md)
|
对于一个配置参数是否支持动态修改,请您参考 [taosd 参考手册](../01-components/01-taosd.md)
|
||||||
|
|
||||||
value 是参数的值,需要是字符格式。如修改 dnode 1 的日志输出级别为 debug:
|
value 是参数的值,需要是字符格式。如修改 dnode 1 的日志输出级别为 debug。
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
ALTER DNODE 1 'debugFlag' '143';
|
ALTER DNODE 1 'debugFlag' '143';
|
||||||
```
|
```
|
||||||
|
|
||||||
### 补充说明:
|
### 补充说明:
|
||||||
配置参数在 dnode 中被分为全局配置参数与局部配置参数,您可以查看 SHOW VARIABLES 或 SHOW DNODE dnode_id VARIABLE 中的 category 字段来确认配置参数属于全局配置参数还是局部配置参数:
|
配置参数在 dnode 中被分为全局配置参数与局部配置参数,您可以查看 SHOW VARIABLES 或 SHOW DNODE dnode_id VARIABLE 中的 category 字段来确认配置参数属于全局配置参数还是局部配置参数。
|
||||||
1. 局部配置参数:您可以使用 ALTER DNODE 或 ALTER ALL DNODES 来更新某一个 dnode 或全部 dnodes 的局部配置参数。
|
1. 局部配置参数:您可以使用 ALTER DNODE 或 ALTER ALL DNODES 来更新某一个 dnode 或全部 dnodes 的局部配置参数。
|
||||||
2. 全局配置参数:全局配置参数要求各个 dnode 保持一致,所以您只可以使用 ALTER ALL DNODES 来更新全部 dnodes 的全局配置参数。
|
2. 全局配置参数:全局配置参数要求各个 dnode 保持一致,所以您只可以使用 ALTER ALL DNODES 来更新全部 dnodes 的全局配置参数。
|
||||||
|
|
||||||
配置参数是否可以动态修改,有以下三种情况:
|
配置参数是否可以动态修改,有以下三种情况:
|
||||||
1. 支持动态修改 立即生效
|
1. 支持动态修改,立即生效
|
||||||
2. 支持动态修改 重启生效
|
2. 支持动态修改,重启生效
|
||||||
3. 不支持动态修改
|
3. 不支持动态修改
|
||||||
|
|
||||||
对于重启后生效的配置参数,您可以通过 SHOW VARIABLES 或 SHOW DNODE dnode_id VARIABLE 看到修改后的值,但是需要重启数据库服务才使其生效。
|
对于重启后生效的配置参数,您可以通过 `SHOW VARIABLES` 或 `SHOW DNODE dnode_id VARIABLE` 看到修改后的值,但是需要重启数据库服务才使其生效。
|
||||||
|
|
||||||
## 添加管理节点
|
## 添加管理节点
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ DROP MNODE ON DNODE dnode_id;
|
||||||
CREATE QNODE ON DNODE dnode_id;
|
CREATE QNODE ON DNODE dnode_id;
|
||||||
```
|
```
|
||||||
|
|
||||||
系统启动默认没有 QNODE,用户可以创建 QNODE 来实现计算和存储的分离。一个 DNODE 上只能创建一个 QNODE。一个 DNODE 的 `supportVnodes` 参数如果不为 0,同时又在其上创建上 QNODE,则在该 dnode 中既有负责存储管理的 vnode 又有负责查询计算的 qnode,如果还在该 dnode 上创建了 mnode,则一个 dnode 上最多三种逻辑节点都可以存在。但通过配置也可以使其彻底分离。将一个 dnode 的`supportVnodes`配置为 0,可以选择在其上创建 mnode 或者 qnode 中的一种,这样可以实现三种逻辑节点在物理上的彻底分离。
|
系统启动默认没有 QNODE,用户可以创建 QNODE 来实现计算和存储的分离。一个 dnode 上只能创建一个 QNODE。一个 dnode 的 `supportVnodes` 参数如果不为 0,同时又在其上创建上 QNODE,则在该 dnode 中既有负责存储管理的 vnode 又有负责查询计算的 qnode,如果还在该 dnode 上创建了 mnode,则一个 dnode 上最多三种逻辑节点都可以存在。但通过配置也可以使其彻底分离。将一个 dnode 的`supportVnodes`配置为 0,可以选择在其上创建 mnode 或者 qnode 中的一种,这样可以实现三种逻辑节点在物理上的彻底分离。
|
||||||
|
|
||||||
## 查看查询节点
|
## 查看查询节点
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ CREATE QNODE ON DNODE dnode_id;
|
||||||
SHOW QNODES;
|
SHOW QNODES;
|
||||||
```
|
```
|
||||||
|
|
||||||
列出集群中所有查询节点,包括 ID,及所在 DNODE。
|
列出集群中所有查询节点,包括 ID,及所在 dnode
|
||||||
|
|
||||||
## 删除查询节点
|
## 删除查询节点
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ SHOW QNODES;
|
||||||
DROP QNODE ON DNODE dnode_id;
|
DROP QNODE ON DNODE dnode_id;
|
||||||
```
|
```
|
||||||
|
|
||||||
删除 ID 为 dnode_id 的 DNODE 上的 QNODE,但并不会影响该 dnode 的状态。
|
删除 ID 为 dnode_id 的 dnode 上的 qnode,但并不会影响该 dnode 的状态。
|
||||||
|
|
||||||
## 查询集群状态
|
## 查询集群状态
|
||||||
|
|
||||||
|
@ -120,7 +120,10 @@ DROP QNODE ON DNODE dnode_id;
|
||||||
SHOW CLUSTER ALIVE;
|
SHOW CLUSTER ALIVE;
|
||||||
```
|
```
|
||||||
|
|
||||||
查询当前集群的状态是否可用,返回值: 0:不可用 1:完全可用 2:部分可用(集群中部分节点下线,但其它节点仍可以正常使用)
|
查询当前集群的状态是否可用,返回值
|
||||||
|
- 0:不可用
|
||||||
|
- 1:完全可用
|
||||||
|
- 2:部分可用(集群中部分节点下线,但其它节点仍可以正常使用)
|
||||||
|
|
||||||
## 修改客户端配置
|
## 修改客户端配置
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ title: 元数据
|
||||||
description: Information_Schema 数据库中存储了系统中所有的元数据信息
|
description: Information_Schema 数据库中存储了系统中所有的元数据信息
|
||||||
---
|
---
|
||||||
|
|
||||||
TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数据库元数据、数据库系统信息和状态的访问,例如数据库或表的名称,当前执行的 SQL 语句等。该数据库存储有关 TDengine 维护的所有其他数据库的信息。它包含多个只读表。实际上,这些表都是视图,而不是基表,因此没有与它们关联的文件。所以对这些表只能查询,不能进行 INSERT 等写入操作。`INFORMATION_SCHEMA` 数据库旨在以一种更一致的方式来提供对 TDengine 支持的各种 SHOW 语句(如 SHOW TABLES、SHOW DATABASES)所提供的信息的访问。与 SHOW 语句相比,使用 SELECT ... FROM INFORMATION_SCHEMA.tablename 具有以下优点:
|
TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数据库元数据、数据库系统信息和状态的访问,例如数据库或表的名称,当前执行的 SQL 语句等。该数据库存储有关 TDengine 维护的所有其他数据库的信息。它包含多个只读表。实际上,这些表都是视图,而不是基表,因此没有与它们关联的文件。所以对这些表只能查询,不能进行 INSERT 等写入操作。`INFORMATION_SCHEMA` 数据库旨在以一种更一致的方式来提供对 TDengine 支持的各种 SHOW 语句(如 SHOW TABLES、SHOW DATABASES)所提供的信息的访问。与 SHOW 语句相比,使用 `SELECT ... FROM INFORMATION_SCHEMA.tablename` 具有以下优点。
|
||||||
|
|
||||||
1. 可以使用 USE 语句将 INFORMATION_SCHEMA 设为默认数据库
|
1. 可以使用 USE 语句将 INFORMATION_SCHEMA 设为默认数据库
|
||||||
2. 可以使用 SELECT 语句熟悉的语法,只需要学习一些表名和列名
|
2. 可以使用 SELECT 语句熟悉的语法,只需要学习一些表名和列名
|
||||||
|
@ -15,7 +15,7 @@ TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数
|
||||||
:::info
|
:::info
|
||||||
|
|
||||||
- 由于 SHOW 语句已经被开发者熟悉和广泛使用,所以它们仍然被保留。
|
- 由于 SHOW 语句已经被开发者熟悉和广泛使用,所以它们仍然被保留。
|
||||||
- 系统表中的一些列可能是关键字,在查询时需要使用转义符'\`',例如查询数据库 test 有几个 VGROUP:
|
- 系统表中的一些列可能是关键字,在查询时需要使用转义符 '\`',例如查询数据库 test 有几个 VGROUP。
|
||||||
```sql
|
```sql
|
||||||
select `vgroups` from ins_databases where name = 'test';
|
select `vgroups` from ins_databases where name = 'test';
|
||||||
```
|
```
|
||||||
|
@ -177,7 +177,7 @@ TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数
|
||||||
| 5 | stable_name | VARCHAR(192) | 所属的超级表表名 |
|
| 5 | stable_name | VARCHAR(192) | 所属的超级表表名 |
|
||||||
| 6 | uid | BIGINT | 表 id |
|
| 6 | uid | BIGINT | 表 id |
|
||||||
| 7 | vgroup_id | INT | vgroup id |
|
| 7 | vgroup_id | INT | vgroup id |
|
||||||
| 8 | ttl | INT | 表的生命周期。需要注意,`ttl` 为 TDengine 关键字,作为列名使用时需要使用 ` 进行转义。 |
|
| 8 | ttl | INT | 表的生命周期。需要注意 `ttl` 为 TDengine 关键字,作为列名使用时需要使用 ` 进行转义。|
|
||||||
| 9 | table_comment | VARCHAR(1024) | 表注释 |
|
| 9 | table_comment | VARCHAR(1024) | 表注释 |
|
||||||
| 10 | type | VARCHAR(21) | 表类型 |
|
| 10 | type | VARCHAR(21) | 表类型 |
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数
|
||||||
| 1 | name | VARCHAR(24) | 用户名 |
|
| 1 | name | VARCHAR(24) | 用户名 |
|
||||||
| 2 | super | TINYINT | 用户是否为超级用户,1:是,0:否 |
|
| 2 | super | TINYINT | 用户是否为超级用户,1:是,0:否 |
|
||||||
| 3 | enable | TINYINT | 用户是否启用,1:是,0:否 |
|
| 3 | enable | TINYINT | 用户是否启用,1:是,0:否 |
|
||||||
| 4 | sysinfo | TINYINT | 用户是否可查看系统信息,1:是, 0:否 |
|
| 4 | sysinfo | TINYINT | 用户是否可查看系统信息,1:是,0:否 |
|
||||||
| 5 | create_time | TIMESTAMP | 创建时间 |
|
| 5 | create_time | TIMESTAMP | 创建时间 |
|
||||||
| 6 | allowed_host | VARCHAR(49152)| IP 白名单 |
|
| 6 | allowed_host | VARCHAR(49152)| IP 白名单 |
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数
|
||||||
| 10 | v3_status | VARCHAR(10) | 第三个成员的状态 |
|
| 10 | v3_status | VARCHAR(10) | 第三个成员的状态 |
|
||||||
| 11 | nfiles | INT | 此 vgroup 中数据/元数据文件的数量 |
|
| 11 | nfiles | INT | 此 vgroup 中数据/元数据文件的数量 |
|
||||||
| 12 | file_size | INT | 此 vgroup 中数据/元数据文件的大小 |
|
| 12 | file_size | INT | 此 vgroup 中数据/元数据文件的大小 |
|
||||||
| 13 | tsma | TINYINT | 此 vgroup 是否专用于 Time-range-wise SMA,1: 是, 0: 否 |
|
| 13 | tsma | TINYINT | 此 vgroup 是否专用于 Time-range-wise SMA,1: 是,0: 否 |
|
||||||
|
|
||||||
## INS_CONFIGS
|
## INS_CONFIGS
|
||||||
|
|
||||||
|
@ -333,14 +333,14 @@ TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数
|
||||||
|:----|:-----------|:------------|:--------|
|
|:----|:-----------|:------------|:--------|
|
||||||
| 1 | db_name | VARCHAR(32) | 数据库名称 |
|
| 1 | db_name | VARCHAR(32) | 数据库名称 |
|
||||||
| 2 | vgroup_id | INT | vgroup 的 ID |
|
| 2 | vgroup_id | INT | vgroup 的 ID |
|
||||||
| 3 | wal | BIGINT | wal 文件大小, 单位为 K |
|
| 3 | wal | BIGINT | wal 文件大小,单位为 KB |
|
||||||
| 4 | data1 | BIGINT | 一级存储上数据文件的大小,单位为KB |
|
| 4 | data1 | BIGINT | 一级存储上数据文件的大小,单位为 KB |
|
||||||
| 5 | data2 | BIGINT | 二级存储上数据文件的大小,单位为 KB |
|
| 5 | data2 | BIGINT | 二级存储上数据文件的大小,单位为 KB |
|
||||||
| 6 | data3 | BIGINT | 三级存储上数据文件的大小, 单位为KB |
|
| 6 | data3 | BIGINT | 三级存储上数据文件的大小,单位为 KB |
|
||||||
| 7 | cache_rdb | BIGINT | last/last_row 文件的大小,单位为KB |
|
| 7 | cache_rdb | BIGINT | last/last_row 文件的大小,单位为 KB |
|
||||||
| 8 | table_meta | BIGINT | meta 文件的大小, 单位为KB |
|
| 8 | table_meta | BIGINT | meta 文件的大小,单位为 KB |
|
||||||
| 9 | s3 | BIGINT | s3 上占用的大小, 单位为KB |
|
| 9 | s3 | BIGINT | s3 上占用的大小,单位为 KB |
|
||||||
| 10 | raw_data | BIGINT | 预估的原始数据的大小, 单位为KB |
|
| 10 | raw_data | BIGINT | 预估的原始数据的大小,单位为 KB |
|
||||||
|
|
||||||
|
|
||||||
## INS_FILESETS
|
## INS_FILESETS
|
||||||
|
|
|
@ -20,7 +20,7 @@ SHOW APPS;
|
||||||
SHOW CLUSTER;
|
SHOW CLUSTER;
|
||||||
```
|
```
|
||||||
|
|
||||||
显示当前集群的信息
|
显示当前集群的信息。
|
||||||
|
|
||||||
## SHOW CLUSTER ALIVE
|
## SHOW CLUSTER ALIVE
|
||||||
|
|
||||||
|
@ -28,17 +28,22 @@ SHOW CLUSTER;
|
||||||
SHOW CLUSTER ALIVE;
|
SHOW CLUSTER ALIVE;
|
||||||
```
|
```
|
||||||
|
|
||||||
查询当前集群的状态是否可用,返回值: 0:不可用 1:完全可用 2:部分可用(集群中部分节点下线,但其它节点仍可以正常使用)
|
查询当前集群的状态是否可用,返回值如下
|
||||||
|
- 0:不可用
|
||||||
|
- 1:完全可用
|
||||||
|
- 2:部分可用(集群中部分节点下线,但其它节点仍可以正常使用)
|
||||||
|
|
||||||
## SHOW CLUSTER MACHINES
|
## SHOW CLUSTER MACHINES
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SHOW CLUSTER MACHINES; // 从 TDengine 3.2.3.0 版本开始支持
|
SHOW CLUSTER MACHINES;
|
||||||
```
|
```
|
||||||
|
|
||||||
显示集群的机器码等信息。
|
显示集群的机器码等信息。
|
||||||
|
|
||||||
注:企业版独有
|
备注
|
||||||
|
- 企业版功能
|
||||||
|
- v3.2.3.0 开始支持
|
||||||
|
|
||||||
## SHOW CONNECTIONS
|
## SHOW CONNECTIONS
|
||||||
|
|
||||||
|
@ -70,7 +75,7 @@ SHOW CREATE DATABASE db_name;
|
||||||
SHOW CREATE STABLE [db_name.]stb_name;
|
SHOW CREATE STABLE [db_name.]stb_name;
|
||||||
```
|
```
|
||||||
|
|
||||||
显示 tb_name 指定的超级表的创建语句
|
显示 tb_name 指定的超级表的创建语句。
|
||||||
|
|
||||||
## SHOW CREATE TABLE
|
## SHOW CREATE TABLE
|
||||||
|
|
||||||
|
@ -114,7 +119,8 @@ SHOW GRANTS FULL; // 从 TDengine 3.2.3.0 版本开始支持
|
||||||
|
|
||||||
显示企业版许可授权的信息。
|
显示企业版许可授权的信息。
|
||||||
|
|
||||||
注:企业版独有
|
备注
|
||||||
|
- 企业版功能
|
||||||
|
|
||||||
## SHOW INDEXES
|
## SHOW INDEXES
|
||||||
|
|
||||||
|
@ -128,10 +134,10 @@ SHOW INDEXES FROM [db_name.]tbl_name;
|
||||||
## SHOW LOCAL VARIABLES
|
## SHOW LOCAL VARIABLES
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SHOW LOCAL VARIABLES;
|
SHOW LOCAL VARIABLES [like pattern];
|
||||||
```
|
```
|
||||||
|
|
||||||
显示当前客户端配置参数的运行值。
|
显示当前客户端配置参数的运行值,可使用 like pattern 根据 name 进行过滤。
|
||||||
|
|
||||||
## SHOW MNODES
|
## SHOW MNODES
|
||||||
|
|
||||||
|
@ -155,7 +161,7 @@ SHOW QNODES;
|
||||||
SHOW QUERIES;
|
SHOW QUERIES;
|
||||||
```
|
```
|
||||||
|
|
||||||
显示当前系统中正在进行的写入(更新)/查询/删除。(由于内部 API 命名原因,所以统称 QUERIES)
|
显示当前系统中正在进行的写入(更新)、查询、删除。(由于内部 API 命名原因,所以统称 QUERIES)
|
||||||
|
|
||||||
## SHOW SCORES
|
## SHOW SCORES
|
||||||
|
|
||||||
|
@ -165,7 +171,8 @@ SHOW SCORES;
|
||||||
|
|
||||||
显示系统被许可授权的容量的信息。
|
显示系统被许可授权的容量的信息。
|
||||||
|
|
||||||
注:企业版独有。
|
备注
|
||||||
|
- 企业版功能
|
||||||
|
|
||||||
## SHOW STABLES
|
## SHOW STABLES
|
||||||
|
|
||||||
|
@ -219,11 +226,11 @@ SHOW TABLE DISTRIBUTED table_name;
|
||||||
|
|
||||||
_block_dist: Total_Blocks=[5] Total_Size=[93.65 KB] Average_size=[18.73 KB] Compression_Ratio=[23.98 %]
|
_block_dist: Total_Blocks=[5] Total_Size=[93.65 KB] Average_size=[18.73 KB] Compression_Ratio=[23.98 %]
|
||||||
|
|
||||||
Total_Blocks: 表 d0 占用的 block 个数为 5 个
|
Total_Blocks:表 d0 占用的 block 个数为 5 个
|
||||||
|
|
||||||
Total_Size: 表 d0 所有 block 在文件中占用的大小为 93.65 KB
|
Total_Size: 表 d0 所有 block 在文件中占用的大小为 93.65 KB
|
||||||
|
|
||||||
Average_size: 平均每个 block 在文件中占用的空间大小为 18.73 KB
|
Average_size:平均每个 block 在文件中占用的空间大小为 18.73 KB
|
||||||
|
|
||||||
Compression_Ratio: 数据压缩率 23.98%
|
Compression_Ratio: 数据压缩率 23.98%
|
||||||
|
|
||||||
|
@ -232,7 +239,7 @@ Compression_Ratio: 数据压缩率 23.98%
|
||||||
|
|
||||||
_block_dist: Total_Rows=[20000] Inmem_Rows=[0] MinRows=[3616] MaxRows=[4096] Average_Rows=[4000]
|
_block_dist: Total_Rows=[20000] Inmem_Rows=[0] MinRows=[3616] MaxRows=[4096] Average_Rows=[4000]
|
||||||
|
|
||||||
Total_Rows: 统计表 d0 的存储在磁盘上行数 20000 行(该数值仅供参考,不是精确的行数。获得精确的行数需要使用 count 函数)
|
Total_Rows:统计表 d0 的存储在磁盘上行数 20000 行(该数值仅供参考,不是精确的行数。获得精确的行数需要使用 count 函数)
|
||||||
|
|
||||||
Inmem_Rows: 存储在写缓存中的数据行数(没有落盘),0 行表示内存缓存中没有数据
|
Inmem_Rows: 存储在写缓存中的数据行数(没有落盘),0 行表示内存缓存中没有数据
|
||||||
|
|
||||||
|
@ -247,7 +254,7 @@ Average_Rows: 每个 BLOCK 中的平均行数,此时为 4000 行
|
||||||
|
|
||||||
_block_dist: Total_Tables=[1] Total_Files=[2] Total_Vgroups=[1]
|
_block_dist: Total_Tables=[1] Total_Files=[2] Total_Vgroups=[1]
|
||||||
|
|
||||||
Total_Tables: 子表的个数,这里为 1
|
Total_Tables: 子表的个数,这里为 1
|
||||||
|
|
||||||
Total_Files: 表数据被分别保存的数据文件数量,这里是 2 个文件
|
Total_Files: 表数据被分别保存的数据文件数量,这里是 2 个文件
|
||||||
|
|
||||||
|
@ -281,7 +288,7 @@ Query OK, 24 row(s) in set (0.002444s)
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
上面是块中包含数据行数的块儿分布情况图,这里的 0100 0299 0498 … 表示的是每个块中包含的数据行数,上面的意思就是这个表的 5 个块,分布在 3483 ~3681 行的块有 1 个,占整个块的 20%,分布在 3881 ~ 4096(最大行数)的块数为 4 个,占整个块的 80%, 其它区域内分布块数为 0。
|
上面是块中包含数据行数的块儿分布情况图,这里的 `0100 0299 0498 …` 表示的是每个块中包含的数据行数,上面的意思就是这个表的 5 个块,分布在 `3483 ~ 3681` 行的块有 1 个,占整个块的 20%,分布在 `3881 ~ 4096`(最大行数)的块数为 4 个,占整个块的 80%, 其它区域内分布块数为 0。
|
||||||
|
|
||||||
需要注意,这里只会显示 data 文件中数据块的信息,stt 文件中的数据的信息不会被显示。
|
需要注意,这里只会显示 data 文件中数据块的信息,stt 文件中的数据的信息不会被显示。
|
||||||
|
|
||||||
|
@ -306,9 +313,10 @@ SHOW TOPICS;
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SHOW TRANSACTIONS;
|
SHOW TRANSACTIONS;
|
||||||
|
SHOW TRANSACTION [tranaction_id];
|
||||||
```
|
```
|
||||||
|
|
||||||
显示当前系统中正在执行的事务的信息(该事务仅针对除普通表以外的元数据级别)
|
显示当前系统中正在执行的所有或者某一个事务的信息(该事务仅针对除普通表以外的元数据级别)。
|
||||||
|
|
||||||
## SHOW USERS
|
## SHOW USERS
|
||||||
|
|
||||||
|
@ -321,11 +329,12 @@ SHOW USERS;
|
||||||
## SHOW CLUSTER VARIABLES(3.0.1.6 之前为 SHOW VARIABLES)
|
## SHOW CLUSTER VARIABLES(3.0.1.6 之前为 SHOW VARIABLES)
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SHOW CLUSTER VARIABLES;
|
SHOW CLUSTER VARIABLES [like pattern];;
|
||||||
SHOW DNODE dnode_id VARIABLES;
|
SHOW DNODE dnode_id VARIABLES [like pattern];;
|
||||||
```
|
```
|
||||||
|
|
||||||
显示当前系统中各节点需要相同的配置参数的运行值,也可以指定 DNODE 来查看其的配置参数。
|
显示当前系统中各节点需要相同的配置参数的运行值,也可以指定 DNODE 来查看其的配置参数。
|
||||||
|
可使用 like pattern 根据 name 进行过滤。
|
||||||
|
|
||||||
## SHOW VGROUPS
|
## SHOW VGROUPS
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ CREATE USER user_name PASS 'password' [SYSINFO {1|0}] [CREATEDB {1|0}];
|
||||||
|
|
||||||
`SYSINFO` 表示该用户是否能够查看系统信息。`1` 表示可以查看,`0` 表示无权查看。系统信息包括服务配置、dnode、vnode、存储等信息。缺省值为 `1`。
|
`SYSINFO` 表示该用户是否能够查看系统信息。`1` 表示可以查看,`0` 表示无权查看。系统信息包括服务配置、dnode、vnode、存储等信息。缺省值为 `1`。
|
||||||
|
|
||||||
`CREATEDB` 表示该用户是否能够创建数据库。`1` 表示可以创建,`0` 表示无权创建。缺省值为 `0`。// 从 TDengine 企业版 3.3.2.0 开始支持
|
`CREATEDB` 表示该用户是否能够创建数据库。`1` 表示可以创建,`0` 表示无权创建。缺省值为 `0`。从企业版 v3.3.2.0 开始支持。
|
||||||
|
|
||||||
在下面的示例中,我们创建一个密码为 `abc123!@#` 且可以查看系统信息的用户。
|
在下面的示例中,我们创建一个密码为 `abc123!@#` 且可以查看系统信息的用户。
|
||||||
|
|
||||||
|
@ -76,12 +76,12 @@ alter_user_clause: {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- PASS: 修改密码,后跟新密码
|
- PASS:修改密码,后跟新密码
|
||||||
- ENABLE: 启用或禁用该用户,`1` 表示启用,`0` 表示禁用
|
- ENABLE:启用或禁用该用户,`1` 表示启用,`0` 表示禁用
|
||||||
- SYSINFO: 允许或禁止查看系统信息,`1` 表示允许,`0` 表示禁止
|
- SYSINFO:允许或禁止查看系统信息,`1` 表示允许,`0` 表示禁止
|
||||||
- CREATEDB: 允许或禁止创建数据库,`1` 表示允许,`0` 表示禁止。// 从 TDengine 企业版 3.3.2.0 开始支持
|
- CREATEDB:允许或禁止创建数据库,`1` 表示允许,`0` 表示禁止。从企业版 v3.3.2.0 开始支持。
|
||||||
|
|
||||||
下面的示例禁用了名为 `test` 的用户:
|
下面的示例禁用了名为 `test` 的用户。
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
taos> alter user test enable 0;
|
taos> alter user test enable 0;
|
||||||
|
|
|
@ -33,7 +33,6 @@ priv_level : {
|
||||||
对数据库的访问权限包含读和写两种权限,它们可以被分别授予,也可以被同时授予。
|
对数据库的访问权限包含读和写两种权限,它们可以被分别授予,也可以被同时授予。
|
||||||
|
|
||||||
说明
|
说明
|
||||||
|
|
||||||
- priv_level 格式中 "." 之前为数据库名称,"." 之后为表名称,意思为表级别的授权控制。如果 "." 之后为 "\*",意为 "." 前所指定的数据库中的所有表
|
- priv_level 格式中 "." 之前为数据库名称,"." 之后为表名称,意思为表级别的授权控制。如果 "." 之后为 "\*",意为 "." 前所指定的数据库中的所有表
|
||||||
- "dbname.\*" 意思是名为 "dbname" 的数据库中的所有表
|
- "dbname.\*" 意思是名为 "dbname" 的数据库中的所有表
|
||||||
- "\*.\*" 意思是所有数据库名中的所有表
|
- "\*.\*" 意思是所有数据库名中的所有表
|
||||||
|
@ -43,9 +42,9 @@ priv_level : {
|
||||||
对 root 用户和普通用户的权限的说明如下表
|
对 root 用户和普通用户的权限的说明如下表
|
||||||
|
|
||||||
| 用户 | 描述 | 权限说明 |
|
| 用户 | 描述 | 权限说明 |
|
||||||
| -------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| -------- | --------------------------------- | -- |
|
||||||
| 超级用户 | 只有 root 是超级用户 | DB 外部 所有操作权限,例如user、dnode、udf、qnode等的CRUD DB 权限,包括 创建 删除 更新,例如修改 Option,移动 Vgruop等 读 写 Enable/Disable 用户 |
|
| 超级用户 | 只有 root 是超级用户 |<br/>DB 外部:所有操作权限,例如 user、dnode、udf、qnode 等的 CRUD <br/>DB 权限:包括创建、删除、修改 Option、移动 Vgruop、读、写、Enable/Disable 用户 |
|
||||||
| 普通用户 | 除 root 以外的其它用户均为普通用户 | 在可读的 DB 中,普通用户可以进行读操作 select describe show subscribe 在可写 DB 的内部,用户可以进行写操作: 创建、删除、修改 超级表 创建、删除、修改 子表 创建、删除、修改 topic 写入数据 被限制系统信息时,不可进行如下操作 show dnode、mnode、vgroups、qnode、snode 修改用户包括自身密码 show db时只能看到自己的db,并且不能看到vgroups、副本、cache等信息 无论是否被限制系统信息,都可以 管理 udf 可以创建 DB 自己创建的 DB 具备所有权限 非自己创建的 DB ,参照读、写列表中的权限 |
|
| 普通用户 | 除 root 以外的其它用户均为普通用户 | <br/>在可读的 DB 中:普通用户可以进行读操作 select、describe、show、subscribe <br/>在可写 DB 的内部,用户可以进行写操作,创建、删除、修改超级表,创建、删除、修改子表,创建、删除、修改 topic。写入数据 <br/>被限制系统信息时,不可进行如下操作 show dnode、mnode、vgroups、qnode、snode、修改用户包括自身密码、`show db` 时只能看到自己的 db,并且不能看到 vgroups、副本、cache等信息 <br/>无论是否被限制系统信息,都可以管理 udf,可以创建 DB、自己创建的 DB 具备所有权限、非自己创建的 DB,参照读、写列表中的权限 |
|
||||||
|
|
||||||
## 消息订阅授权
|
## 消息订阅授权
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ REVOKE SUBSCRIBE ON topic_name FROM user_name
|
||||||
|
|
||||||
## 基于标签的授权(表级授权)
|
## 基于标签的授权(表级授权)
|
||||||
|
|
||||||
从 TDengine 3.0.5.0 开始,我们支持按标签授权某个超级表中部分特定的子表。具体的 SQL 语法如下。
|
从 v3.0.5.0 开始,我们支持按标签授权某个超级表中部分特定的子表。具体的 SQL 语法如下。
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
GRANT privileges ON priv_level [WITH tag_condition] TO user_name
|
GRANT privileges ON priv_level [WITH tag_condition] TO user_name
|
||||||
|
@ -111,7 +110,7 @@ priv_level : {
|
||||||
下表列出了在不同的数据库授权和表级授权的组合下产生的实际权限。
|
下表列出了在不同的数据库授权和表级授权的组合下产生的实际权限。
|
||||||
|
|
||||||
| | **表无授权** | **表读授权** | **表读授权有标签条件** | **表写授权** | **表写授权有标签条件** |
|
| | **表无授权** | **表读授权** | **表读授权有标签条件** | **表写授权** | **表写授权有标签条件** |
|
||||||
| ---------------- | ---------------- | ---------------------------------------- | ------------------------------------------------------------ | ---------------------------------------- | ---------------------------------------------------------- |
|
| -------------- | ------------- | --------------------------------- | ------------------------------------------------- | ---------------------------------- | -------------------- |
|
||||||
| **数据库无授权** | 无授权 | 对此表有读权限,对数据库下的其他表无权限 | 对此表符合标签权限的子表有读权限,对数据库下的其他表无权限 | 对此表有写权限,对数据库下的其他表无权限 | 对此表符合标签权限的子表有写权限,对数据库下的其他表无权限 |
|
| **数据库无授权** | 无授权 | 对此表有读权限,对数据库下的其他表无权限 | 对此表符合标签权限的子表有读权限,对数据库下的其他表无权限 | 对此表有写权限,对数据库下的其他表无权限 | 对此表符合标签权限的子表有写权限,对数据库下的其他表无权限 |
|
||||||
| **数据库读授权** | 对所有表有读权限 | 对所有表有读权限 | 对此表符合标签权限的子表有读权限,对数据库下的其他表有读权限 | 对此表有写权限,对所有表有读权限 | 对此表符合标签权限的子表有写权限,所有表有读权限 |
|
| **数据库读授权** | 对所有表有读权限 | 对所有表有读权限 | 对此表符合标签权限的子表有读权限,对数据库下的其他表有读权限 | 对此表有写权限,对所有表有读权限 | 对此表符合标签权限的子表有写权限,所有表有读权限 |
|
||||||
| **数据库写授权** | 对所有表有写权限 | 对此表有读权限,对所有表有写权限 | 对此表符合标签权限的子表有读权限,对所有表有写权限 | 对所有表有写权限 | 对此表符合标签权限的子表有写权限,数据库下的其他表有写权限 |
|
| **数据库写授权** | 对所有表有写权限 | 对此表有读权限,对所有表有写权限 | 对此表符合标签权限的子表有读权限,对所有表有写权限 | 对所有表有写权限 | 对此表符合标签权限的子表有写权限,数据库下的其他表有写权限 |
|
||||||
|
|
|
@ -7,7 +7,7 @@ description: 使用 UDF 的详细指南
|
||||||
除了 TDengine 的内置函数以外,用户还可以编写自己的函数逻辑并加入 TDengine 系统中。
|
除了 TDengine 的内置函数以外,用户还可以编写自己的函数逻辑并加入 TDengine 系统中。
|
||||||
## 创建 UDF
|
## 创建 UDF
|
||||||
|
|
||||||
用户可以通过 SQL 指令在系统中加载客户端所在主机上的 UDF 函数库(不能通过 RESTful 接口或 HTTP 管理界面来进行这一过程)。一旦创建成功,则当前 TDengine 集群的所有用户都可以在 SQL 指令中使用这些函数。UDF 存储在系统的 MNode 节点上,因此即使重启 TDengine 系统,已经创建的 UDF 也仍然可用。
|
用户可以通过 SQL 指令在系统中加载客户端所在主机上的 UDF 函数库(不能通过 RESTful 接口或 HTTP 管理界面来进行这一过程)。一旦创建成功,则当前 TDengine 集群的所有用户都可以在 SQL 指令中使用这些函数。UDF 存储在系统的 mnode 节点上,因此即使重启 TDengine 系统,已经创建的 UDF 也仍然可用。
|
||||||
|
|
||||||
在创建 UDF 时,需要区分标量函数和聚合函数。如果创建时声明了错误的函数类别,则可能导致通过 SQL 指令调用函数时出错。此外,用户需要保证输入数据类型与 UDF 程序匹配,UDF 输出数据类型与 OUTPUTTYPE 匹配。
|
在创建 UDF 时,需要区分标量函数和聚合函数。如果创建时声明了错误的函数类别,则可能导致通过 SQL 指令调用函数时出错。此外,用户需要保证输入数据类型与 UDF 程序匹配,UDF 输出数据类型与 OUTPUTTYPE 匹配。
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ description: 使用 UDF 的详细指南
|
||||||
```sql
|
```sql
|
||||||
CREATE [OR REPLACE] FUNCTION function_name AS library_path OUTPUTTYPE output_type [LANGUAGE 'C|Python'];
|
CREATE [OR REPLACE] FUNCTION function_name AS library_path OUTPUTTYPE output_type [LANGUAGE 'C|Python'];
|
||||||
```
|
```
|
||||||
- OR REPLACE: 如果函数已经存在,会修改已有的函数属性。
|
- OR REPLACE:如果函数已经存在,会修改已有的函数属性。
|
||||||
- function_name:标量函数未来在 SQL 中被调用时的函数名;
|
- function_name:标量函数未来在 SQL 中被调用时的函数名。
|
||||||
- LANGUAGE 'C|Python':函数编程语言,目前支持C语言和Python语言。 如果这个从句忽略,编程语言是C语言
|
- LANGUAGE 'C|Python':函数编程语言,目前支持 C 语言和 Python 语言。如果这个从句忽略,编程语言是 C 语言。
|
||||||
- library_path:如果编程语言是C,路径是包含 UDF 函数实现的动态链接库的库文件绝对路径(指的是库文件在当前客户端所在主机上的保存路径,通常是指向一个 .so 文件)。如果编程语言是 Python,路径是包含 UDF 函数实现的 Python 文件路径。这个路径需要用英文单引号或英文双引号括起来;
|
- library_path:如果编程语言是C,路径是包含 UDF 函数实现的动态链接库的库文件绝对路径(指的是库文件在当前客户端所在主机上的保存路径,通常是指向一个 .so 文件)。如果编程语言是 Python,路径是包含 UDF 函数实现的 Python 文件路径。这个路径需要用英文单引号或英文双引号括起来;
|
||||||
- output_type:此函数计算结果的数据类型名称;
|
- output_type:此函数计算结果的数据类型名称。
|
||||||
|
|
||||||
例如,如下语句可以把 libbitand.so 创建为系统中可用的 UDF:
|
例如,如下语句可以把 libbitand.so 创建为系统中可用的 UDF:
|
||||||
|
|
||||||
|
@ -36,14 +36,14 @@ CREATE [OR REPLACE] FUNCTION function_name AS library_path OUTPUTTYPE output_typ
|
||||||
```sql
|
```sql
|
||||||
CREATE [OR REPLACE] AGGREGATE FUNCTION function_name AS library_path OUTPUTTYPE output_type [ BUFSIZE buffer_size ] [LANGUAGE 'C|Python'];
|
CREATE [OR REPLACE] AGGREGATE FUNCTION function_name AS library_path OUTPUTTYPE output_type [ BUFSIZE buffer_size ] [LANGUAGE 'C|Python'];
|
||||||
```
|
```
|
||||||
- OR REPLACE: 如果函数已经存在,会修改已有的函数属性。
|
- OR REPLACE:如果函数已经存在,会修改已有的函数属性。
|
||||||
- function_name:聚合函数未来在 SQL 中被调用时的函数名,必须与函数实现中 udfNormalFunc 的实际名称一致;
|
- function_name:聚合函数未来在 SQL 中被调用时的函数名,必须与函数实现中 udfNormalFunc 的实际名称一致;
|
||||||
- LANGUAGE 'C|Python':函数编程语言,目前支持 C 语言和 Python 语言(v3.7+)。
|
- LANGUAGE 'C|Python':函数编程语言,目前支持 C 语言和 Python 语言(v3.7+)。
|
||||||
- library_path:如果编程语言是C,路径是包含 UDF 函数实现的动态链接库的库文件绝对路径(指的是库文件在当前客户端所在主机上的保存路径,通常是指向一个 .so 文件)。如果编程语言是Python,路径是包含 UDF 函数实现的Python文件路径。这个路径需要用英文单引号或英文双引号括起来;;
|
- library_path:如果编程语言是C,路径是包含 UDF 函数实现的动态链接库的库文件绝对路径(指的是库文件在当前客户端所在主机上的保存路径,通常是指向一个 `.so` 文件)。如果编程语言是 Python,路径是包含 UDF 函数实现的 Python 文件路径。这个路径需要用英文单引号或英文双引号括起来;
|
||||||
- output_type:此函数计算结果的数据类型名称;
|
- output_type:此函数计算结果的数据类型名称;
|
||||||
- buffer_size:中间计算结果的缓冲区大小,单位是字节。如果不使用可以不设置。
|
- buffer_size:中间计算结果的缓冲区大小,单位是字节。如果不使用可以不设置。
|
||||||
|
|
||||||
例如,如下语句可以把 libl2norm.so 创建为系统中可用的 UDF:
|
例如,如下语句可以把 libl2norm.so 创建为系统中可用的 UDF。
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
CREATE AGGREGATE FUNCTION l2norm AS "/home/taos/udf_example/libl2norm.so" OUTPUTTYPE DOUBLE bufsize 8;
|
CREATE AGGREGATE FUNCTION l2norm AS "/home/taos/udf_example/libl2norm.so" OUTPUTTYPE DOUBLE bufsize 8;
|
||||||
|
@ -57,25 +57,26 @@ CREATE [OR REPLACE] AGGREGATE FUNCTION function_name AS library_path OUTPUTTYPE
|
||||||
|
|
||||||
## 管理 UDF
|
## 管理 UDF
|
||||||
|
|
||||||
- 删除指定名称的用户定义函数:
|
- 删除指定名称的用户定义函数。
|
||||||
```
|
```
|
||||||
DROP FUNCTION function_name;
|
DROP FUNCTION function_name;
|
||||||
```
|
```
|
||||||
|
|
||||||
- function_name:此参数的含义与 CREATE 指令中的 function_name 参数一致,也即要删除的函数的名字,例如bit_and, l2norm
|
- function_name:此参数的含义与 CREATE 指令中的 function_name 参数一致,也即要删除的函数的名字,例如 bit_and、l2norm
|
||||||
```sql
|
```sql
|
||||||
DROP FUNCTION bit_and;
|
DROP FUNCTION bit_and;
|
||||||
```
|
```
|
||||||
- 显示系统中当前可用的所有 UDF:
|
|
||||||
|
- 显示系统中当前可用的所有 UDF。
|
||||||
```sql
|
```sql
|
||||||
SHOW FUNCTIONS;
|
SHOW FUNCTIONS;
|
||||||
```
|
```
|
||||||
|
|
||||||
## 调用 UDF
|
## 调用 UDF
|
||||||
|
|
||||||
在 SQL 指令中,可以直接以在系统中创建 UDF 时赋予的函数名来调用用户定义函数。例如:
|
在 SQL 指令中,可以直接以在系统中创建 UDF 时赋予的函数名来调用用户定义函数。
|
||||||
```sql
|
```sql
|
||||||
SELECT bit_and(c1,c2) FROM table;
|
SELECT bit_and(c1,c2) FROM table;
|
||||||
```
|
```
|
||||||
|
|
||||||
表示对表 table 上名为 c1, c2 的数据列调用名为 bit_and 的用户定义函数。SQL 指令中用户定义函数可以配合 WHERE 等查询特性来使用。
|
表示对表 table 上名为 c1、c2 的数据列调用名为 bit_and 的用户定义函数。SQL 指令中用户定义函数可以配合 WHERE 等查询特性来使用。
|
||||||
|
|
|
@ -4,8 +4,9 @@ title: 窗口预聚集
|
||||||
description: 窗口预聚集使用说明
|
description: 窗口预聚集使用说明
|
||||||
---
|
---
|
||||||
|
|
||||||
在大数据量场景下, 经常需要查询某段时间内的汇总结果, 当历史数据变多或者时间范围变大时, 查询时间也会相应增加. 通过预聚集的方式可以将计算结果提前存储下来, 后续查询可以直接读取聚集结果, 而不需要扫描原始数据, 如当前Block内的SMA (Small Materialized Aggregates)信息.
|
在大数据量场景下,经常需要查询某段时间内的汇总结果,当历史数据变多或者时间范围变大时,查询时间也会相应增加。通过预聚集的方式可以将计算结果提前存储下来,后续查询可以直接读取聚集结果,而不需要扫描原始数据,如当前 Block 内的 SMA (Small Materialized Aggregates)信息。
|
||||||
Block内的SMA信息粒度较小, 若查询时间范围是日,月甚至年时, Block的数量将会很多, 因此TSMA (Time-Range Small Materialized Aggregates)支持用户指定时间窗口进行预聚集. 通过对固定时间窗口内的数据进行预计算, 并将计算结果存储下来, 查询时通过查询预计算结果以提高查询性能。
|
|
||||||
|
Block 内的 SMA 信息粒度较小,若查询时间范围是日,月甚至年时,Block 的数量将会很多,因此 TSMA (Time-Range Small Materialized Aggregates)支持用户指定时间窗口进行预聚集。通过对固定时间窗口内的数据进行预计算,并将计算结果存储下来,查询时通过查询预计算结果以提高查询性能。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ Block内的SMA信息粒度较小, 若查询时间范围是日,月甚至年时, B
|
||||||
```sql
|
```sql
|
||||||
-- 创建基于超级表或普通表的 tsma
|
-- 创建基于超级表或普通表的 tsma
|
||||||
CREATE TSMA tsma_name ON [dbname.]table_name FUNCTION (func_name(func_param) [, ...] ) INTERVAL(time_duration);
|
CREATE TSMA tsma_name ON [dbname.]table_name FUNCTION (func_name(func_param) [, ...] ) INTERVAL(time_duration);
|
||||||
|
|
||||||
-- 创建基于小窗口 tsma 的大窗口 tsma
|
-- 创建基于小窗口 tsma 的大窗口 tsma
|
||||||
CREATE RECURSIVE TSMA tsma_name ON [db_name.]tsma_name1 INTERVAL(time_duration);
|
CREATE RECURSIVE TSMA tsma_name ON [db_name.]tsma_name1 INTERVAL(time_duration);
|
||||||
|
|
||||||
|
@ -21,19 +23,19 @@ time_duration:
|
||||||
number unit
|
number unit
|
||||||
```
|
```
|
||||||
|
|
||||||
创建 TSMA 时需要指定 TSMA 名字, 表名字, 函数列表以及窗口大小. 当基于一个已经存在的 TSMA 创建新的 TSMA 时, 需要使用 `RECURSIVE` 关键字但不能指定 `FUNCTION()`, 新创建的 TSMA 已有 TSMA 拥有相同的函数列表, 且此种情况下所指定的 INTERVAL 必须至少为所基于的 TSMA 窗口长度的整数倍, 并且天不能基于2h或3h建立, 只能基于1h建立, 月也只能基于1d而非2d,3d建立。
|
创建 TSMA 时需要指定 TSMA 名字,表名字,函数列表以及窗口大小。当基于一个已经存在的 TSMA 创建新的 TSMA 时,需要使用 `RECURSIVE` 关键字但不能指定 `FUNCTION()`,新创建的 TSMA 已有 TSMA 拥有相同的函数列表,且此种情况下所指定的 INTERVAL 必须至少为所基于的 TSMA 窗口长度的整数倍,并且天不能基于 2h 或 3h 建立,只能基于 1h 建立,月也只能基于 1d 而非 2d、3d 建立。
|
||||||
|
|
||||||
其中 TSMA 命名规则与表名字类似, 长度最大限制为表名长度限制减去输出表后缀长度, 表名长度限制为193, 输出表后缀为`_tsma_res_stb_`, TSMA 名字最大长度为178.
|
其中 TSMA 命名规则与表名字类似,长度最大限制为表名长度限制减去输出表后缀长度,表名长度限制为 193,输出表后缀为`_tsma_res_stb_`,TSMA 名字最大长度为 178。
|
||||||
|
|
||||||
TSMA只能基于超级表和普通表创建, 不能基于子表创建.
|
TSMA 只能基于超级表和普通表创建,不能基于子表创建。
|
||||||
|
|
||||||
函数列表中只能指定支持的聚集函数(见下文), 并且函数参数必须为1个, 即使当前函数支持多个参数, 函数参数内必须为普通列名, 不能为标签列. 函数列表中完全相同的函数和列会被去重, 如同时创建两个avg(c1), 则只会计算一个输出. TSMA 计算时将会把所有`函数中间结果`都输出到另一张超级表中, 输出超级表还包含了原始表的所有tag列. 函数列表中函数个数最多支持创建表最大列个数(包括tag列)减去 TSMA 计算附加的四列, 分别为`_wstart`, `_wend`, `_wduration`, 以及一个新增tag列 `tbname`, 再减去原始表的tag列数. 若列个数超出限制, 会报`Too many columns`错误.
|
函数列表中只能指定支持的聚集函数(见下文),并且函数参数必须为 1 个,即使当前函数支持多个参数,函数参数内必须为普通列名,不能为标签列。函数列表中完全相同的函数和列会被去重,如同时创建两个 avg(c1),则只会计算一个输出。TSMA 计算时将会把所有 `函数中间结果` 都输出到另一张超级表中,输出超级表还包含了原始表的所有 tag 列。函数列表中函数个数最多支持创建表最大列个数(包括 tag 列)减去 TSMA 计算附加的四列,分别为 `_wstart`、`_wend`、`_wduration`,以及一个新增 tag 列 `tbname`,再减去原始表的 tag 列数。若列个数超出限制,会报 `Too many columns` 错误。
|
||||||
|
|
||||||
由于TSMA输出为一张超级表, 因此输出表的行长度受最大行长度限制, 不同函数的`中间结果`大小各异, 一般都大于原始数据大小, 若输出表的行长度大于最大行长度限制, 将会报`Row length exceeds max length`错误. 此时需要减少函数个数或者将常用的函数进行分组拆分到多个TSMA中.
|
由于 TSMA 输出为一张超级表,因此输出表的行长度受最大行长度限制,不同函数的 `中间结果` 大小各异,一般都大于原始数据大小,若输出表的行长度大于最大行长度限制,将会报 `Row length exceeds max length` 错误。此时需要减少函数个数或者将常用的函数进行分组拆分到多个 TSMA 中。
|
||||||
|
|
||||||
窗口大小的限制为[1m ~ 1y/12n]. INTERVAL 的单位与查询中INTERVAL子句相同, 如 a (毫秒), b (纳秒), h (小时), m (分钟), s (秒), u (微秒), d (天), w(周), n(月), y(年).
|
窗口大小的限制为 [1m ~ 1y/12n]。INTERVAL 的单位与查询中 INTERVAL 子句相同,如 a(毫秒)、b(纳秒)、h(小时)、m(分钟)、s(秒)、u(微秒)、d(天)、w(周)、n(月)、y(年)。
|
||||||
|
|
||||||
TSMA为库内对象, 但名字全局唯一. 集群内一共可创建TSMA个数受参数`maxTsmaNum`限制, 参数默认值为3, 范围: [0-3]. 注意, 由于TSMA后台计算使用流计算, 因此每创建一条TSMA, 将会创建一条流, 因此能够创建的TSMA条数也受当前已经存在的流条数和最大可创建流条数限制.
|
TSMA 为库内对象,但名字全局唯一。集群内一共可创建 TSMA 个数受参数 `maxTsmaNum` 限制,参数默认值为 3,范围:[0-3]。注意,由于 TSMA 后台计算使用流计算,因此每创建一条 TSMA,将会创建一条流,因此能够创建的 TSMA 条数也受当前已经存在的流条数和最大可创建流条数限制。
|
||||||
|
|
||||||
## 支持的函数列表
|
## 支持的函数列表
|
||||||
| 函数| 备注 |
|
| 函数| 备注 |
|
||||||
|
@ -44,7 +46,7 @@ TSMA为库内对象, 但名字全局唯一. 集群内一共可创建TSMA个数
|
||||||
|first||
|
|first||
|
||||||
|last||
|
|last||
|
||||||
|avg||
|
|avg||
|
||||||
|count| 若想使用count(*), 则应创建count(ts)函数|
|
|count| 若想使用 count(*),则应创建 count(ts) 函数|
|
||||||
|spread||
|
|spread||
|
||||||
|stddev||
|
|stddev||
|
||||||
|||
|
|||
|
||||||
|
@ -53,52 +55,51 @@ TSMA为库内对象, 但名字全局唯一. 集群内一共可创建TSMA个数
|
||||||
```sql
|
```sql
|
||||||
DROP TSMA [db_name.]tsma_name;
|
DROP TSMA [db_name.]tsma_name;
|
||||||
```
|
```
|
||||||
若存在其他TSMA基于当前被删除TSMA创建, 则删除操作报`Invalid drop base tsma, drop recursive tsma first`错误. 因此需先删除 所有Recursive TSMA.
|
若存在其他 TSMA 基于当前被删除 TSMA 创建,则删除操作报 `Invalid drop base tsma, drop recursive tsma first` 错误。因此需先删除 所有 Recursive TSMA。
|
||||||
|
|
||||||
## TSMA 的计算
|
## TSMA 的计算
|
||||||
TSMA的计算结果为与原始表相同库下的一张超级表, 此表用户不可见. 不可删除, 在`DROP TSMA`时自动删除. TSMA的计算是通过流计算完成的, 此过程为后台异步过程, TSMA的计算结果不保证实时性, 但可以保证最终正确性.
|
TSMA 的计算结果为与原始表相同库下的一张超级表,此表用户不可见。不可删除,在 `DROP TSMA` 时自动删除。TSMA 的计算是通过流计算完成的,此过程为后台异步过程,TSMA 的计算结果不保证实时性,但可以保证最终正确性。
|
||||||
|
|
||||||
TSMA计算时若原始子表内没有数据, 则可能不会创建对应的输出子表, 因此在count查询中, 即使配置了`countAlwaysReturnValue`, 也不会返回该表的结果.
|
TSMA 计算时若原始子表内没有数据,则可能不会创建对应的输出子表,因此在 count 查询中,即使配置了 `countAlwaysReturnValue`,也不会返回该表的结果。
|
||||||
|
|
||||||
当存在大量历史数据时, 创建TSMA之后, 流计算将会首先计算历史数据, 此期间新创建的TSMA不会被使用. 数据更新删除或者过期数据到来时自动重新计算影响部分数据。 在重新计算期间 TSMA 查询结果不保证实时性。若希望查询实时数据, 可以通过在 SQL 中添加 hint `/*+ skip_tsma() */` 或者关闭参数`querySmaOptimize`从原始数据查询。
|
当存在大量历史数据时,创建 TSMA 之后,流计算将会首先计算历史数据,此期间新创建的 TSMA 不会被使用。数据更新删除或者过期数据到来时自动重新计算影响部分数据。在重新计算期间 TSMA 查询结果不保证实时性。若希望查询实时数据,可以通过在 SQL 中添加 hint `/*+ skip_tsma() */` 或者关闭参数 `querySmaOptimize` 从原始数据查询。
|
||||||
|
|
||||||
## TSMA 的使用与限制
|
## TSMA 的使用与限制
|
||||||
|
|
||||||
客户端配置参数: `querySmaOptimize`, 用于控制查询时是否使用TSMA, `True`为使用, `False`为不使用即从原始数据查询.
|
- 客户端配置参数:`querySmaOptimize`,用于控制查询时是否使用TSMA,`True`为使用,`False` 为不使用即从原始数据查询。
|
||||||
|
- 客户端配置参数:`maxTsmaCalcDelay`,单位为秒,用于控制用户可以接受的 TSMA 计算延迟,若 TSMA 的计算进度与最新时间差距在此范围内,则该 TSMA 将会被使用,若超出该范围,则不使用,默认值:600(10 分钟),最小值:600(10 分钟),最大值:86400(1 天)。
|
||||||
客户端配置参数:`maxTsmaCalcDelay`,单位 s,用于控制用户可以接受的 TSMA 计算延迟,若 TSMA 的计算进度与最新时间差距在此范围内, 则该 TSMA 将会被使用, 若超出该范围, 则不使用, 默认值: 600(10 分钟), 最小值: 600(10 分钟), 最大值: 86400(1 天).
|
- 客户端配置参数:`tsmaDataDeleteMark`,单位毫秒,与流计算参数 `deleteMark` 一致,用于控制流计算中间结果的保存时间,默认值为 1d,最小值为 1h。因此那些距最后一条数据时间大于配置参数的历史数据将不保存流计算中间结果,因此若修改这些时间窗口内的数据,TSMA 的计算结果中将不包含更新的结果。即与查询原始数据结果将不一致。
|
||||||
|
|
||||||
客户端配置参数: `tsmaDataDeleteMark`, 单位毫秒, 与流计算参数`deleteMark`一致, 用于控制流计算中间结果的保存时间, 默认值为: 1d, 最小值为1h. 因此那些距最后一条数据时间大于配置参数的历史数据将不保存流计算中间结果, 因此若修改这些时间窗口内的数据, TSMA的计算结果中将不包含更新的结果. 即与查询原始数据结果将不一致.
|
|
||||||
|
|
||||||
### 查询时使用 TSMA
|
### 查询时使用 TSMA
|
||||||
|
|
||||||
已在 TSMA 中定义的 agg 函数在大部分查询场景下都可直接使用,若存在多个可用的 TSMA,优先使用大窗口的 TSMA,未闭合窗口通过查询小窗口 TSMA 或者原始数据计算。同时也有某些场景不能使用 TSMA(见下文)。不可用时整个查询将使用原始数据进行计算。
|
已在 TSMA 中定义的 agg 函数在大部分查询场景下都可直接使用,若存在多个可用的 TSMA,优先使用大窗口的 TSMA,未闭合窗口通过查询小窗口 TSMA 或者原始数据计算。同时也有某些场景不能使用 TSMA(见下文)。不可用时整个查询将使用原始数据进行计算。
|
||||||
|
|
||||||
未指定窗口大小的查询语句默认优先使用包含所有查询聚合函数的最大窗口 TSMA 进行数据的计算。 如`SELECT COUNT(*) FROM stable GROUP BY tbname`将会使用包含count(ts)且窗口最大的TSMA。因此若使用聚合查询频率高时, 应当尽可能创建大窗口的TSMA.
|
未指定窗口大小的查询语句默认优先使用包含所有查询聚合函数的最大窗口 TSMA 进行数据的计算。如 `SELECT COUNT(*) FROM stable GROUP BY tbname` 将会使用包含 count(ts) 且窗口最大的 TSMA。因此若使用聚合查询频率高时,应当尽可能创建大窗口的 TSMA。
|
||||||
|
|
||||||
指定窗口大小时即 `INTERVAL` 语句,使用最大的可整除窗口 TSMA。 窗口查询中, `INTERVAL` 的窗口大小, `OFFSET` 以及 `SLIDING` 都影响能使用的 TSMA 窗口大小, 可整 除窗口 TSMA 即 TSMA 窗口大小可被查询语句的 `INTERVAL, OFFSET, SLIDING` 整除的窗口。因此若使用窗口查询较多时, 需要考虑经常查询的窗口大小, 以及 offset, sliding大小来创建TSMA.
|
指定窗口大小时即 `INTERVAL` 语句,使用最大的可整除窗口 TSMA。窗口查询中,`INTERVAL` 的窗口大小、`OFFSET` 以及 `SLIDING` 都影响能使用的 TSMA 窗口大小。因此若使用窗口查询较多时,需要考虑经常查询的窗口大小,以及 offset、sliding 大小来创建 TSMA。
|
||||||
|
|
||||||
例 1. 如 创建 TSMA 窗口大小 `5m` 一条, `10m` 一条, 查询时 `INTERVAL(30m)`, 那么优先使用 `10m` 的 TSMA, 若查询为 `INTERVAL(30m, 10m) SLIDING(5m)`, 那么仅可使用 `5m` 的 TSMA 查询。
|
例如 创建 TSMA 窗口大小 `5m` 一条,`10m` 一条,查询时 `INTERVAL(30m)`,那么优先使用 `10m` 的 TSMA,若查询为 `INTERVAL(30m, 10m) SLIDING(5m)`,那么仅可使用 `5m` 的 TSMA 查询。
|
||||||
|
|
||||||
|
|
||||||
### 查询限制
|
### 查询限制
|
||||||
|
|
||||||
在开启了参数`querySmaOptimize`并且无`skip_tsma()` hint时, 以下查询场景无法使用TSMA:
|
在开启了参数 `querySmaOptimize` 并且无 `skip_tsma()` hint 时,以下查询场景无法使用 TSMA。
|
||||||
|
|
||||||
- 某个 TSMA 中定义的 agg 函数不能覆盖当前查询的函数列表时
|
- 某个 TSMA 中定义的 agg 函数不能覆盖当前查询的函数列表时
|
||||||
- 非 `INTERVAL` 的其他窗口,或者 `INTERVAL` 查询窗口大小(包括 `INTERVAL,SLIDING,OFFSET`)不是定义窗口的整数倍,如定义窗口为 2m,查询使用 5 分钟窗口,但若存在 1m 的窗口,则可以使用。
|
- 非 `INTERVAL` 的其他窗口,或者 `INTERVAL` 查询窗口大小(包括 `INTERVAL,SLIDING,OFFSET`)不是定义窗口的整数倍,如定义窗口为 2m,查询使用 5 分钟窗口,但若存在 1m 的窗口,则可以使用。
|
||||||
- 查询 `WHERE` 条件中包含任意普通列(非主键时间列)的过滤。
|
- 查询 `WHERE` 条件中包含任意普通列(非主键时间列)的过滤。
|
||||||
- `PARTITION` 或者 `GROUY BY` 包含任意普通列或其表达式时
|
- `PARTITION` 或者 `GROUY BY` 包含任意普通列或其表达式时
|
||||||
- 可以使用其他更快的优化逻辑时, 如last cache优化, 若符合last优化的条件, 则先走last 优化, 无法走last时, 再判断是否可以走tsma优化
|
- 可以使用其他更快的优化逻辑时,如 last cache 优化,若符合 last 优化的条件,则先走 last 优化,无法走 last 时,再判断是否可以走 tsma 优化
|
||||||
- 当前 TSMA 计算进度延迟大于配置参数 `maxTsmaCalcDelay`时
|
- 当前 TSMA 计算进度延迟大于配置参数 `maxTsmaCalcDelay`时
|
||||||
|
|
||||||
下面是一些例子:
|
下面是一些例子:
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
SELECT agg_func_list [, pesudo_col_list] FROM stable WHERE exprs [GROUP/PARTITION BY [tbname] [, tag_list]] [HAVING ...] [INTERVAL(time_duration, offset) SLIDING(duration)]...;
|
SELECT agg_func_list [, pesudo_col_list] FROM stable WHERE exprs [GROUP/PARTITION BY [tbname] [, tag_list]] [HAVING ...] [INTERVAL(time_duration, offset) SLIDING(duration)]...;
|
||||||
|
|
||||||
-- 创建
|
-- 创建
|
||||||
CREATE TSMA tsma1 ON stable FUNCTION(COUNT(ts), SUM(c1), SUM(c3), MIN(c1), MIN(c3), AVG(c1)) INTERVAL(1m);
|
CREATE TSMA tsma1 ON stable FUNCTION(COUNT(ts), SUM(c1), SUM(c3), MIN(c1), MIN(c3), AVG(c1)) INTERVAL(1m);
|
||||||
|
|
||||||
-- 查询
|
-- 查询
|
||||||
SELECT COUNT(*), SUM(c1) + SUM(c3) FROM stable; ---- use tsma1
|
SELECT COUNT(*), SUM(c1) + SUM(c3) FROM stable; ---- use tsma1
|
||||||
SELECT COUNT(*), AVG(c1) FROM stable GROUP/PARTITION BY tbname, tag1, tag2; --- use tsma1
|
SELECT COUNT(*), AVG(c1) FROM stable GROUP/PARTITION BY tbname, tag1, tag2; --- use tsma1
|
||||||
|
@ -124,15 +125,15 @@ SELECT COUNT(*), MIN(c1) FROM stable where c2 > 0; ---- can't use tsma1 or tsam2
|
||||||
|
|
||||||
### 使用限制
|
### 使用限制
|
||||||
|
|
||||||
创建TSMA之后, 对原始超级表的操作有以下限制:
|
创建 TSMA 之后,对原始超级表的操作有以下限制:
|
||||||
|
|
||||||
- 必须删除该表上的所有TSMA才能删除该表.
|
- 必须删除该表上的所有 TSMA 才能删除该表。
|
||||||
- 原始表所有tag列不能删除, 也不能修改tag列名或子表的tag值, 必须先删除TSMA, 才能删除tag列.
|
- 原始表所有 tag 列不能删除,也不能修改 tag 列名或子表的 tag 值,必须先删除 TSMA,才能删除 tag 列。
|
||||||
- 若某些列被TSMA使用了, 则这些列不能被删除, 必须先删除TSMA. 添加列不受影响, 但是新添加的列不在任何TSMA中, 因此若要计算新增列, 需要新创建其他的TSMA.
|
- 若某些列被 TSMA 使用了,则这些列不能被删除,必须先删除 TSMA。添加列不受影响,但是新添加的列不在任何 TSMA 中,因此若要计算新增列,需要新创建其他的 TSMA。
|
||||||
|
|
||||||
## 查看TSMA
|
## 查看TSMA
|
||||||
```sql
|
```sql
|
||||||
SHOW [db_name.]TSMAS;
|
SHOW [db_name.]TSMAS;
|
||||||
SELECT * FROM information_schema.ins_tsma;
|
SELECT * FROM information_schema.ins_tsma;
|
||||||
```
|
```
|
||||||
若创建时指定的较多的函数, 且列名较长, 在显示函数列表时可能会被截断(目前最大支持输出256KB).
|
若创建时指定的较多的函数,且列名较长,在显示函数列表时可能会被截断(目前最大支持输出 256KB)。
|
||||||
|
|
|
@ -26,15 +26,15 @@ description: "TDengine 3.0 版本的语法变更说明"
|
||||||
|
|
||||||
| # | **语句** | **<div style={{width: 60}}>差异性</div>** | **说明** |
|
| # | **语句** | **<div style={{width: 60}}>差异性</div>** | **说明** |
|
||||||
| - | :------- | :-------- | :------- |
|
| - | :------- | :-------- | :------- |
|
||||||
| 1 | ALTER ACCOUNT | 废除 | 2.x中为企业版功能,3.0不再支持。语法暂时保留了,执行报“This statement is no longer supported”错误。
|
| 1 | ALTER ACCOUNT | 废除 | 2.x 中为企业版功能,3.0 不再支持。语法暂时保留,执行报 “This statement is no longer supported” 错误。
|
||||||
| 2 | ALTER ALL DNODES | 新增 | 修改所有 DNODE 的参数。
|
| 2 | ALTER ALL DNODES | 新增 | 修改所有 DNODE 的参数。
|
||||||
| 3 | ALTER DATABASE | 调整 | <p>废除</p><ul><li>QUORUM:写入需要的副本确认数。3.0 版本默认行为是强一致性,且不支持修改为弱一致性。</li><li>BLOCKS:VNODE使用的内存块数。3.0版本使用BUFFER来表示VNODE写入内存池的大小。</li><li>UPDATE:更新操作的支持模式。3.0版本所有数据库都支持部分列更新。</li><li>CACHELAST:缓存最新一行数据的模式。3.0版本用CACHEMODEL代替。</li><li>COMP:3.0版本暂不支持修改。</li></ul><p>新增</p><ul><li>CACHEMODEL:表示是否在内存中缓存子表的最近数据。</li><li>CACHESIZE:表示缓存子表最近数据的内存大小。</li><li>WAL_FSYNC_PERIOD:代替原FSYNC参数。</li><li>WAL_LEVEL:代替原WAL参数。</li><li>WAL_RETENTION_PERIOD:3.0.4.0版本新增,wal文件的额外保留策略,用于数据订阅。</li><li>WAL_RETENTION_SIZE:3.0.4.0版本新增,wal文件的额外保留策略,用于数据订阅。</li></ul><p>调整</p><ul><li>KEEP:3.0版本新增支持带单位的设置方式。</li></ul>
|
| 3 | ALTER DATABASE | 调整 | <p>废除</p><ul><li>QUORUM:写入需要的副本确认数。3.0 版本默认行为是强一致性,且不支持修改为弱一致性。</li><li>BLOCKS:VNODE使用的内存块数。3.0 版本使用 BUFFER 来表示 VNODE 写入内存池的大小。</li><li>UPDATE:更新操作的支持模式。3.0 版本所有数据库都支持部分列更新。</li><li>CACHELAST:缓存最新一行数据的模式。3.0 版本用 CACHEMODEL 代替。</li><li>COMP:3.0 版本暂不支持修改。</li></ul><p>新增</p><ul><li>CACHEMODEL:表示是否在内存中缓存子表的最近数据。</li><li>CACHESIZE:表示缓存子表最近数据的内存大小。</li><li>WAL_FSYNC_PERIOD:代替原 FSYNC 参数。</li><li>WAL_LEVEL:代替原 WAL 参数。</li><li>WAL_RETENTION_PERIOD:v3.0.4.0 新增,WAL 文件的额外保留策略,用于数据订阅。</li><li>WAL_RETENTION_SIZE:v3.0.4.0 新增,WAL 文件的额外保留策略,用于数据订阅。</li></ul><p>调整</p><ul><li>KEEP:3.0 版本新增支持带单位的设置方式。</li></ul>
|
||||||
| 4 | ALTER STABLE | 调整 | 废除<ul><li>CHANGE TAG:修改标签列的名称。3.0 版本使用 RENAME TAG 代替。<br/>新增</li><li>RENAME TAG:代替原 CHANGE TAG 子句。</li><li>COMMENT:修改超级表的注释。</li></ul>
|
| 4 | ALTER STABLE | 调整 | 废除<ul><li>CHANGE TAG:修改标签列的名称。3.0 版本使用 RENAME TAG 代替。<br/>新增</li><li>RENAME TAG:代替原 CHANGE TAG 子句。</li><li>COMMENT:修改超级表的注释。</li></ul>
|
||||||
| 5 | ALTER TABLE | 调整 | 废除<ul><li>CHANGE TAG:修改标签列的名称。3.0 版本使用 RENAME TAG 代替。<br/>新增</li><li>RENAME TAG:代替原 CHANGE TAG 子句。</li><li>COMMENT:修改表的注释。</li><li>TTL:修改表的生命周期。</li></ul>
|
| 5 | ALTER TABLE | 调整 | 废除<ul><li>CHANGE TAG:修改标签列的名称。3.0 版本使用 RENAME TAG 代替。<br/>新增</li><li>RENAME TAG:代替原 CHANGE TAG 子句。</li><li>COMMENT:修改表的注释。</li><li>TTL:修改表的生命周期。</li></ul>
|
||||||
| 6 | ALTER USER | 调整 | 废除<ul><li>PRIVILEGE:修改用户权限。3.0 版本使用 GRANT 和 REVOKE 来授予和回收权限。<br/>新增</li><li>ENABLE:启用或停用此用户。</li><li>SYSINFO:修改用户是否可查看系统信息。</li></ul>
|
| 6 | ALTER USER | 调整 | 废除<ul><li>PRIVILEGE:修改用户权限。3.0 版本使用 GRANT 和 REVOKE 来授予和回收权限。<br/>新增</li><li>ENABLE:启用或停用此用户。</li><li>SYSINFO:修改用户是否可查看系统信息。</li></ul>
|
||||||
| 7 | COMPACT VNODES | 暂不支持 | 整理指定VNODE的数据。3.0.0版本暂不支持。
|
| 7 | COMPACT VNODES | 暂不支持 | 整理指定 VNODE 的数据。
|
||||||
| 8 | CREATE ACCOUNT | 废除 | 2.x中为企业版功能,3.0不再支持。语法暂时保留了,执行报“This statement is no longer supported”错误。
|
| 8 | CREATE ACCOUNT | 废除 | 2.x 中为企业版功能,3.0 不再支持。语法暂时保留,执行报 “This statement is no longer supported” 错误。
|
||||||
| 9 | CREATE DATABASE | 调整 | <p>废除</p><ul><li>BLOCKS:VNODE使用的内存块数。3.0版本使用BUFFER来表示VNODE写入内存池的大小。</li><li>CACHE:VNODE使用的内存块的大小。3.0版本使用BUFFER来表示VNODE写入内存池的大小。</li><li>CACHELAST:缓存最新一行数据的模式。3.0版本用CACHEMODEL代替。</li><li>DAYS:数据文件存储数据的时间跨度。3.0版本使用DURATION代替。</li><li>FSYNC:当 WAL 设置为 2 时,执行 fsync 的周期。3.0版本使用WAL_FSYNC_PERIOD代替。</li><li>QUORUM:写入需要的副本确认数。3.0版本使用STRICT来指定强一致还是弱一致。</li><li>UPDATE:更新操作的支持模式。3.0版本所有数据库都支持部分列更新。</li><li>WAL:WAL 级别。3.0版本使用WAL_LEVEL代替。</li></ul><p>新增</p><ul><li>BUFFER:一个 VNODE 写入内存池大小。</li><li>CACHEMODEL:表示是否在内存中缓存子表的最近数据。</li><li>CACHESIZE:表示缓存子表最近数据的内存大小。</li><li>DURATION:代替原DAYS参数。新增支持带单位的设置方式。</li><li>PAGES:一个 VNODE 中元数据存储引擎的缓存页个数。</li><li>PAGESIZE:一个 VNODE 中元数据存储引擎的页大小。</li><li>RETENTIONS:表示数据的聚合周期和保存时长。</li><li>STRICT:表示数据同步的一致性要求。</li><li>SINGLE_STABLE:表示此数据库中是否只可以创建一个超级表。</li><li>VGROUPS:数据库中初始VGROUP的数目。</li><li>WAL_FSYNC_PERIOD:代替原FSYNC参数。</li><li>WAL_LEVEL:代替原WAL参数。</li><li>WAL_RETENTION_PERIOD:wal文件的额外保留策略,用于数据订阅。</li><li>WAL_RETENTION_SIZE:wal文件的额外保留策略,用于数据订阅。</li></ul><p>调整</p><ul><li>KEEP:3.0版本新增支持带单位的设置方式。</li></ul>
|
| 9 | CREATE DATABASE | 调整 | <p>废除</p><ul><li>BLOCKS:VNODE 使用的内存块数。3.0 版本使用 BUFFER 来表示 VNODE 写入内存池的大小。</li><li>CACHE:VNODE 使用的内存块的大小。3.0 版本使用 BUFFER 来表示 VNODE 写入内存池的大小。</li><li>CACHELAST:缓存最新一行数据的模式。3.0 版本用 CACHEMODEL 代替。</li><li>DAYS:数据文件存储数据的时间跨度。3.0 版本使用 DURATION 代替。</li><li>FSYNC:当 WAL 设置为 2 时,执行 fsync 的周期。3.0 版本使用 WAL_FSYNC_PERIOD 代替。</li><li>QUORUM:写入需要的副本确认数。3.0 版本使用 STRICT 来指定强一致还是弱一致。</li><li>UPDATE:更新操作的支持模式。3.0 版本所有数据库都支持部分列更新。</li><li>WAL:WAL 级别。3.0 版本使用 WAL_LEVEL 代替。</li></ul><p>新增</p><ul><li>BUFFER:一个 VNODE 写入内存池大小。</li><li>CACHEMODEL:表示是否在内存中缓存子表的最近数据。</li><li>CACHESIZE:表示缓存子表最近数据的内存大小。</li><li>DURATION:代替原 DAYS 参数。新增支持带单位的设置方式。</li><li>PAGES:一个 VNODE 中元数据存储引擎的缓存页个数。</li><li>PAGESIZE:一个 VNODE 中元数据存储引擎的页大小。</li><li>RETENTIONS:表示数据的聚合周期和保存时长。</li><li>STRICT:表示数据同步的一致性要求。</li><li>SINGLE_STABLE:表示此数据库中是否只可以创建一个超级表。</li><li>VGROUPS:数据库中初始 VGROUP 的数目。</li><li>WAL_FSYNC_PERIOD:代替原 FSYNC 参数。</li><li>WAL_LEVEL:代替原 WAL 参数。</li><li>WAL_RETENTION_PERIOD:WAL 文件的额外保留策略,用于数据订阅。</li><li>WAL_RETENTION_SIZE:WAL 文件的额外保留策略,用于数据订阅。</li></ul><p>调整</p><ul><li>KEEP:3.0 版本新增支持带单位的设置方式。</li></ul>
|
||||||
| 10 | CREATE DNODE | 调整 | 新增主机名和端口号分开指定语法<ul><li>CREATE DNODE dnode_host_name PORT port_val</li></ul>
|
| 10 | CREATE DNODE | 调整 | 新增主机名和端口号分开指定语法<ul><li>CREATE DNODE dnode_host_name PORT port_val</li></ul>
|
||||||
| 11 | CREATE INDEX | 新增 | 创建SMA索引。
|
| 11 | CREATE INDEX | 新增 | 创建SMA索引。
|
||||||
| 12 | CREATE MNODE | 新增 | 创建管理节点。
|
| 12 | CREATE MNODE | 新增 | 创建管理节点。
|
||||||
|
@ -43,7 +43,7 @@ description: "TDengine 3.0 版本的语法变更说明"
|
||||||
| 15 | CREATE STREAM | 新增 | 创建流。
|
| 15 | CREATE STREAM | 新增 | 创建流。
|
||||||
| 16 | CREATE TABLE | 调整 | 新增表参数语法<ul><li>COMMENT:表注释。</li><li>WATERMARK:指定窗口的关闭时间。</li><li>MAX_DELAY:用于控制推送计算结果的最大延迟。</li><li>ROLLUP:指定的聚合函数,提供基于多层级的降采样聚合结果。</li><li>SMA:提供基于数据块的自定义预计算功能。</li><li>TTL:用来指定表的生命周期的参数。</li></ul>
|
| 16 | CREATE TABLE | 调整 | 新增表参数语法<ul><li>COMMENT:表注释。</li><li>WATERMARK:指定窗口的关闭时间。</li><li>MAX_DELAY:用于控制推送计算结果的最大延迟。</li><li>ROLLUP:指定的聚合函数,提供基于多层级的降采样聚合结果。</li><li>SMA:提供基于数据块的自定义预计算功能。</li><li>TTL:用来指定表的生命周期的参数。</li></ul>
|
||||||
| 17 | CREATE TOPIC | 新增 | 创建订阅主题。
|
| 17 | CREATE TOPIC | 新增 | 创建订阅主题。
|
||||||
| 18 | DROP ACCOUNT | 废除 | 2.x中为企业版功能,3.0不再支持。语法暂时保留了,执行报“This statement is no longer supported”错误。
|
| 18 | DROP ACCOUNT | 废除 | 2.x 中为企业版功能,3.0 不再支持。语法暂时保留,执行报 “This statement is no longer supported” 错误。
|
||||||
| 19 | DROP CONSUMER GROUP | 新增 | 删除消费组。
|
| 19 | DROP CONSUMER GROUP | 新增 | 删除消费组。
|
||||||
| 20 | DROP INDEX | 新增 | 删除索引。
|
| 20 | DROP INDEX | 新增 | 删除索引。
|
||||||
| 21 | DROP MNODE | 新增 | 创建管理节点。
|
| 21 | DROP MNODE | 新增 | 创建管理节点。
|
||||||
|
@ -56,8 +56,8 @@ description: "TDengine 3.0 版本的语法变更说明"
|
||||||
| 28 | KILL TRANSACTION | 新增 | 终止管理节点的事务。
|
| 28 | KILL TRANSACTION | 新增 | 终止管理节点的事务。
|
||||||
| 29 | KILL STREAM | 废除 | 终止连续查询。3.0 版本不再支持连续查询,而是用更通用的流计算来代替。
|
| 29 | KILL STREAM | 废除 | 终止连续查询。3.0 版本不再支持连续查询,而是用更通用的流计算来代替。
|
||||||
| 31 | REVOKE | 新增 | 回收用户权限。
|
| 31 | REVOKE | 新增 | 回收用户权限。
|
||||||
| 32 | SELECT | 调整 | <ul><li>SELECT关闭隐式结果列,输出列均需要由SELECT子句来指定。</li><li>DISTINCT功能全面支持。2.x版本只支持对标签列去重,并且不可以和JOIN、GROUP BY等子句混用。</li><li>JOIN功能增强。增加支持:JOIN后WHERE条件中有OR条件;JOIN后的多表运算;JOIN后的多表GROUP BY。</li><li>FROM后子查询功能大幅增强。不限制子查询嵌套层数;支持子查询和UNION ALL混合使用;移除其他一些之前版本的语法限制。</li><li>WHERE后可以使用任意的标量表达式。</li><li>GROUP BY功能增强。支持任意标量表达式及其组合的分组。</li><li>SESSION可以用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。</li><li>STATE_WINDOW可以用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。</li><li>ORDER BY功能大幅增强。不再必须和GROUP BY子句一起使用;不再有排序表达式个数的限制;增加支持NULLS FIRST/LAST语法功能;支持符合语法语义的任意表达式。</li><li>新增PARTITION BY语法。替代原来的GROUP BY tags。</li></ul>
|
| 32 | SELECT | 调整 | <ul><li>SELECT 关闭隐式结果列,输出列均需要由 SELECT 子句来指定。</li><li>DISTINCT 功能全面支持。2.x 版本只支持对标签列去重,并且不可以和 JOIN、GROUP BY 等子句混用。</li><li>JOIN 功能增强。增加支持:JOIN 后 WHERE 条件中有 OR 条件;JOIN 后的多表运算;JOIN 后的多表 GROUP BY。</li><li>FROM 后子查询功能大幅增强。不限制子查询嵌套层数;支持子查询和 UNION ALL 混合使用;移除其他一些之前版本的语法限制。</li><li>WHERE 后可以使用任意的标量表达式。</li><li>GROUP BY 功能增强。支持任意标量表达式及其组合的分组。</li><li>SESSION 可以用于超级表。之前版本,超级表的数据会被合并成一条时间线。</li><li>STATE_WINDOW 可以用于超级表。之前版本,超级表的数据会被合并成一条时间线。</li><li>ORDER BY 功能大幅增强。不再必须和 GROUP BY 子句一起使用;不再有排序表达式个数的限制;增加支持 NULLS FIRST/LAST 语法功能;支持符合语法语义的任意表达式。</li><li>新增 PARTITION BY 语法。替代原来的 GROUP BY tags。</li></ul>
|
||||||
| 33 | SHOW ACCOUNTS | 废除 | 2.x中为企业版功能,3.0不再支持。语法暂时保留了,执行报“This statement is no longer supported”错误。
|
| 33 | SHOW ACCOUNTS | 废除 | 2.x 中为企业版功能,3.0 不再支持。语法暂时保留,执行报 “This statement is no longer supported” 错误。
|
||||||
| 34 | SHOW APPS |新增 | 显示接入集群的应用(客户端)信息。
|
| 34 | SHOW APPS |新增 | 显示接入集群的应用(客户端)信息。
|
||||||
| 35 | SHOW CONSUMERS | 新增 | 显示当前数据库下所有活跃的消费者的信息。
|
| 35 | SHOW CONSUMERS | 新增 | 显示当前数据库下所有活跃的消费者的信息。
|
||||||
| 36 | SHOW DATABASES | 调整 | 3.0 版本只显示数据库名。
|
| 36 | SHOW DATABASES | 调整 | 3.0 版本只显示数据库名。
|
||||||
|
@ -71,11 +71,11 @@ description: "TDengine 3.0 版本的语法变更说明"
|
||||||
| 44 | SHOW STREAMS | 调整 | 2.x 版本此命令显示系统中已创建的连续查询的信息。3.0 版本废除了连续查询,用流代替。此命令显示已创建的流。
|
| 44 | SHOW STREAMS | 调整 | 2.x 版本此命令显示系统中已创建的连续查询的信息。3.0 版本废除了连续查询,用流代替。此命令显示已创建的流。
|
||||||
| 45 | SHOW SUBSCRIPTIONS | 新增 | 显示当前数据库下的所有的订阅关系
|
| 45 | SHOW SUBSCRIPTIONS | 新增 | 显示当前数据库下的所有的订阅关系
|
||||||
| 46 | SHOW TABLES | 调整 | 3.0 版本只显示表名。
|
| 46 | SHOW TABLES | 调整 | 3.0 版本只显示表名。
|
||||||
| 47 | SHOW TABLE DISTRIBUTED | 新增 | 显示表的数据分布信息。代替2.x版本中的SELECT _block_dist() FROM \{ tb_name | stb_name }方式。
|
| 47 | SHOW TABLE DISTRIBUTED | 新增 | 显示表的数据分布信息。代替 2.x 版本中的 `SELECT _block_dist() FROM tb_name` 方式。
|
||||||
| 48 | SHOW TOPICS | 新增 | 显示当前数据库下的所有订阅主题。
|
| 48 | SHOW TOPICS | 新增 | 显示当前数据库下的所有订阅主题。
|
||||||
| 49 | SHOW TRANSACTIONS | 新增 | 显示当前系统中正在执行的事务的信息。
|
| 49 | SHOW TRANSACTIONS | 新增 | 显示当前系统中正在执行的事务的信息。
|
||||||
| 50 | SHOW DNODE VARIABLES | 新增 |显示指定 DNODE 的配置参数。
|
| 50 | SHOW DNODE VARIABLES | 新增 |显示指定 DNODE 的配置参数。
|
||||||
| 51 | SHOW VNODES | 暂不支持 | 显示当前系统中VNODE的信息。3.0.0版本暂不支持。
|
| 51 | SHOW VNODES | 暂不支持 | 显示当前系统中 VNODE 的信息。
|
||||||
| 52 | TRIM DATABASE | 新增 | 删除过期数据,并根据多级存储的配置归整数据。
|
| 52 | TRIM DATABASE | 新增 | 删除过期数据,并根据多级存储的配置归整数据。
|
||||||
| 53 | REDISTRIBUTE VGROUP | 新增 | 调整 VGROUP 中 VNODE 的分布。
|
| 53 | REDISTRIBUTE VGROUP | 新增 | 调整 VGROUP 中 VNODE 的分布。
|
||||||
| 54 | BALANCE VGROUP | 新增 | 自动调整 VGROUP中 VNODE 的分布。
|
| 54 | BALANCE VGROUP | 新增 | 自动调整 VGROUP中 VNODE 的分布。
|
||||||
|
@ -84,22 +84,22 @@ description: "TDengine 3.0 版本的语法变更说明"
|
||||||
|
|
||||||
| # | **函数** | ** <div style={{width: 60}}>差异性</div> ** | **说明** |
|
| # | **函数** | ** <div style={{width: 60}}>差异性</div> ** | **说明** |
|
||||||
| - | :------- | :-------- | :------- |
|
| - | :------- | :-------- | :------- |
|
||||||
| 1 | TWA | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 1 | TWA | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 2 | IRATE | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 2 | IRATE | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 3 | LEASTSQUARES | 增强 | 可以用于超级表了。
|
| 3 | LEASTSQUARES | 增强 | 可以用于超级表。
|
||||||
| 4 | ELAPSED | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 4 | ELAPSED | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 5 | DIFF | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 5 | DIFF | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 6 | DERIVATIVE | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 6 | DERIVATIVE | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 7 | CSUM | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 7 | CSUM | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 8 | MAVG | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 8 | MAVG | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 9 | SAMPLE | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 9 | SAMPLE | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 10 | STATECOUNT | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 10 | STATECOUNT | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 11 | STATEDURATION | 增强 | 可以直接用于超级表了。没有PARTITION BY时,超级表的数据会被合并成一条时间线。
|
| 11 | STATEDURATION | 增强 | 可以直接用于超级表。之前版本,超级表的数据会被合并成一条时间线。
|
||||||
| 12 | TIMETRUNCATE | 增强 | 增加ignore_timezone参数,可选是否使用,默认值为1.
|
| 12 | TIMETRUNCATE | 增强 | 增加 ignore_timezone 参数,可选是否使用,默认值为 1。
|
||||||
|
|
||||||
|
|
||||||
## SCHEMALESS 变更
|
## SCHEMALESS 变更
|
||||||
|
|
||||||
| # | **元素** | **<div style={{width: 60}}>差异性</div>** | **说明** |
|
| # | **元素** | **<div style={{width: 60}}>差异性</div>** | **说明** |
|
||||||
| - | :------- | :-------- | :------- |
|
| - | :------- | :-------- | :------- |
|
||||||
| 1 | 主键ts 变更为 _ts | 变更 | schemaless自动建的列名用 _ 开头,不同于2.x。
|
| 1 | 主键 ts 变更为 _ts | 变更 | schemaless 自动建的列名用 `_` 开头,不同于2.x。
|
||||||
|
|
|
@ -4,7 +4,7 @@ sidebar_label: 可配置压缩
|
||||||
description: 可配置压缩算法
|
description: 可配置压缩算法
|
||||||
---
|
---
|
||||||
|
|
||||||
从 TDengine 3.3.0.0 版本开始,TDengine 提供了更高级的压缩功能,用户可以在建表时针对每一列配置是否进行压缩、以及使用的压缩算法和压缩级别。
|
从 v3.3.0.0 开始,TDengine 提供了更高级的压缩功能,用户可以在建表时针对每一列配置是否进行压缩、以及使用的压缩算法和压缩级别。
|
||||||
|
|
||||||
## 压缩术语定义
|
## 压缩术语定义
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ description: 可配置压缩算法
|
||||||
|
|
||||||
### 压缩算法列表
|
### 压缩算法列表
|
||||||
|
|
||||||
- 编码算法列表(一级压缩):simple8b, bit-packing,delta-i, delta-d, disabled
|
- 编码算法列表(一级压缩):simple8b、bit-packing、delta-i、delta-d、disabled
|
||||||
|
|
||||||
- 压缩算法列表(二级压缩): lz4、zlib、zstd、tsz、xz、disabled
|
- 压缩算法列表(二级压缩):lz4、zlib、zstd、tsz、xz、disabled
|
||||||
|
|
||||||
- 各个数据类型的默认压缩算法列表和适用范围
|
- 各个数据类型的默认压缩算法列表和适用范围
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ CREATE [dbname.]tabname (colName colType [ENCODE 'encode_type'] [COMPRESS 'compr
|
||||||
**参数说明**
|
**参数说明**
|
||||||
|
|
||||||
- tabname:超级表或者普通表名称
|
- tabname:超级表或者普通表名称
|
||||||
- encode_type: 一级压缩,具体参数见上面列表
|
- encode_type:一级压缩,具体参数见上面列表
|
||||||
- compress_type: 二级压缩,具体参数见上面列表
|
- compress_type:二级压缩,具体参数见上面列表
|
||||||
- level: 特指二级压缩的级别,默认值为medium, 支持简写为 'h'/'l'/'m'
|
- level:特指二级压缩的级别,默认值为 medium,支持简写为 'h'、'l'、'm'
|
||||||
|
|
||||||
**功能说明**
|
**功能说明**
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ ALTER TABLE [db_name.]tabName MODIFY COLUMN colName [ENCODE 'ecode_type'] [COMPR
|
||||||
|
|
||||||
**参数说明**
|
**参数说明**
|
||||||
|
|
||||||
- tabName: 表名,可以为超级表、普通表
|
- tabName:表名,可以为超级表、普通表
|
||||||
- colName: 待更改压缩算法的列, 只能为普通列
|
- colName:待更改压缩算法的列,只能为普通列
|
||||||
|
|
||||||
**功能说明**
|
**功能说明**
|
||||||
|
|
||||||
|
@ -87,4 +87,4 @@ DESCRIBE [dbname.]tabName
|
||||||
## 兼容性
|
## 兼容性
|
||||||
|
|
||||||
- 完全兼容已经存在的数据
|
- 完全兼容已经存在的数据
|
||||||
- 从更低版本升级到 3.3.0.0 后不能回退
|
- 从更低版本升级到 v3.3.0.0 后不能回退
|
||||||
|
|
|
@ -4,14 +4,13 @@ title: "视图"
|
||||||
sidebar_label: "视图"
|
sidebar_label: "视图"
|
||||||
---
|
---
|
||||||
|
|
||||||
从 TDengine 3.2.1.0 开始,TDengine 企业版提供视图功能,便于用户简化操作,提升用户间的分享能力。
|
从 v3.2.1.0 开始,TDengine 企业版提供视图功能,便于用户简化操作,提升用户间的分享能力。
|
||||||
|
|
||||||
视图(View)本质上是一个存储在数据库中的查询语句。视图(非物化视图)本身不包含数据,只有在从视图读取数据时才动态执行视图所指定的查询语句。我们在创建视图时指定一个名称,然后可以像使用普通表一样对其进行查询等操作。视图的使用需遵循以下规则:
|
视图(View)本质上是一个存储在数据库中的查询语句。视图(非物化视图)本身不包含数据,只有在从视图读取数据时才动态执行视图所指定的查询语句。我们在创建视图时指定一个名称,然后可以像使用普通表一样对其进行查询等操作。视图的使用需遵循以下规则:
|
||||||
- 视图可以嵌套定义和使用,视图与创建时指定的或当前数据库绑定使用。
|
- 视图可以嵌套定义和使用,视图与创建时指定的或当前数据库绑定使用。
|
||||||
- 在同一个数据库内,视图名称不允许重名,视图名跟表名也推荐不重名(不强制)。当出现视图与表名重名时,写入、查询、授权、回收权限等操作优先使用同名表。
|
- 在同一个数据库内,视图名称不允许重名,视图名跟表名也推荐不重名(不强制)。当出现视图与表名重名时,写入、查询、授权、回收权限等操作优先使用同名表。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 语法
|
## 语法
|
||||||
|
|
||||||
### 创建(更新)视图
|
### 创建(更新)视图
|
||||||
|
|
|
@ -1184,7 +1184,7 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多
|
||||||
- **接口说明**:用于轮询消费数据,每一个消费者,只能单线程调用该接口。
|
- **接口说明**:用于轮询消费数据,每一个消费者,只能单线程调用该接口。
|
||||||
- tmq:[入参] 指向一个有效的 tmq_t 结构体指针,该结构体代表一个 TMQ 消费者对象。
|
- tmq:[入参] 指向一个有效的 tmq_t 结构体指针,该结构体代表一个 TMQ 消费者对象。
|
||||||
- timeout:[入参] 轮询的超时时间,单位为毫秒,负数表示默认超时1秒。
|
- timeout:[入参] 轮询的超时时间,单位为毫秒,负数表示默认超时1秒。
|
||||||
- **返回值**:非 `NULL`:成功,返回一个指向 TAOS_RES 结构体的指针,该结构体包含了接收到的消息。。`NULL`:失败,表示没有数据。TAOS_RES 结果和 taos_query 返回结果一致,可通过查询的各种接口获取 TAOS_RES 里的信息,比如 schema 等。
|
- **返回值**:非 `NULL`:成功,返回一个指向 TAOS_RES 结构体的指针,该结构体包含了接收到的消息。。`NULL`:表示没有数据,可通过taos_errno(NULL) 获取错误码,具体错误码参见参考手册。TAOS_RES 结果和 taos_query 返回结果一致,可通过查询的各种接口获取 TAOS_RES 里的信息,比如 schema 等。
|
||||||
|
|
||||||
- `int32_t tmq_consumer_close(tmq_t *tmq)`
|
- `int32_t tmq_consumer_close(tmq_t *tmq)`
|
||||||
- **接口说明**:用于关闭 tmq_t 结构体。需与 tmq_consumer_new 配合使用。
|
- **接口说明**:用于关闭 tmq_t 结构体。需与 tmq_consumer_new 配合使用。
|
||||||
|
|
|
@ -431,7 +431,7 @@ description: TDengine 服务端的错误码列表和详细说明
|
||||||
| 0x80002635 | Incorrect TIMESTAMP value | 主键时间戳列值非法 | 检查并修正 SQL 语句 |
|
| 0x80002635 | Incorrect TIMESTAMP value | 主键时间戳列值非法 | 检查并修正 SQL 语句 |
|
||||||
| 0x80002637 | soffset/offset can not be less than 0 | soffset/offset 值非法 | 检查并修正 SQL 语句 |
|
| 0x80002637 | soffset/offset can not be less than 0 | soffset/offset 值非法 | 检查并修正 SQL 语句 |
|
||||||
| 0x80002638 | slimit/soffset only available for PARTITION/GROUP BY query | slimit/soffset 只支持 PARTITION BY/GROUP BY 语句 | 检查并修正 SQL 语句 |
|
| 0x80002638 | slimit/soffset only available for PARTITION/GROUP BY query | slimit/soffset 只支持 PARTITION BY/GROUP BY 语句 | 检查并修正 SQL 语句 |
|
||||||
| 0x80002639 | Invalid topic query | 不支持的 TOPIC 查询语 |
|
| 0x80002639 | Invalid topic query | 不支持的 TOPIC 查询语法 |
|
||||||
| 0x8000263A | Cannot drop super table in batch | 不支持批量删除超级表 | 检查并修正 SQL 语句 |
|
| 0x8000263A | Cannot drop super table in batch | 不支持批量删除超级表 | 检查并修正 SQL 语句 |
|
||||||
| 0x8000263B | Start(end) time of query range required or time range too large | 窗口个数超出限制 | 检查并修正 SQL 语句 |
|
| 0x8000263B | Start(end) time of query range required or time range too large | 窗口个数超出限制 | 检查并修正 SQL 语句 |
|
||||||
| 0x8000263C | Duplicated column names | 列名称重复 | 检查并修正 SQL 语句 |
|
| 0x8000263C | Duplicated column names | 列名称重复 | 检查并修正 SQL 语句 |
|
||||||
|
@ -475,6 +475,12 @@ description: TDengine 服务端的错误码列表和详细说明
|
||||||
| 0x80002665 | The _TAGS pseudo column can only be used for subtable and supertable queries | 非法 TAG 列查询 | 检查并修正 SQL 语句 |
|
| 0x80002665 | The _TAGS pseudo column can only be used for subtable and supertable queries | 非法 TAG 列查询 | 检查并修正 SQL 语句 |
|
||||||
| 0x80002666 | 子查询不含主键时间戳列输出 | 检查并修正 SQL 语句 |
|
| 0x80002666 | 子查询不含主键时间戳列输出 | 检查并修正 SQL 语句 |
|
||||||
| 0x80002667 | Invalid usage of expr: %s | 非法表达式 | 检查并修正 SQL 语句 |
|
| 0x80002667 | Invalid usage of expr: %s | 非法表达式 | 检查并修正 SQL 语句 |
|
||||||
|
| 0x80002687 | True_for duration cannot be negative | true_for 的值不能是负数 | 检查并修正 SQL 语句 |
|
||||||
|
| 0x80002688 | Cannot use 'year' or 'month' as true_for duration | 不能使用 n(月), y(年) 作为 true_for 的时间单位 | 检查并修正 SQL 语句 |
|
||||||
|
| 0x80002689 | Invalid using cols function | cols 函数使用错误 | 检查并修正 SQL 语句 |
|
||||||
|
| 0x8000268A | Cols function's first param must be a select function that output a single row | cols 函数第一个参数应该为选择函数 | 检查并修正 SQL 语句 |
|
||||||
|
| 0x8000268B | Invalid using cols function with multiple output columns | 多列输出的 cols 函数使用错误 | 检查并修正 SQL 语句 |
|
||||||
|
| 0x8000268C | Invalid using alias for cols function | cols 函数输出列重命名错误 | 检查并修正 SQL 语句 |
|
||||||
| 0x800026FF | Parser internal error | 解析器内部错误 | 保留现场和日志,github上报issue |
|
| 0x800026FF | Parser internal error | 解析器内部错误 | 保留现场和日志,github上报issue |
|
||||||
| 0x80002700 | Planner internal error | 计划期内部错误 | 保留现场和日志,github上报issue |
|
| 0x80002700 | Planner internal error | 计划期内部错误 | 保留现场和日志,github上报issue |
|
||||||
| 0x80002701 | Expect ts equal | JOIN 条件校验失败 | 保留现场和日志,github上报issue |
|
| 0x80002701 | Expect ts equal | JOIN 条件校验失败 | 保留现场和日志,github上报issue |
|
||||||
|
@ -551,8 +557,10 @@ description: TDengine 服务端的错误码列表和详细说明
|
||||||
|
|
||||||
| 错误码 | 错误描述 | 可能的出错场景或者可能的原因 | 建议用户采取的措施 |
|
| 错误码 | 错误描述 | 可能的出错场景或者可能的原因 | 建议用户采取的措施 |
|
||||||
| ---------- | --------------------- | -------------------------------------------------------------------------------- | ------------------------------ |
|
| ---------- | --------------------- | -------------------------------------------------------------------------------- | ------------------------------ |
|
||||||
|
| 0x800003E6 | Consumer not exist | Consumer 超时下线 | 重新建 consumer 订阅数据 |
|
||||||
|
| 0x800003EA | Consumer not ready | Consumer 正在平衡中 | 等待 2 秒后重试 |
|
||||||
| 0x80004000 | Invalid message | 订阅到的数据非法,一般不会出现 | 具体查看 client 端的错误日志提示 |
|
| 0x80004000 | Invalid message | 订阅到的数据非法,一般不会出现 | 具体查看 client 端的错误日志提示 |
|
||||||
| 0x80004001 | Consumer mismatch | 订阅请求的 vnode 和重新分配的 vnode 不一致,一般存在于有新消费者加入相同消费者组里时 | 内部错误,不暴露给用户 |
|
| 0x80004001 | Consumer mismatch | 订阅请求的 vnode 和重新分配的 vnode 不一致,一般存在于有新消费者加入相同消费者组里时 | 内部错误 |
|
||||||
| 0x80004002 | Consumer closed | 消费者已经不存在了 | 查看是否已经 close 掉了 |
|
| 0x80004002 | Consumer closed | 消费者已经不存在了 | 查看是否已经 close 掉了 |
|
||||||
| 0x80004017 | Invalid status, please subscribe topic first | 数据订阅状态不对 | 没有调用 subscribe,直接 poll 数据 |
|
| 0x80004017 | Invalid status, please subscribe topic first | 数据订阅状态不对 | 没有调用 subscribe,直接 poll 数据 |
|
||||||
| 0x80004100 | Stream task not exist | 流计算任务不存在 | 具体查看 server 端的错误日志 |
|
| 0x80004100 | Stream task not exist | 流计算任务不存在 | 具体查看 server 端的错误日志 |
|
||||||
|
|
|
@ -247,6 +247,8 @@ typedef struct TAOS_STMT2_BINDV {
|
||||||
DLL_EXPORT TAOS_STMT2 *taos_stmt2_init(TAOS *taos, TAOS_STMT2_OPTION *option);
|
DLL_EXPORT TAOS_STMT2 *taos_stmt2_init(TAOS *taos, TAOS_STMT2_OPTION *option);
|
||||||
DLL_EXPORT int taos_stmt2_prepare(TAOS_STMT2 *stmt, const char *sql, unsigned long length);
|
DLL_EXPORT int taos_stmt2_prepare(TAOS_STMT2 *stmt, const char *sql, unsigned long length);
|
||||||
DLL_EXPORT int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx);
|
DLL_EXPORT int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx);
|
||||||
|
DLL_EXPORT int taos_stmt2_bind_param_a(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col_idx, __taos_async_fn_t fp,
|
||||||
|
void *param);
|
||||||
DLL_EXPORT int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows);
|
DLL_EXPORT int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows);
|
||||||
DLL_EXPORT int taos_stmt2_close(TAOS_STMT2 *stmt);
|
DLL_EXPORT int taos_stmt2_close(TAOS_STMT2 *stmt);
|
||||||
DLL_EXPORT int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert);
|
DLL_EXPORT int taos_stmt2_is_insert(TAOS_STMT2 *stmt, int *insert);
|
||||||
|
@ -360,7 +362,8 @@ typedef enum tmq_res_t {
|
||||||
TMQ_RES_INVALID = -1,
|
TMQ_RES_INVALID = -1,
|
||||||
TMQ_RES_DATA = 1,
|
TMQ_RES_DATA = 1,
|
||||||
TMQ_RES_TABLE_META = 2,
|
TMQ_RES_TABLE_META = 2,
|
||||||
TMQ_RES_METADATA = 3
|
TMQ_RES_METADATA = 3,
|
||||||
|
TMQ_RES_RAWDATA = 4
|
||||||
} tmq_res_t;
|
} tmq_res_t;
|
||||||
|
|
||||||
typedef struct tmq_topic_assignment {
|
typedef struct tmq_topic_assignment {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#define TDENGINE_STREAMMSG_H
|
#define TDENGINE_STREAMMSG_H
|
||||||
|
|
||||||
#include "tmsg.h"
|
#include "tmsg.h"
|
||||||
//#include "trpc.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -256,6 +255,14 @@ typedef struct {
|
||||||
int32_t tEncodeStreamTaskRunReq(SEncoder* pEncoder, const SStreamTaskRunReq* pReq);
|
int32_t tEncodeStreamTaskRunReq(SEncoder* pEncoder, const SStreamTaskRunReq* pReq);
|
||||||
int32_t tDecodeStreamTaskRunReq(SDecoder* pDecoder, SStreamTaskRunReq* pReq);
|
int32_t tDecodeStreamTaskRunReq(SDecoder* pDecoder, SStreamTaskRunReq* pReq);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SMsgHead head;
|
||||||
|
int64_t streamId;
|
||||||
|
} SStreamTaskStopReq;
|
||||||
|
|
||||||
|
int32_t tEncodeStreamTaskStopReq(SEncoder* pEncoder, const SStreamTaskStopReq* pReq);
|
||||||
|
int32_t tDecodeStreamTaskStopReq(SDecoder* pDecoder, SStreamTaskStopReq* pReq);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -63,6 +63,7 @@ extern "C" {
|
||||||
#define TSDB_INS_TABLE_TSMAS "ins_tsmas"
|
#define TSDB_INS_TABLE_TSMAS "ins_tsmas"
|
||||||
#define TSDB_INS_DISK_USAGE "ins_disk_usage"
|
#define TSDB_INS_DISK_USAGE "ins_disk_usage"
|
||||||
#define TSDB_INS_TABLE_FILESETS "ins_filesets"
|
#define TSDB_INS_TABLE_FILESETS "ins_filesets"
|
||||||
|
#define TSDB_INS_TABLE_TRANSACTION_DETAILS "ins_transaction_details"
|
||||||
|
|
||||||
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
#define TSDB_PERFORMANCE_SCHEMA_DB "performance_schema"
|
||||||
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
|
#define TSDB_PERFS_TABLE_SMAS "perf_smas"
|
||||||
|
|
|
@ -121,10 +121,11 @@ enum {
|
||||||
TMQ_MSG_TYPE__POLL_DATA_META_RSP,
|
TMQ_MSG_TYPE__POLL_DATA_META_RSP,
|
||||||
TMQ_MSG_TYPE__WALINFO_RSP,
|
TMQ_MSG_TYPE__WALINFO_RSP,
|
||||||
TMQ_MSG_TYPE__POLL_BATCH_META_RSP,
|
TMQ_MSG_TYPE__POLL_BATCH_META_RSP,
|
||||||
|
TMQ_MSG_TYPE__POLL_RAW_DATA_RSP,
|
||||||
};
|
};
|
||||||
|
|
||||||
static char* tmqMsgTypeStr[] = {
|
static const char* tmqMsgTypeStr[] = {
|
||||||
"data", "meta", "ask ep", "meta data", "wal info", "batch meta"
|
"data", "meta", "ask ep", "meta data", "wal info", "batch meta", "raw data"
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -160,6 +161,7 @@ typedef enum EStreamType {
|
||||||
STREAM_PARTITION_DELETE_DATA,
|
STREAM_PARTITION_DELETE_DATA,
|
||||||
STREAM_GET_RESULT,
|
STREAM_GET_RESULT,
|
||||||
STREAM_DROP_CHILD_TABLE,
|
STREAM_DROP_CHILD_TABLE,
|
||||||
|
STREAM_NOTIFY_EVENT,
|
||||||
} EStreamType;
|
} EStreamType;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
@ -408,8 +410,11 @@ typedef struct STUidTagInfo {
|
||||||
#define UD_GROUPID_COLUMN_INDEX 1
|
#define UD_GROUPID_COLUMN_INDEX 1
|
||||||
#define UD_TAG_COLUMN_INDEX 2
|
#define UD_TAG_COLUMN_INDEX 2
|
||||||
|
|
||||||
|
// stream notify event block column
|
||||||
|
#define NOTIFY_EVENT_STR_COLUMN_INDEX 0
|
||||||
|
|
||||||
int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t startTime);
|
int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t startTime);
|
||||||
int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol);
|
int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol, char* likePattern);
|
||||||
|
|
||||||
#define TSMA_RES_STB_POSTFIX "_tsma_res_stb_"
|
#define TSMA_RES_STB_POSTFIX "_tsma_res_stb_"
|
||||||
#define MD5_OUTPUT_LEN 32
|
#define MD5_OUTPUT_LEN 32
|
||||||
|
|
|
@ -195,6 +195,8 @@ int32_t colDataSetVal(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const
|
||||||
// For the VAR_DATA_TYPE type, if a row already has data before inserting it (judged by offset != -1),
|
// For the VAR_DATA_TYPE type, if a row already has data before inserting it (judged by offset != -1),
|
||||||
// it will be inserted at the original position and the old data will be overwritten.
|
// it will be inserted at the original position and the old data will be overwritten.
|
||||||
int32_t colDataSetValOrCover(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull);
|
int32_t colDataSetValOrCover(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, bool isNull);
|
||||||
|
int32_t varColSetVarData(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pVarData, int32_t varDataLen,
|
||||||
|
bool isNull);
|
||||||
int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData);
|
int32_t colDataReassignVal(SColumnInfoData* pColumnInfoData, uint32_t dstRowIdx, uint32_t srcRowIdx, const char* pData);
|
||||||
int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, uint32_t numOfRows,
|
int32_t colDataSetNItems(SColumnInfoData* pColumnInfoData, uint32_t rowIndex, const char* pData, uint32_t numOfRows,
|
||||||
bool trimValue);
|
bool trimValue);
|
||||||
|
@ -285,6 +287,8 @@ bool isAutoTableName(char* ctbName);
|
||||||
int32_t buildCtbNameAddGroupId(const char* stbName, char* ctbName, uint64_t groupId, size_t cap);
|
int32_t buildCtbNameAddGroupId(const char* stbName, char* ctbName, uint64_t groupId, size_t cap);
|
||||||
int32_t buildCtbNameByGroupId(const char* stbName, uint64_t groupId, char** pName);
|
int32_t buildCtbNameByGroupId(const char* stbName, uint64_t groupId, char** pName);
|
||||||
int32_t buildCtbNameByGroupIdImpl(const char* stbName, uint64_t groupId, char* pBuf);
|
int32_t buildCtbNameByGroupIdImpl(const char* stbName, uint64_t groupId, char* pBuf);
|
||||||
|
int32_t buildSinkDestTableName(char* parTbName, const char* stbFullName, uint64_t gid, bool newSubTableRule,
|
||||||
|
char** dstTableName);
|
||||||
|
|
||||||
int32_t trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolList);
|
int32_t trimDataBlock(SSDataBlock* pBlock, int32_t totalRows, const bool* pBoolList);
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ extern EEncryptAlgor tsiEncryptAlgorithm;
|
||||||
extern EEncryptScope tsiEncryptScope;
|
extern EEncryptScope tsiEncryptScope;
|
||||||
// extern char tsAuthCode[];
|
// extern char tsAuthCode[];
|
||||||
extern char tsEncryptKey[];
|
extern char tsEncryptKey[];
|
||||||
|
extern int8_t tsEnableStrongPassword;
|
||||||
|
|
||||||
// common
|
// common
|
||||||
extern int32_t tsMaxShellConns;
|
extern int32_t tsMaxShellConns;
|
||||||
|
@ -296,6 +297,8 @@ extern int32_t tsMaxStreamBackendCache;
|
||||||
extern int32_t tsPQSortMemThreshold;
|
extern int32_t tsPQSortMemThreshold;
|
||||||
extern bool tsStreamCoverage;
|
extern bool tsStreamCoverage;
|
||||||
extern int8_t tsS3EpNum;
|
extern int8_t tsS3EpNum;
|
||||||
|
extern int32_t tsStreamNotifyMessageSize;
|
||||||
|
extern int32_t tsStreamNotifyFrameSize;
|
||||||
|
|
||||||
extern bool tsExperimental;
|
extern bool tsExperimental;
|
||||||
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
||||||
|
|
|
@ -61,6 +61,7 @@ typedef enum {
|
||||||
TSDB_GRANT_ACTIVE_ACTIVE,
|
TSDB_GRANT_ACTIVE_ACTIVE,
|
||||||
TSDB_GRANT_DUAL_REPLICA_HA,
|
TSDB_GRANT_DUAL_REPLICA_HA,
|
||||||
TSDB_GRANT_DB_ENCRYPTION,
|
TSDB_GRANT_DB_ENCRYPTION,
|
||||||
|
TSDB_GRANT_TD_GPT,
|
||||||
} EGrantType;
|
} EGrantType;
|
||||||
|
|
||||||
int32_t checkAndGetCryptKey(const char *encryptCode, const char *machineId, char **key);
|
int32_t checkAndGetCryptKey(const char *encryptCode, const char *machineId, char **key);
|
||||||
|
|
|
@ -163,6 +163,7 @@ typedef enum _mgmt_table {
|
||||||
TSDB_MGMT_TABLE_ANODE_FULL,
|
TSDB_MGMT_TABLE_ANODE_FULL,
|
||||||
TSDB_MGMT_TABLE_USAGE,
|
TSDB_MGMT_TABLE_USAGE,
|
||||||
TSDB_MGMT_TABLE_FILESETS,
|
TSDB_MGMT_TABLE_FILESETS,
|
||||||
|
TSDB_MGMT_TABLE_TRANSACTION_DETAIL,
|
||||||
TSDB_MGMT_TABLE_MAX,
|
TSDB_MGMT_TABLE_MAX,
|
||||||
} EShowType;
|
} EShowType;
|
||||||
|
|
||||||
|
@ -268,6 +269,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_TSMA_OPTIONS,
|
QUERY_NODE_TSMA_OPTIONS,
|
||||||
QUERY_NODE_ANOMALY_WINDOW,
|
QUERY_NODE_ANOMALY_WINDOW,
|
||||||
QUERY_NODE_RANGE_AROUND,
|
QUERY_NODE_RANGE_AROUND,
|
||||||
|
QUERY_NODE_STREAM_NOTIFY_OPTIONS,
|
||||||
|
|
||||||
// Statement nodes are used in parser and planner module.
|
// Statement nodes are used in parser and planner module.
|
||||||
QUERY_NODE_SET_OPERATOR = 100,
|
QUERY_NODE_SET_OPERATOR = 100,
|
||||||
|
@ -357,6 +359,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_CREATE_ANODE_STMT,
|
QUERY_NODE_CREATE_ANODE_STMT,
|
||||||
QUERY_NODE_DROP_ANODE_STMT,
|
QUERY_NODE_DROP_ANODE_STMT,
|
||||||
QUERY_NODE_UPDATE_ANODE_STMT,
|
QUERY_NODE_UPDATE_ANODE_STMT,
|
||||||
|
QUERY_NODE_ASSIGN_LEADER_STMT,
|
||||||
|
|
||||||
// show statement nodes
|
// show statement nodes
|
||||||
// see 'sysTableShowAdapter', 'SYSTABLE_SHOW_TYPE_OFFSET'
|
// see 'sysTableShowAdapter', 'SYSTABLE_SHOW_TYPE_OFFSET'
|
||||||
|
@ -405,6 +408,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_SHOW_CREATE_TSMA_STMT,
|
QUERY_NODE_SHOW_CREATE_TSMA_STMT,
|
||||||
QUERY_NODE_DROP_TSMA_STMT,
|
QUERY_NODE_DROP_TSMA_STMT,
|
||||||
QUERY_NODE_SHOW_FILESETS_STMT,
|
QUERY_NODE_SHOW_FILESETS_STMT,
|
||||||
|
QUERY_NODE_SHOW_TRANSACTION_DETAILS_STMT,
|
||||||
|
|
||||||
// logic plan node
|
// logic plan node
|
||||||
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
|
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
|
||||||
|
@ -480,11 +484,13 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_PHYSICAL_PLAN_STREAM_ANOMALY,
|
QUERY_NODE_PHYSICAL_PLAN_STREAM_ANOMALY,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC,
|
QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC,
|
||||||
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC,
|
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERP_FUNC,
|
||||||
|
QUERY_NODE_RESET_STREAM_STMT,
|
||||||
} ENodeType;
|
} ENodeType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
uint8_t option; // 0x0 REQ_OPT_TBNAME, 0x01 REQ_OPT_TBUID
|
uint8_t option; // 0x0 REQ_OPT_TBNAME, 0x01 REQ_OPT_TBUID
|
||||||
|
uint8_t autoCreateCtb; // 0x0 not auto create, 0x01 auto create
|
||||||
const char* dbFName;
|
const char* dbFName;
|
||||||
const char* tbName;
|
const char* tbName;
|
||||||
} SBuildTableInput;
|
} SBuildTableInput;
|
||||||
|
@ -1085,6 +1091,7 @@ typedef struct {
|
||||||
char* sql;
|
char* sql;
|
||||||
int8_t isImport;
|
int8_t isImport;
|
||||||
int8_t createDb;
|
int8_t createDb;
|
||||||
|
int8_t passIsMd5;
|
||||||
} SCreateUserReq;
|
} SCreateUserReq;
|
||||||
|
|
||||||
int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
|
int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq);
|
||||||
|
@ -1155,6 +1162,7 @@ typedef struct {
|
||||||
int64_t privileges;
|
int64_t privileges;
|
||||||
int32_t sqlLen;
|
int32_t sqlLen;
|
||||||
char* sql;
|
char* sql;
|
||||||
|
int8_t passIsMd5;
|
||||||
} SAlterUserReq;
|
} SAlterUserReq;
|
||||||
|
|
||||||
int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq);
|
int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq);
|
||||||
|
@ -1635,6 +1643,7 @@ typedef struct {
|
||||||
int32_t sqlLen;
|
int32_t sqlLen;
|
||||||
char* sql;
|
char* sql;
|
||||||
SArray* vgroupIds;
|
SArray* vgroupIds;
|
||||||
|
int8_t metaOnly;
|
||||||
} SCompactDbReq;
|
} SCompactDbReq;
|
||||||
|
|
||||||
int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq);
|
int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq);
|
||||||
|
@ -1773,6 +1782,8 @@ typedef struct {
|
||||||
int64_t numOfBatchInsertSuccessReqs;
|
int64_t numOfBatchInsertSuccessReqs;
|
||||||
int32_t numOfCachedTables;
|
int32_t numOfCachedTables;
|
||||||
int32_t learnerProgress; // use one reservered
|
int32_t learnerProgress; // use one reservered
|
||||||
|
int64_t syncAppliedIndex;
|
||||||
|
int64_t syncCommitIndex;
|
||||||
} SVnodeLoad;
|
} SVnodeLoad;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -2078,6 +2089,7 @@ typedef struct {
|
||||||
int64_t compactStartTime;
|
int64_t compactStartTime;
|
||||||
STimeWindow tw;
|
STimeWindow tw;
|
||||||
int32_t compactId;
|
int32_t compactId;
|
||||||
|
int8_t metaOnly;
|
||||||
} SCompactVnodeReq;
|
} SCompactVnodeReq;
|
||||||
|
|
||||||
int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq);
|
int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq);
|
||||||
|
@ -2164,6 +2176,7 @@ typedef struct {
|
||||||
char dbFName[TSDB_DB_FNAME_LEN];
|
char dbFName[TSDB_DB_FNAME_LEN];
|
||||||
char tbName[TSDB_TABLE_NAME_LEN];
|
char tbName[TSDB_TABLE_NAME_LEN];
|
||||||
uint8_t option;
|
uint8_t option;
|
||||||
|
uint8_t autoCreateCtb;
|
||||||
} STableInfoReq;
|
} STableInfoReq;
|
||||||
|
|
||||||
int32_t tSerializeSTableInfoReq(void* buf, int32_t bufLen, STableInfoReq* pReq);
|
int32_t tSerializeSTableInfoReq(void* buf, int32_t bufLen, STableInfoReq* pReq);
|
||||||
|
@ -2242,11 +2255,14 @@ typedef struct {
|
||||||
} STagData;
|
} STagData;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t useless; // useless
|
int32_t opType;
|
||||||
|
uint32_t valLen;
|
||||||
|
char* val;
|
||||||
} SShowVariablesReq;
|
} SShowVariablesReq;
|
||||||
|
|
||||||
int32_t tSerializeSShowVariablesReq(void* buf, int32_t bufLen, SShowVariablesReq* pReq);
|
int32_t tSerializeSShowVariablesReq(void* buf, int32_t bufLen, SShowVariablesReq* pReq);
|
||||||
// int32_t tDeserializeSShowVariablesReq(void* buf, int32_t bufLen, SShowVariablesReq* pReq);
|
int32_t tDeserializeSShowVariablesReq(void* buf, int32_t bufLen, SShowVariablesReq* pReq);
|
||||||
|
void tFreeSShowVariablesReq(SShowVariablesReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_CONFIG_OPTION_LEN + 1];
|
char name[TSDB_CONFIG_OPTION_LEN + 1];
|
||||||
|
@ -2309,6 +2325,10 @@ typedef struct SSysTableSchema {
|
||||||
int32_t tSerializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq);
|
int32_t tSerializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq);
|
||||||
int32_t tDeserializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq);
|
int32_t tDeserializeSRetrieveTableReq(void* buf, int32_t bufLen, SRetrieveTableReq* pReq);
|
||||||
|
|
||||||
|
#define RETRIEVE_TABLE_RSP_VERSION 0
|
||||||
|
#define RETRIEVE_TABLE_RSP_TMQ_VERSION 1
|
||||||
|
#define RETRIEVE_TABLE_RSP_TMQ_RAW_VERSION 2
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t useconds;
|
int64_t useconds;
|
||||||
int8_t completed; // all results are returned to client
|
int8_t completed; // all results are returned to client
|
||||||
|
@ -2574,6 +2594,7 @@ typedef struct {
|
||||||
char* arbToken;
|
char* arbToken;
|
||||||
int64_t arbTerm;
|
int64_t arbTerm;
|
||||||
char* memberToken;
|
char* memberToken;
|
||||||
|
int8_t force;
|
||||||
} SVArbSetAssignedLeaderReq;
|
} SVArbSetAssignedLeaderReq;
|
||||||
|
|
||||||
int32_t tSerializeSVArbSetAssignedLeaderReq(void* buf, int32_t bufLen, SVArbSetAssignedLeaderReq* pReq);
|
int32_t tSerializeSVArbSetAssignedLeaderReq(void* buf, int32_t bufLen, SVArbSetAssignedLeaderReq* pReq);
|
||||||
|
@ -2609,6 +2630,8 @@ typedef struct {
|
||||||
int8_t assignedAcked;
|
int8_t assignedAcked;
|
||||||
SMArbUpdateGroupAssigned assignedLeader;
|
SMArbUpdateGroupAssigned assignedLeader;
|
||||||
int64_t version;
|
int64_t version;
|
||||||
|
int32_t code;
|
||||||
|
int64_t updateTimeMs;
|
||||||
} SMArbUpdateGroup;
|
} SMArbUpdateGroup;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -2650,6 +2673,15 @@ int32_t tSerializeSBalanceVgroupReq(void* buf, int32_t bufLen, SBalanceVgroupReq
|
||||||
int32_t tDeserializeSBalanceVgroupReq(void* buf, int32_t bufLen, SBalanceVgroupReq* pReq);
|
int32_t tDeserializeSBalanceVgroupReq(void* buf, int32_t bufLen, SBalanceVgroupReq* pReq);
|
||||||
void tFreeSBalanceVgroupReq(SBalanceVgroupReq* pReq);
|
void tFreeSBalanceVgroupReq(SBalanceVgroupReq* pReq);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t useless; // useless
|
||||||
|
int32_t sqlLen;
|
||||||
|
char* sql;
|
||||||
|
} SAssignLeaderReq;
|
||||||
|
|
||||||
|
int32_t tSerializeSAssignLeaderReq(void* buf, int32_t bufLen, SAssignLeaderReq* pReq);
|
||||||
|
int32_t tDeserializeSAssignLeaderReq(void* buf, int32_t bufLen, SAssignLeaderReq* pReq);
|
||||||
|
void tFreeSAssignLeaderReq(SAssignLeaderReq* pReq);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t vgId1;
|
int32_t vgId1;
|
||||||
int32_t vgId2;
|
int32_t vgId2;
|
||||||
|
@ -2954,8 +2986,29 @@ typedef struct {
|
||||||
// 3.3.0.0
|
// 3.3.0.0
|
||||||
SArray* pCols; // array of SField
|
SArray* pCols; // array of SField
|
||||||
int64_t smaId;
|
int64_t smaId;
|
||||||
|
// 3.3.6.0
|
||||||
|
SArray* pNotifyAddrUrls;
|
||||||
|
int32_t notifyEventTypes;
|
||||||
|
int32_t notifyErrorHandle;
|
||||||
|
int8_t notifyHistory;
|
||||||
} SCMCreateStreamReq;
|
} SCMCreateStreamReq;
|
||||||
|
|
||||||
|
typedef struct STaskNotifyEventStat {
|
||||||
|
int64_t notifyEventAddTimes; // call times of add function
|
||||||
|
int64_t notifyEventAddElems; // elements added by add function
|
||||||
|
double notifyEventAddCostSec; // time cost of add function
|
||||||
|
int64_t notifyEventPushTimes; // call times of push function
|
||||||
|
int64_t notifyEventPushElems; // elements pushed by push function
|
||||||
|
double notifyEventPushCostSec; // time cost of push function
|
||||||
|
int64_t notifyEventPackTimes; // call times of pack function
|
||||||
|
int64_t notifyEventPackElems; // elements packed by pack function
|
||||||
|
double notifyEventPackCostSec; // time cost of pack function
|
||||||
|
int64_t notifyEventSendTimes; // call times of send function
|
||||||
|
int64_t notifyEventSendElems; // elements sent by send function
|
||||||
|
double notifyEventSendCostSec; // time cost of send function
|
||||||
|
int64_t notifyEventHoldElems; // elements hold due to watermark
|
||||||
|
} STaskNotifyEventStat;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t streamId;
|
int64_t streamId;
|
||||||
} SCMCreateStreamRsp;
|
} SCMCreateStreamRsp;
|
||||||
|
@ -2972,6 +3025,8 @@ enum {
|
||||||
|
|
||||||
#define DEFAULT_MAX_POLL_INTERVAL 300000
|
#define DEFAULT_MAX_POLL_INTERVAL 300000
|
||||||
#define DEFAULT_SESSION_TIMEOUT 12000
|
#define DEFAULT_SESSION_TIMEOUT 12000
|
||||||
|
#define DEFAULT_MAX_POLL_WAIT_TIME 1000
|
||||||
|
#define DEFAULT_MIN_POLL_ROWS 4096
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic
|
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic
|
||||||
|
@ -3521,6 +3576,7 @@ typedef struct {
|
||||||
SArray* rsps; // SArray<SClientHbRsp>
|
SArray* rsps; // SArray<SClientHbRsp>
|
||||||
SMonitorParas monitorParas;
|
SMonitorParas monitorParas;
|
||||||
int8_t enableAuditDelete;
|
int8_t enableAuditDelete;
|
||||||
|
int8_t enableStrongPass;
|
||||||
} SClientHbBatchRsp;
|
} SClientHbBatchRsp;
|
||||||
|
|
||||||
static FORCE_INLINE uint32_t hbKeyHashFunc(const char* key, uint32_t keyLen) { return taosIntHash_64(key, keyLen); }
|
static FORCE_INLINE uint32_t hbKeyHashFunc(const char* key, uint32_t keyLen) { return taosIntHash_64(key, keyLen); }
|
||||||
|
@ -3914,6 +3970,15 @@ typedef struct {
|
||||||
int32_t tSerializeSMResumeStreamReq(void* buf, int32_t bufLen, const SMResumeStreamReq* pReq);
|
int32_t tSerializeSMResumeStreamReq(void* buf, int32_t bufLen, const SMResumeStreamReq* pReq);
|
||||||
int32_t tDeserializeSMResumeStreamReq(void* buf, int32_t bufLen, SMResumeStreamReq* pReq);
|
int32_t tDeserializeSMResumeStreamReq(void* buf, int32_t bufLen, SMResumeStreamReq* pReq);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char name[TSDB_STREAM_FNAME_LEN];
|
||||||
|
int8_t igNotExists;
|
||||||
|
int8_t igUntreated;
|
||||||
|
} SMResetStreamReq;
|
||||||
|
|
||||||
|
int32_t tSerializeSMResetStreamReq(void* buf, int32_t bufLen, const SMResetStreamReq* pReq);
|
||||||
|
int32_t tDeserializeSMResetStreamReq(void* buf, int32_t bufLen, SMResetStreamReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_TABLE_FNAME_LEN];
|
char name[TSDB_TABLE_FNAME_LEN];
|
||||||
char stb[TSDB_TABLE_FNAME_LEN];
|
char stb[TSDB_TABLE_FNAME_LEN];
|
||||||
|
@ -4165,7 +4230,10 @@ typedef struct {
|
||||||
STqOffsetVal reqOffset;
|
STqOffsetVal reqOffset;
|
||||||
int8_t enableReplay;
|
int8_t enableReplay;
|
||||||
int8_t sourceExcluded;
|
int8_t sourceExcluded;
|
||||||
|
int8_t rawData;
|
||||||
|
int32_t minPollRows;
|
||||||
int8_t enableBatchMeta;
|
int8_t enableBatchMeta;
|
||||||
|
SHashObj *uidHash; // to find if uid is duplicated
|
||||||
} SMqPollReq;
|
} SMqPollReq;
|
||||||
|
|
||||||
int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
|
int32_t tSerializeSMqPollReq(void* buf, int32_t bufLen, SMqPollReq* pReq);
|
||||||
|
@ -4239,13 +4307,21 @@ typedef struct {
|
||||||
SArray* createTableLen;
|
SArray* createTableLen;
|
||||||
SArray* createTableReq;
|
SArray* createTableReq;
|
||||||
};
|
};
|
||||||
|
struct{
|
||||||
|
int32_t len;
|
||||||
|
void* rawData;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
void* data; //for free in client, only effected if type is data or metadata. raw data not effected
|
||||||
|
bool blockDataElementFree; // if true, free blockDataElement in blockData,(true in server, false in client)
|
||||||
|
|
||||||
} SMqDataRsp;
|
} SMqDataRsp;
|
||||||
|
|
||||||
int32_t tEncodeMqDataRsp(SEncoder* pEncoder, const SMqDataRsp* pObj);
|
int32_t tEncodeMqDataRsp(SEncoder* pEncoder, const SMqDataRsp* pObj);
|
||||||
int32_t tDecodeMqDataRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
|
int32_t tDecodeMqDataRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
|
||||||
|
int32_t tDecodeMqRawDataRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
|
||||||
void tDeleteMqDataRsp(SMqDataRsp* pRsp);
|
void tDeleteMqDataRsp(SMqDataRsp* pRsp);
|
||||||
|
void tDeleteMqRawDataRsp(SMqDataRsp* pRsp);
|
||||||
|
|
||||||
int32_t tEncodeSTaosxRsp(SEncoder* pEncoder, const SMqDataRsp* pRsp);
|
int32_t tEncodeSTaosxRsp(SEncoder* pEncoder, const SMqDataRsp* pRsp);
|
||||||
int32_t tDecodeSTaosxRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
|
int32_t tDecodeSTaosxRsp(SDecoder* pDecoder, SMqDataRsp* pRsp);
|
||||||
|
@ -4495,6 +4571,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SArray* aSubmitTbData; // SArray<SSubmitTbData>
|
SArray* aSubmitTbData; // SArray<SSubmitTbData>
|
||||||
|
bool raw;
|
||||||
} SSubmitReq2;
|
} SSubmitReq2;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -4503,8 +4580,9 @@ typedef struct {
|
||||||
char data[]; // SSubmitReq2
|
char data[]; // SSubmitReq2
|
||||||
} SSubmitReq2Msg;
|
} SSubmitReq2Msg;
|
||||||
|
|
||||||
|
int32_t transformRawSSubmitTbData(void* data, int64_t suid, int64_t uid, int32_t sver);
|
||||||
int32_t tEncodeSubmitReq(SEncoder* pCoder, const SSubmitReq2* pReq);
|
int32_t tEncodeSubmitReq(SEncoder* pCoder, const SSubmitReq2* pReq);
|
||||||
int32_t tDecodeSubmitReq(SDecoder* pCoder, SSubmitReq2* pReq);
|
int32_t tDecodeSubmitReq(SDecoder* pCoder, SSubmitReq2* pReq, SArray* rawList);
|
||||||
void tDestroySubmitTbData(SSubmitTbData* pTbData, int32_t flag);
|
void tDestroySubmitTbData(SSubmitTbData* pTbData, int32_t flag);
|
||||||
void tDestroySubmitReq(SSubmitReq2* pReq, int32_t flag);
|
void tDestroySubmitReq(SSubmitReq2* pReq, int32_t flag);
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,7 @@
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_AUDIT, "audit", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_AUDIT, "audit", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_CONFIG, "init-config", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_CONFIG, "init-config", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_SDB, "config-sdb", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_CONFIG_SDB, "config-sdb", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_MND_RESET_STREAM, "reset-stream", NULL, NULL)
|
||||||
TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG)
|
TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG)
|
||||||
|
|
||||||
TD_NEW_MSG_SEG(TDMT_VND_MSG) // 2<<8
|
TD_NEW_MSG_SEG(TDMT_VND_MSG) // 2<<8
|
||||||
|
@ -401,6 +402,7 @@
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TASK_CHECK, "vnode-stream-task-check", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TASK_CHECK, "vnode-stream-task-check", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_UNUSED, "vnd-stream-unused", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_UNUSED, "vnd-stream-unused", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_VND_GET_STREAM_PROGRESS, "vnd-stream-progress", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_VND_GET_STREAM_PROGRESS, "vnd-stream-progress", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_ALL_STOP, "vnd-stream-allstop", NULL, NULL)
|
||||||
TD_CLOSE_MSG_SEG(TDMT_VND_STREAM_MSG)
|
TD_CLOSE_MSG_SEG(TDMT_VND_STREAM_MSG)
|
||||||
|
|
||||||
TD_NEW_MSG_SEG(TDMT_VND_TMQ_MSG) //8 << 8
|
TD_NEW_MSG_SEG(TDMT_VND_TMQ_MSG) //8 << 8
|
||||||
|
@ -421,6 +423,7 @@
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_ARB_CHECK_SYNC_TIMER, "mnd-arb-check-sync-tmr", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_ARB_CHECK_SYNC_TIMER, "mnd-arb-check-sync-tmr", NULL, NULL)
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_ARB_UPDATE_GROUP, "mnd-arb-update-group", NULL, NULL) // no longer used
|
TD_DEF_MSG_TYPE(TDMT_MND_ARB_UPDATE_GROUP, "mnd-arb-update-group", NULL, NULL) // no longer used
|
||||||
TD_DEF_MSG_TYPE(TDMT_MND_ARB_UPDATE_GROUP_BATCH, "mnd-arb-update-group-batch", NULL, NULL)
|
TD_DEF_MSG_TYPE(TDMT_MND_ARB_UPDATE_GROUP_BATCH, "mnd-arb-update-group-batch", NULL, NULL)
|
||||||
|
TD_DEF_MSG_TYPE(TDMT_MND_ARB_ASSIGN_LEADER, "mnd-arb-assign-leader", NULL, NULL)
|
||||||
TD_CLOSE_MSG_SEG(TDMT_MND_ARB_MSG)
|
TD_CLOSE_MSG_SEG(TDMT_MND_ARB_MSG)
|
||||||
|
|
||||||
TD_NEW_MSG_SEG(TDMT_MAX_MSG) // msg end mark
|
TD_NEW_MSG_SEG(TDMT_MAX_MSG) // msg end mark
|
||||||
|
|
|
@ -39,6 +39,7 @@ int32_t tqStreamTaskProcessRunReq(SStreamMeta* pMeta, SRpcMsg* pMsg, bool isLead
|
||||||
int32_t tqStartTaskCompleteCallback(SStreamMeta* pMeta);
|
int32_t tqStartTaskCompleteCallback(SStreamMeta* pMeta);
|
||||||
int32_t tqStreamTasksGetTotalNum(SStreamMeta* pMeta);
|
int32_t tqStreamTasksGetTotalNum(SStreamMeta* pMeta);
|
||||||
int32_t tqStreamTaskProcessTaskResetReq(SStreamMeta* pMeta, char* msg);
|
int32_t tqStreamTaskProcessTaskResetReq(SStreamMeta* pMeta, char* msg);
|
||||||
|
int32_t tqStreamTaskProcessAllTaskStopReq(SStreamMeta* pMeta, SMsgCb* pMsgCb, SRpcMsg* pMsg);
|
||||||
int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg);
|
int32_t tqStreamTaskProcessRetrieveTriggerReq(SStreamMeta* pMeta, SRpcMsg* pMsg);
|
||||||
int32_t tqStreamTaskProcessRetrieveTriggerRsp(SStreamMeta* pMeta, SRpcMsg* pMsg);
|
int32_t tqStreamTaskProcessRetrieveTriggerRsp(SStreamMeta* pMeta, SRpcMsg* pMsg);
|
||||||
int32_t tqStreamTaskProcessTaskPauseReq(SStreamMeta* pMeta, char* pMsg);
|
int32_t tqStreamTaskProcessTaskPauseReq(SStreamMeta* pMeta, char* pMsg);
|
||||||
|
|
|
@ -79,6 +79,7 @@ typedef struct SDbInfo {
|
||||||
typedef struct STablesReq {
|
typedef struct STablesReq {
|
||||||
char dbFName[TSDB_DB_FNAME_LEN];
|
char dbFName[TSDB_DB_FNAME_LEN];
|
||||||
SArray* pTables;
|
SArray* pTables;
|
||||||
|
uint8_t autoCreate; // 0x0 not auto create, 0x01 auto create
|
||||||
} STablesReq;
|
} STablesReq;
|
||||||
|
|
||||||
typedef struct SCatalogReq {
|
typedef struct SCatalogReq {
|
||||||
|
|
|
@ -98,6 +98,9 @@ int32_t qSetTaskId(qTaskInfo_t tinfo, uint64_t taskId, uint64_t queryId);
|
||||||
|
|
||||||
int32_t qSetStreamOpOpen(qTaskInfo_t tinfo);
|
int32_t qSetStreamOpOpen(qTaskInfo_t tinfo);
|
||||||
|
|
||||||
|
int32_t qSetStreamNotifyInfo(qTaskInfo_t tinfo, int32_t eventTypes, const SSchemaWrapper* pSchemaWrapper,
|
||||||
|
const char* stbFullName, bool newSubTableRule, STaskNotifyEventStat* pNotifyEventStat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set multiple input data blocks for the stream scan.
|
* Set multiple input data blocks for the stream scan.
|
||||||
* @param tinfo
|
* @param tinfo
|
||||||
|
|
|
@ -432,6 +432,7 @@ typedef struct SStateStore {
|
||||||
int32_t (*updateInfoSerialize)(SEncoder* pEncoder, const SUpdateInfo* pInfo);
|
int32_t (*updateInfoSerialize)(SEncoder* pEncoder, const SUpdateInfo* pInfo);
|
||||||
int32_t (*updateInfoDeserialize)(SDecoder* pDeCoder, SUpdateInfo* pInfo);
|
int32_t (*updateInfoDeserialize)(SDecoder* pDeCoder, SUpdateInfo* pInfo);
|
||||||
|
|
||||||
|
SStreamStateCur* (*streamStateSessionSeekKeyPrev)(SStreamState* pState, const SSessionKey* key);
|
||||||
SStreamStateCur* (*streamStateSessionSeekKeyNext)(SStreamState* pState, const SSessionKey* key);
|
SStreamStateCur* (*streamStateSessionSeekKeyNext)(SStreamState* pState, const SSessionKey* key);
|
||||||
SStreamStateCur* (*streamStateCountSeekKeyPrev)(SStreamState* pState, const SSessionKey* pKey, COUNT_TYPE count);
|
SStreamStateCur* (*streamStateCountSeekKeyPrev)(SStreamState* pState, const SSessionKey* pKey, COUNT_TYPE count);
|
||||||
SStreamStateCur* (*streamStateSessionSeekKeyCurrentPrev)(SStreamState* pState, const SSessionKey* key);
|
SStreamStateCur* (*streamStateSessionSeekKeyCurrentPrev)(SStreamState* pState, const SSessionKey* key);
|
||||||
|
|
|
@ -276,12 +276,14 @@ typedef struct tExprNode {
|
||||||
int32_t num;
|
int32_t num;
|
||||||
struct SFunctionNode *pFunctNode;
|
struct SFunctionNode *pFunctNode;
|
||||||
int32_t functionType;
|
int32_t functionType;
|
||||||
|
int32_t bindExprID;
|
||||||
} _function;
|
} _function;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct SNode *pRootNode;
|
struct SNode *pRootNode;
|
||||||
} _optrRoot;
|
} _optrRoot;
|
||||||
};
|
};
|
||||||
|
int32_t relatedTo;
|
||||||
} tExprNode;
|
} tExprNode;
|
||||||
|
|
||||||
struct SScalarParam {
|
struct SScalarParam {
|
||||||
|
|
|
@ -155,6 +155,7 @@ typedef enum EFunctionType {
|
||||||
FUNCTION_TYPE_FORECAST_LOW,
|
FUNCTION_TYPE_FORECAST_LOW,
|
||||||
FUNCTION_TYPE_FORECAST_HIGH,
|
FUNCTION_TYPE_FORECAST_HIGH,
|
||||||
FUNCTION_TYPE_FORECAST_ROWTS,
|
FUNCTION_TYPE_FORECAST_ROWTS,
|
||||||
|
FUNCTION_TYPE_COLS,
|
||||||
FUNCTION_TYPE_IROWTS_ORIGIN,
|
FUNCTION_TYPE_IROWTS_ORIGIN,
|
||||||
|
|
||||||
// internal function
|
// internal function
|
||||||
|
@ -208,6 +209,7 @@ typedef enum EFunctionType {
|
||||||
FUNCTION_TYPE_HYPERLOGLOG_STATE,
|
FUNCTION_TYPE_HYPERLOGLOG_STATE,
|
||||||
FUNCTION_TYPE_HYPERLOGLOG_STATE_MERGE,
|
FUNCTION_TYPE_HYPERLOGLOG_STATE_MERGE,
|
||||||
|
|
||||||
|
|
||||||
// geometry functions
|
// geometry functions
|
||||||
FUNCTION_TYPE_GEOM_FROM_TEXT = 4250,
|
FUNCTION_TYPE_GEOM_FROM_TEXT = 4250,
|
||||||
FUNCTION_TYPE_AS_TEXT,
|
FUNCTION_TYPE_AS_TEXT,
|
||||||
|
@ -295,6 +297,7 @@ bool fmisSelectGroupConstValueFunc(int32_t funcId);
|
||||||
bool fmIsElapsedFunc(int32_t funcId);
|
bool fmIsElapsedFunc(int32_t funcId);
|
||||||
bool fmIsDBUsageFunc(int32_t funcId);
|
bool fmIsDBUsageFunc(int32_t funcId);
|
||||||
bool fmIsRowTsOriginFunc(int32_t funcId);
|
bool fmIsRowTsOriginFunc(int32_t funcId);
|
||||||
|
bool fmIsSelectColsFunc(int32_t funcId);
|
||||||
|
|
||||||
void getLastCacheDataType(SDataType* pType, int32_t pkBytes);
|
void getLastCacheDataType(SDataType* pType, int32_t pkBytes);
|
||||||
int32_t createFunction(const char* pName, SNodeList* pParameterList, SFunctionNode** pFunc);
|
int32_t createFunction(const char* pName, SNodeList* pParameterList, SFunctionNode** pFunc);
|
||||||
|
|
|
@ -348,9 +348,9 @@ typedef int32_t (*TScriptCloseFunc)();
|
||||||
#define udfFatal(...) { if (udfDebugFlag & 1) { taosPrintLog("UDF FATAL ", 1, 255, __VA_ARGS__); }}
|
#define udfFatal(...) { if (udfDebugFlag & 1) { taosPrintLog("UDF FATAL ", 1, 255, __VA_ARGS__); }}
|
||||||
#define udfError(...) { if (udfDebugFlag & 1) { taosPrintLog("UDF ERROR ", 1, 255, __VA_ARGS__); }}
|
#define udfError(...) { if (udfDebugFlag & 1) { taosPrintLog("UDF ERROR ", 1, 255, __VA_ARGS__); }}
|
||||||
#define udfWarn(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF WARN ", 2, 255, __VA_ARGS__); }}
|
#define udfWarn(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF WARN ", 2, 255, __VA_ARGS__); }}
|
||||||
#define udfInfo(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF ", 2, 255, __VA_ARGS__); }}
|
#define udfInfo(...) { if (udfDebugFlag & 2) { taosPrintLog("UDF INFO ", 2, 255, __VA_ARGS__); }}
|
||||||
#define udfDebug(...) { if (udfDebugFlag & 4) { taosPrintLog("UDF ", 4, udfDebugFlag, __VA_ARGS__); }}
|
#define udfDebug(...) { if (udfDebugFlag & 4) { taosPrintLog("UDF DEBUG ", 4, udfDebugFlag, __VA_ARGS__); }}
|
||||||
#define udfTrace(...) { if (udfDebugFlag & 8) { taosPrintLog("UDF ", 8, udfDebugFlag, __VA_ARGS__); }}
|
#define udfTrace(...) { if (udfDebugFlag & 8) { taosPrintLog("UDF TRACE ", 8, udfDebugFlag, __VA_ARGS__); }}
|
||||||
#endif
|
#endif
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ extern "C" {
|
||||||
|
|
||||||
#define UDF_LISTEN_PIPE_NAME_LEN 32
|
#define UDF_LISTEN_PIPE_NAME_LEN 32
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define UDF_LISTEN_PIPE_NAME_PREFIX "\\\\?\\pipe\\udfd.sock"
|
#define UDF_LISTEN_PIPE_NAME_PREFIX "\\\\?\\pipe\\taosudf.sock"
|
||||||
#else
|
#else
|
||||||
#define UDF_LISTEN_PIPE_NAME_PREFIX ".udfd.sock."
|
#define UDF_LISTEN_PIPE_NAME_PREFIX ".taosudf.sock."
|
||||||
#endif
|
#endif
|
||||||
#define UDF_DNODE_ID_ENV_NAME "DNODE_ID"
|
#define UDF_DNODE_ID_ENV_NAME "DNODE_ID"
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ extern "C" {
|
||||||
const void *ptrs[] = {__VA_ARGS__}; \
|
const void *ptrs[] = {__VA_ARGS__}; \
|
||||||
for (int i = 0; i < sizeof(ptrs) / sizeof(ptrs[0]); ++i) { \
|
for (int i = 0; i < sizeof(ptrs) / sizeof(ptrs[0]); ++i) { \
|
||||||
if (ptrs[i] == NULL) { \
|
if (ptrs[i] == NULL) { \
|
||||||
fnError("udfd %dth parameter invalid, NULL PTR.line:%d", i, __LINE__); \
|
fnError("taosudf %dth parameter invalid, NULL PTR.line:%d", i, __LINE__); \
|
||||||
return TSDB_CODE_INVALID_PARA; \
|
return TSDB_CODE_INVALID_PARA; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
@ -77,7 +77,7 @@ extern "C" {
|
||||||
const void *ptrs[] = {__VA_ARGS__}; \
|
const void *ptrs[] = {__VA_ARGS__}; \
|
||||||
for (int i = 0; i < sizeof(ptrs) / sizeof(ptrs[0]); ++i) { \
|
for (int i = 0; i < sizeof(ptrs) / sizeof(ptrs[0]); ++i) { \
|
||||||
if (ptrs[i] == NULL) { \
|
if (ptrs[i] == NULL) { \
|
||||||
fnError("udfd %dth parameter invalid, NULL PTR.line:%d", i, __LINE__); \
|
fnError("taosudf %dth parameter invalid, NULL PTR.line:%d", i, __LINE__); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
@ -137,31 +137,31 @@ int32_t cleanUpUdfs();
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// udf api
|
// udf api
|
||||||
/**
|
/**
|
||||||
* create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
|
* create taosudf proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
int32_t udfcOpen();
|
int32_t udfcOpen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* destroy udfd proxy
|
* destroy taosudf proxy
|
||||||
* @return error code
|
* @return error code
|
||||||
*/
|
*/
|
||||||
int32_t udfcClose();
|
int32_t udfcClose();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* start udfd that serves udf function invocation under dnode startDnodeId
|
* start taosudf that serves udf function invocation under dnode startDnodeId
|
||||||
* @param startDnodeId
|
* @param startDnodeId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t udfStartUdfd(int32_t startDnodeId);
|
int32_t udfStartUdfd(int32_t startDnodeId);
|
||||||
/**
|
/**
|
||||||
* stop udfd
|
* stop taosudf
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void udfStopUdfd();
|
void udfStopUdfd();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get udfd pid
|
* get taosudf pid
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// int32_t udfGetUdfdPid(int32_t* pUdfdPid);
|
// int32_t udfGetUdfdPid(int32_t* pUdfdPid);
|
||||||
|
|
|
@ -169,6 +169,7 @@ typedef struct SCompactDatabaseStmt {
|
||||||
char dbName[TSDB_DB_NAME_LEN];
|
char dbName[TSDB_DB_NAME_LEN];
|
||||||
SNode* pStart;
|
SNode* pStart;
|
||||||
SNode* pEnd;
|
SNode* pEnd;
|
||||||
|
bool metaOnly;
|
||||||
} SCompactDatabaseStmt;
|
} SCompactDatabaseStmt;
|
||||||
|
|
||||||
typedef struct SCompactVgroupsStmt {
|
typedef struct SCompactVgroupsStmt {
|
||||||
|
@ -177,6 +178,7 @@ typedef struct SCompactVgroupsStmt {
|
||||||
SNodeList* vgidList;
|
SNodeList* vgidList;
|
||||||
SNode* pStart;
|
SNode* pStart;
|
||||||
SNode* pEnd;
|
SNode* pEnd;
|
||||||
|
bool metaOnly;
|
||||||
} SCompactVgroupsStmt;
|
} SCompactVgroupsStmt;
|
||||||
|
|
||||||
typedef struct STableOptions {
|
typedef struct STableOptions {
|
||||||
|
@ -299,7 +301,7 @@ typedef struct SAlterTableMultiStmt {
|
||||||
typedef struct SCreateUserStmt {
|
typedef struct SCreateUserStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
char userName[TSDB_USER_LEN];
|
char userName[TSDB_USER_LEN];
|
||||||
char password[TSDB_USET_PASSWORD_LEN];
|
char password[TSDB_USET_PASSWORD_LONGLEN];
|
||||||
int8_t sysinfo;
|
int8_t sysinfo;
|
||||||
int8_t createDb;
|
int8_t createDb;
|
||||||
int8_t isImport;
|
int8_t isImport;
|
||||||
|
@ -313,7 +315,7 @@ typedef struct SAlterUserStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
char userName[TSDB_USER_LEN];
|
char userName[TSDB_USER_LEN];
|
||||||
int8_t alterType;
|
int8_t alterType;
|
||||||
char password[TSDB_USET_PASSWORD_LEN];
|
char password[TSDB_USET_PASSWORD_LONGLEN];
|
||||||
int8_t enable;
|
int8_t enable;
|
||||||
int8_t sysinfo;
|
int8_t sysinfo;
|
||||||
int8_t createdb;
|
int8_t createdb;
|
||||||
|
@ -440,6 +442,11 @@ typedef struct SShowCompactDetailsStmt {
|
||||||
SNode* pCompactId;
|
SNode* pCompactId;
|
||||||
} SShowCompactDetailsStmt;
|
} SShowCompactDetailsStmt;
|
||||||
|
|
||||||
|
typedef struct SShowTransactionDetailsStmt {
|
||||||
|
ENodeType type;
|
||||||
|
SNode* pTransactionId;
|
||||||
|
} SShowTransactionDetailsStmt;
|
||||||
|
|
||||||
typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT, INDEX_TYPE_NORMAL } EIndexType;
|
typedef enum EIndexType { INDEX_TYPE_SMA = 1, INDEX_TYPE_FULLTEXT, INDEX_TYPE_NORMAL } EIndexType;
|
||||||
|
|
||||||
typedef struct SIndexOptions {
|
typedef struct SIndexOptions {
|
||||||
|
@ -562,6 +569,31 @@ typedef struct SStreamOptions {
|
||||||
int64_t setFlag;
|
int64_t setFlag;
|
||||||
} SStreamOptions;
|
} SStreamOptions;
|
||||||
|
|
||||||
|
typedef enum EStreamNotifyOptionSetFlag {
|
||||||
|
SNOTIFY_OPT_ERROR_HANDLE_SET = BIT_FLAG_MASK(0),
|
||||||
|
SNOTIFY_OPT_NOTIFY_HISTORY_SET = BIT_FLAG_MASK(1),
|
||||||
|
} EStreamNotifyOptionSetFlag;
|
||||||
|
|
||||||
|
typedef enum EStreamNotifyEventType {
|
||||||
|
SNOTIFY_EVENT_WINDOW_INVALIDATION = 0,
|
||||||
|
SNOTIFY_EVENT_WINDOW_OPEN = BIT_FLAG_MASK(0),
|
||||||
|
SNOTIFY_EVENT_WINDOW_CLOSE = BIT_FLAG_MASK(1),
|
||||||
|
} EStreamNotifyEventType;
|
||||||
|
|
||||||
|
typedef enum EStreamNotifyErrorHandleType {
|
||||||
|
SNOTIFY_ERROR_HANDLE_PAUSE,
|
||||||
|
SNOTIFY_ERROR_HANDLE_DROP,
|
||||||
|
} EStreamNotifyErrorHandleType;
|
||||||
|
|
||||||
|
typedef struct SStreamNotifyOptions {
|
||||||
|
ENodeType type;
|
||||||
|
SNodeList* pAddrUrls;
|
||||||
|
EStreamNotifyEventType eventTypes;
|
||||||
|
EStreamNotifyErrorHandleType errorHandle;
|
||||||
|
bool notifyHistory;
|
||||||
|
EStreamNotifyOptionSetFlag setFlag;
|
||||||
|
} SStreamNotifyOptions;
|
||||||
|
|
||||||
typedef struct SCreateStreamStmt {
|
typedef struct SCreateStreamStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
char streamName[TSDB_TABLE_NAME_LEN];
|
char streamName[TSDB_TABLE_NAME_LEN];
|
||||||
|
@ -574,6 +606,7 @@ typedef struct SCreateStreamStmt {
|
||||||
SNodeList* pTags;
|
SNodeList* pTags;
|
||||||
SNode* pSubtable;
|
SNode* pSubtable;
|
||||||
SNodeList* pCols;
|
SNodeList* pCols;
|
||||||
|
SStreamNotifyOptions* pNotifyOptions;
|
||||||
SCMCreateStreamReq* pReq;
|
SCMCreateStreamReq* pReq;
|
||||||
} SCreateStreamStmt;
|
} SCreateStreamStmt;
|
||||||
|
|
||||||
|
@ -596,6 +629,12 @@ typedef struct SResumeStreamStmt {
|
||||||
bool ignoreUntreated;
|
bool ignoreUntreated;
|
||||||
} SResumeStreamStmt;
|
} SResumeStreamStmt;
|
||||||
|
|
||||||
|
typedef struct SResetStreamStmt {
|
||||||
|
ENodeType type;
|
||||||
|
char streamName[TSDB_TABLE_NAME_LEN];
|
||||||
|
bool ignoreNotExists;
|
||||||
|
} SResetStreamStmt;
|
||||||
|
|
||||||
typedef struct SCreateFunctionStmt {
|
typedef struct SCreateFunctionStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
bool orReplace;
|
bool orReplace;
|
||||||
|
@ -646,6 +685,10 @@ typedef struct SBalanceVgroupStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
} SBalanceVgroupStmt;
|
} SBalanceVgroupStmt;
|
||||||
|
|
||||||
|
typedef struct SAssignLeaderStmt {
|
||||||
|
ENodeType type;
|
||||||
|
} SAssignLeaderStmt;
|
||||||
|
|
||||||
typedef struct SBalanceVgroupLeaderStmt {
|
typedef struct SBalanceVgroupLeaderStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
|
|
|
@ -128,6 +128,7 @@ typedef struct SScanLogicNode {
|
||||||
bool paraTablesSort; // for table merge scan
|
bool paraTablesSort; // for table merge scan
|
||||||
bool smallDataTsSort; // disable row id sort for table merge scan
|
bool smallDataTsSort; // disable row id sort for table merge scan
|
||||||
bool needSplit;
|
bool needSplit;
|
||||||
|
bool noPseudoRefAfterGrp; // no pseudo columns referenced ater group/partition clause
|
||||||
} SScanLogicNode;
|
} SScanLogicNode;
|
||||||
|
|
||||||
typedef struct SJoinLogicNode {
|
typedef struct SJoinLogicNode {
|
||||||
|
@ -326,6 +327,7 @@ typedef struct SWindowLogicNode {
|
||||||
SNode* pStateExpr;
|
SNode* pStateExpr;
|
||||||
SNode* pStartCond;
|
SNode* pStartCond;
|
||||||
SNode* pEndCond;
|
SNode* pEndCond;
|
||||||
|
int64_t trueForLimit;
|
||||||
int8_t triggerType;
|
int8_t triggerType;
|
||||||
int64_t watermark;
|
int64_t watermark;
|
||||||
int64_t deleteMark;
|
int64_t deleteMark;
|
||||||
|
@ -723,6 +725,7 @@ typedef SSessionWinodwPhysiNode SStreamFinalSessionWinodwPhysiNode;
|
||||||
typedef struct SStateWinodwPhysiNode {
|
typedef struct SStateWinodwPhysiNode {
|
||||||
SWindowPhysiNode window;
|
SWindowPhysiNode window;
|
||||||
SNode* pStateKey;
|
SNode* pStateKey;
|
||||||
|
int64_t trueForLimit;
|
||||||
} SStateWinodwPhysiNode;
|
} SStateWinodwPhysiNode;
|
||||||
|
|
||||||
typedef SStateWinodwPhysiNode SStreamStateWinodwPhysiNode;
|
typedef SStateWinodwPhysiNode SStreamStateWinodwPhysiNode;
|
||||||
|
@ -731,6 +734,7 @@ typedef struct SEventWinodwPhysiNode {
|
||||||
SWindowPhysiNode window;
|
SWindowPhysiNode window;
|
||||||
SNode* pStartCond;
|
SNode* pStartCond;
|
||||||
SNode* pEndCond;
|
SNode* pEndCond;
|
||||||
|
int64_t trueForLimit;
|
||||||
} SEventWinodwPhysiNode;
|
} SEventWinodwPhysiNode;
|
||||||
|
|
||||||
typedef SEventWinodwPhysiNode SStreamEventWinodwPhysiNode;
|
typedef SEventWinodwPhysiNode SStreamEventWinodwPhysiNode;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#ifndef _TD_QUERY_NODES_H_
|
#ifndef _TD_QUERY_NODES_H_
|
||||||
#define _TD_QUERY_NODES_H_
|
#define _TD_QUERY_NODES_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,6 +62,8 @@ typedef struct SExprNode {
|
||||||
bool asParam;
|
bool asParam;
|
||||||
bool asPosition;
|
bool asPosition;
|
||||||
int32_t projIdx;
|
int32_t projIdx;
|
||||||
|
int32_t relatedTo;
|
||||||
|
int32_t bindExprID;
|
||||||
} SExprNode;
|
} SExprNode;
|
||||||
|
|
||||||
typedef enum EColumnType {
|
typedef enum EColumnType {
|
||||||
|
@ -322,6 +325,7 @@ typedef struct SStateWindowNode {
|
||||||
ENodeType type; // QUERY_NODE_STATE_WINDOW
|
ENodeType type; // QUERY_NODE_STATE_WINDOW
|
||||||
SNode* pCol; // timestamp primary key
|
SNode* pCol; // timestamp primary key
|
||||||
SNode* pExpr;
|
SNode* pExpr;
|
||||||
|
SNode* pTrueForLimit;
|
||||||
} SStateWindowNode;
|
} SStateWindowNode;
|
||||||
|
|
||||||
typedef struct SSessionWindowNode {
|
typedef struct SSessionWindowNode {
|
||||||
|
@ -346,6 +350,7 @@ typedef struct SEventWindowNode {
|
||||||
SNode* pCol; // timestamp primary key
|
SNode* pCol; // timestamp primary key
|
||||||
SNode* pStartCond;
|
SNode* pStartCond;
|
||||||
SNode* pEndCond;
|
SNode* pEndCond;
|
||||||
|
SNode* pTrueForLimit;
|
||||||
} SEventWindowNode;
|
} SEventWindowNode;
|
||||||
|
|
||||||
typedef struct SCountWindowNode {
|
typedef struct SCountWindowNode {
|
||||||
|
@ -420,7 +425,7 @@ typedef struct SWindowOffsetNode {
|
||||||
|
|
||||||
typedef struct SRangeAroundNode {
|
typedef struct SRangeAroundNode {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
SNode* pTimepoint;
|
SNode* pRange;
|
||||||
SNode* pInterval;
|
SNode* pInterval;
|
||||||
} SRangeAroundNode;
|
} SRangeAroundNode;
|
||||||
|
|
||||||
|
@ -428,6 +433,7 @@ typedef struct SSelectStmt {
|
||||||
ENodeType type; // QUERY_NODE_SELECT_STMT
|
ENodeType type; // QUERY_NODE_SELECT_STMT
|
||||||
bool isDistinct;
|
bool isDistinct;
|
||||||
SNodeList* pProjectionList;
|
SNodeList* pProjectionList;
|
||||||
|
SNodeList* pProjectionBindList;
|
||||||
SNode* pFromTable;
|
SNode* pFromTable;
|
||||||
SNode* pWhere;
|
SNode* pWhere;
|
||||||
SNodeList* pPartitionByList;
|
SNodeList* pPartitionByList;
|
||||||
|
@ -565,6 +571,7 @@ typedef struct SVnodeModifyOpStmt {
|
||||||
SHashObj* pVgroupsHashObj; // SHashObj<vgId, SVgInfo>
|
SHashObj* pVgroupsHashObj; // SHashObj<vgId, SVgInfo>
|
||||||
SHashObj* pTableBlockHashObj; // SHashObj<tuid, STableDataCxt*>
|
SHashObj* pTableBlockHashObj; // SHashObj<tuid, STableDataCxt*>
|
||||||
SHashObj* pSubTableHashObj; // SHashObj<table_name, STableMeta*>
|
SHashObj* pSubTableHashObj; // SHashObj<table_name, STableMeta*>
|
||||||
|
SHashObj* pSuperTableHashObj; // SHashObj<table_name, STableMeta*>
|
||||||
SHashObj* pTableNameHashObj; // set of table names for refreshing meta, sync mode
|
SHashObj* pTableNameHashObj; // set of table names for refreshing meta, sync mode
|
||||||
SHashObj* pDbFNameHashObj; // set of db names for refreshing meta, sync mode
|
SHashObj* pDbFNameHashObj; // set of db names for refreshing meta, sync mode
|
||||||
SHashObj* pTableCxtHashObj; // temp SHashObj<tuid, STableDataCxt*> for single request
|
SHashObj* pTableCxtHashObj; // temp SHashObj<tuid, STableDataCxt*> for single request
|
||||||
|
@ -697,6 +704,9 @@ char* getJoinSTypeString(EJoinSubType type);
|
||||||
char* getFullJoinTypeString(EJoinType type, EJoinSubType stype);
|
char* getFullJoinTypeString(EJoinType type, EJoinSubType stype);
|
||||||
int32_t mergeJoinConds(SNode** ppDst, SNode** ppSrc);
|
int32_t mergeJoinConds(SNode** ppDst, SNode** ppSrc);
|
||||||
|
|
||||||
|
void rewriteExprAliasName(SExprNode* pNode, int64_t num);
|
||||||
|
bool isRelatedToOtherExpr(SExprNode* pExpr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -158,9 +158,12 @@ int32_t qBindStmtTagsValue(void* pBlock, void* boundTags, int64_t suid, const ch
|
||||||
int32_t qStmtBindParams2(SQuery* pQuery, TAOS_STMT2_BIND* pParams, int32_t colIdx, void* charsetCxt);
|
int32_t qStmtBindParams2(SQuery* pQuery, TAOS_STMT2_BIND* pParams, int32_t colIdx, void* charsetCxt);
|
||||||
int32_t qBindStmtStbColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
|
int32_t qBindStmtStbColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
|
||||||
STSchema** pTSchema, SBindInfo2* pBindInfos, void *charsetCxt);
|
STSchema** pTSchema, SBindInfo2* pBindInfos, void *charsetCxt);
|
||||||
int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen, void *charsetCxt);
|
int32_t qBindStmtColsValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
|
||||||
|
void* charsetCxt);
|
||||||
int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
|
int32_t qBindStmtSingleColValue2(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
|
||||||
int32_t colIdx, int32_t rowNum, void* charsetCxt);
|
int32_t colIdx, int32_t rowNum, void* charsetCxt);
|
||||||
|
int32_t qBindStmt2RowValue(void* pBlock, SArray* pCols, TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen,
|
||||||
|
STSchema** pTSchema, SBindInfo2* pBindInfos, void* charsetCxt);
|
||||||
int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName,
|
int32_t qBindStmtTagsValue2(void* pBlock, void* boundTags, int64_t suid, const char* sTableName, char* tName,
|
||||||
TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen, void* charsetCxt);
|
TAOS_STMT2_BIND* bind, char* msgBuf, int32_t msgBufLen, void* charsetCxt);
|
||||||
|
|
||||||
|
@ -180,8 +183,11 @@ int32_t smlBindData(SQuery* handle, bool dataFormat, SArray* tags, SArray* colsS
|
||||||
STableMeta* pTableMeta, char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl,
|
STableMeta* pTableMeta, char* tableName, const char* sTableName, int32_t sTableNameLen, int32_t ttl,
|
||||||
char* msgBuf, int32_t msgBufLen, void* charsetCxt);
|
char* msgBuf, int32_t msgBufLen, void* charsetCxt);
|
||||||
int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash);
|
int32_t smlBuildOutput(SQuery* handle, SHashObj* pVgHash);
|
||||||
|
int32_t smlBuildOutputRaw(SQuery* handle, SHashObj* pVgHash);
|
||||||
|
int rawBlockBindRawData(SHashObj* pVgroupHash, SArray* pVgroupList, STableMeta* pTableMeta, void* data);
|
||||||
int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, void* fields,
|
int rawBlockBindData(SQuery* query, STableMeta* pTableMeta, void* data, SVCreateTbReq* pCreateTb, void* fields,
|
||||||
int numFields, bool needChangeLength, char* errstr, int32_t errstrLen, bool raw);
|
int numFields, bool needChangeLength, char* errstr, int32_t errstrLen, bool raw);
|
||||||
|
int32_t checkSchema(SSchema* pColSchema, int8_t* fields, char* errstr, int32_t errstrLen);
|
||||||
|
|
||||||
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
|
int32_t rewriteToVnodeModifyOpStmt(SQuery* pQuery, SArray* pBufArray);
|
||||||
int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut);
|
int32_t serializeVgroupsCreateTableBatch(SHashObj* pVgroupHashmap, SArray** pOut);
|
||||||
|
|
|
@ -300,6 +300,7 @@ int32_t cleanupTaskQueue();
|
||||||
int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code);
|
int32_t taosAsyncExec(__async_exec_fn_t execFn, void* execParam, int32_t* code);
|
||||||
int32_t taosAsyncWait();
|
int32_t taosAsyncWait();
|
||||||
int32_t taosAsyncRecover();
|
int32_t taosAsyncRecover();
|
||||||
|
int32_t taosStmt2AsyncBind(__async_exec_fn_t execFn, void* execParam);
|
||||||
|
|
||||||
void destroySendMsgInfo(SMsgSendInfo* pMsgBody);
|
void destroySendMsgInfo(SMsgSendInfo* pMsgBody);
|
||||||
|
|
||||||
|
@ -408,48 +409,16 @@ void* getTaskPoolWorkerCb();
|
||||||
#define IS_AUDIT_CTB_NAME(_ctbname) \
|
#define IS_AUDIT_CTB_NAME(_ctbname) \
|
||||||
((*(_ctbname) == 't') && (0 == strncmp(_ctbname, TSDB_AUDIT_CTB_OPERATION, TSDB_AUDIT_CTB_OPERATION_LEN)))
|
((*(_ctbname) == 't') && (0 == strncmp(_ctbname, TSDB_AUDIT_CTB_OPERATION, TSDB_AUDIT_CTB_OPERATION_LEN)))
|
||||||
|
|
||||||
#define qFatal(...) \
|
// clang-format off
|
||||||
do { \
|
#define qFatal(...) do { if (qDebugFlag & DEBUG_FATAL) { taosPrintLog("QRY FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
if (qDebugFlag & DEBUG_FATAL) { \
|
#define qError(...) do { if (qDebugFlag & DEBUG_ERROR) { taosPrintLog("QRY ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
taosPrintLog("QRY FATAL ", DEBUG_FATAL, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
|
#define qWarn(...) do { if (qDebugFlag & DEBUG_WARN) { taosPrintLog("QRY WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
} \
|
#define qInfo(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLog("QRY INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
} while (0)
|
#define qDebug(...) do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLog("QRY DEBUG ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
#define qError(...) \
|
#define qTrace(...) do { if (qDebugFlag & DEBUG_TRACE) { taosPrintLog("QRY TRACE ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
do { \
|
#define qDebugL(...)do { if (qDebugFlag & DEBUG_DEBUG) { taosPrintLongString("QRY DEBUG ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
if (qDebugFlag & DEBUG_ERROR) { \
|
#define qInfoL(...) do { if (qDebugFlag & DEBUG_INFO) { taosPrintLongString("QRY INFO ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); }} while(0)
|
||||||
taosPrintLog("QRY ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
|
// clang-format on
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#define qWarn(...) \
|
|
||||||
do { \
|
|
||||||
if (qDebugFlag & DEBUG_WARN) { \
|
|
||||||
taosPrintLog("QRY WARN ", DEBUG_WARN, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#define qInfo(...) \
|
|
||||||
do { \
|
|
||||||
if (qDebugFlag & DEBUG_INFO) { \
|
|
||||||
taosPrintLog("QRY ", DEBUG_INFO, tsLogEmbedded ? 255 : qDebugFlag, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#define qDebug(...) \
|
|
||||||
do { \
|
|
||||||
if (qDebugFlag & DEBUG_DEBUG) { \
|
|
||||||
taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#define qTrace(...) \
|
|
||||||
do { \
|
|
||||||
if (qDebugFlag & DEBUG_TRACE) { \
|
|
||||||
taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#define qDebugL(...) \
|
|
||||||
do { \
|
|
||||||
if (qDebugFlag & DEBUG_DEBUG) { \
|
|
||||||
taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define QRY_ERR_RET(c) \
|
#define QRY_ERR_RET(c) \
|
||||||
do { \
|
do { \
|
||||||
|
|
|
@ -66,6 +66,7 @@ int32_t streamStateCountGetKeyByRange(SStreamState* pState, const SSessionKey* r
|
||||||
int32_t streamStateSessionAllocWinBuffByNextPosition(SStreamState* pState, SStreamStateCur* pCur,
|
int32_t streamStateSessionAllocWinBuffByNextPosition(SStreamState* pState, SStreamStateCur* pCur,
|
||||||
const SSessionKey* pKey, void** pVal, int32_t* pVLen);
|
const SSessionKey* pKey, void** pVal, int32_t* pVLen);
|
||||||
|
|
||||||
|
SStreamStateCur *streamStateSessionSeekKeyPrev(SStreamState *pState, const SSessionKey *key);
|
||||||
SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSessionKey* key);
|
SStreamStateCur* streamStateSessionSeekKeyNext(SStreamState* pState, const SSessionKey* key);
|
||||||
SStreamStateCur* streamStateCountSeekKeyPrev(SStreamState* pState, const SSessionKey* pKey, COUNT_TYPE count);
|
SStreamStateCur* streamStateCountSeekKeyPrev(SStreamState* pState, const SSessionKey* pKey, COUNT_TYPE count);
|
||||||
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key);
|
SStreamStateCur* streamStateSessionSeekKeyCurrentPrev(SStreamState* pState, const SSessionKey* key);
|
||||||
|
|