Merge branch '3.0' of github.com:taosdata/TDengine into 3.0
|
@ -78,7 +78,7 @@ def check_docs(){
|
|||
file_only_tdgpt_change_except = sh (
|
||||
script: '''
|
||||
cd ${WKC}
|
||||
git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${CHANGE_TARGET}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | grep -v "forecastoperator.c\\|anomalywindowoperator.c" |grep -v "tsim/analytics" |grep -v "tdgpt_cases.task" || :
|
||||
git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${CHANGE_TARGET}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | grep -v "forecastoperator.c\\|anomalywindowoperator.c\\|tanalytics.h\\|tanalytics.c" |grep -v "tsim/analytics" |grep -v "tdgpt_cases.task" || :
|
||||
''',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
</p>
|
||||
<p>
|
||||
|
||||
[](https://cloud.drone.io/taosdata/TDengine)
|
||||
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
|
||||
[](https://coveralls.io/github/taosdata/TDengine?branch=3.0)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/4201)
|
||||
<br />
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
IF (DEFINED VERNUMBER)
|
||||
SET(TD_VER_NUMBER ${VERNUMBER})
|
||||
ELSE ()
|
||||
SET(TD_VER_NUMBER "3.3.4.8.alpha")
|
||||
SET(TD_VER_NUMBER "3.3.5.0.alpha")
|
||||
ENDIF ()
|
||||
|
||||
IF (DEFINED VERCOMPATIBLE)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taosadapter
|
||||
ExternalProject_Add(taosadapter
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||
GIT_TAG 3.0
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taos-tools
|
||||
ExternalProject_Add(taos-tools
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||
GIT_TAG 3.0
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taosws-rs
|
||||
ExternalProject_Add(taosws-rs
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
||||
GIT_TAG 3.0
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -22,15 +22,11 @@ import imgStep11 from '../../assets/grafana-11.png';
|
|||
|
||||
This document describes how to integrate the TDengine data source with the open-source data visualization system [Grafana](https://www.grafana.com/) to achieve data visualization and build a monitoring and alert system. With the TDengine plugin, you can easily display data from TDengine tables on Grafana dashboards without the need for complex development work.
|
||||
|
||||
## Grafana Version Requirements
|
||||
|
||||
TDengine currently supports Grafana version 7.5 and above. It is recommended to use the latest version. Please download and install the corresponding version of Grafana according to your system environment.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To add the TDengine data source to Grafana normally, the following preparations are needed.
|
||||
|
||||
- Grafana service has been deployed and is running normally.
|
||||
- Grafana service has been deployed and is running normally. TDengine currently supports Grafana version 7.5 and above. It is recommended to use the latest version.
|
||||
**Note**: Ensure that the account starting Grafana has write permissions to its installation directory, otherwise you may not be able to install plugins later.
|
||||
- TDengine cluster has been deployed and is running normally.
|
||||
- taosAdapter has been installed and is running normally. For details, please refer to the [taosAdapter user manual](../../../tdengine-reference/components/taosadapter/)
|
||||
|
|
|
@ -13,13 +13,11 @@ Seeq is advanced analytics software for the manufacturing and Industrial Interne
|
|||
|
||||
Through the TDengine Java connector, Seeq can easily support querying time-series data provided by TDengine and offer data presentation, analysis, prediction, and other functions.
|
||||
|
||||
## Seeq Installation Method
|
||||
## Prerequisites
|
||||
|
||||
Download the relevant software from [Seeq's official website](https://www.seeq.com/customer-download), such as Seeq Server and Seeq Data Lab, etc. Seeq Data Lab needs to be installed on a different server from Seeq Server and interconnected through configuration. For detailed installation and configuration instructions, refer to the [Seeq Knowledge Base](https://support.seeq.com/kb/latest/cloud/).
|
||||
- Seeq has been installed. Download the relevant software from [Seeq's official website](https://www.seeq.com/customer-download), such as Seeq Server and Seeq Data Lab, etc. Seeq Data Lab needs to be installed on a different server from Seeq Server and interconnected through configuration. For detailed installation and configuration instructions, refer to the [Seeq Knowledge Base](https://support.seeq.com/kb/latest/cloud/).
|
||||
|
||||
### TDengine Local Instance Installation Method
|
||||
|
||||
Please refer to the [official documentation](../../../get-started).
|
||||
- TDengine local instance has been installed. Please refer to the [official documentation](../../../get-started). If using TDengine Cloud, please go to https://cloud.taosdata.com apply for an account and log in to see how to access TDengine Cloud.
|
||||
|
||||
## Configuring Seeq to Access TDengine
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ The default configuration file for `Agent` is located at `/etc/taos/agent.toml`,
|
|||
- `token`: Required, the Token generated when creating `Agent` in `Explorer`.
|
||||
- `instanceId`: The instance ID of the current taosx-agent service. If multiple taosx-agent instances are started on the same machine, it is necessary to ensure that the instance IDs of each instance are unique.
|
||||
- `compression`: Optional, can be configured as `true` or `false`, default is `false`. If set to `true`, it enables data compression in communication between `Agent` and `taosX`.
|
||||
- `in_memory_cache_capacity`: Optional, signifies the maximum number of message batches that can be cached in memory and can be configured as a positive integer greater than zero. The default value is set at 64.
|
||||
- `log_level`: Optional, log level, default is `info`. Like `taosX`, it supports five levels: `error`, `warn`, `info`, `debug`, `trace`. Deprecated, please use `log.level` instead.
|
||||
- `log_keep_days`: Optional, the number of days to keep logs, default is `30` days. Deprecated, please use `log.keepDays` instead.
|
||||
- `log.path`: The directory where log files are stored.
|
||||
|
@ -45,6 +46,10 @@ As shown below:
|
|||
#
|
||||
#compression = true
|
||||
|
||||
# In-memory cache capacity
|
||||
#
|
||||
#in_memory_cache_capacity = 64
|
||||
|
||||
# log configuration
|
||||
[log]
|
||||
# All log files are stored in this directory
|
||||
|
|
|
@ -190,6 +190,7 @@ ROUND(expr[, digits])
|
|||
- `digits` less than zero means discarding the decimal places and rounding the number to the left of the decimal point by `digits` places. If the number of places to the left of the decimal point is less than `digits`, returns 0.
|
||||
- Since the DECIMAL type is not yet supported, this function will use DOUBLE and FLOAT to represent results containing decimals, but DOUBLE and FLOAT have precision limits, and using this function may be meaningless when there are too many digits.
|
||||
- Can only be used with regular columns, selection (Selection), projection (Projection) functions, and cannot be used with aggregation (Aggregation) functions.
|
||||
- `digits` is supported from version 3.3.3.0.
|
||||
|
||||
**Example**:
|
||||
|
||||
|
@ -249,6 +250,8 @@ TAN(expr)
|
|||
|
||||
**Function Description**: Obtains the tangent result of the specified field.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: DOUBLE.
|
||||
|
||||
**Applicable Data Types**: Numeric types.
|
||||
|
@ -297,6 +300,8 @@ TRUNCATE(expr, digits)
|
|||
|
||||
**Function Description**: Gets the truncated value of the specified field to the specified number of digits.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: Consistent with the original data type of the `expr` field.
|
||||
|
||||
**Applicable Data Types**:
|
||||
|
@ -340,6 +345,8 @@ EXP(expr)
|
|||
|
||||
**Function Description**: Returns the value of e (the base of natural logarithms) raised to the specified power.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: DOUBLE.
|
||||
|
||||
**Applicable Data Types**: Numeric type.
|
||||
|
@ -370,6 +377,8 @@ LN(expr)
|
|||
|
||||
**Function Description**: Returns the natural logarithm of the specified parameter.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: DOUBLE.
|
||||
|
||||
**Applicable Data Types**: Numeric type.
|
||||
|
@ -401,6 +410,8 @@ MOD(expr1, expr2)
|
|||
|
||||
**Function Description**: Calculates the result of expr1 % expr2.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: DOUBLE.
|
||||
|
||||
**Applicable Data Types**: Numeric type.
|
||||
|
@ -437,6 +448,8 @@ RAND([seed])
|
|||
|
||||
**Function Description**: Returns a uniformly distributed random number from 0 to 1.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: DOUBLE.
|
||||
|
||||
**Applicable Data Types**:
|
||||
|
@ -484,6 +497,8 @@ SIGN(expr)
|
|||
|
||||
**Function Description**: Returns the sign of the specified parameter.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: Consistent with the original data type of the specified field.
|
||||
|
||||
**Applicable Data Types**: Numeric types.
|
||||
|
@ -527,6 +542,8 @@ DEGREES(expr)
|
|||
|
||||
**Function Description**: Calculates the value of the specified parameter converted from radians to degrees.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: DOUBLE.
|
||||
|
||||
**Applicable Data Types**: Numeric types.
|
||||
|
@ -558,6 +575,8 @@ RADIANS(expr)
|
|||
|
||||
**Function Description**: Calculates the value of the specified parameter converted from degrees to radians.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: DOUBLE.
|
||||
|
||||
**Applicable Data Types**: Numeric types.
|
||||
|
@ -729,6 +748,8 @@ TRIM([remstr FROM] expr)
|
|||
|
||||
**Function Description**: Returns the string expr with all prefixes or suffixes of remstr removed.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: Same as the original type of the input field expr.
|
||||
|
||||
**Applicable Data Types**:
|
||||
|
@ -807,6 +828,8 @@ SUBSTRING/SUBSTR(expr FROM pos [FOR len])
|
|||
- If `len` is less than 1, returns an empty string.
|
||||
- `pos` is 1-based; if `pos` is 0, returns an empty string.
|
||||
- If `pos` + `len` exceeds `len(expr)`, returns the substring from `pos` to the end of the string, equivalent to executing `substring(expr, pos)`.
|
||||
- Function `SUBSTRING` is equal to `SUBSTR`, supported from ver-3.3.3.0.
|
||||
- Syntax `SUBSTRING/SUBSTR(expr FROM pos [FOR len])` is supported from ver-3.3.3.0.
|
||||
|
||||
**Examples**:
|
||||
|
||||
|
@ -845,6 +868,8 @@ SUBSTRING_INDEX(expr, delim, count)
|
|||
|
||||
**Function Description**: Returns a substring of `expr` cut at the position where the delimiter appears the specified number of times.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: Same as the original type of the input field `expr`.
|
||||
|
||||
**Applicable Data Types**:
|
||||
|
@ -902,6 +927,8 @@ CHAR(expr1 [, expr2] [, expr3] ...)
|
|||
|
||||
**Function Description**: Treats the input parameters as integers and returns the characters corresponding to these integers in ASCII encoding.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: VARCHAR.
|
||||
|
||||
**Applicable Data Types**: Integer types, VARCHAR, NCHAR.
|
||||
|
@ -949,6 +976,8 @@ ASCII(expr)
|
|||
|
||||
**Function Description**: Returns the ASCII code of the first character of the string.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Data Type**: BIGINT.
|
||||
|
||||
**Applicable Data Types**: VARCHAR, NCHAR.
|
||||
|
@ -979,6 +1008,8 @@ POSITION(expr1 IN expr2)
|
|||
|
||||
**Function Description**: Calculates the position of string `expr1` in string `expr2`.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: BIGINT.
|
||||
|
||||
**Applicable Data Types**:
|
||||
|
@ -1026,6 +1057,8 @@ REPLACE(expr, from_str, to_str)
|
|||
|
||||
**Function Description**: Replaces all occurrences of `from_str` in the string with `to_str`.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: Same as the original type of the input field `expr`.
|
||||
|
||||
**Applicable Data Types**:
|
||||
|
@ -1061,6 +1094,8 @@ REPEAT(expr, count)
|
|||
|
||||
**Function Description**: Returns a string that repeats the string `expr` a specified number of times.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: Same as the original type of the input field `expr`.
|
||||
|
||||
**Applicable Data Types**:
|
||||
|
@ -1319,6 +1354,7 @@ TIMEDIFF(expr1, expr2 [, time_unit])
|
|||
- `expr1`: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 standard date-time format.
|
||||
- `expr2`: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 standard date-time format.
|
||||
- `time_unit`: See usage instructions.
|
||||
- `timediff` return the absolute value of the difference between timestamp `expr1` and `expr2` before ver-3.3.3.0.
|
||||
|
||||
**Nested Subquery Support**: Applicable to both inner and outer queries.
|
||||
|
||||
|
@ -1423,6 +1459,8 @@ WEEK(expr [, mode])
|
|||
|
||||
**Function Description**: Returns the week number of the input date.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Result Type**: BIGINT.
|
||||
|
||||
**Applicable Data Types**:
|
||||
|
@ -1490,6 +1528,8 @@ WEEKOFYEAR(expr)
|
|||
|
||||
**Function Description**: Returns the week number of the input date.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: BIGINT.
|
||||
|
||||
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
|
||||
|
@ -1521,6 +1561,8 @@ WEEKDAY(expr)
|
|||
|
||||
**Function Description**: Returns the weekday of the input date.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: BIGINT.
|
||||
|
||||
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
|
||||
|
@ -1552,6 +1594,8 @@ DAYOFWEEK(expr)
|
|||
|
||||
**Function Description**: Returns the weekday of the input date.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Type**: BIGINT.
|
||||
|
||||
**Applicable Data Types**: BIGINT, TIMESTAMP types representing timestamps, or VARCHAR, NCHAR types in ISO8601/RFC3339 date-time format.
|
||||
|
@ -1707,6 +1751,9 @@ STDDEV/STDDEV_POP(expr)
|
|||
|
||||
**Applicable to**: Tables and supertables.
|
||||
|
||||
**Description**:
|
||||
- Function `STDDEV_POP` equals `STDDEV` and is supported from ver-3.3.3.0.
|
||||
|
||||
**Example**:
|
||||
|
||||
```sql
|
||||
|
@ -1733,6 +1780,8 @@ VAR_POP(expr)
|
|||
|
||||
**Function Description**: Calculates the population variance of a column in a table.
|
||||
|
||||
**Version**: ver-3.3.3.0
|
||||
|
||||
**Return Data Type**: DOUBLE.
|
||||
|
||||
**Applicable Data Types**: Numeric types.
|
||||
|
@ -1975,7 +2024,8 @@ MAX(expr)
|
|||
|
||||
**Applicable to**: Tables and supertables.
|
||||
|
||||
**Usage Instructions**: The max function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value.
|
||||
**Usage Instructions**:
|
||||
- The max function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value(supported from ver-3.3.3.0, function `max` only accept numeric parameter before ver-3.3.3.0).
|
||||
|
||||
### MIN
|
||||
|
||||
|
@ -1991,7 +2041,8 @@ MIN(expr)
|
|||
|
||||
**Applicable to**: Tables and supertables.
|
||||
|
||||
**Usage Instructions**: The min function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value.
|
||||
**Usage Instructions**:
|
||||
- The min function can accept strings as input parameters, and when the input parameter is a string type, it returns the largest string value(supported from ver-3.3.3.0, function `min` only accept numeric parameter before ver-3.3.3.0).
|
||||
|
||||
### MODE
|
||||
|
||||
|
|
|
@ -386,7 +386,7 @@ This document details the server error codes that may be encountered when using
|
|||
| 0x8000260D | Tags number not matched | Mismatched number of tag columns | Check and correct the SQL statement |
|
||||
| 0x8000260E | Invalid tag name | Invalid or non-existent tag name | Check and correct the SQL statement |
|
||||
| 0x80002610 | Value is too long | Value length exceeds limit | Check and correct the SQL statement or API parameters |
|
||||
| 0x80002611 | Password can not be empty | Password is empty | Use a valid password |
|
||||
| 0x80002611 | Password too short or empty | Password is empty or less than 8 chars | Use a valid password |
|
||||
| 0x80002612 | Port should be an integer that is less than 65535 and greater than 0 | Illegal port number | Check and correct the port number |
|
||||
| 0x80002613 | Endpoint should be in the format of 'fqdn:port' | Incorrect address format | Check and correct the address information |
|
||||
| 0x80002614 | This statement is no longer supported | Feature has been deprecated | Refer to the feature documentation |
|
||||
|
|
|
@ -16,7 +16,7 @@ TDengine 采用 SQL 作为查询语言,大大降低学习成本、降低迁移
|
|||
|
||||
如果你是系统管理员,关心安装、升级、容错灾备、关心数据导入、导出、配置参数,如何监测 TDengine 是否健康运行,如何提升系统运行的性能,请仔细参考[运维指南](./operation)一章。
|
||||
|
||||
如果你对数据库内核设计感兴趣,或是开源爱好者,建议仔细阅读[技术内幕](./tdinterna)一章。该章从分布式架构到存储引擎、查询引擎、数据订阅,再到流计算引擎都做了详细阐述。建议对照文档,查看TDengine在GitHub的源代码,对TDengine的设计和编码做深入了解,更欢迎加入开源社区,贡献代码。
|
||||
如果你对数据库内核设计感兴趣,或是开源爱好者,建议仔细阅读[技术内幕](./tdinternal)一章。该章从分布式架构到存储引擎、查询引擎、数据订阅,再到流计算引擎都做了详细阐述。建议对照文档,查看TDengine在GitHub的源代码,对TDengine的设计和编码做深入了解,更欢迎加入开源社区,贡献代码。
|
||||
|
||||
最后,作为一个开源软件,欢迎大家的参与。如果发现文档有任何错误、描述不清晰的地方,请在每个页面的最下方,点击“编辑本文档”直接进行修改。
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@ import Tabs from "@theme/Tabs";
|
|||
import TabItem from "@theme/TabItem";
|
||||
import PkgListV3 from "/components/PkgListV3";
|
||||
|
||||
您可以[用 Docker 立即体验](../../get-started/docker/) TDengine。如果您希望对 TDengine 贡献代码或对内部实现感兴趣,请参考我们的 [TDengine GitHub 主页](https://github.com/taosdata/TDengine) 下载源码构建和安装.
|
||||
|
||||
TDengine 完整的软件包包括服务端(taosd)、应用驱动(taosc)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、命令行程序(CLI,taos)和一些工具软件。目前 TDinsight 仅在 Linux 系统上安装和运行,后续将支持 Windows、macOS 等系统。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](../../reference/components/taosadapter/) 提供 [RESTful 接口](../../reference/connector/rest-api/)。
|
||||
|
||||
为方便使用,标准的服务端安装包包含了 taosd、taosAdapter、taosc、taos、taosdump、taosBenchmark、TDinsight 安装脚本和示例代码;如果您只需要用到服务端程序和客户端连接的 C/C++ 语言支持,也可以仅下载 Lite 版本的安装包。
|
||||
|
@ -319,4 +317,4 @@ SELECT AVG(current), MAX(voltage), MIN(phase) FROM test.meters WHERE groupId = 1
|
|||
SELECT _wstart, AVG(current), MAX(voltage), MIN(phase) FROM test.d1001 INTERVAL(10s);
|
||||
```
|
||||
|
||||
在上面的查询中,使用系统提供的伪列 _wstart 来给出每个窗口的开始时间。
|
||||
在上面的查询中,使用系统提供的伪列 _wstart 来给出每个窗口的开始时间。
|
||||
|
|
|
@ -10,7 +10,7 @@ import official_account from './official-account.webp'
|
|||
|
||||
TDengine 完整的软件包包括服务端(taosd)、用于与第三方系统对接并提供 RESTful 接口的 taosAdapter、应用驱动(taosc)、命令行程序 (CLI,taos) 和一些工具软件。TDengine 除了提供多种语言的连接器之外,还通过 [taosAdapter](../reference/components/taosadapter) 提供 [RESTful 接口](../reference/connector/rest-api)。
|
||||
|
||||
本章主要介绍如何利用 Docker 或者安装包快速设置 TDengine 环境并体验其高效写入和查询。
|
||||
本章主要介绍如何快速设置 TDengine 环境并体验其高效写入和查询。
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
@ -34,4 +34,4 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
|||
<td style={{padding:'1em 3em',border:0}}>关注 TDengine 视频号<br/>收看技术直播与教学视频</td>
|
||||
<td style={{padding:'1em 3em',border:0}}>关注 TDengine 公众号<br/>阅读技术文章与行业案例</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
|
|
|
@ -175,7 +175,7 @@ TDengine 对于修改数据提供两种处理方式,由 IGNORE UPDATE 选项
|
|||
|
||||
用户可以为每个 partition 对应的子表生成自定义的 TAG 值,如下创建流的语句,
|
||||
```sql
|
||||
CREATE STREAM output_tag trigger at_once INTO output_tag_s TAGS(alias_tag varchar(100)) as select _wstart, count(*) from power.meters partition by concat("tag-", tbname) as alias_tag interval(10s));
|
||||
CREATE STREAM output_tag trigger at_once INTO output_tag_s TAGS(alias_tag varchar(100)) as select _wstart, count(*) from power.meters partition by concat("tag-", tbname) as alias_tag interval(10s);
|
||||
```
|
||||
|
||||
在 PARTITION 子句中,为 concat("tag-", tbname)定义了一个别名 alias_tag, 对应超级表 output_tag_s 的自定义 TAG 的名字。在上述示例中,流新创建的子表的 TAG 将以前缀 'tag-' 连接原表名作为 TAG 的值。会对 TAG 信息进行如下检查。
|
||||
|
|
|
@ -166,6 +166,12 @@ json 数据支持 JSONObject 或者 JSONArray,使用 json 解析器可以解
|
|||
|
||||

|
||||
|
||||
### 8. 创建完成
|
||||
### 8. 异常处理策略
|
||||
|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
<Contributing />
|
||||
|
||||
### 9. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 MQTT 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -196,12 +196,16 @@ json 数据支持 JSONObject 或者 JSONArray,使用 json 解析器可以解
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||

|
||||
<AdvancedOptions/>
|
||||
|
||||

|
||||
### 9. 异常处理策略
|
||||
|
||||
### 9. 创建完成
|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 Kafka 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -75,9 +75,9 @@ InfluxDB 是一种流行的开源时间序列数据库,它针对处理大量
|
|||
|
||||
### 6. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||

|
||||

|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
<AdvancedOptions/>
|
||||
|
||||
### 7. 创建完成
|
||||
|
|
@ -58,9 +58,9 @@ OpenTSDB 是一个架构在 HBase 系统之上的实时监控信息收集和展
|
|||
|
||||
### 5. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||

|
||||

|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
<AdvancedOptions/>
|
||||
|
||||
### 6. 创建完成
|
||||
|
|
@ -107,13 +107,25 @@ sidebar_label: "CSV"
|
|||
|
||||

|
||||
|
||||
### 5. 创建完成
|
||||
### 5. 配置高级选项
|
||||
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
<AdvancedOptions/>
|
||||
|
||||
### 6. 异常处理策略
|
||||
|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
<Contributing />
|
||||
|
||||
### 7. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 CSV 到 TDengine 的数据同步任务,回到数据写入任务列表页面,可查看任务执行情况,也可以进行任务的“启动/停止”操作与“查看/编辑/删除/复制”操作。
|
||||
|
||||

|
||||
|
||||
### 6. 查看运行指标
|
||||
### 8. 查看运行指标
|
||||
|
||||
点击 **查看** 按钮,查看任务的运行指标,同时也可以查看任务中所有文件的处理情况。
|
||||
|
|
@ -134,6 +134,12 @@ split 提取器,seperator 填写分割符 `,`, number 填写 2。
|
|||
|
||||

|
||||
|
||||
### 7. 创建完成
|
||||
### 7. 异常处理策略
|
||||
|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
<Contributing />
|
||||
|
||||
### 8. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建任务。提交任务后,回到**数据写入**页面可以查看任务状态。
|
|
@ -98,14 +98,16 @@ MySQL 是最流行的关系型数据库之一。很多系统都曾经或正在
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 9. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 9. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 MySQL 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -99,14 +99,16 @@ TDengine 可以高效地从 PostgreSQL 读取数据并将其写入 TDengine,
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 9. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 9. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 PostgreSQL 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -91,14 +91,16 @@ TDengine 可以高效地从 Oracle 读取数据并将其写入 TDengine,以实
|
|||
|
||||
### 7. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 8. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 8. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 9. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 Oracle 到 TDengine 的数据同步任务,回到**数据源列表****页面可查看任务执行情况。
|
|
@ -105,14 +105,16 @@ Microsoft SQL Server 是最流行的关系型数据库之一。很多系统都
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 9. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 9. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 Microsoft SQL Server 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -122,14 +122,16 @@ MongoDB 是一个介于关系型数据库与非关系型数据库之间的产品
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 9. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 9. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 MongoDB 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -0,0 +1,7 @@
|
|||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
|
||||

|
|
@ -0,0 +1,23 @@
|
|||
异常处理策略区域是对数据异常时的处理策略进行配置,默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
|
||||

|
||||
|
||||
各异常项说明及相应可选处理策略如下:
|
||||
|
||||
> 通用处理策略说明:
|
||||
> 归档:将异常数据写入归档文件(默认路径为 `${data_dir}/tasks/_id/.datetime`),不写入目标库
|
||||
> 丢弃:将异常数据忽略,不写入目标库
|
||||
> 报错:任务报错
|
||||
|
||||
- **主键时间戳溢出** 检查数据中第一列时间戳是否在正确的时间范围内(now - keep1, now + 100y),可选处理策略:归档、丢弃、报错
|
||||
- **主键时间戳空** 检查数据中第一列时间戳是否为空,可选处理策略:归档、丢弃、报错、使用当前时间
|
||||
> 使用当前时间:使用当前时间填充到空的时间戳字段中
|
||||
- **表名长度溢出** 检查子表表名的长度是否超出限制(最大 192 字符),可选处理策略:归档、丢弃、报错、截断、截断且归档
|
||||
> 截断:截取原始表名的前 192 个字符作为新的表名
|
||||
> 截断且归档:截取原始表名的前 192 个字符作为新的表名,并且将此行记录写入归档文件
|
||||
- **表名非法字符** 检查子表表名中是否包含特殊字符(符号 `.` 等),可选处理策略:归档、丢弃、报错、非法字符替换为指定字符串
|
||||
> 非法字符替换为指定字符串:将原始表名中的特殊字符替换为后方输入框中的指定字符串,例如 `a.b` 替换为 `a_b`
|
||||
- **表名模板变量空值** 检查子表表名模板中的变量是否为空,可选处理策略:丢弃、留空、变量替换为指定字符串
|
||||
> 留空:变量位置不做任何特殊处理,例如 `a_{x}` 转换为 `a_`
|
||||
> 变量替换为指定字符串:变量位置使用后方输入框中的指定字符串,例如 `a_{x}` 转换为 `a_b`
|
||||
- **列名长度溢出** 检查列名的长度是否超出限制(最大 64 字符),可选处理策略:归档、丢弃、报错
|
After Width: | Height: | Size: 19 KiB |
|
@ -294,9 +294,32 @@ let v3 = data["voltage"].split(",");
|
|||
|
||||
在任务列表页面,还可以对任务进行启动、停止、查看、删除、复制等操作,也可以查看各个任务的运行情况,包括写入的记录条数、流量等。
|
||||
|
||||
### 健康状态
|
||||
|
||||
从 3.3.5.0 开始,在任务管理列表中,增加了一项 ”健康状态“,用于指示当前任务运行过程中的健康状态。
|
||||
|
||||
在数据源的”高级选项“列表中,增加了多项健康状态监测的配置项,包括:
|
||||
|
||||

|
||||
|
||||
1. 健康监测时段(Health Check Duration):可选项,表示对最近多长时间的任务状态进行统计。
|
||||
2. Busy 状态阈值(Busy State Threshold):百分比,表示写入队列中入队元素数量与队列长度之比,默认 100%。
|
||||
3. 写入队列长度(Max Write Queue Length):表示对应的写入队列长度最大值。
|
||||
4. 写入错误阈值(Write Error Threshold):数值类型,表示健康监测时段中允许写入错误的数量。超出阈值,则报错。
|
||||
|
||||
在任务管理列表展示中,有如下状态:
|
||||
|
||||
- Ready:数据源和目标端健康检查通过,可以进行数据读取和写入。
|
||||
- Idle:表示监测时段内无数据处理(没有数据进入处理流程)。
|
||||
- Busy:表示写入队列已满(超出一定阈值,表示写入繁忙,在一定程度上意味着当前可能存在性能瓶颈,需要调整参数或配置等来进行改善,但并不说明存在错误)。
|
||||
- Bounce:数据源和目标端均正常,但在写入过程中存在错误,一定周期内超出阈值,可能意味着存在大量非正常数据或正在发生数据丢失。
|
||||
- SourceError: 数据源错误导致无法进行读取。此时工作负载将尝试重连数据源。
|
||||
- SinkError:写入端错误导致无法进行写入。此时工作负载将尝试重连数据库,恢复后进入 Ready 状态。
|
||||
- Fatal:严重或无法恢复的错误。
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
|
||||
|
||||
<DocCardList items={useCurrentSidebarCategory().items}/>
|
||||
```
|
||||
```
|
||||
|
|
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 31 KiB |
|
@ -6,45 +6,154 @@ toc_max_heading_level: 4
|
|||
|
||||
为了防止数据丢失、误删操作,TDengine 提供全面的数据备份、恢复、容错、异地数据实时同步等功能,以保证数据存储的安全。本节简要说明备份和恢复功能。
|
||||
|
||||
## 基于 taosdump 进行数据备份恢复
|
||||
# 1. 基于 taosdump 进行数据备份恢复
|
||||
|
||||
taosdump 是一个开源工具,用于支持从运行中的 TDengine 集群备份数据并将备份的数据恢复到相同或另一个正在运行的 TDengine 集群中。taosdump 可以将数据库作为逻辑数据单元进行备份,也可以对数据库中指定时间段内的数据记录进行备份。在使用taosdump 时,可以指定数据备份的目录路径。如果不指定目录路径,taosdump 将默认将数据备份到当前目录。
|
||||
taosdump 是一个开源工具,用于支持从运行中的 TDengine 集群备份数据并将备份的数据恢复到相同或另一个正在运行的 TDengine
|
||||
集群中。taosdump 可以将数据库作为逻辑数据单元进行备份,也可以对数据库中指定时间段内的数据记录进行备份。在使用taosdump
|
||||
时,可以指定数据备份的目录路径。如果不指定目录路径,taosdump 将默认将数据备份到当前目录。
|
||||
|
||||
以下为 taosdump 执行数据备份的使用示例。
|
||||
|
||||
```shell
|
||||
taosdump -h localhost -P 6030 -D dbname -o /file/path
|
||||
```
|
||||
|
||||
执行上述命令后,taosdump 会连接 localhost:6030 所在的 TDengine 集群,查询数据库 dbname 中的所有数据,并将数据备份到 /f ile/path 下。
|
||||
执行上述命令后,taosdump 会连接 localhost:6030 所在的 TDengine 集群,查询数据库 dbname 中的所有数据,并将数据备份到 /f
|
||||
ile/path 下。
|
||||
|
||||
在使用 taosdump 时,如果指定的存储路径已经包含数据文件,taosdump 会提示用户并立即退出,以避免数据被覆盖。这意味着同一存储路径只能用于一次备份。如果你看到相关提示,请谨慎操作,以免误操作导致数据丢失。
|
||||
在使用 taosdump 时,如果指定的存储路径已经包含数据文件,taosdump
|
||||
会提示用户并立即退出,以避免数据被覆盖。这意味着同一存储路径只能用于一次备份。如果你看到相关提示,请谨慎操作,以免误操作导致数据丢失。
|
||||
|
||||
要将本地指定文件路径中的数据文件恢复到正在运行的 TDengine 集群中,可以通过指定命令行参数和数据文件所在路径来执行 taosdump
|
||||
命令。以下为 taosdump 执行数据恢复的示例代码。
|
||||
|
||||
要将本地指定文件路径中的数据文件恢复到正在运行的 TDengine 集群中,可以通过指定命令行参数和数据文件所在路径来执行 taosdump 命令。以下为 taosdump 执行数据恢复的示例代码。
|
||||
```shell
|
||||
taosdump -i /file/path -h localhost -P 6030
|
||||
```
|
||||
|
||||
执行上述命令后,taosdump 会连接 localhost:6030 所在的 TDengine 集群,并将 /file/path 下的数据文件恢复到 TDengine 集群中。
|
||||
|
||||
## 基于 TDengine Enterprise 进行数据备份恢复
|
||||
# 2. 基于 TDengine Enterprise 进行数据备份恢复
|
||||
|
||||
TDengine Enterprise 提供了一个高效的增量备份功能,具体流程如下。
|
||||
## 2.1. 概念
|
||||
|
||||
第 1 步,通过浏览器访问 taosExplorer 服务,访问地址通常为 TDengine 集群所在 IP 地址的端口 6060,如 http://localhost:6060。
|
||||
基于 TDengine 的数据订阅功能,TDengine Enterprise 实现了数据的增量备份和恢复。用户可以通过 taosExplorer 对 TDengine
|
||||
集群进行备份和恢复。
|
||||
|
||||
第 2 步,在 taosExplorer 服务页面中的“系统管理 - 备份”页面新增一个数据备份任务,在任务配置信息中填写需要备份的数据库名称和备份存储文件路径,完成创建任务
|
||||
后即可启动数据备份。 在数据备份配置页面中可以配置三个参数:
|
||||
- 备份周期:必填项,配置每次执行数据备份的时间间隔,可通过下拉框选择每天、每 7 天、每 30 天执行一次数据备份,配置后,会在对应的备份周期的0:00时启动一次数据备份任务;
|
||||
- 数据库:必填项,配置需要备份的数据库名(数据库的 wal_retention_period 参数需大于0);
|
||||
- 目录:必填项,配置将数据备份到 taosX 所在运行环境中指定的路径下,如 /root/data_backup;
|
||||
TDengine Enterprise 的备份和恢复功能包括以下几个概念:
|
||||
|
||||
第 3 步,在数据备份任务完成后,在相同页面的已创建任务列表中找到创建的数据备份任务,直接执行一键恢复,就能够将数据恢复到 TDengine 中。
|
||||
1. 备份对象:用户可以对一个数据库,或者一个超级表进行备份。
|
||||
2. 备份计划:用户可以为某个备份对象创建一个备份计划。备份计划从指定的时间点开始,周期性的执行一次备份任务,并生成一组备份文件。
|
||||
3. 备份点:每执行一次备份任务,生成一组备份文件,它们对应一个时间点,称为**备份点**。第一个备份点称为**初始备份点**。
|
||||
4. 备份文件:多个备份点,组成备份计划的备份文件。
|
||||
5. 恢复任务:用户可以选择备份计划的某个备份点,创建一个恢复任务。恢复任务会从初始备份点开始,逐个应用备份点,恢复到指定的备份点。
|
||||
|
||||
与 taosdump 相比,如果对相同的数据在指定存储路径下进行多次备份操作,由于TDengine Enterprise 不仅备份效率高,而且实行的是增量处理,因此每次备份任务都会很快完成。而由于 taosdump 永远是全量备份,因此 TDengine Enterprise 在数据量较大的场景下可以显著减小系统开销,而且更加方便。
|
||||

|
||||
|
||||
**常见错误排查**
|
||||
以上面的图为例:
|
||||
|
||||
1. 如果任务启动失败并报以下错误:
|
||||
1. 用户创建了一个备份计划,从 2024-08-27 00:00:00 开始,每隔 1 天执行一次备份任务。
|
||||
2. 在 2024-08-27 00:00:00 执行了第一次备份任务,生成了一个备份点。
|
||||
3. 之后,每隔 1 天执行一次备份任务,生成了多个备份点,组成了备份文件。
|
||||
4. 用户可以选择某个备份点,创建一个恢复任务,恢复到指定的备份点。
|
||||
5. 恢复任务会从初始备份点开始,逐个应用备份点,恢复到指定的备份点。
|
||||
|
||||
## 2.2. 备份计划
|
||||
|
||||
### 2.1.1. 创建
|
||||
|
||||
1. 通过浏览器访问 taosExplorer 服务,访问地址通常为 TDengine 集群所在 IP 地址的端口 6060,如 http://localhost:6060。
|
||||
2. 在 taosExplorer 服务页面中,进入“系统管理 - 备份”页面,点击“创建备份计划”按钮。
|
||||
|
||||

|
||||
|
||||
3. 在弹出的“创建备份计划”表单中,填写备份计划的相关信息。
|
||||
|
||||

|
||||
|
||||
需要填写的信息包括:
|
||||
|
||||
* 数据库:需要备份的数据库名称。一个备份计划只能备份一个数据库/超级表。
|
||||
* 超级表:需要备份的超级表名称。如果不填写,则备份整个数据库。
|
||||
* 下次执行时间:首次执行备份任务的日期时间。
|
||||
* 备份周期:备份点之间的时间间隔。注意:备份周期必须大于数据库的 WAL_RETENTION_PERIOD 参数值。
|
||||
* 错误重试次数:对于可通过重试解决的错误,系统会按照此次数进行重试。
|
||||
* 错误重试间隔:每次重试之间的时间间隔。
|
||||
* 目录:存储备份文件的目录。
|
||||
* 备份文件大小:备份文件的大小限制。当备份文件大小达到此限制时,会自动创建新的备份文件。
|
||||
* 文件压缩等级:备份文件的压缩等级。支持:最快速度、最佳压缩比、兼具速度和压缩比。
|
||||
|
||||
创建成功后,备份计划会开始按照配置的参数运行。
|
||||
|
||||
### 2.1.2. 查看
|
||||
|
||||
在“备份计划”下的列表中,可以查看已创建的备份计划。
|
||||
|
||||

|
||||
|
||||
点击“操作”中的“查看”按钮,可以查看备份计划的详细信息。
|
||||
|
||||

|
||||
|
||||
### 2.1.3. 修改
|
||||
|
||||
点击“操作”中的“修改”按钮,可以修改备份计划的配置。
|
||||
|
||||

|
||||
|
||||
修改备份计划的配置后,当前运行的备份任务会先停止,然后按照新的配置重新运行。
|
||||
|
||||
### 2.1.4. 复制
|
||||
|
||||
点击“操作”中的“复制”按钮,可以复制备份计划。
|
||||
|
||||

|
||||
|
||||
除了数据库和超级表被置为空外,其他配置项和被复制的计划相同。用户点击“确认”后,创建一个新的备份计划。
|
||||
|
||||
### 2.1.5. 删除
|
||||
|
||||
在操作中点击关闭按钮,可以停止当前备份计划。点击“操作”中的“删除”按钮,可以删除备份计划。
|
||||
|
||||

|
||||
|
||||
删除备份计划时,可以选择,是否删除关联的备份文件。
|
||||
|
||||
## 2.2. 备份文件
|
||||
|
||||
### 2.2.1. 查看
|
||||
|
||||
在备份计划列表中,选择要一个备份计划。在“备份文件”列中,点击“查看”按钮。可以查看和备份计划的所有备份点。
|
||||
|
||||

|
||||
|
||||
在备份文件列表中,可以查看备份文件的详细信息。
|
||||
|
||||

|
||||
|
||||
## 2.3. 恢复任务
|
||||
|
||||
### 2.3.1. 创建
|
||||
|
||||
在备份文件列表中,点击“操作”中的“恢复”按钮,可以创建一个恢复任务。
|
||||
|
||||

|
||||
|
||||
在弹出的对话框中,选择使用哪个备份点开始恢复,默认为最早的备份点。点击“确定”后,创建恢复任务,并跳转至“恢复任务”列表。
|
||||
|
||||
### 2.3.2. 查看
|
||||
|
||||
在“恢复任务”列表中,可以查看已创建的恢复任务。
|
||||
|
||||

|
||||
|
||||
恢复任务可以终止。点击“操作”中的开关,可以终止当前恢复任务。
|
||||
|
||||
# 3. 常见错误排查
|
||||
|
||||
## 3.1. 端口访问异常
|
||||
|
||||
如果任务启动失败并报以下错误:
|
||||
|
||||
```text
|
||||
Error: tmq to td task exec error
|
||||
|
@ -52,9 +161,12 @@ Error: tmq to td task exec error
|
|||
Caused by:
|
||||
[0x000B] Unable to establish connection
|
||||
```
|
||||
|
||||
产生原因是与数据源的端口链接异常,需检查数据源 FQDN 是否联通及端口 6030 是否可正常访问。
|
||||
|
||||
2. 如果使用 WebSocket 连接,任务启动失败并报以下错误:
|
||||
## 3.2. 连接异常
|
||||
|
||||
如果使用 WebSocket 连接,任务启动失败并报以下错误:
|
||||
|
||||
```text
|
||||
Error: tmq to td task exec error
|
||||
|
@ -73,7 +185,9 @@ Caused by:
|
|||
- "HTTP error: *": 可能连接到错误的 taosAdapter 端口或 LSB/Nginx/Proxy 配置错误。
|
||||
- "WebSocket protocol error: Handshake not finished": WebSocket 连接错误,通常是因为配置的端口不正确。
|
||||
|
||||
3. 如果任务启动失败并报以下错误:
|
||||
## 3.3. 任务启动失败
|
||||
|
||||
如果任务启动失败并报以下错误:
|
||||
|
||||
```text
|
||||
Error: tmq to td task exec error
|
||||
|
@ -88,5 +202,6 @@ Caused by:
|
|||
修改数据 WAL 配置:
|
||||
|
||||
```sql
|
||||
alter database test wal_retention_period 3600;
|
||||
alter
|
||||
database test wal_retention_period 3600;
|
||||
```
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
title: 三副本方案
|
||||
sidebar_label: 三副本方案
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
TDengine 的三副本方案采用 RAFT 算法来实现数据的一致性,包括元数据和时序数据。一个虚拟节点组(VGroup)构成了一个 RAFT 组;VGroup 中的虚拟节点(Vnode),便是该 RAFT 组的成员节点,也称之为副本。
|
||||
|
||||
1. 每个 Vnode 都有自己的角色,可以是 Leader(领导者)、Follower(跟随者)、Candidate(候选人)。
|
||||
2. 每个 Vnode 都维护了一份连续的日志,用于记录数据写入、变更、或删除等操作的所有指令。日志是由一系列有序的日志条目组成,每条日志都有唯一的编号,用于标识日志协商或执行的进度。
|
||||
3. Leader 角色的 Vnode 提供读写服务,在故障节点不超过半数的情况下保证集群的高可用性。此外,即使发生了节点重启及 Leader 重新选举等事件后,RAFT 协议也能够始终保证新产生的 Leader 可以提供已经写入成功的全部完整数据的读写服务。
|
||||
4. 每一次对数据库的变更请求(比如数据写入),都对应一条日志。在持续写入数据的过程中,会按照协议机制在每个成员节点上产生完全相同的日志记录,并且以相同的顺序执行数据变更操作,以 WAL 文件的形式存储在数据文件目录中。
|
||||
5. 只有当过半数的节点把该条日志追加到 WAL 文件,并且收到确认消息之后,这条日志才会被 Leader 认为是安全的;此时该日志进入 committed 状态,完成数据的插入,随后该日志被标记为 applied 的状态。
|
||||
|
||||
多副本工作原理参见 [数据写入与复制流程](../../26-tdinternal/01-arch.md#数据写入与复制流程)
|
||||
|
||||
## 集群配置
|
||||
|
||||
三副本要求集群至少配置三个服务器节点,基本部署与配置步骤如下:
|
||||
1. 确定服务器节点数量、主机名或域名,配置好所有节点的域名解析:DNS 或 /etc/hosts
|
||||
2. 各节点分别安装 TDengine 服务端安装包,按需编辑好各节点 taos.cfg
|
||||
3. 启动各节点 taosd 服务,其他服务可按需启动(taosadapter/taosx/taoskeeper/taos-explorer)
|
||||
|
||||
## 运维命令
|
||||
|
||||
### 创建集群
|
||||
|
||||
创建三节点的集群
|
||||
|
||||
```sql
|
||||
CREATE dnode <dnode_ep> port <dnode_port>;
|
||||
CREATE dnode <dnode_ep> port <dnode_port>;
|
||||
```
|
||||
|
||||
创建三副本的 Mnode,保证 Mnode 高可用
|
||||
|
||||
```sql
|
||||
CREATE mnode on dnode <dnode_id>;
|
||||
CREATE mnode on dnode <dnode_id>;
|
||||
```
|
||||
|
||||
### 数据库创建
|
||||
|
||||
创建三副本的数据库
|
||||
|
||||
```sql
|
||||
create database <dbname> replica 3 vgroups xx buffer xx ...
|
||||
```
|
||||
|
||||
### 修改数据库副本数
|
||||
|
||||
创建了单副本数据库后,如果希望改为三副本时,可通过 alter 命令来实现,反之亦然
|
||||
|
||||
```sql
|
||||
alter database <dbname> replica 3|1
|
||||
```
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 1. 创建三副本数据库或修改为三副本时,报错:DB error: Out of dnodes
|
||||
- 服务器节点数不足:原因是服务器节点数少于三个。
|
||||
- 解决方案:增加服务器节点数量,满足最低要求。
|
||||
|
||||
### 2. 创建三副本数据库或 split vgroup 时,报错:DB error: Vnodes exhausted
|
||||
- 服务器可用 Vnodes 不足:原因是某些服务器节点可用 Vnodes 数少于建库或 split vgroup 的需求数。
|
||||
- 解决方案:调整服务器 CPU 数量、SupportVnodes 配置参数,满足建库要求。
|
|
@ -0,0 +1,84 @@
|
|||
---
|
||||
title: 双副本方案
|
||||
sidebar_label: 双副本方案
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
部分用户期望在保证一定可靠性、可用性条件下,尽可能压缩部署成本。为此,TDengine 提出基于 Arbitrator 的双副本方案,可提供集群中**只有单个服务故障且不出现连续故障**的容错能力。双副本方案是 TDengine Enterprise 特有功能,在 3.3.0.0 版本中第一次发布,建议使用最新版本。
|
||||
|
||||
双副本选主由高可用的 Mnode 提供仲裁服务,不由 Raft 组内决定。
|
||||
1. Arbitrator:仲裁服务,不存储数据,VGroup 因某一 Vnode 故障而无法提供服务时,Arbitrator 可根据数据同步情况指定 VGroup 内另一 Vnode 成为 Assigned Leader
|
||||
2. AssignedLeader:被强制设置为 Leader 的 Vnode,无论其他副本 Vnode 是否存活,均可一直响应用户请求
|
||||
|
||||

|
||||
|
||||
## 集群配置
|
||||
|
||||
双副本要求集群至少配置三个节点,基本部署与配置步骤如下:
|
||||
1. 确定服务器节点数量、主机名或域名,配置好所有节点的域名解析:DNS 或 /etc/hosts
|
||||
2. 各节点分别安装 TDengine **企业版**服务端安装包,按需编辑好各节点 taos.cfg
|
||||
3. 可选择其中一个节点仅提供仲裁服务(部署 Mnode),将 SupportVnodes 参数设置为 0,表示不存储时序数据;该占用资源较少,仅需 1~2 核,且可与其他应用共用
|
||||
4. 启动各节点 taosd 服务,其他服务可按需启动(taosadapter/taosx/taoskeeper/taos-explorer)
|
||||
|
||||
## 约束条件
|
||||
1. 最小配置的服务器节点数为 2+1 个,其中两个数据节点,一个仲裁节点
|
||||
2. 双副本为数据库建库参数,不同数据库可按需选择副本数
|
||||
3. 支持 TDengine 集群的完整特性,包括:读缓存、数据订阅、流计算等
|
||||
4. 支持 TDengine 所有语言连接器以及连接方式
|
||||
5. 支持单副本与双副本之间切换(前提是节点数量满足需求、各节点可用 Vnode 数量/内存/存储空间足够)
|
||||
6. 不支持双副本与三副本之间的切换
|
||||
7. 不支持双副本切换为双活,除非另外部署一套实例与当前实例组成双活方案
|
||||
|
||||
## 运维命令
|
||||
|
||||
### 创建集群
|
||||
|
||||
创建三节点的集群
|
||||
|
||||
```sql
|
||||
CREATE dnode <dnode_ep> port <dnode_port>;
|
||||
CREATE dnode <dnode_ep> port <dnode_port>;
|
||||
```
|
||||
|
||||
创建三副本的 Mnode,保证 Mnode 高可用,确保仲裁服务的高可用
|
||||
|
||||
```sql
|
||||
CREATE mnode on dnode <dnode_id>;
|
||||
CREATE mnode on dnode <dnode_id>;
|
||||
```
|
||||
|
||||
### 数据库创建
|
||||
|
||||
按需创建双副本数据库
|
||||
|
||||
```sql
|
||||
create database <dbname> replica 2 vgroups xx buffer xx ...
|
||||
```
|
||||
|
||||
### 修改数据库副本数
|
||||
|
||||
创建了单副本数据库后,希望改为双副本时,可通过 alter 命令来实现,反之亦然
|
||||
|
||||
```sql
|
||||
alter database <dbname> replica 2|1
|
||||
```
|
||||
|
||||
## 异常情况
|
||||
|
||||
| 异常场景 | 集群状态 |
|
||||
| ------- | ------ |
|
||||
| 没有 Vnode 发生故障: Arbitrator 故障(Mnode 宕机节点超过一个,导致 Mnode 无法选主)| **持续提供服务** |
|
||||
| 仅一个 Vnode 故障:VGroup 已经达成同步后,某一个 Vnode 才发生故障的 | **持续提供服务** |
|
||||
| 仅一个 Vnode 故障:离线 Vnode 启动后,VGroup 未达成同步前,另一个 Vnode 服务故障的 | **无法提供服务** |
|
||||
| 两个 Vnode 都发生故障 | **无法提供服务** |
|
||||
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 1. 创建双副本数据库或修改为双副本时,报错:DB error: Out of dnodes
|
||||
- 服务器节点数不足:原因是,数据服务器节点数少于两个。
|
||||
- 解决方案:增加服务器节点数量,满足最低要求。
|
||||
|
||||
### 2. 创建双副本数据库或 split vgroup 时,报错:DB error: Vnodes exhausted
|
||||
- 服务器可用 Vnodes 不足:原因是某些服务器节点可用 Vnodes 数少于建库或 split vgroup 的需求数。
|
||||
- 解决方案:调整服务器 CPU 数量、SupportVnodes 数量,满足建库要求。
|
|
@ -1,31 +1,29 @@
|
|||
---
|
||||
title: TDengine 双活系统
|
||||
sidebar_label: 双活系统
|
||||
title: 双活方案
|
||||
sidebar_label: 双活方案
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
本节介绍 TDengine 双活系统的配置和使用。
|
||||
部分用户因为部署环境的特殊性只能部署两台服务器,同时希望实现一定的服务高可用和数据高可靠。本文主要描述基于数据复制和客户端 Failover 两项关键技术的 TDengine 双活系统的产品行为,包括双活系统的架构、配置、运维等。TDengine 双活既可以用于前面所述资源受限的环境,也可用于在两套 TDengine 集群(不限资源)之间的灾备场景。双活是 TDengine Enterprise 特有功能,在 3.3.0.0 版本中第一次发布,建议使用最新版本。
|
||||
|
||||
1. 部分用户因为部署环境的特殊性只能部署两台服务器,同时希望实现一定的服务高可用和数据高可靠。本文主要描述基于数据复制和客户端 Failover 两项关键技术的 TDengine 双活系统的产品行为,包括双活系统的架构、配置、运维等。TDengine 双活既可以用于前面所述资源受限的环境,也可用于在两套 TDengine 集群(不限资源)之间的灾备场景。双活是 TDengine Enterprise 特有功能,在 3.3.0.0 版本中第一次发布,建议使用最新版本。
|
||||
双活系统的定义是:业务系统中有且仅有两台服务器,其上分别部署一套服务,在业务层看来这两台机器和两套服务是一个完整的系统,对其中的细节业务层不需要感知。双活中的两个节点通常被称为 Master-Slave,意为”主从“或”主备“,本文档中可能会出现混用的情况。
|
||||
|
||||
2. 双活系统的定义是:业务系统中有且仅有两台服务器,其上分别部署一套服务,在业务层看来这两台机器和两套服务是一个完整的系统,对其中的细节业务层不需要感知。双活中的两个节点通常被称为 Master-Slave,意为”主从“或”主备“,本文档中可能会出现混用的情况。
|
||||
TDengine 双活系统的部署架构图如下, 其中涉及到三个关键点:
|
||||
|
||||
3. TDengine 双活系统的部署架构图如下, 其中涉及到三个关键点:
|
||||
1. 由 Client Driver 实现对双系统的 Failover,即主节点宕机时的主从切换
|
||||
2. 由 taosX 从(当前的)主节点到从节点实现数据复制
|
||||
3. 由数据订阅的写接口在写入复制过来的数据时在 WAL 中加入特殊标记,由数据订阅的读接口在读取数据时自动过滤掉带有该特殊标记的数据,避免重复复制形成 infinite loop
|
||||
|
||||
注:下图中仅以一个单机版 TDengine 作为示例,但在实际部署中图中的一个 Host 也可以被任意节点数量的 TDengine 集群代替。
|
||||
|
||||

|
||||

|
||||
|
||||
## 配置
|
||||
|
||||
### 集群配置
|
||||
## 集群配置
|
||||
|
||||
双活对 TDengine 集群本身的配置没有任何要求,但对要在双活系统之间同步的数据库的 WAL 保留时长有一定要求,WAL 保留时长越大双活系统的容错率越高;如果备节点宕机时长超过主节点上的 WAL 保留时长,必定会导致备节点上有数据缺失;如果备节点宕机时长虽未超过主节点上的 WAL 保留时长,也有一定概率丢失数据,取决于接近的程度以及数据同步的速度。
|
||||
|
||||
### 客户端配置
|
||||
## 客户端配置
|
||||
|
||||
目前只有 Java 连接器在 WebSocket 连接模式下支持双活,其配置示例如下
|
||||
|
||||
|
@ -42,19 +40,19 @@ connection = DriverManager.getConnection(url, properties);
|
|||
|
||||
其中的配置属性及含义如下表
|
||||
|
||||
| 属性名 | 含义 |
|
||||
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
||||
| PROPERTY_KEY_SLAVE_CLUSTER_HOST | 第二节点的主机名或者 ip,默认空 |
|
||||
| PROPERTY_KEY_SLAVE_CLUSTER_PORT | 第二节点的端口号,默认空 |
|
||||
| 属性名 | 含义 |
|
||||
| ---------------------------------- | --- |
|
||||
| PROPERTY_KEY_SLAVE_CLUSTER_HOST | 第二节点的主机名或者 ip,默认空 |
|
||||
| PROPERTY_KEY_SLAVE_CLUSTER_PORT | 第二节点的端口号,默认空 |
|
||||
| PROPERTY_KEY_ENABLE_AUTO_RECONNECT | 是否启用自动重连。仅在使用 WebSocket 连接时生效。true: 启用,false: 不启用。默认为 false。双活场景下请设置为 true |
|
||||
| PROPERTY_KEY_RECONNECT_INTERVAL_MS | 重连的时间间隔,单位毫秒:默认 2000 毫秒,也就是 2 秒;最小值为 0, 表示立即重试;最大值不做限制 |
|
||||
| PROPERTY_KEY_RECONNECT_RETRY_COUNT | 每节点最多重试次数:默认值为 3;最小值为 0,表示不进行重试;最大值不做限制 |
|
||||
| PROPERTY_KEY_RECONNECT_INTERVAL_MS | 重连的时间间隔,单位毫秒:默认 2000 毫秒,也就是 2 秒;最小值为 0, 表示立即重试;最大值不做限制 |
|
||||
| PROPERTY_KEY_RECONNECT_RETRY_COUNT | 每节点最多重试次数:默认值为 3;最小值为 0,表示不进行重试;最大值不做限制 |
|
||||
|
||||
### 约束条件
|
||||
## 约束条件
|
||||
|
||||
1. 应用程序不能使用订阅接口,如果配置了双活参数会导致创建消费者失败。
|
||||
2. 不建议应用程序使用参数绑定的写入和查询方式,如果使用应用需要自己解决连接切换后的相关对象失效问题。
|
||||
3. 在双活场景下,不建议用户应用程序显示调用 use database,应该在连接参数中指定 database。
|
||||
1. 应用程序不能使用订阅接口,如果配置了双活参数会导致创建消费者失败
|
||||
2. 不建议应用程序使用参数绑定的写入和查询方式,如果使用应用需要自己解决连接切换后的相关对象失效问题
|
||||
3. 在双活场景下,不建议用户应用程序显示调用 use database,应该在连接参数中指定 database
|
||||
4. 双活的两端集群必须同构(即数据库的命名和所有配置参数以及用户名密码和权限设置等完全相同)
|
||||
5. 只支持 WebSocket 连接模式
|
||||
|
||||
|
@ -73,7 +71,7 @@ taosx replica start
|
|||
1. 方法一
|
||||
|
||||
```shell
|
||||
- taosx replica start -f source_endpoint -t sink_endpoint [database...]
|
||||
taosx replica start -f source_endpoint -t sink_endpoint [database...]
|
||||
```
|
||||
|
||||
在本机器所在的 taosx 服务中建立从 source_endpoint 到 sink_endpoint 的同步任务。运行该命令成功后,将打印 replica ID 到控制台(后续记为 id)。
|
||||
|
@ -82,6 +80,7 @@ taosx replica start
|
|||
```shell
|
||||
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 仅创建指定的数据库同步任务。
|
||||
|
||||
2. 方法二
|
||||
|
@ -93,9 +92,9 @@ taosx replica start -i id [database...]
|
|||
使用上面已经创建的 Replica ID (id) 以在该同步任务中增加其它数据库。
|
||||
|
||||
注意:
|
||||
- 多次使用该命令,不会创建重复任务,仅将所指定的数据库增加到相应任务中。
|
||||
- replica id 在一个 taosX 实例内是全局唯一的,与 source/sink 的组合无关
|
||||
- 为便于记忆,replica id 为一个随机常用单词,系统自动将 source/sink 组合对应到一个词库中取得一个唯一可用单词。
|
||||
1. 多次使用该命令,不会创建重复任务,仅将所指定的数据库增加到相应任务中。
|
||||
2. replica id 在一个 taosX 实例内是全局唯一的,与 source/sink 的组合无关
|
||||
3. 为便于记忆,replica id 为一个随机常用单词,系统自动将 source/sink 组合对应到一个词库中取得一个唯一可用单词。
|
||||
|
||||
### 查看任务状态
|
||||
|
||||
|
@ -120,8 +119,8 @@ taosx replica stop id [db...]
|
|||
```
|
||||
|
||||
该命令作用如下:
|
||||
- 停止指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||
- 使用 `taosx replica stop id1 db1` 表示停止 id1 replica 下 db1的同步任务。
|
||||
1. 停止指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||
2. 使用 `taosx replica stop id1 db1` 表示停止 id1 replica 下 db1的同步任务。
|
||||
|
||||
### 重启双活任务
|
||||
|
||||
|
@ -130,8 +129,8 @@ taosx replica restart id [db...]
|
|||
```
|
||||
|
||||
该命令作用如下:
|
||||
- 重启指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||
- 使用 `taosx replica start id1 db1` 仅重启指定数据库 db1的同步任务。
|
||||
1. 重启指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||
2. 使用 `taosx replica start id1 db1` 仅重启指定数据库 db1的同步任务。
|
||||
|
||||
### 查看同步进度
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
sidebar_label: 高可用
|
||||
title: 高可用
|
||||
---
|
||||
|
||||
TDengine 作为分布式时序数据库,支持高可用特性。默认高可用方案为基于 RAFT 协议的标准三副本方案;为适应不同用户场景的需要,提供基于 RAFT 协议改造的双副本方案;为满足传统双机主备架构的需求,提供基于 WAL 数据同步的双活方案。
|
||||
|
||||
- 标准三副本方案:时序数据的副本数目为 3,确保了最高的可用性,成本也最高。
|
||||
- 双副本结合 Arbitrator 方案:时序数据的副本数目为 2,但节点数目至少为 3,以确保高可用性和良好的数据一致性,可显著降低成本。与三副本方案相比,此方案在显著降低成本的同时,依然保持了较高的可用性。
|
||||
- 双活方案:可仅部署两个节点,高可用性较好,数据一致性较弱(最终一致性)。
|
||||
|
||||
以下为三种方案的特点:
|
||||
|
||||
| # | **三副本** | **双副本** | **双活** |
|
||||
|:--|:----------|:----------|:--------|
|
||||
| **集群数目** | 部署一个集群 | 部署一个集群 | 部署两个不同集群 |
|
||||
| **最小节点数** | 三个数据节点 | 两个数据节点,一个仲裁节点 | 两个数据节点 |
|
||||
| **选主原理** | Raft 协议 | 管理节点仲裁选主 | 无需选主 |
|
||||
| **同步原理** | Raft 协议 | Raft 协议 | 通过 taosX 进行数据同步 |
|
||||
| **同步延迟** | 无延迟 | 无延迟 | 依赖于 taosX 的同步速度,秒级延迟 |
|
||||
| **数据安全性** | 无数据丢失 | 无数据丢失 | 依赖于 WAL 的保存时长 |
|
||||
| **数据一致性** | RAFT 一致性 | RAFT 一致性 | 最终一致性 |
|
||||
| **高可用性** | 任一节点宕机不影响服务 | 任一节点宕机不影响服务,但不能处理连续宕机场景 | 一个实例存活即可提供服务 |
|
||||
|
||||
|
Before Width: | Height: | Size: 161 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 103 KiB |
|
@ -10,15 +10,11 @@ import TabItem from "@theme/TabItem";
|
|||
## 概述
|
||||
本文档介绍如何将 TDengine 数据源与开源数据可视化系统 [Grafana](https://www.grafana.com/) 集成,以实现数据的可视化和监测报警系统的搭建。通过 TDengine 插件,您可以轻松地将 TDengine 数据表的数据展示在 Grafana 仪表盘上,且无需进行复杂的开发工作。
|
||||
|
||||
## Grafana 版本要求
|
||||
当前 TDengine 支持 Grafana 7.5 及以上版本,建议使用最新版本。请根据您的系统环境下载并安装对应版本的 Grafana。
|
||||
|
||||
|
||||
## 前置条件
|
||||
|
||||
要让 Grafana 能正常添加 TDengine 数据源,需要以下几方面的准备工作。
|
||||
|
||||
- Grafana 服务已经部署并正常运行。
|
||||
- Grafana 服务已经部署并正常运行。当前 TDengine 支持 Grafana 7.5 及以上版本,建议使用最新版本。
|
||||
**注意**:要确保启动 Grafana 的账号有其安装目录的写权限,否则可能后面无法安装插件。
|
||||
- TDengine 集群已经部署并正常运行。
|
||||
- taosAdapter 已经安装并正常运行。具体细节请参考 [taosAdapter 的使用手册](../../../reference/components/taosadapter)
|
||||
|
|
|
@ -10,13 +10,10 @@ toc_max_heading_level: 4
|
|||
|
||||
一旦数据源配置完成,永洪BI便能直接从TDengine中读取数据,并利用其强大的数据处理和分析功能,为用户提供丰富的数据展示、分析和预测能力。这意味着用户无须编写复杂的代码或进行烦琐的数据转换工作,即可轻松获取所需的业务洞察。
|
||||
|
||||
## 安装永洪 BI
|
||||
## 前置条件
|
||||
|
||||
确保永洪 BI 已经安装并运行(如果未安装,请到永洪科技官方下载页面下载)。
|
||||
|
||||
## 安装JDBC驱动
|
||||
|
||||
从 maven.org 下载 TDengine JDBC 连接器文件 “taos-jdbcdriver-3.2.7-dist.jar”,并安装在永洪 BI 的机器上。
|
||||
- 确保永洪 BI 已经安装并运行(如果未安装,请到永洪科技官方下载页面下载)。
|
||||
- 安装JDBC驱动。从 maven.org 下载 TDengine JDBC 连接器文件 “taos-jdbcdriver-3.4.0-dist.jar”,并安装在永洪 BI 的机器上。
|
||||
|
||||
## 配置JDBC数据源
|
||||
|
||||
|
|
|
@ -8,16 +8,11 @@ Seeq 是制造业和工业互联网(IIOT)高级分析软件。Seeq 支持在
|
|||
|
||||
通过 TDengine Java connector, Seeq 可以轻松支持查询 TDengine 提供的时序数据,并提供数据展现、分析、预测等功能。
|
||||
|
||||
## Seeq 安装方法
|
||||
## 前置条件
|
||||
|
||||
从 [Seeq 官网](https://www.seeq.com/customer-download)下载相关软件,例如 Seeq Server 和 Seeq Data Lab 等。Seeq Data Lab 需要安装在和 Seeq Server 不同的服务器上,并通过配置和 Seeq Server 互联。详细安装配置指令参见[Seeq 知识库]( https://support.seeq.com/kb/latest/cloud/)。
|
||||
- Seeq 已经安装。从 [Seeq 官网](https://www.seeq.com/customer-download)下载相关软件,例如 Seeq Server 和 Seeq Data Lab 等。Seeq Data Lab 需要安装在和 Seeq Server 不同的服务器上,并通过配置和 Seeq Server 互联。详细安装配置指令参见[Seeq 知识库]( https://support.seeq.com/kb/latest/cloud/)。
|
||||
|
||||
### TDengine 本地实例安装方法
|
||||
|
||||
请参考[官网文档](../../../get-started)。
|
||||
|
||||
### TDengine Cloud 访问方法
|
||||
如果使用 Seeq 连接 TDengine Cloud,请在 https://cloud.taosdata.com 申请帐号并登录查看如何访问 TDengine Cloud。
|
||||
- TDengine 本地实例已安装。 请参考[官网文档](../../../get-started)。 若使用 TDengine Cloud,请在 https://cloud.taosdata.com 申请帐号并登录查看如何访问 TDengine Cloud。
|
||||
|
||||
## 配置 Seeq 访问 TDengine
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ taosws://用户名:密码@主机名:端口号
|
|||
```bash
|
||||
taosws://root:taosdata@localhost:6041
|
||||
```
|
||||
第5步,配置好连接串,点击 “TEST CONNECTION” 测试连接是否成功,测试通过后点击 “CONNECT” 按钮,完成连接。
|
||||
**第 5 步**,配置好连接串,点击 “TEST CONNECTION” 测试连接是否成功,测试通过后点击 “CONNECT” 按钮,完成连接。
|
||||
|
||||
|
||||
## 开始使用
|
||||
|
|
|
@ -282,9 +282,6 @@ d4,2017-07-14T10:40:00.006+08:00,-2.740636,10,-0.893545,7,California.LosAngles
|
|||
# listen to ip:port address
|
||||
#listen = "0.0.0.0:6050"
|
||||
|
||||
# database url
|
||||
#database_url = "sqlite:taosx.db"
|
||||
|
||||
# default global request timeout which unit is second. This parameter takes effect for certain interfaces that require a timeout setting
|
||||
#request_timeout = 30
|
||||
|
||||
|
@ -384,6 +381,16 @@ Linux 下 `journalctl` 查看日志的命令如下:
|
|||
journalctl -u taosx [-f]
|
||||
```
|
||||
|
||||
### 从旧版本升级
|
||||
|
||||
从 3.3.5.0/3.3.4.11 版本开始,不再在 systemd 服务文件预置 `DATABASE_URL=` 环境变量。如果在配置文件中使用了自定义 `data_dir` 参数,从旧版本升级后,必须将数据库文件从旧版本移动到自定义目录中。以 `data_dir = "/path/to/data"` 为例,执行以下命令:
|
||||
|
||||
```shell
|
||||
mv /var/lib/taos/taosx/taosx.db* /path/to/data/
|
||||
```
|
||||
|
||||
之后再重启服务(此行为仅影响 Linux 系统)。
|
||||
|
||||
## taosX 监控指标
|
||||
|
||||
taosX 会将监控指标上报给 taosKeeper,这些监控指标会被 taosKeeper 写入监控数据库,默认是 `log` 库,可以在 taoskeeper 配置文件中修改。以下是这些监控指标的详细介绍。
|
||||
|
|
|
@ -12,7 +12,8 @@ sidebar_label: taosX-Agent
|
|||
- `endpoint`: 必填,`taosX` 的 GRPC 服务地址。
|
||||
- `token`: 必填,在 `Explorer` 上创建 `Agent` 时,产生的 Token。
|
||||
- `instanceId`:当前 taosx-agent 服务的实例 ID,如果同一台机器上启动了多个 taosx-agent 实例,必须保证各个实例的实例 ID 互不相同。
|
||||
- `compression`: 非必填,可配置为 `ture` 或 `false`, 默认为 `false`。配置为`true`, 则开启 `Agent` 和 `taosX` 通信数据压缩。
|
||||
- `compression`: 非必填,可配置为 `true` 或 `false`, 默认为 `false`。配置为`true`, 则开启 `Agent` 和 `taosX` 通信数据压缩。
|
||||
- `in_memory_cache_capacity`: 非必填,表示可在内存中缓存的最大消息批次数,可配置为大于 0 的整数。默认为 `64`。
|
||||
- `log_level`: 非必填,日志级别,默认为 `info`, 同 `taosX` 一样,支持 `error`,`warn`,`info`,`debug`,`trace` 五级。已弃用,请使用 `log.level` 代替。
|
||||
- `log_keep_days`:非必填,日志保存天数,默认为 `30` 天。已弃用,请使用 `log.keepDays` 代替。
|
||||
- `log.path`:日志文件存放的目录。
|
||||
|
@ -44,6 +45,10 @@ sidebar_label: taosX-Agent
|
|||
#
|
||||
#compression = true
|
||||
|
||||
# In-memory cache capacity
|
||||
#
|
||||
#in_memory_cache_capacity = 64
|
||||
|
||||
# log configuration
|
||||
[log]
|
||||
# All log files are stored in this directory
|
||||
|
|
|
@ -193,6 +193,7 @@ ROUND(expr[, digits])
|
|||
- `digits` 小于零表示丢掉小数位,并将数字四舍五入到小数点左侧 `digits` 位。若小数点左侧的位数小于 `digits`位,返回 0。
|
||||
- 由于暂未支持 DECIMAL 类型,所以该函数会用 DOUBLE 和 FLOAT 来表示包含小数的结果,但是 DOUBLE 和 FLOAT 是有精度上限的,当位数太多时使用该函数可能没有意义。
|
||||
- 只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。
|
||||
- `digits` 从 ver-3.3.3.0 开始支持。
|
||||
|
||||
**举例**:
|
||||
```sql
|
||||
|
@ -268,6 +269,8 @@ PI()
|
|||
|
||||
**功能说明**:返回圆周率 π 的值。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:DOUBLE。
|
||||
|
||||
**适用数据类型**:无。
|
||||
|
@ -295,6 +298,8 @@ TRUNCATE(expr, digits)
|
|||
|
||||
**功能说明**:获得指定字段按照指定位数截断的值。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:与 `expr` 字段的原始数据类型一致。
|
||||
|
||||
**适用数据类型**:
|
||||
|
@ -333,6 +338,8 @@ EXP(expr)
|
|||
```
|
||||
**功能说明**:返回 e(自然对数的底)的指定乘方后的值。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:DOUBLE。
|
||||
|
||||
**适用数据类型**:数值类型。
|
||||
|
@ -360,6 +367,8 @@ LN(expr)
|
|||
|
||||
**功能说明**:返回指定参数的自然对数。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:DOUBLE。
|
||||
|
||||
**适用数据类型**:数值类型。
|
||||
|
@ -388,6 +397,8 @@ MOD(expr1, expr2)
|
|||
|
||||
**功能说明**:计算 expr1 % expr2 的结果。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:DOUBLE。
|
||||
|
||||
**适用数据类型**:数值类型。
|
||||
|
@ -421,6 +432,8 @@ RAND([seed])
|
|||
|
||||
**功能说明**:返回一个从0到1均匀分布的随机数。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:DOUBLE。
|
||||
|
||||
**适用数据类型**:
|
||||
|
@ -464,6 +477,8 @@ SIGN(expr)
|
|||
|
||||
**功能说明**:返回指定参数的符号。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:与指定字段的原始数据类型一致。
|
||||
|
||||
**适用数据类型**:数值类型。
|
||||
|
@ -504,6 +519,8 @@ DEGREES(expr)
|
|||
|
||||
**功能说明**:计算指定参数由弧度值转为角度后的值。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:DOUBLE。
|
||||
|
||||
**适用数据类型**:数值类型。
|
||||
|
@ -532,6 +549,8 @@ RADIANS(expr)
|
|||
|
||||
**功能说明**:计算指定参数由角度值转为弧度后的值。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:DOUBLE。
|
||||
|
||||
**适用数据类型**:数值类型。
|
||||
|
@ -702,6 +721,8 @@ TRIM([remstr FROM] expr)
|
|||
|
||||
**功能说明**:返回去掉了所有 remstr 前缀或后缀的字符串 epxr 。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:与输入字段 epxr 的原始类型相同。
|
||||
|
||||
**适用数据类型**:
|
||||
|
@ -773,6 +794,8 @@ SUBSTRING/SUBSTR(expr FROM pos [FOR len])
|
|||
- 若 `len` 小于 1,返回空串。
|
||||
- `pos` 是 1-base 的,若 `pos` 为 0,返回空串。
|
||||
- 若 `pos` + `len` 大于 `len(expr)`,返回从 `pos` 开始到字符串结尾的子串,等同于执行 `substring(expr, pos)`。
|
||||
- `SUBSTRING` 函数等价于 `SUBSTR`, 从 ver-3.3.3.0 开始支持。
|
||||
- `SUBSTRING/SUBSTR(expr FROM pos [FOR len])` 语法从 ver-3.3.3.0 开始支持。
|
||||
|
||||
**举例**:
|
||||
```sql
|
||||
|
@ -809,6 +832,8 @@ SUBSTRING_INDEX(expr, delim, count)
|
|||
|
||||
**功能说明**:返回字符串 `expr` 在出现指定次数分隔符的位置截取的子串。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:与输入字段 `expr` 的原始类型相同。
|
||||
|
||||
**适用数据类型**:
|
||||
|
@ -862,6 +887,8 @@ CHAR(expr1 [, expr2] [, epxr3] ...)
|
|||
|
||||
**功能说明**:将输入参数当作整数,并返回这些整数在 ASCII 编码中对应的字符。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:VARCHAR。
|
||||
|
||||
**适用数据类型**:整数类型,VARCHAR,NCHAR。
|
||||
|
@ -906,6 +933,8 @@ ASCII(expr)
|
|||
|
||||
**功能说明**:返回字符串第一个字符的 ASCII 码。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果数据类型**:BIGINT。
|
||||
|
||||
**适用数据类型**:VARCHAR, NCHAR。
|
||||
|
@ -933,6 +962,8 @@ POSITION(expr1 IN expr2)
|
|||
|
||||
**功能说明**:计算字符串 `expr1` 在字符串 `expr2` 中的位置。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:BIGINT。
|
||||
|
||||
**适用数据类型**:
|
||||
|
@ -975,6 +1006,8 @@ REPLACE(expr, from_str, to_str)
|
|||
```
|
||||
**功能说明**:将字符串中的 `from_str` 全部替换为 `to_str`。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:与输入字段 `expr` 的原始类型相同。
|
||||
|
||||
**适用数据类型**:
|
||||
|
@ -1005,6 +1038,8 @@ REPEAT(expr, count)
|
|||
```
|
||||
**功能说明**:返回将字符串重复指定次数得到的字符串。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:与输入字段 `expr` 的原始类型相同。
|
||||
|
||||
**适用数据类型**:
|
||||
|
@ -1260,6 +1295,7 @@ TIMEDIFF(expr1, expr2 [, time_unit])
|
|||
- `expr1`:表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
|
||||
- `expr2`:表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
|
||||
- `time_unit`:见使用说明。
|
||||
- ver-3.3.3.0 之前该函数结果为时间戳 `expr1` 和 `expr2` 的差值的绝对值,结果为正数。
|
||||
|
||||
**嵌套子查询支持**:适用于内层查询和外层查询。
|
||||
|
||||
|
@ -1361,6 +1397,8 @@ WEEK(expr [, mode])
|
|||
```
|
||||
**功能说明**:返回输入日期的周数。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:BIGINT。
|
||||
|
||||
**适用数据类型**:
|
||||
|
@ -1422,6 +1460,8 @@ WEEKOFYEAR(expr)
|
|||
```
|
||||
**功能说明**:返回输入日期的周数。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:BIGINT。
|
||||
|
||||
**适用数据类型**:表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
|
||||
|
@ -1449,6 +1489,8 @@ WEEKDAY(expr)
|
|||
```
|
||||
**功能说明**:返回输入日期是周几。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:BIGINT。
|
||||
|
||||
**适用数据类型**:表示 表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
|
||||
|
@ -1476,6 +1518,8 @@ DAYOFWEEK(expr)
|
|||
```
|
||||
**功能说明**:返回输入日期是周几。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回结果类型**:BIGINT。
|
||||
|
||||
**适用数据类型**:表示时间戳的 BIGINT, TIMESTAMP 类型,或符合 ISO8601/RFC3339 标准的日期时间格式的 VARCHAR, NCHAR 类型。
|
||||
|
@ -1633,6 +1677,9 @@ STDDEV/STDDEV_POP(expr)
|
|||
|
||||
**适用于**:表和超级表。
|
||||
|
||||
**说明**:
|
||||
- `STDDEV_POP` 函数等价于 `STDDEV` 函数,从 ver-3.3.3.0 开始支持。
|
||||
|
||||
**举例**:
|
||||
```sql
|
||||
taos> select id from test_stddev;
|
||||
|
@ -1656,6 +1703,8 @@ VAR_POP(expr)
|
|||
|
||||
**功能说明**:统计表中某列的总体方差。
|
||||
|
||||
**版本**: ver-3.3.3.0
|
||||
|
||||
**返回数据类型**:DOUBLE。
|
||||
|
||||
**适用数据类型**:数值类型。
|
||||
|
@ -1898,7 +1947,8 @@ MAX(expr)
|
|||
|
||||
**适用于**:表和超级表。
|
||||
|
||||
**使用说明**:max 函数可以接受字符串作为输入参数,当输入参数为字符串类型时,返回最大的字符串值。
|
||||
**使用说明**:
|
||||
- max 函数可以接受字符串作为输入参数,当输入参数为字符串类型时,返回最大的字符串值,从 ver-3.3.3.0 开始支持,之前的版本不支持字符串参数。
|
||||
|
||||
### MIN
|
||||
|
||||
|
@ -1914,7 +1964,8 @@ MIN(expr)
|
|||
|
||||
**适用于**:表和超级表。
|
||||
|
||||
**使用说明**:min 函数可以接受字符串作为输入参数,当输入参数为字符串类型时,返回最大的字符串值。
|
||||
**使用说明**:
|
||||
- min 函数可以接受字符串作为输入参数,当输入参数为字符串类型时,返回最大的字符串值,从 ver-3.3.3.0 开始支持,之前的版本不支持字符串参数。
|
||||
|
||||
### MODE
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ SHOW QNODES;
|
|||
SHOW QUERIES;
|
||||
```
|
||||
|
||||
显示当前系统中正在进行的查询。
|
||||
显示当前系统中正在进行的写入(更新)/查询/删除。(由于内部 API 命名原因,所以统称 QUERIES)
|
||||
|
||||
## SHOW SCORES
|
||||
|
||||
|
|
|
@ -403,7 +403,7 @@ description: TDengine 服务端的错误码列表和详细说明
|
|||
| 0x8000260D | Tags number not matched | tag列个数不匹配 | 检查并修正SQL语句 |
|
||||
| 0x8000260E | Invalid tag name | 无效或不存在的tag名 | 检查并修正SQL语句 |
|
||||
| 0x80002610 | Value is too long | 值长度超出限制 | 检查并修正SQL语句或API参数 |
|
||||
| 0x80002611 | Password can not be empty | 密码为空 | 使用合法的密码 |
|
||||
| 0x80002611 | Password too short or empty | 密码为空或少于 8 个字符 | 使用合法的密码 |
|
||||
| 0x80002612 | Port should be an integer that is less than 65535 and greater than 0 | 端口号非法 | 检查并修正端口号 |
|
||||
| 0x80002613 | Endpoint should be in the format of 'fqdn:port' | 地址格式错误 | 检查并修正地址信息 |
|
||||
| 0x80002614 | This statement is no longer supported | 功能已经废弃 | 参考功能文档说明 |
|
||||
|
|
Before Width: | Height: | Size: 319 KiB After Width: | Height: | Size: 232 KiB |
Before Width: | Height: | Size: 476 KiB After Width: | Height: | Size: 330 KiB |
Before Width: | Height: | Size: 359 KiB After Width: | Height: | Size: 332 KiB |
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 250 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 75 KiB |
|
@ -28,8 +28,8 @@ extern "C" {
|
|||
#define ANAL_FORECAST_DEFAULT_ROWS 10
|
||||
#define ANAL_FORECAST_DEFAULT_CONF 95
|
||||
#define ANAL_FORECAST_DEFAULT_WNCHECK 1
|
||||
#define ANAL_FORECAST_MAX_ROWS 10000
|
||||
#define ANAL_ANOMALY_WINDOW_MAX_ROWS 10000
|
||||
#define ANAL_FORECAST_MAX_ROWS 40000
|
||||
#define ANAL_ANOMALY_WINDOW_MAX_ROWS 40000
|
||||
|
||||
typedef struct {
|
||||
EAnalAlgoType type;
|
||||
|
|
|
@ -378,7 +378,7 @@ typedef struct {
|
|||
TAOS_MULTI_BIND *bind;
|
||||
} SBindInfo;
|
||||
int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted, const STSchema *pTSchema,
|
||||
SArray *rowArray);
|
||||
SArray *rowArray, bool *pOrdered, bool *pDupTs);
|
||||
|
||||
// stmt2 binding
|
||||
int32_t tColDataAddValueByBind2(SColData *pColData, TAOS_STMT2_BIND *pBind, int32_t buffMaxLen, initGeosFn igeos,
|
||||
|
@ -392,7 +392,7 @@ typedef struct {
|
|||
} SBindInfo2;
|
||||
|
||||
int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorted, const STSchema *pTSchema,
|
||||
SArray *rowArray);
|
||||
SArray *rowArray, bool *pOrdered, bool *pDupTs);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ extern int32_t tsRetentionSpeedLimitMB;
|
|||
|
||||
extern const char *tsAlterCompactTaskKeywords;
|
||||
extern int32_t tsNumOfCompactThreads;
|
||||
extern int32_t tsNumOfRetentionThreads;
|
||||
|
||||
// sync raft
|
||||
extern int32_t tsElectInterval;
|
||||
|
@ -291,6 +292,7 @@ extern bool tsFilterScalarMode;
|
|||
extern int32_t tsMaxStreamBackendCache;
|
||||
extern int32_t tsPQSortMemThreshold;
|
||||
extern int32_t tsResolveFQDNRetryTime;
|
||||
extern bool tsStreamCoverage;
|
||||
|
||||
extern bool tsExperimental;
|
||||
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
||||
|
@ -323,6 +325,8 @@ void printConfigNotMatch(SArray *array);
|
|||
|
||||
int32_t compareSConfigItemArrays(SArray *mArray, const SArray *dArray, SArray *diffArray);
|
||||
bool isConifgItemLazyMode(SConfigItem *item);
|
||||
int32_t taosUpdateTfsItemDisable(SConfig *pCfg, const char *value, void *pTfs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -288,6 +288,7 @@ struct SScalarParam {
|
|||
bool colAlloced;
|
||||
SColumnInfoData *columnData;
|
||||
SHashObj *pHashFilter;
|
||||
SHashObj *pHashFilterOthers;
|
||||
int32_t hashValueType;
|
||||
void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value
|
||||
int32_t numOfRows;
|
||||
|
|
|
@ -109,8 +109,9 @@ int32_t doCallUdfAggProcess(UdfcFuncHandle handle, SSDataBlock *block, SUdfInter
|
|||
int32_t doCallUdfAggFinalize(UdfcFuncHandle handle, SUdfInterBuf *interBuf, SUdfInterBuf *resultData);
|
||||
// input: interbuf1, interbuf2
|
||||
// output: resultBuf
|
||||
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2,
|
||||
SUdfInterBuf *resultBuf);
|
||||
// udf todo: aggmerge
|
||||
// int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2,
|
||||
// SUdfInterBuf *resultBuf);
|
||||
// input: block
|
||||
// output: resultData
|
||||
int32_t doCallUdfScalarFunc(UdfcFuncHandle handle, SScalarParam *input, int32_t numOfCols, SScalarParam *output);
|
||||
|
|
|
@ -40,7 +40,7 @@ pDst need to freed in caller
|
|||
int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst);
|
||||
|
||||
int32_t scalarGetOperatorParamNum(EOperatorType type);
|
||||
int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type);
|
||||
int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type, int8_t processType);
|
||||
|
||||
int32_t vectorGetConvertType(int32_t type1, int32_t type2);
|
||||
int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, int32_t *overflow, int32_t startIndex, int32_t numOfRows);
|
||||
|
|
|
@ -207,7 +207,6 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
int32_t nodeId;
|
||||
SEpSet epset;
|
||||
} SDownstreamTaskEpset;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -319,6 +319,15 @@ bool tfsDiskSpaceAvailable(STfs *pTfs, int32_t level);
|
|||
*/
|
||||
bool tfsDiskSpaceSufficient(STfs *pTfs, int32_t level, int32_t disk);
|
||||
|
||||
/**
|
||||
* @brief Update disk size of tfs.
|
||||
*
|
||||
* @param pTfs The fs object.
|
||||
* @param dir The directory.
|
||||
* @param disable The disable flag.
|
||||
*/
|
||||
int32_t tfsUpdateDiskDisable(STfs *pTfs, const char *dir, int8_t disable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -801,7 +801,7 @@ int32_t taosGetErrSize();
|
|||
#define TSDB_CODE_PAR_TAGS_NOT_MATCHED TAOS_DEF_ERROR_CODE(0, 0x260D)
|
||||
#define TSDB_CODE_PAR_INVALID_TAG_NAME TAOS_DEF_ERROR_CODE(0, 0x260E)
|
||||
#define TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2610)
|
||||
#define TSDB_CODE_PAR_PASSWD_EMPTY TAOS_DEF_ERROR_CODE(0, 0x2611)
|
||||
#define TSDB_CODE_PAR_PASSWD_TOO_SHORT_OR_EMPTY TAOS_DEF_ERROR_CODE(0, 0x2611)
|
||||
#define TSDB_CODE_PAR_INVALID_PORT TAOS_DEF_ERROR_CODE(0, 0x2612)
|
||||
#define TSDB_CODE_PAR_INVALID_ENDPOINT TAOS_DEF_ERROR_CODE(0, 0x2613)
|
||||
#define TSDB_CODE_PAR_EXPRIE_STATEMENT TAOS_DEF_ERROR_CODE(0, 0x2614)
|
||||
|
|
|
@ -44,27 +44,27 @@ mkdir -p ${pkg_dir}${install_home_path}/include
|
|||
#mkdir -p ${pkg_dir}${install_home_path}/init.d
|
||||
mkdir -p ${pkg_dir}${install_home_path}/script
|
||||
|
||||
# download taoskeeper and build
|
||||
if [ "$cpuType" = "x64" ] || [ "$cpuType" = "x86_64" ] || [ "$cpuType" = "amd64" ]; then
|
||||
arch=amd64
|
||||
elif [ "$cpuType" = "x32" ] || [ "$cpuType" = "i386" ] || [ "$cpuType" = "i686" ]; then
|
||||
arch=386
|
||||
elif [ "$cpuType" = "arm" ] || [ "$cpuType" = "aarch32" ]; then
|
||||
arch=arm
|
||||
elif [ "$cpuType" = "arm64" ] || [ "$cpuType" = "aarch64" ]; then
|
||||
arch=arm64
|
||||
else
|
||||
arch=$cpuType
|
||||
fi
|
||||
# # download taoskeeper and build
|
||||
# if [ "$cpuType" = "x64" ] || [ "$cpuType" = "x86_64" ] || [ "$cpuType" = "amd64" ]; then
|
||||
# arch=amd64
|
||||
# elif [ "$cpuType" = "x32" ] || [ "$cpuType" = "i386" ] || [ "$cpuType" = "i686" ]; then
|
||||
# arch=386
|
||||
# elif [ "$cpuType" = "arm" ] || [ "$cpuType" = "aarch32" ]; then
|
||||
# arch=arm
|
||||
# elif [ "$cpuType" = "arm64" ] || [ "$cpuType" = "aarch64" ]; then
|
||||
# arch=arm64
|
||||
# else
|
||||
# arch=$cpuType
|
||||
# fi
|
||||
|
||||
echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}"
|
||||
echo "$top_dir=${top_dir}"
|
||||
taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}`
|
||||
echo "taoskeeper_binary: ${taoskeeper_binary}"
|
||||
# echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}"
|
||||
# echo "$top_dir=${top_dir}"
|
||||
# taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}`
|
||||
# echo "taoskeeper_binary: ${taoskeeper_binary}"
|
||||
|
||||
# copy config files
|
||||
cp $(dirname ${taoskeeper_binary})/config/taoskeeper.toml ${pkg_dir}${install_home_path}/cfg
|
||||
cp $(dirname ${taoskeeper_binary})/taoskeeper.service ${pkg_dir}${install_home_path}/cfg
|
||||
# cp $(dirname ${taoskeeper_binary})/config/taoskeeper.toml ${pkg_dir}${install_home_path}/cfg
|
||||
# cp $(dirname ${taoskeeper_binary})/taoskeeper.service ${pkg_dir}${install_home_path}/cfg
|
||||
|
||||
cp ${compile_dir}/../packaging/cfg/taos.cfg ${pkg_dir}${install_home_path}/cfg
|
||||
cp ${compile_dir}/../packaging/cfg/taosd.service ${pkg_dir}${install_home_path}/cfg
|
||||
|
@ -75,7 +75,12 @@ fi
|
|||
if [ -f "${compile_dir}/test/cfg/taosadapter.service" ]; then
|
||||
cp ${compile_dir}/test/cfg/taosadapter.service ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
|
||||
if [ -f "${compile_dir}/test/cfg/taoskeeper.toml" ]; then
|
||||
cp ${compile_dir}/test/cfg/taoskeeper.toml ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
if [ -f "${compile_dir}/test/cfg/taoskeeper.service" ]; then
|
||||
cp ${compile_dir}/test/cfg/taoskeeper.service ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
if [ -f "${compile_dir}/../../../explorer/target/taos-explorer.service" ]; then
|
||||
cp ${compile_dir}/../../../explorer/target/taos-explorer.service ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
|
@ -83,7 +88,7 @@ if [ -f "${compile_dir}/../../../explorer/server/example/explorer.toml" ]; then
|
|||
cp ${compile_dir}/../../../explorer/server/example/explorer.toml ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
|
||||
cp ${taoskeeper_binary} ${pkg_dir}${install_home_path}/bin
|
||||
# cp ${taoskeeper_binary} ${pkg_dir}${install_home_path}/bin
|
||||
#cp ${compile_dir}/../packaging/deb/taosd ${pkg_dir}${install_home_path}/init.d
|
||||
cp ${compile_dir}/../packaging/tools/post.sh ${pkg_dir}${install_home_path}/script
|
||||
cp ${compile_dir}/../packaging/tools/preun.sh ${pkg_dir}${install_home_path}/script
|
||||
|
@ -104,6 +109,9 @@ cp ${compile_dir}/build/bin/taosdump ${pkg_dir}${install_home_path
|
|||
if [ -f "${compile_dir}/build/bin/taosadapter" ]; then
|
||||
cp ${compile_dir}/build/bin/taosadapter ${pkg_dir}${install_home_path}/bin ||:
|
||||
fi
|
||||
if [ -f "${compile_dir}/build/bin/taoskeeper" ]; then
|
||||
cp ${compile_dir}/build/bin/taoskeeper ${pkg_dir}${install_home_path}/bin ||:
|
||||
fi
|
||||
|
||||
if [ -f "${compile_dir}/../../../explorer/target/release/taos-explorer" ]; then
|
||||
cp ${compile_dir}/../../../explorer/target/release/taos-explorer ${pkg_dir}${install_home_path}/bin ||:
|
||||
|
@ -185,7 +193,7 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf ${pkg_dir}/build-taoskeeper
|
||||
# rm -rf ${pkg_dir}/build-taoskeeper
|
||||
# make deb package
|
||||
dpkg -b ${pkg_dir} $debname
|
||||
echo "make deb package success!"
|
||||
|
|
|
@ -56,24 +56,23 @@ fi
|
|||
${csudo}mkdir -p ${pkg_dir}
|
||||
cd ${pkg_dir}
|
||||
|
||||
# download taoskeeper and build
|
||||
if [ "$cpuType" = "x64" ] || [ "$cpuType" = "x86_64" ] || [ "$cpuType" = "amd64" ]; then
|
||||
arch=amd64
|
||||
elif [ "$cpuType" = "x32" ] || [ "$cpuType" = "i386" ] || [ "$cpuType" = "i686" ]; then
|
||||
arch=386
|
||||
elif [ "$cpuType" = "arm" ] || [ "$cpuType" = "aarch32" ]; then
|
||||
arch=arm
|
||||
elif [ "$cpuType" = "arm64" ] || [ "$cpuType" = "aarch64" ]; then
|
||||
arch=arm64
|
||||
else
|
||||
arch=$cpuType
|
||||
fi
|
||||
# # download taoskeeper and build
|
||||
# if [ "$cpuType" = "x64" ] || [ "$cpuType" = "x86_64" ] || [ "$cpuType" = "amd64" ]; then
|
||||
# arch=amd64
|
||||
# elif [ "$cpuType" = "x32" ] || [ "$cpuType" = "i386" ] || [ "$cpuType" = "i686" ]; then
|
||||
# arch=386
|
||||
# elif [ "$cpuType" = "arm" ] || [ "$cpuType" = "aarch32" ]; then
|
||||
# arch=arm
|
||||
# elif [ "$cpuType" = "arm64" ] || [ "$cpuType" = "aarch64" ]; then
|
||||
# arch=arm64
|
||||
# else
|
||||
# arch=$cpuType
|
||||
# fi
|
||||
|
||||
cd ${top_dir}
|
||||
echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}"
|
||||
taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}`
|
||||
echo "taoskeeper_binary: ${taoskeeper_binary}"
|
||||
cd ${package_dir}
|
||||
# cd ${top_dir}
|
||||
# echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}"
|
||||
# taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}`
|
||||
# echo "taoskeeper_binary: ${taoskeeper_binary}"
|
||||
|
||||
${csudo}mkdir -p BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
|
||||
|
||||
|
@ -106,4 +105,4 @@ mv ${output_dir}/TDengine-${tdengine_ver}.rpm ${output_dir}/${rpmname}
|
|||
|
||||
cd ..
|
||||
${csudo}rm -rf ${pkg_dir}
|
||||
rm -rf ${top_dir}/build-taoskeeper
|
||||
# rm -rf ${top_dir}/build-taoskeeper
|
|
@ -68,12 +68,12 @@ if [ -f %{_compiledir}/test/cfg/taosadapter.service ]; then
|
|||
cp %{_compiledir}/test/cfg/taosadapter.service %{buildroot}%{homepath}/cfg
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/../build-taoskeeper/config/taoskeeper.toml ]; then
|
||||
cp %{_compiledir}/../build-taoskeeper/config/taoskeeper.toml %{buildroot}%{homepath}/cfg ||:
|
||||
if [ -f %{_compiledir}/test/cfg/taoskeeper.toml ]; then
|
||||
cp %{_compiledir}/test/cfg/taoskeeper.toml %{buildroot}%{homepath}/cfg ||:
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/../build-taoskeeper/taoskeeper.service ]; then
|
||||
cp %{_compiledir}/../build-taoskeeper/taoskeeper.service %{buildroot}%{homepath}/cfg ||:
|
||||
if [ -f %{_compiledir}/test/cfg/taoskeeper.service ]; then
|
||||
cp %{_compiledir}/test/cfg/taoskeeper.service %{buildroot}%{homepath}/cfg ||:
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/../../../explorer/target/taos-explorer.service ]; then
|
||||
|
@ -104,8 +104,8 @@ if [ -f %{_compiledir}/../../../explorer/target/release/taos-explorer ]; then
|
|||
cp %{_compiledir}/../../../explorer/target/release/taos-explorer %{buildroot}%{homepath}/bin
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/../build-taoskeeper/taoskeeper ]; then
|
||||
cp %{_compiledir}/../build-taoskeeper/taoskeeper %{buildroot}%{homepath}/bin
|
||||
if [ -f %{_compiledir}/build/bin//taoskeeper ]; then
|
||||
cp %{_compiledir}/build/bin//taoskeeper %{buildroot}%{homepath}/bin
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/build/bin/taosadapter ]; then
|
||||
|
|
|
@ -282,5 +282,3 @@ else
|
|||
rm -rf ${install_dir} ||:
|
||||
# mv ../"$(basename ${pkg_name}).tar.gz" .
|
||||
fi
|
||||
|
||||
cd ${curr_dir}
|
||||
|
|
|
@ -2168,17 +2168,41 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col
|
|||
pStmt->semWaited = true;
|
||||
}
|
||||
|
||||
int32_t code = 0;
|
||||
SSHashObj *hashTbnames = tSimpleHashInit(100, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR));
|
||||
if (NULL == hashTbnames) {
|
||||
tscError("stmt2 bind failed: %s", tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
for (int i = 0; i < bindv->count; ++i) {
|
||||
if (bindv->tbnames && bindv->tbnames[i]) {
|
||||
if (pStmt->sql.stbInterlaceMode) {
|
||||
if (tSimpleHashGet(hashTbnames, bindv->tbnames[i], strlen(bindv->tbnames[i])) != NULL) {
|
||||
code = terrno = TSDB_CODE_PAR_TBNAME_DUPLICATED;
|
||||
tscError("stmt2 bind failed: %s %s", tstrerror(terrno), bindv->tbnames[i]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
code = tSimpleHashPut(hashTbnames, bindv->tbnames[i], strlen(bindv->tbnames[i]), NULL, 0);
|
||||
if (code) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
code = stmtSetTbName2(stmt, bindv->tbnames[i]);
|
||||
if (code) {
|
||||
return code;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (bindv->tags && bindv->tags[i]) {
|
||||
code = stmtSetTbTags2(stmt, bindv->tags[i]);
|
||||
if (code) {
|
||||
goto out;
|
||||
}
|
||||
} else if (pStmt->bInfo.tbType == TSDB_CHILD_TABLE && pStmt->sql.autoCreateTbl) {
|
||||
code = stmtSetTbTags2(stmt, NULL);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
|
@ -2189,26 +2213,29 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col
|
|||
|
||||
if (bind->num <= 0 || bind->num > INT16_MAX) {
|
||||
tscError("invalid bind num %d", bind->num);
|
||||
terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
|
||||
return terrno;
|
||||
code = terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
int32_t insert = 0;
|
||||
(void)stmtIsInsert2(stmt, &insert);
|
||||
if (0 == insert && bind->num > 1) {
|
||||
tscError("only one row data allowed for query");
|
||||
terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
|
||||
return terrno;
|
||||
code = terrno = TSDB_CODE_TSC_STMT_BIND_NUMBER_ERROR;
|
||||
goto out;
|
||||
}
|
||||
|
||||
code = stmtBindBatch2(stmt, bind, col_idx);
|
||||
if (TSDB_CODE_SUCCESS != code) {
|
||||
return code;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
out:
|
||||
tSimpleHashCleanup(hashTbnames);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
int taos_stmt2_exec(TAOS_STMT2 *stmt, int *affected_rows) {
|
||||
|
|
|
@ -68,10 +68,19 @@ static bool tmqAddJsonArrayItem(cJSON *array, cJSON *item){
|
|||
}
|
||||
|
||||
|
||||
static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen);
|
||||
static tb_uid_t processSuid(tb_uid_t suid, char* db) { return suid + MurmurHash3_32(db, strlen(db)); }
|
||||
static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, uint32_t metaLen);
|
||||
static tb_uid_t processSuid(tb_uid_t suid, char* db) {
|
||||
if (db == NULL) {
|
||||
return suid;
|
||||
}
|
||||
return suid + MurmurHash3_32(db, strlen(db));
|
||||
}
|
||||
static void buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, int8_t t,
|
||||
SColCmprWrapper* pColCmprRow, cJSON** pJson) {
|
||||
if (schemaRow == NULL || name == NULL || pColCmprRow == NULL || pJson == NULL) {
|
||||
uError("invalid parameter, schemaRow:%p, name:%p, pColCmprRow:%p, pJson:%p", schemaRow, name, pColCmprRow, pJson);
|
||||
return;
|
||||
}
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
int8_t buildDefaultCompress = 0;
|
||||
if (pColCmprRow->nCols <= 0) {
|
||||
|
@ -186,6 +195,9 @@ end:
|
|||
}
|
||||
|
||||
static int32_t setCompressOption(cJSON* json, uint32_t para) {
|
||||
if (json == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
uint8_t encode = COMPRESS_L1_TYPE_U32(para);
|
||||
int32_t code = 0;
|
||||
if (encode != 0) {
|
||||
|
@ -219,6 +231,10 @@ end:
|
|||
return code;
|
||||
}
|
||||
static void buildAlterSTableJson(void* alterData, int32_t alterDataLen, cJSON** pJson) {
|
||||
if (alterData == NULL || pJson == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SMAlterStbReq req = {0};
|
||||
cJSON* json = NULL;
|
||||
char* string = NULL;
|
||||
|
@ -362,6 +378,10 @@ end:
|
|||
}
|
||||
|
||||
static void processCreateStb(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
||||
if (metaRsp == NULL || pJson == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SVCreateStbReq req = {0};
|
||||
SDecoder coder;
|
||||
|
||||
|
@ -382,6 +402,10 @@ end:
|
|||
}
|
||||
|
||||
static void processAlterStb(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
||||
if (metaRsp == NULL || pJson == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SVCreateStbReq req = {0};
|
||||
SDecoder coder = {0};
|
||||
uDebug("alter stable data:%p", metaRsp);
|
||||
|
@ -402,6 +426,10 @@ end:
|
|||
}
|
||||
|
||||
static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) {
|
||||
if (json == NULL || pCreateReq == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
STag* pTag = (STag*)pCreateReq->ctb.pTag;
|
||||
char* sname = pCreateReq->ctb.stbName;
|
||||
char* name = pCreateReq->name;
|
||||
|
@ -502,6 +530,10 @@ end:
|
|||
}
|
||||
|
||||
static void buildCreateCTableJson(SVCreateTbReq* pCreateReq, int32_t nReqs, cJSON** pJson) {
|
||||
if (pJson == NULL || pCreateReq == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
int32_t code = 0;
|
||||
char* string = NULL;
|
||||
cJSON* json = cJSON_CreateObject();
|
||||
|
@ -531,6 +563,10 @@ end:
|
|||
}
|
||||
|
||||
static void processCreateTable(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
||||
if (pJson == NULL || metaRsp == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SDecoder decoder = {0};
|
||||
SVCreateTbBatchReq req = {0};
|
||||
SVCreateTbReq* pCreateReq;
|
||||
|
@ -561,6 +597,10 @@ end:
|
|||
}
|
||||
|
||||
static void processAutoCreateTable(SMqDataRsp* rsp, char** string) {
|
||||
if (rsp == NULL || string == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SDecoder* decoder = NULL;
|
||||
SVCreateTbReq* pCreateReq = NULL;
|
||||
int32_t code = 0;
|
||||
|
@ -611,6 +651,10 @@ end:
|
|||
}
|
||||
|
||||
static void processAlterTable(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
||||
if (pJson == NULL || metaRsp == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SDecoder decoder = {0};
|
||||
SVAlterTbReq vAlterTbReq = {0};
|
||||
char* string = NULL;
|
||||
|
@ -850,6 +894,10 @@ end:
|
|||
}
|
||||
|
||||
static void processDropSTable(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
||||
if (pJson == NULL || metaRsp == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SDecoder decoder = {0};
|
||||
SVDropStbReq req = {0};
|
||||
cJSON* json = NULL;
|
||||
|
@ -884,6 +932,10 @@ end:
|
|||
*pJson = json;
|
||||
}
|
||||
static void processDeleteTable(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
||||
if (pJson == NULL || metaRsp == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SDeleteRes req = {0};
|
||||
SDecoder coder = {0};
|
||||
cJSON* json = NULL;
|
||||
|
@ -921,6 +973,10 @@ end:
|
|||
}
|
||||
|
||||
static void processDropTable(SMqMetaRsp* metaRsp, cJSON** pJson) {
|
||||
if (pJson == NULL || metaRsp == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SDecoder decoder = {0};
|
||||
SVDropTbBatchReq req = {0};
|
||||
cJSON* json = NULL;
|
||||
|
@ -958,7 +1014,11 @@ end:
|
|||
*pJson = json;
|
||||
}
|
||||
|
||||
static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
|
||||
static int32_t taosCreateStb(TAOS* taos, void* meta, uint32_t metaLen) {
|
||||
if (taos == NULL || meta == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SVCreateStbReq req = {0};
|
||||
SDecoder coder;
|
||||
SMCreateStbReq pReq = {0};
|
||||
|
@ -973,8 +1033,8 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
goto end;
|
||||
}
|
||||
// decode and process req
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
int32_t len = metaLen - sizeof(SMsgHead);
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
uint32_t len = metaLen - sizeof(SMsgHead);
|
||||
tDecoderInit(&coder, data, len);
|
||||
if (tDecodeSVCreateStbReq(&coder, &req) < 0) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
|
@ -1068,7 +1128,11 @@ end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
|
||||
static int32_t taosDropStb(TAOS* taos, void* meta, uint32_t metaLen) {
|
||||
if (taos == NULL || meta == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SVDropStbReq req = {0};
|
||||
SDecoder coder = {0};
|
||||
SMDropStbReq pReq = {0};
|
||||
|
@ -1083,8 +1147,8 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
goto end;
|
||||
}
|
||||
// decode and process req
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
int32_t len = metaLen - sizeof(SMsgHead);
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
uint32_t len = metaLen - sizeof(SMsgHead);
|
||||
tDecoderInit(&coder, data, len);
|
||||
if (tDecodeSVDropStbReq(&coder, &req) < 0) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
|
@ -1173,11 +1237,19 @@ typedef struct SVgroupCreateTableBatch {
|
|||
} SVgroupCreateTableBatch;
|
||||
|
||||
static void destroyCreateTbReqBatch(void* data) {
|
||||
if (data == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SVgroupCreateTableBatch* pTbBatch = (SVgroupCreateTableBatch*)data;
|
||||
taosArrayDestroy(pTbBatch->req.pArray);
|
||||
}
|
||||
|
||||
static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
|
||||
static int32_t taosCreateTable(TAOS* taos, void* meta, uint32_t metaLen) {
|
||||
if (taos == NULL || meta == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SVCreateTbBatchReq req = {0};
|
||||
SDecoder coder = {0};
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -1195,8 +1267,8 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
goto end;
|
||||
}
|
||||
// decode and process req
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
int32_t len = metaLen - sizeof(SMsgHead);
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
uint32_t len = metaLen - sizeof(SMsgHead);
|
||||
tDecoderInit(&coder, data, len);
|
||||
if (tDecodeSVCreateTbBatchReq(&coder, &req) < 0) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
|
@ -1359,11 +1431,19 @@ typedef struct SVgroupDropTableBatch {
|
|||
} SVgroupDropTableBatch;
|
||||
|
||||
static void destroyDropTbReqBatch(void* data) {
|
||||
if (data == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SVgroupDropTableBatch* pTbBatch = (SVgroupDropTableBatch*)data;
|
||||
taosArrayDestroy(pTbBatch->req.pArray);
|
||||
}
|
||||
|
||||
static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
|
||||
static int32_t taosDropTable(TAOS* taos, void* meta, uint32_t metaLen) {
|
||||
if (taos == NULL || meta == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SVDropTbBatchReq req = {0};
|
||||
SDecoder coder = {0};
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -1380,8 +1460,8 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
goto end;
|
||||
}
|
||||
// decode and process req
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
int32_t len = metaLen - sizeof(SMsgHead);
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
uint32_t len = metaLen - sizeof(SMsgHead);
|
||||
tDecoderInit(&coder, data, len);
|
||||
if (tDecodeSVDropTbBatchReq(&coder, &req) < 0) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
|
@ -1475,7 +1555,11 @@ end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) {
|
||||
static int32_t taosDeleteData(TAOS* taos, void* meta, uint32_t metaLen) {
|
||||
if (taos == NULL || meta == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SDeleteRes req = {0};
|
||||
SDecoder coder = {0};
|
||||
char sql[256] = {0};
|
||||
|
@ -1484,8 +1568,8 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
uDebug("connId:0x%" PRIx64 " delete data, meta:%p, len:%d", *(int64_t*)taos, meta, metaLen);
|
||||
|
||||
// decode and process req
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
int32_t len = metaLen - sizeof(SMsgHead);
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
uint32_t len = metaLen - sizeof(SMsgHead);
|
||||
tDecoderInit(&coder, data, len);
|
||||
if (tDecodeDeleteRes(&coder, &req) < 0) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
|
@ -1510,7 +1594,11 @@ end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
|
||||
static int32_t taosAlterTable(TAOS* taos, void* meta, uint32_t metaLen) {
|
||||
if (taos == NULL || meta == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SVAlterTbReq req = {0};
|
||||
SDecoder dcoder = {0};
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -1527,8 +1615,8 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) {
|
|||
goto end;
|
||||
}
|
||||
// decode and process req
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
int32_t len = metaLen - sizeof(SMsgHead);
|
||||
void* data = POINTER_SHIFT(meta, sizeof(SMsgHead));
|
||||
uint32_t len = metaLen - sizeof(SMsgHead);
|
||||
tDecoderInit(&dcoder, data, len);
|
||||
if (tDecodeSVAlterTbReq(&dcoder, &req) < 0) {
|
||||
code = TSDB_CODE_INVALID_PARA;
|
||||
|
@ -1632,7 +1720,8 @@ int taos_write_raw_block_with_fields(TAOS* taos, int rows, char* pData, const ch
|
|||
|
||||
int taos_write_raw_block_with_fields_with_reqid(TAOS* taos, int rows, char* pData, const char* tbname,
|
||||
TAOS_FIELD* fields, int numFields, int64_t reqid) {
|
||||
if (!taos || !pData || !tbname) {
|
||||
if (taos == NULL || pData == NULL || tbname == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -1693,7 +1782,7 @@ int taos_write_raw_block(TAOS* taos, int rows, char* pData, const char* tbname)
|
|||
}
|
||||
|
||||
int taos_write_raw_block_with_reqid(TAOS* taos, int rows, char* pData, const char* tbname, int64_t reqid) {
|
||||
if (!taos || !pData || !tbname) {
|
||||
if (taos == NULL || pData == NULL || tbname == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -1749,6 +1838,10 @@ end:
|
|||
}
|
||||
|
||||
static void* getRawDataFromRes(void* pRetrieve) {
|
||||
if (pRetrieve == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return NULL;
|
||||
}
|
||||
void* rawData = NULL;
|
||||
// deal with compatibility
|
||||
if (*(int64_t*)pRetrieve == 0) {
|
||||
|
@ -1760,6 +1853,10 @@ static void* getRawDataFromRes(void* pRetrieve) {
|
|||
}
|
||||
|
||||
static int32_t buildCreateTbMap(SMqDataRsp* rsp, SHashObj* pHashObj) {
|
||||
if (rsp == NULL || pHashObj == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
// find schema data info
|
||||
int32_t code = 0;
|
||||
SVCreateTbReq pCreateReq = {0};
|
||||
|
@ -1819,11 +1916,19 @@ typedef struct {
|
|||
} tbInfo;
|
||||
|
||||
static void tmqFreeMeta(void* data) {
|
||||
if (data == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
STableMeta* pTableMeta = *(STableMeta**)data;
|
||||
taosMemoryFree(pTableMeta);
|
||||
}
|
||||
|
||||
static void freeRawCache(void* data) {
|
||||
if (data == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
rawCacheInfo* pRawCache = (rawCacheInfo*)data;
|
||||
taosHashCleanup(pRawCache->pMetaHash);
|
||||
taosHashCleanup(pRawCache->pNameHash);
|
||||
|
@ -1842,6 +1947,10 @@ static int32_t initRawCacheHash() {
|
|||
}
|
||||
|
||||
static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrapper* pSW) {
|
||||
if (rawData == NULL || pTableMeta == NULL || pSW == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return false;
|
||||
}
|
||||
char* p = (char*)rawData;
|
||||
// | version | total length | total rows | blankFill | total columns | flag seg| block group id | column schema | each
|
||||
// column length |
|
||||
|
@ -1877,6 +1986,10 @@ static bool needRefreshMeta(void* rawData, STableMeta* pTableMeta, SSchemaWrappe
|
|||
}
|
||||
|
||||
static int32_t getRawCache(SHashObj** pVgHash, SHashObj** pNameHash, SHashObj** pMetaHash, void* key) {
|
||||
if (pVgHash == NULL || pNameHash == NULL || pMetaHash == NULL || key == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = 0;
|
||||
void* cacheInfo = taosHashGet(writeRawCache, &key, POINTER_BYTES);
|
||||
if (cacheInfo == NULL) {
|
||||
|
@ -1905,6 +2018,10 @@ end:
|
|||
}
|
||||
|
||||
static int32_t buildRawRequest(TAOS* taos, SRequestObj** pRequest, SCatalog** pCatalog, SRequestConnInfo* conn) {
|
||||
if (taos == NULL || pRequest == NULL || pCatalog == NULL || conn == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = 0;
|
||||
RAW_RETURN_CHECK(buildRequest(*(int64_t*)taos, "", 0, NULL, false, pRequest, 0));
|
||||
(*pRequest)->syncQuery = true;
|
||||
|
@ -1924,26 +2041,38 @@ end:
|
|||
}
|
||||
|
||||
typedef int32_t _raw_decode_func_(SDecoder* pDecoder, SMqDataRsp* pRsp);
|
||||
static int32_t decodeRawData(SDecoder* decoder, void* data, int32_t dataLen, _raw_decode_func_ func,
|
||||
static int32_t decodeRawData(SDecoder* decoder, void* data, uint32_t dataLen, _raw_decode_func_ func,
|
||||
SMqRspObj* rspObj) {
|
||||
int8_t dataVersion = *(int8_t*)data;
|
||||
if (dataVersion >= MQ_DATA_RSP_VERSION) {
|
||||
data = POINTER_SHIFT(data, sizeof(int8_t) + sizeof(int32_t));
|
||||
dataLen -= sizeof(int8_t) + sizeof(int32_t);
|
||||
if (decoder == NULL || data == NULL || func == NULL || rspObj == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int8_t dataVersion = *(int8_t*)data;
|
||||
if (dataVersion >= MQ_DATA_RSP_VERSION) {
|
||||
data = POINTER_SHIFT(data, sizeof(int8_t) + sizeof(int32_t));
|
||||
if (dataLen < sizeof(int8_t) + sizeof(int32_t)) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
dataLen -= sizeof(int8_t) + sizeof(int32_t);
|
||||
}
|
||||
|
||||
rspObj->resIter = -1;
|
||||
tDecoderInit(decoder, data, dataLen);
|
||||
int32_t code = func(decoder, &rspObj->dataRsp);
|
||||
if (code != 0) {
|
||||
SET_ERROR_MSG("decode mq taosx data rsp failed");
|
||||
rspObj->resIter = -1;
|
||||
tDecoderInit(decoder, data, dataLen);
|
||||
int32_t code = func(decoder, &rspObj->dataRsp);
|
||||
if (code != 0) {
|
||||
SET_ERROR_MSG("decode mq taosx data rsp failed");
|
||||
}
|
||||
return code;
|
||||
return code;
|
||||
}
|
||||
|
||||
static int32_t processCacheMeta(SHashObj* pVgHash, SHashObj* pNameHash, SHashObj* pMetaHash,
|
||||
SVCreateTbReq* pCreateReqDst, SCatalog* pCatalog, SRequestConnInfo* conn, SName* pName,
|
||||
STableMeta** pMeta, SSchemaWrapper* pSW, void* rawData, int32_t retry) {
|
||||
if (pVgHash == NULL || pNameHash == NULL || pMetaHash == NULL || pCatalog == NULL || conn == NULL || pName == NULL ||
|
||||
pMeta == NULL || pSW == NULL || rawData == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = 0;
|
||||
STableMeta* pTableMeta = NULL;
|
||||
tbInfo* tmpInfo = (tbInfo*)taosHashGet(pNameHash, pName->tname, strlen(pName->tname));
|
||||
|
@ -2000,7 +2129,11 @@ end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
|
||||
static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, uint32_t dataLen) {
|
||||
if (taos == NULL || data == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SQuery* pQuery = NULL;
|
||||
SMqRspObj rspObj = {0};
|
||||
|
@ -2073,7 +2206,11 @@ end:
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen) {
|
||||
static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, uint32_t dataLen) {
|
||||
if (taos == NULL || data == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SQuery* pQuery = NULL;
|
||||
SMqRspObj rspObj = {0};
|
||||
|
@ -2162,6 +2299,10 @@ end:
|
|||
}
|
||||
|
||||
static void processSimpleMeta(SMqMetaRsp* pMetaRsp, cJSON** meta) {
|
||||
if (pMetaRsp == NULL || meta == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
if (pMetaRsp->resMsgType == TDMT_VND_CREATE_STB) {
|
||||
processCreateStb(pMetaRsp, meta);
|
||||
} else if (pMetaRsp->resMsgType == TDMT_VND_ALTER_STB) {
|
||||
|
@ -2182,6 +2323,10 @@ static void processSimpleMeta(SMqMetaRsp* pMetaRsp, cJSON** meta) {
|
|||
}
|
||||
|
||||
static void processBatchMetaToJson(SMqBatchMetaRsp* pMsgRsp, char** string) {
|
||||
if (pMsgRsp == NULL || string == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return;
|
||||
}
|
||||
SDecoder coder;
|
||||
SMqBatchMetaRsp rsp = {0};
|
||||
int32_t code = 0;
|
||||
|
@ -2228,7 +2373,10 @@ end:
|
|||
}
|
||||
|
||||
char* tmq_get_json_meta(TAOS_RES* res) {
|
||||
if (res == NULL) return NULL;
|
||||
if (res == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return NULL;
|
||||
}
|
||||
uDebug("tmq_get_json_meta res:%p", res);
|
||||
if (!TD_RES_TMQ_META(res) && !TD_RES_TMQ_METADATA(res) && !TD_RES_TMQ_BATCH_META(res)) {
|
||||
return NULL;
|
||||
|
@ -2256,6 +2404,10 @@ char* tmq_get_json_meta(TAOS_RES* res) {
|
|||
void tmq_free_json_meta(char* jsonMeta) { taosMemoryFreeClear(jsonMeta); }
|
||||
|
||||
static int32_t getOffSetLen(const SMqDataRsp* pRsp) {
|
||||
if (pRsp == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SEncoder coder = {0};
|
||||
tEncoderInit(&coder, NULL, 0);
|
||||
if (tEncodeSTqOffsetVal(&coder, &pRsp->reqOffset) < 0) return -1;
|
||||
|
@ -2267,44 +2419,48 @@ static int32_t getOffSetLen(const SMqDataRsp* pRsp) {
|
|||
|
||||
typedef int32_t __encode_func__(SEncoder* pEncoder, const SMqDataRsp* pRsp);
|
||||
static int32_t encodeMqDataRsp(__encode_func__* encodeFunc, SMqDataRsp* rspObj, tmq_raw_data* raw) {
|
||||
int32_t len = 0;
|
||||
int32_t code = 0;
|
||||
SEncoder encoder = {0};
|
||||
void* buf = NULL;
|
||||
tEncodeSize(encodeFunc, rspObj, len, code);
|
||||
if (code < 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
if (raw == NULL || encodeFunc == NULL || rspObj == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
len += sizeof(int8_t) + sizeof(int32_t);
|
||||
buf = taosMemoryCalloc(1, len);
|
||||
if (buf == NULL) {
|
||||
code = terrno;
|
||||
goto FAILED;
|
||||
uint32_t len = 0;
|
||||
int32_t code = 0;
|
||||
SEncoder encoder = {0};
|
||||
void* buf = NULL;
|
||||
tEncodeSize(encodeFunc, rspObj, len, code);
|
||||
if (code < 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
}
|
||||
tEncoderInit(&encoder, buf, len);
|
||||
if (tEncodeI8(&encoder, MQ_DATA_RSP_VERSION) < 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
len += sizeof(int8_t) + sizeof(int32_t);
|
||||
buf = taosMemoryCalloc(1, len);
|
||||
if (buf == NULL) {
|
||||
code = terrno;
|
||||
goto FAILED;
|
||||
}
|
||||
int32_t offsetLen = getOffSetLen(rspObj);
|
||||
if (offsetLen <= 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
tEncoderInit(&encoder, buf, len);
|
||||
if (tEncodeI8(&encoder, MQ_DATA_RSP_VERSION) < 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
}
|
||||
if (tEncodeI32(&encoder, offsetLen) < 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
int32_t offsetLen = getOffSetLen(rspObj);
|
||||
if (offsetLen <= 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
}
|
||||
if (encodeFunc(&encoder, rspObj) < 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
if (tEncodeI32(&encoder, offsetLen) < 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
}
|
||||
tEncoderClear(&encoder);
|
||||
if (encodeFunc(&encoder, rspObj) < 0) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto FAILED;
|
||||
}
|
||||
tEncoderClear(&encoder);
|
||||
|
||||
raw->raw = buf;
|
||||
raw->raw_len = len;
|
||||
return code;
|
||||
raw->raw = buf;
|
||||
raw->raw_len = len;
|
||||
return code;
|
||||
FAILED:
|
||||
tEncoderClear(&encoder);
|
||||
taosMemoryFree(buf);
|
||||
|
@ -2312,13 +2468,14 @@ FAILED:
|
|||
}
|
||||
|
||||
int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data* raw) {
|
||||
if (!raw || !res) {
|
||||
if (raw == NULL || res == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SMqRspObj* rspObj = ((SMqRspObj*)res);
|
||||
if (TD_RES_TMQ_META(res)) {
|
||||
raw->raw = rspObj->metaRsp.metaRsp;
|
||||
raw->raw_len = rspObj->metaRsp.metaRspLen;
|
||||
raw->raw_len = rspObj->metaRsp.metaRspLen >= 0 ? rspObj->metaRsp.metaRspLen : 0;
|
||||
raw->raw_type = rspObj->metaRsp.resMsgType;
|
||||
uDebug("tmq get raw type meta:%p", raw);
|
||||
} else if (TD_RES_TMQ(res)) {
|
||||
|
@ -2378,6 +2535,10 @@ static int32_t writeRawInit() {
|
|||
}
|
||||
|
||||
static int32_t writeRawImpl(TAOS* taos, void* buf, uint32_t len, uint16_t type) {
|
||||
if (taos == NULL || buf == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
if (writeRawInit() != 0) {
|
||||
return TSDB_CODE_INTERNAL_ERROR;
|
||||
}
|
||||
|
@ -2415,8 +2576,9 @@ int32_t tmq_write_raw(TAOS* taos, tmq_raw_data raw) {
|
|||
return writeRawImpl(taos, raw.raw, raw.raw_len, raw.raw_type);
|
||||
}
|
||||
|
||||
static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, int32_t metaLen) {
|
||||
static int32_t tmqWriteBatchMetaDataImpl(TAOS* taos, void* meta, uint32_t metaLen) {
|
||||
if (taos == NULL || meta == NULL) {
|
||||
uError("invalid parameter in %s", __func__);
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SMqBatchMetaRsp rsp = {0};
|
||||
|
|
|
@ -77,7 +77,7 @@ static int32_t stmtCreateRequest(STscStmt2* pStmt) {
|
|||
}
|
||||
if (pStmt->db != NULL) {
|
||||
taosMemoryFreeClear(pStmt->exec.pRequest->pDb);
|
||||
pStmt->exec.pRequest->pDb = strdup(pStmt->db);
|
||||
pStmt->exec.pRequest->pDb = taosStrdup(pStmt->db);
|
||||
}
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
pStmt->exec.pRequest->syncQuery = true;
|
||||
|
@ -1012,10 +1012,10 @@ int stmtSetTbTags2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* tags) {
|
|||
}
|
||||
|
||||
SBoundColInfo* tags_info = (SBoundColInfo*)pStmt->bInfo.boundTags;
|
||||
if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) {
|
||||
tscWarn("no tags or cols bound in sql, will not bound tags");
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
// if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) {
|
||||
// tscWarn("no tags or cols bound in sql, will not bound tags");
|
||||
// return TSDB_CODE_SUCCESS;
|
||||
// }
|
||||
|
||||
STableDataCxt** pDataBlock =
|
||||
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||
|
|
|
@ -554,6 +554,9 @@ char** tmq_list_to_c_array(const tmq_list_t* list) {
|
|||
}
|
||||
|
||||
static int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) {
|
||||
if (pParamSet == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int64_t refId = pParamSet->refId;
|
||||
int32_t code = 0;
|
||||
tmq_t* tmq = taosAcquireRef(tmqMgmt.rsetId, refId);
|
||||
|
@ -575,6 +578,9 @@ static int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) {
|
|||
}
|
||||
|
||||
static int32_t commitRspCountDown(SMqCommitCbParamSet* pParamSet, int64_t consumerId, const char* pTopic, int32_t vgId) {
|
||||
if (pParamSet == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t waitingRspNum = atomic_sub_fetch_32(&pParamSet->waitingRspNum, 1);
|
||||
if (waitingRspNum == 0) {
|
||||
tqDebugC("consumer:0x%" PRIx64 " topic:%s vgId:%d all commit-rsp received, commit completed", consumerId, pTopic,
|
||||
|
@ -603,6 +609,9 @@ static int32_t tmqCommitCb(void* param, SDataBuf* pBuf, int32_t code) {
|
|||
|
||||
static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffsetVal* offset, const char* pTopicName,
|
||||
SMqCommitCbParamSet* pParamSet) {
|
||||
if (tmq == NULL || epSet == NULL || offset == NULL || pTopicName == NULL || pParamSet == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SMqVgOffset pOffset = {0};
|
||||
|
||||
pOffset.consumerId = tmq->consumerId;
|
||||
|
@ -673,6 +682,9 @@ static int32_t doSendCommitMsg(tmq_t* tmq, int32_t vgId, SEpSet* epSet, STqOffse
|
|||
}
|
||||
|
||||
static int32_t getTopicByName(tmq_t* tmq, const char* pTopicName, SMqClientTopic** topic) {
|
||||
if (tmq == NULL || pTopicName == NULL || topic == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t numOfTopics = taosArrayGetSize(tmq->clientTopics);
|
||||
for (int32_t i = 0; i < numOfTopics; ++i) {
|
||||
SMqClientTopic* pTopic = taosArrayGet(tmq->clientTopics, i);
|
||||
|
@ -689,6 +701,9 @@ static int32_t getTopicByName(tmq_t* tmq, const char* pTopicName, SMqClientTopic
|
|||
|
||||
static int32_t prepareCommitCbParamSet(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* userParam, int32_t rspNum,
|
||||
SMqCommitCbParamSet** ppParamSet) {
|
||||
if (tmq == NULL || ppParamSet == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SMqCommitCbParamSet* pParamSet = taosMemoryCalloc(1, sizeof(SMqCommitCbParamSet));
|
||||
if (pParamSet == NULL) {
|
||||
return terrno;
|
||||
|
@ -704,6 +719,9 @@ static int32_t prepareCommitCbParamSet(tmq_t* tmq, tmq_commit_cb* pCommitFp, voi
|
|||
}
|
||||
|
||||
static int32_t getClientVg(tmq_t* tmq, char* pTopicName, int32_t vgId, SMqClientVg** pVg) {
|
||||
if (tmq == NULL || pTopicName == NULL || pVg == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SMqClientTopic* pTopic = NULL;
|
||||
int32_t code = getTopicByName(tmq, pTopicName, &pTopic);
|
||||
if (code != 0) {
|
||||
|
@ -724,6 +742,9 @@ static int32_t getClientVg(tmq_t* tmq, char* pTopicName, int32_t vgId, SMqClient
|
|||
}
|
||||
|
||||
static int32_t innerCommit(tmq_t* tmq, char* pTopicName, STqOffsetVal* offsetVal, SMqClientVg* pVg, SMqCommitCbParamSet* pParamSet){
|
||||
if (tmq == NULL || pTopicName == NULL || offsetVal == NULL || pVg == NULL || pParamSet == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = 0;
|
||||
if (offsetVal->type <= 0) {
|
||||
code = TSDB_CODE_TMQ_INVALID_MSG;
|
||||
|
@ -754,6 +775,9 @@ static int32_t innerCommit(tmq_t* tmq, char* pTopicName, STqOffsetVal* offsetVal
|
|||
|
||||
static int32_t asyncCommitOffset(tmq_t* tmq, char* pTopicName, int32_t vgId, STqOffsetVal* offsetVal,
|
||||
tmq_commit_cb* pCommitFp, void* userParam) {
|
||||
if (tmq == NULL || pTopicName == NULL || offsetVal == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
tqInfoC("consumer:0x%" PRIx64 " do manual commit offset for %s, vgId:%d", tmq->consumerId, pTopicName, vgId);
|
||||
SMqCommitCbParamSet* pParamSet = NULL;
|
||||
int32_t code = prepareCommitCbParamSet(tmq, pCommitFp, userParam, 0, &pParamSet);
|
||||
|
@ -807,6 +831,9 @@ end:
|
|||
}
|
||||
|
||||
static int32_t innerCommitAll(tmq_t* tmq, SMqCommitCbParamSet* pParamSet){
|
||||
if (tmq == NULL || pParamSet == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = 0;
|
||||
taosRLockLatch(&tmq->lock);
|
||||
int32_t numOfTopics = taosArrayGetSize(tmq->clientTopics);
|
||||
|
@ -842,6 +869,9 @@ END:
|
|||
}
|
||||
|
||||
static void asyncCommitAllOffsets(tmq_t* tmq, tmq_commit_cb* pCommitFp, void* userParam) {
|
||||
if (tmq == NULL) {
|
||||
return;
|
||||
}
|
||||
int32_t code = 0;
|
||||
SMqCommitCbParamSet* pParamSet = NULL;
|
||||
// init waitingRspNum as DEFAULT_COMMIT_CNT to prevent concurrency issue
|
||||
|
@ -1071,12 +1101,15 @@ END:
|
|||
}
|
||||
|
||||
static void defaultCommitCbFn(tmq_t* pTmq, int32_t code, void* param) {
|
||||
if (code != 0) {
|
||||
if (code != 0 && pTmq != NULL) {
|
||||
tqErrorC("consumer:0x%" PRIx64 ", failed to commit offset, code:%s", pTmq->consumerId, tstrerror(code));
|
||||
}
|
||||
}
|
||||
|
||||
static void tmqFreeRspWrapper(SMqRspWrapper* rspWrapper) {
|
||||
if (rspWrapper == NULL) {
|
||||
return;
|
||||
}
|
||||
if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__EP_RSP) {
|
||||
tDeleteSMqAskEpRsp(&rspWrapper->epRsp);
|
||||
} else if (rspWrapper->tmqRspType == TMQ_MSG_TYPE__POLL_DATA_RSP) {
|
||||
|
@ -1091,12 +1124,18 @@ static void tmqFreeRspWrapper(SMqRspWrapper* rspWrapper) {
|
|||
}
|
||||
|
||||
static void freeClientVg(void* param) {
|
||||
if (param == NULL) {
|
||||
return;
|
||||
}
|
||||
SMqClientVg* pVg = param;
|
||||
tOffsetDestroy(&pVg->offsetInfo.endOffset);
|
||||
tOffsetDestroy(&pVg->offsetInfo.beginOffset);
|
||||
tOffsetDestroy(&pVg->offsetInfo.committedOffset);
|
||||
}
|
||||
static void freeClientTopic(void* param) {
|
||||
if (param == NULL) {
|
||||
return;
|
||||
}
|
||||
SMqClientTopic* pTopic = param;
|
||||
taosMemoryFreeClear(pTopic->schema.pSchema);
|
||||
taosArrayDestroyEx(pTopic->vgs, freeClientVg);
|
||||
|
@ -1104,6 +1143,9 @@ static void freeClientTopic(void* param) {
|
|||
|
||||
static void initClientTopicFromRsp(SMqClientTopic* pTopic, SMqSubTopicEp* pTopicEp, SHashObj* pVgOffsetHashMap,
|
||||
tmq_t* tmq) {
|
||||
if (pTopic == NULL || pTopicEp == NULL || pVgOffsetHashMap == NULL || tmq == NULL) {
|
||||
return;
|
||||
}
|
||||
pTopic->schema = pTopicEp->schema;
|
||||
pTopicEp->schema.nCols = 0;
|
||||
pTopicEp->schema.pSchema = NULL;
|
||||
|
@ -1167,6 +1209,9 @@ static void initClientTopicFromRsp(SMqClientTopic* pTopic, SMqSubTopicEp* pTopic
|
|||
}
|
||||
|
||||
static void buildNewTopicList(tmq_t* tmq, SArray* newTopics, const SMqAskEpRsp* pRsp){
|
||||
if (tmq == NULL || newTopics == NULL || pRsp == NULL) {
|
||||
return;
|
||||
}
|
||||
SHashObj* pVgOffsetHashMap = taosHashInit(64, MurmurHash3_32, false, HASH_NO_LOCK);
|
||||
if (pVgOffsetHashMap == NULL) {
|
||||
tqErrorC("consumer:0x%" PRIx64 " taos hash init null, code:%d", tmq->consumerId, terrno);
|
||||
|
@ -1221,6 +1266,9 @@ static void buildNewTopicList(tmq_t* tmq, SArray* newTopics, const SMqAskEpRsp*
|
|||
}
|
||||
|
||||
static void doUpdateLocalEp(tmq_t* tmq, int32_t epoch, const SMqAskEpRsp* pRsp) {
|
||||
if (tmq == NULL || pRsp == NULL) {
|
||||
return;
|
||||
}
|
||||
int32_t topicNumGet = taosArrayGetSize(pRsp->topics);
|
||||
// vnode transform (epoch == tmq->epoch && topicNumGet != 0)
|
||||
// ask ep rsp (epoch == tmq->epoch && topicNumGet == 0)
|
||||
|
@ -1337,6 +1385,9 @@ static int32_t askEpCb(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
}
|
||||
|
||||
static int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
|
||||
if (pTmq == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SMqAskEpReq req = {0};
|
||||
req.consumerId = pTmq->consumerId;
|
||||
req.epoch = updateEpSet ? -1 : pTmq->epoch;
|
||||
|
@ -1395,6 +1446,9 @@ static int32_t askEp(tmq_t* pTmq, void* param, bool sync, bool updateEpSet) {
|
|||
}
|
||||
|
||||
void tmqHandleAllDelayedTask(tmq_t* pTmq) {
|
||||
if (pTmq == NULL) {
|
||||
return;
|
||||
}
|
||||
STaosQall* qall = NULL;
|
||||
int32_t code = 0;
|
||||
|
||||
|
@ -1443,6 +1497,7 @@ void tmqHandleAllDelayedTask(tmq_t* pTmq) {
|
|||
}
|
||||
|
||||
void tmqClearUnhandleMsg(tmq_t* tmq) {
|
||||
if (tmq == NULL) return;
|
||||
SMqRspWrapper* rspWrapper = NULL;
|
||||
while (taosGetQitem(tmq->qall, (void**)&rspWrapper) != 0) {
|
||||
tmqFreeRspWrapper(rspWrapper);
|
||||
|
@ -1507,6 +1562,7 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) {
|
|||
}
|
||||
|
||||
void tmqFreeImpl(void* handle) {
|
||||
if (handle == NULL) return;
|
||||
tmq_t* tmq = (tmq_t*)handle;
|
||||
int64_t id = tmq->consumerId;
|
||||
|
||||
|
@ -1715,6 +1771,7 @@ _failed:
|
|||
}
|
||||
|
||||
static int32_t syncAskEp(tmq_t* pTmq) {
|
||||
if (pTmq == NULL) return TSDB_CODE_INVALID_PARA;
|
||||
SAskEpInfo* pInfo = taosMemoryMalloc(sizeof(SAskEpInfo));
|
||||
if (pInfo == NULL) return terrno;
|
||||
if (tsem2_init(&pInfo->sem, 0, 0) != 0) {
|
||||
|
@ -1897,6 +1954,9 @@ void tmq_conf_set_auto_commit_cb(tmq_conf_t* conf, tmq_commit_cb* cb, void* para
|
|||
}
|
||||
|
||||
static void getVgInfo(tmq_t* tmq, char* topicName, int32_t vgId, SMqClientVg** pVg) {
|
||||
if (tmq == NULL || topicName == NULL || pVg == NULL) {
|
||||
return;
|
||||
}
|
||||
int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
|
||||
for (int i = 0; i < topicNumCur; i++) {
|
||||
SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, i);
|
||||
|
@ -1914,6 +1974,9 @@ static void getVgInfo(tmq_t* tmq, char* topicName, int32_t vgId, SMqClientVg** p
|
|||
}
|
||||
|
||||
static SMqClientTopic* getTopicInfo(tmq_t* tmq, char* topicName) {
|
||||
if (tmq == NULL || topicName == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
int32_t topicNumCur = taosArrayGetSize(tmq->clientTopics);
|
||||
for (int i = 0; i < topicNumCur; i++) {
|
||||
SMqClientTopic* pTopicCur = taosArrayGet(tmq->clientTopics, i);
|
||||
|
@ -2026,6 +2089,9 @@ EXIT:
|
|||
}
|
||||
|
||||
void tmqBuildConsumeReqImpl(SMqPollReq* pReq, tmq_t* tmq, int64_t timeout, SMqClientTopic* pTopic, SMqClientVg* pVg) {
|
||||
if (pReq == NULL || tmq == NULL || pTopic == NULL || pVg == NULL) {
|
||||
return;
|
||||
}
|
||||
(void)snprintf(pReq->subKey, TSDB_SUBSCRIBE_KEY_LEN, "%s%s%s", tmq->groupId, TMQ_SEPARATOR, pTopic->topicName);
|
||||
pReq->withTbName = tmq->withTbName;
|
||||
pReq->consumerId = tmq->consumerId;
|
||||
|
@ -2072,7 +2138,7 @@ void changeByteEndian(char* pData) {
|
|||
}
|
||||
|
||||
static void tmqGetRawDataRowsPrecisionFromRes(void* pRetrieve, void** rawData, int64_t* rows, int32_t* precision) {
|
||||
if (pRetrieve == NULL) {
|
||||
if (pRetrieve == NULL || rawData == NULL || rows == NULL) {
|
||||
return;
|
||||
}
|
||||
if (*(int64_t*)pRetrieve == 0) {
|
||||
|
@ -2092,6 +2158,9 @@ static void tmqGetRawDataRowsPrecisionFromRes(void* pRetrieve, void** rawData, i
|
|||
|
||||
static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg* pVg, int64_t* numOfRows,
|
||||
SMqRspObj* pRspObj) {
|
||||
if (pWrapper == NULL || pVg == NULL || numOfRows == NULL || pRspObj == NULL) {
|
||||
return;
|
||||
}
|
||||
pRspObj->resIter = -1;
|
||||
pRspObj->resInfo.totalRows = 0;
|
||||
pRspObj->resInfo.precision = TSDB_TIME_PRECISION_MILLI;
|
||||
|
@ -2130,6 +2199,9 @@ static void tmqBuildRspFromWrapperInner(SMqPollRspWrapper* pWrapper, SMqClientVg
|
|||
}
|
||||
|
||||
static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* pVg, int64_t timeout) {
|
||||
if (pTmq == NULL || pTopic == NULL || pVg == NULL) {
|
||||
return TSDB_CODE_INVALID_MSG;
|
||||
}
|
||||
SMqPollReq req = {0};
|
||||
char* msg = NULL;
|
||||
SMqPollCbParam* pParam = NULL;
|
||||
|
@ -2199,6 +2271,9 @@ static int32_t doTmqPollImpl(tmq_t* pTmq, SMqClientTopic* pTopic, SMqClientVg* p
|
|||
|
||||
// broadcast the poll request to all related vnodes
|
||||
static int32_t tmqPollImpl(tmq_t* tmq, int64_t timeout) {
|
||||
if (tmq == NULL) {
|
||||
return TSDB_CODE_INVALID_MSG;
|
||||
}
|
||||
int32_t code = 0;
|
||||
|
||||
taosWLockLatch(&tmq->lock);
|
||||
|
@ -2258,6 +2333,9 @@ end:
|
|||
|
||||
static void updateVgInfo(SMqClientVg* pVg, STqOffsetVal* reqOffset, STqOffsetVal* rspOffset, int64_t sver, int64_t ever,
|
||||
int64_t consumerId, bool hasData) {
|
||||
if (pVg == NULL || reqOffset == NULL || rspOffset == NULL) {
|
||||
return;
|
||||
}
|
||||
if (!pVg->seekUpdated) {
|
||||
tqDebugC("consumer:0x%" PRIx64 " local offset is update, since seekupdate not set", consumerId);
|
||||
if (hasData) {
|
||||
|
@ -2283,6 +2361,9 @@ static SMqRspObj* buildRsp(SMqPollRspWrapper* pollRspWrapper){
|
|||
SMqBatchMetaRsp batchMetaRsp;
|
||||
} MEMSIZE;
|
||||
|
||||
if (pollRspWrapper == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
SMqRspObj* pRspObj = taosMemoryCalloc(1, sizeof(SMqRspObj));
|
||||
if (pRspObj == NULL) {
|
||||
tqErrorC("buildRsp:failed to allocate memory");
|
||||
|
@ -2297,6 +2378,9 @@ static SMqRspObj* buildRsp(SMqPollRspWrapper* pollRspWrapper){
|
|||
}
|
||||
|
||||
static void processMqRspError(tmq_t* tmq, SMqRspWrapper* pRspWrapper){
|
||||
if (tmq == NULL || pRspWrapper == NULL) {
|
||||
return;
|
||||
}
|
||||
SMqPollRspWrapper* pollRspWrapper = &pRspWrapper->pollRsp;
|
||||
|
||||
if (pRspWrapper->code == TSDB_CODE_VND_INVALID_VGROUP_ID) { // for vnode transform
|
||||
|
@ -2322,6 +2406,9 @@ static void processMqRspError(tmq_t* tmq, SMqRspWrapper* pRspWrapper){
|
|||
taosWUnLockLatch(&tmq->lock);
|
||||
}
|
||||
static SMqRspObj* processMqRsp(tmq_t* tmq, SMqRspWrapper* pRspWrapper){
|
||||
if (tmq == NULL || pRspWrapper == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
SMqRspObj* pRspObj = NULL;
|
||||
|
||||
if (pRspWrapper->tmqRspType == TMQ_MSG_TYPE__EP_RSP) {
|
||||
|
@ -2401,6 +2488,9 @@ static SMqRspObj* processMqRsp(tmq_t* tmq, SMqRspWrapper* pRspWrapper){
|
|||
}
|
||||
|
||||
static void* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout) {
|
||||
if (tmq == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
tqDebugC("consumer:0x%" PRIx64 " start to handle the rsp, total:%d", tmq->consumerId, taosQallItemSize(tmq->qall));
|
||||
|
||||
void* returnVal = NULL;
|
||||
|
@ -2478,6 +2568,7 @@ TAOS_RES* tmq_consumer_poll(tmq_t* tmq, int64_t timeout) {
|
|||
}
|
||||
|
||||
static void displayConsumeStatistics(tmq_t* pTmq) {
|
||||
if (pTmq == NULL) return;
|
||||
taosRLockLatch(&pTmq->lock);
|
||||
int32_t numOfTopics = taosArrayGetSize(pTmq->clientTopics);
|
||||
tqInfoC("consumer:0x%" PRIx64 " closing poll:%" PRId64 " rows:%" PRId64 " topics:%d, final epoch:%d",
|
||||
|
@ -2680,7 +2771,11 @@ void tmq_commit_async(tmq_t* tmq, const TAOS_RES* pRes, tmq_commit_cb* cb, void*
|
|||
}
|
||||
}
|
||||
|
||||
static void commitCallBackFn(tmq_t* UNUSED_PARAM(tmq), int32_t code, void* param) {
|
||||
static void commitCallBackFn(tmq_t* tmq, int32_t code, void* param) {
|
||||
if (param == NULL) {
|
||||
tqErrorC("invalid param in commit cb");
|
||||
return;
|
||||
}
|
||||
SSyncCommitInfo* pInfo = (SSyncCommitInfo*)param;
|
||||
pInfo->code = code;
|
||||
if (tsem2_post(&pInfo->sem) != 0){
|
||||
|
@ -2732,6 +2827,10 @@ int32_t tmq_commit_sync(tmq_t* tmq, const TAOS_RES* pRes) {
|
|||
|
||||
// wal range will be ok after calling tmq_get_topic_assignment or poll interface
|
||||
static int32_t checkWalRange(SVgOffsetInfo* offset, int64_t value) {
|
||||
if (offset == NULL) {
|
||||
tqErrorC("invalid offset, null");
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
if (offset->walVerBegin == -1 || offset->walVerEnd == -1) {
|
||||
tqErrorC("Assignment or poll interface need to be called first");
|
||||
return TSDB_CODE_TMQ_NEED_INITIALIZED;
|
||||
|
@ -2852,6 +2951,9 @@ end:
|
|||
|
||||
|
||||
int32_t tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4, SReqResultInfo** pResInfo) {
|
||||
if (res == NULL || pResInfo == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
SMqRspObj* pRspObj = (SMqRspObj*)res;
|
||||
SMqDataRsp* data = &pRspObj->dataRsp;
|
||||
|
||||
|
@ -2889,7 +2991,7 @@ int32_t tmqGetNextResInfo(TAOS_RES* res, bool convertUcs4, SReqResultInfo** pRes
|
|||
}
|
||||
|
||||
static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) {
|
||||
if (param == NULL) {
|
||||
if (param == NULL || pMsg == NULL) {
|
||||
return code;
|
||||
}
|
||||
SMqVgWalInfoParam* pParam = param;
|
||||
|
@ -2962,6 +3064,9 @@ static bool isInSnapshotMode(int8_t type, bool useSnapshot) {
|
|||
}
|
||||
|
||||
static int32_t tmCommittedCb(void* param, SDataBuf* pMsg, int32_t code) {
|
||||
if (param == NULL) {
|
||||
return code;
|
||||
}
|
||||
SMqCommittedParam* pParam = param;
|
||||
|
||||
if (code != 0) {
|
||||
|
@ -2992,6 +3097,9 @@ end:
|
|||
}
|
||||
|
||||
int64_t getCommittedFromServer(tmq_t* tmq, char* tname, int32_t vgId, SEpSet* epSet) {
|
||||
if (tmq == NULL || tname == NULL || epSet == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
int32_t code = 0;
|
||||
SMqVgOffset pOffset = {0};
|
||||
|
||||
|
|
|
@ -788,6 +788,8 @@ TEST(clientCase, insert_test) {
|
|||
}
|
||||
|
||||
TEST(clientCase, projection_query_tables) {
|
||||
taos_options(TSDB_OPTION_CONFIGDIR, "/home/lisa/first/cfg");
|
||||
|
||||
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||
ASSERT_NE(pConn, nullptr);
|
||||
|
||||
|
@ -796,6 +798,12 @@ TEST(clientCase, projection_query_tables) {
|
|||
pRes= taos_query(pConn, "use abc1");
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "select forecast(k,'algo=arima,wncheck=0') from t1 where ts<='2024-11-15 1:7:44'");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
(void)printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
||||
}
|
||||
taos_free_result(pRes);
|
||||
|
||||
pRes = taos_query(pConn, "create table tu using st2 tags(2)");
|
||||
if (taos_errno(pRes) != 0) {
|
||||
(void)printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
|
||||
|
|
|
@ -449,9 +449,11 @@ static int32_t tBindInfoCompare(const void *p1, const void *p2, const void *para
|
|||
* `infoSorted` is whether the bind information is sorted by column id
|
||||
* `pTSchema` is the schema of the table
|
||||
* `rowArray` is the array to store the rows
|
||||
* `pOrdered` is the pointer to store ordered
|
||||
* `pDupTs` is the pointer to store duplicateTs
|
||||
*/
|
||||
int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted, const STSchema *pTSchema,
|
||||
SArray *rowArray) {
|
||||
SArray *rowArray, bool *pOrdered, bool *pDupTs) {
|
||||
if (infos == NULL || numOfInfos <= 0 || numOfInfos > pTSchema->numOfCols || pTSchema == NULL || rowArray == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
@ -469,6 +471,7 @@ int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted,
|
|||
return terrno;
|
||||
}
|
||||
|
||||
SRowKey rowKey, lastRowKey;
|
||||
for (int32_t iRow = 0; iRow < numOfRows; iRow++) {
|
||||
taosArrayClear(colValArray);
|
||||
|
||||
|
@ -507,6 +510,22 @@ int32_t tRowBuildFromBind(SBindInfo *infos, int32_t numOfInfos, bool infoSorted,
|
|||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (pOrdered && pDupTs) {
|
||||
tRowGetKey(row, &rowKey);
|
||||
if (iRow == 0) {
|
||||
*pOrdered = true;
|
||||
*pDupTs = false;
|
||||
} else {
|
||||
// no more compare if we already get disordered or duplicate rows
|
||||
if (*pOrdered && !*pDupTs) {
|
||||
int32_t code = tRowKeyCompare(&rowKey, &lastRowKey);
|
||||
*pOrdered = (code >= 0);
|
||||
*pDupTs = (code == 0);
|
||||
}
|
||||
}
|
||||
lastRowKey = rowKey;
|
||||
}
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -3235,9 +3254,11 @@ _exit:
|
|||
* `infoSorted` is whether the bind information is sorted by column id
|
||||
* `pTSchema` is the schema of the table
|
||||
* `rowArray` is the array to store the rows
|
||||
* `pOrdered` is the pointer to store ordered
|
||||
* `pDupTs` is the pointer to store duplicateTs
|
||||
*/
|
||||
int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorted, const STSchema *pTSchema,
|
||||
SArray *rowArray) {
|
||||
SArray *rowArray, bool *pOrdered, bool *pDupTs) {
|
||||
if (infos == NULL || numOfInfos <= 0 || numOfInfos > pTSchema->numOfCols || pTSchema == NULL || rowArray == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
@ -3266,6 +3287,7 @@ int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorte
|
|||
}
|
||||
}
|
||||
|
||||
SRowKey rowKey, lastRowKey;
|
||||
for (int32_t iRow = 0; iRow < numOfRows; iRow++) {
|
||||
taosArrayClear(colValArray);
|
||||
|
||||
|
@ -3317,6 +3339,22 @@ int32_t tRowBuildFromBind2(SBindInfo2 *infos, int32_t numOfInfos, bool infoSorte
|
|||
code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
if (pOrdered && pDupTs) {
|
||||
tRowGetKey(row, &rowKey);
|
||||
if (iRow == 0) {
|
||||
*pOrdered = true;
|
||||
*pDupTs = false;
|
||||
} else {
|
||||
// no more compare if we already get disordered or duplicate rows
|
||||
if (*pOrdered && !*pDupTs) {
|
||||
int32_t code = tRowKeyCompare(&rowKey, &lastRowKey);
|
||||
*pOrdered = (code >= 0);
|
||||
*pDupTs = (code == 0);
|
||||
}
|
||||
}
|
||||
lastRowKey = rowKey;
|
||||
}
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
*/
|
||||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "tglobal.h"
|
||||
#include "cJSON.h"
|
||||
#include "defines.h"
|
||||
#include "os.h"
|
||||
#include "osString.h"
|
||||
#include "tconfig.h"
|
||||
#include "tglobal.h"
|
||||
#include "tgrant.h"
|
||||
#include "tjson.h"
|
||||
#include "tlog.h"
|
||||
|
@ -104,6 +104,7 @@ int32_t tsRetentionSpeedLimitMB = 0; // unlimited
|
|||
|
||||
const char *tsAlterCompactTaskKeywords = "max_compact_tasks";
|
||||
int32_t tsNumOfCompactThreads = 2;
|
||||
int32_t tsNumOfRetentionThreads = 1;
|
||||
|
||||
// sync raft
|
||||
int32_t tsElectInterval = 25 * 1000;
|
||||
|
@ -328,6 +329,7 @@ int64_t tsStreamBufferSize = 128 * 1024 * 1024;
|
|||
bool tsFilterScalarMode = false;
|
||||
int tsResolveFQDNRetryTime = 100; // seconds
|
||||
int tsStreamAggCnt = 100000;
|
||||
bool tsStreamCoverage = false;
|
||||
|
||||
bool tsUpdateCacheBatch = true;
|
||||
|
||||
|
@ -390,6 +392,16 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
|
|||
int32_t taosSetTfsCfg(SConfig *pCfg);
|
||||
#endif
|
||||
|
||||
#ifndef _STORAGE
|
||||
int32_t cfgUpdateTfsItemDisable(SConfig *pCfg, const char *value, void *pTfs) { return TSDB_CODE_INVALID_CFG; }
|
||||
#else
|
||||
int32_t cfgUpdateTfsItemDisable(SConfig *pCfg, const char *value, void *pTfs);
|
||||
#endif
|
||||
|
||||
int32_t taosUpdateTfsItemDisable(SConfig *pCfg, const char *value, void *pTfs) {
|
||||
return cfgUpdateTfsItemDisable(pCfg, value, pTfs);
|
||||
}
|
||||
|
||||
static int32_t taosSplitS3Cfg(SConfig *pCfg, const char *name, char gVarible[TSDB_MAX_EP_NUM][TSDB_FQDN_LEN],
|
||||
int8_t *pNum) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -733,6 +745,9 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
|||
CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
|
||||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tsmaDataDeleteMark", tsmaDataDeleteMark, 60 * 60 * 1000, INT64_MAX,
|
||||
CFG_SCOPE_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
|
||||
|
||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "streamCoverage", tsStreamCoverage, CFG_DYN_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -1463,6 +1478,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
|
|||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "bypassFlag");
|
||||
tsBypassFlag = pItem->i32;
|
||||
|
||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "streamCoverage");
|
||||
tsStreamCoverage = pItem->bval;
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -2381,6 +2399,10 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
|
|||
code = TSDB_CODE_SUCCESS;
|
||||
goto _exit;
|
||||
}
|
||||
if (strcasecmp(name, "dataDir") == 0) {
|
||||
code = TSDB_CODE_SUCCESS;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
{ // 'bool/int32_t/int64_t/float/double' variables with general modification function
|
||||
static OptionNameAndVar debugOptions[] = {
|
||||
|
@ -2735,7 +2757,8 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
|||
{"maxTsmaCalcDelay", &tsMaxTsmaCalcDelay},
|
||||
{"tsmaDataDeleteMark", &tsmaDataDeleteMark},
|
||||
{"numOfRpcSessions", &tsNumOfRpcSessions},
|
||||
{"bypassFlag", &tsBypassFlag}};
|
||||
{"bypassFlag", &tsBypassFlag},
|
||||
{"streamCoverage", &tsStreamCoverage}};
|
||||
|
||||
if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) {
|
||||
code = taosCfgSetOption(options, tListLen(options), pItem, false);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "tcompression.h"
|
||||
|
||||
const int32_t TYPE_BYTES[21] = {
|
||||
-1, // TSDB_DATA_TYPE_NULL
|
||||
2, // TSDB_DATA_TYPE_NULL
|
||||
CHAR_BYTES, // TSDB_DATA_TYPE_BOOL
|
||||
CHAR_BYTES, // TSDB_DATA_TYPE_TINYINT
|
||||
SHORT_BYTES, // TSDB_DATA_TYPE_SMALLINT
|
||||
|
@ -42,7 +42,7 @@ const int32_t TYPE_BYTES[21] = {
|
|||
};
|
||||
|
||||
tDataTypeDescriptor tDataTypes[TSDB_DATA_TYPE_MAX] = {
|
||||
{TSDB_DATA_TYPE_NULL, 6, 1, "NOTYPE", 0, 0, NULL, NULL},
|
||||
{TSDB_DATA_TYPE_NULL, 6, 2, "NOTYPE", 0, 0, NULL, NULL},
|
||||
{TSDB_DATA_TYPE_BOOL, 4, CHAR_BYTES, "BOOL", false, true, tsCompressBool, tsDecompressBool},
|
||||
{TSDB_DATA_TYPE_TINYINT, 7, CHAR_BYTES, "TINYINT", INT8_MIN, INT8_MAX, tsCompressTinyint, tsDecompressTinyint},
|
||||
{TSDB_DATA_TYPE_SMALLINT, 8, SHORT_BYTES, "SMALLINT", INT16_MIN, INT16_MAX, tsCompressSmallint,
|
||||
|
|
|
@ -25,6 +25,7 @@ extern "C" {
|
|||
typedef struct SDnodeMgmt {
|
||||
SDnodeData *pData;
|
||||
SMsgCb msgCb;
|
||||
STfs *pTfs;
|
||||
const char *path;
|
||||
const char *name;
|
||||
TdThread statusThread;
|
||||
|
@ -69,6 +70,7 @@ int32_t dmStartStatusThread(SDnodeMgmt *pMgmt);
|
|||
int32_t dmStartConfigThread(SDnodeMgmt *pMgmt);
|
||||
int32_t dmStartStatusInfoThread(SDnodeMgmt *pMgmt);
|
||||
void dmStopStatusThread(SDnodeMgmt *pMgmt);
|
||||
void dmStopConfigThread(SDnodeMgmt *pMgmt);
|
||||
void dmStopStatusInfoThread(SDnodeMgmt *pMgmt);
|
||||
int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt);
|
||||
void dmStopNotifyThread(SDnodeMgmt *pMgmt);
|
||||
|
|
|
@ -475,7 +475,7 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern void tsdbAlterMaxCompactTasks();
|
||||
extern void tsdbAlterNumCompactThreads();
|
||||
static int32_t dmAlterMaxCompactTask(const char *value) {
|
||||
int32_t max_compact_tasks;
|
||||
char *endptr = NULL;
|
||||
|
@ -489,7 +489,7 @@ static int32_t dmAlterMaxCompactTask(const char *value) {
|
|||
dInfo("alter max compact tasks from %d to %d", tsNumOfCompactThreads, max_compact_tasks);
|
||||
tsNumOfCompactThreads = max_compact_tasks;
|
||||
#ifdef TD_ENTERPRISE
|
||||
tsdbAlterMaxCompactTasks();
|
||||
(void)tsdbAlterNumCompactThreads();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -499,9 +499,15 @@ static int32_t dmAlterMaxCompactTask(const char *value) {
|
|||
int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||
int32_t code = 0;
|
||||
SDCfgDnodeReq cfgReq = {0};
|
||||
SConfig *pCfg = taosGetCfg();
|
||||
SConfigItem *pItem = NULL;
|
||||
|
||||
if (tDeserializeSDCfgDnodeReq(pMsg->pCont, pMsg->contLen, &cfgReq) != 0) {
|
||||
return TSDB_CODE_INVALID_MSG;
|
||||
}
|
||||
if (strcasecmp(cfgReq.config, "dataDir") == 0) {
|
||||
return taosUpdateTfsItemDisable(pCfg, cfgReq.value, pMgmt->pTfs);
|
||||
}
|
||||
|
||||
if (strncmp(cfgReq.config, tsAlterCompactTaskKeywords, strlen(tsAlterCompactTaskKeywords) + 1) == 0) {
|
||||
return dmAlterMaxCompactTask(cfgReq.value);
|
||||
|
@ -509,9 +515,6 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
|
||||
dInfo("start to config, option:%s, value:%s", cfgReq.config, cfgReq.value);
|
||||
|
||||
SConfig *pCfg = taosGetCfg();
|
||||
SConfigItem *pItem = NULL;
|
||||
|
||||
code = cfgGetAndSetItem(pCfg, &pItem, cfgReq.config, cfgReq.value, CFG_STYPE_ALTER_SERVER_CMD, true);
|
||||
if (code != 0) {
|
||||
if (strncasecmp(cfgReq.config, "resetlog", strlen("resetlog")) == 0) {
|
||||
|
|