Merge pull request #29771 from taosdata/merge/mainto3.02
merge: from main to 3.0 branch
This commit is contained in:
commit
8b28c34d0d
|
@ -1,4 +1,4 @@
|
|||
name: taosKeeper CI
|
||||
name: taosKeeper Build
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -8,7 +8,7 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
name: Run unit tests
|
||||
name: Build and test on ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout the repository
|
|
@ -26,6 +26,7 @@ Flink Connector supports all platforms that can run Flink 1.19 and above version
|
|||
|
||||
| Flink Connector Version | Major Changes | TDengine Version|
|
||||
|-------------------------| ------------------------------------ | ---------------- |
|
||||
| 2.0.2 | The Table Sink supports types such as RowKind.UPDATE_BEFORE, RowKind.UPDATE_AFTER, and RowKind.DELETE.| - |
|
||||
| 2.0.1 | Sink supports writing types from Rowdata implementations.| - |
|
||||
| 2.0.0 | 1.Support SQL queries on data in TDengine database. <br/> 2. Support CDC subscription to data in TDengine database.<br/> 3. Supports reading and writing to TDengine database using Table SQL. | 3.3.5.1 and higher|
|
||||
| 1.0.0 | Support Sink function to write data from other sources to TDengine in the future.| 3.3.2.0 and higher|
|
||||
|
@ -115,7 +116,7 @@ If using Maven to manage a project, simply add the following dependencies in pom
|
|||
<dependency>
|
||||
<groupId>com.taosdata.flink</groupId>
|
||||
<artifactId>flink-connector-tdengine</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ INFO: Spend 26.9530 second completed total queries: 30000, the QPS of all thread
|
|||
```
|
||||
|
||||
- The first line represents the percentile distribution of query execution and query request delay for each of the three threads executing 10000 queries. The SQL command is the test query statement
|
||||
- The second line indicates that the total query time is 26.9653 seconds, the total queries is 10000 * 3 = 30000, and the query rate per second (QPS) is 1113.049 times/second
|
||||
- The second line indicates that the total query time is 26.9653 seconds, and the query rate per second (QPS) is 1113.049 times/second
|
||||
- If the `continue_if_fail` option is set to `yes` in the query, the last line will output the number of failed requests and error rate, the format like "error + number of failed requests (error rate)"
|
||||
- QPS = number of successful requests / time spent (in seconds)
|
||||
- Error rate = number of failed requests / (number of successful requests + number of failed requests)
|
||||
|
@ -459,7 +459,7 @@ For other common parameters, see Common Configuration Parameters.
|
|||
|
||||
Configuration parameters for querying specified tables (can specify supertables, subtables, or regular tables) are set in `specified_table_query`.
|
||||
|
||||
- `General Query`: Each SQL in `sqls` starts `threads` threads to query this SQL, Each thread exits after executing the `query_times` queries, and only after all threads executing this SQL have completed can the next SQL be executed.
|
||||
`General Query`: Each SQL in `sqls` starts `threads` threads to query this SQL, Each thread exits after executing the `query_times` queries, and only after all threads executing this SQL have completed can the next SQL be executed.
|
||||
The total number of queries(`General Query`) = the number of `sqls` * `query_times` * `threads`
|
||||
- `Mixed Query` : All SQL statements in `sqls` are divided into `threads` groups, with each thread executing one group. Each SQL statement needs to execute `query_times` queries.
|
||||
The total number of queries(`Mixed Query`) = the number of `sqls` * `query_times`
|
||||
|
@ -501,7 +501,7 @@ Configuration parameters for subscribing to specified tables (can specify supert
|
|||
- **sqls** :
|
||||
- **sql** : The SQL command to execute, required.
|
||||
|
||||
#### Data Type Writing Comparison Table in Configuration File
|
||||
### Data Type Writing Comparison Table in Configuration File
|
||||
|
||||
| # | **Engine** | **taosBenchmark**
|
||||
| --- | :----------------: | :---------------:
|
||||
|
|
|
@ -25,6 +25,8 @@ Support all platforms that can run Node.js.
|
|||
|
||||
| Node.js Connector Version | Major Changes | TDengine Version |
|
||||
| ------------------------- | ------------------------------------------------------------------------ | --------------------------- |
|
||||
| 3.1.4 | Modified the readme.| - |
|
||||
| 3.1.3 | Upgraded the es5-ext version to address vulnerabilities in the lower version. | - |
|
||||
| 3.1.2 | Optimized data protocol and parsing, significantly improved performance. | - |
|
||||
| 3.1.1 | Optimized data transmission performance. | 3.3.2.0 and higher versions |
|
||||
| 3.1.0 | New release, supports WebSocket connection. | 3.2.0.0 and higher versions |
|
||||
|
@ -132,16 +134,20 @@ Node.js connector (`@tdengine/websocket`), which connects to a TDengine instance
|
|||
In addition to obtaining a connection through a specified URL, you can also use WSConfig to specify parameters when establishing a connection.
|
||||
|
||||
```js
|
||||
try {
|
||||
let url = 'ws://127.0.0.1:6041'
|
||||
let conf = WsSql.NewConfig(url)
|
||||
conf.setUser('root')
|
||||
conf.setPwd('taosdata')
|
||||
conf.setDb('db')
|
||||
conf.setTimeOut(500)
|
||||
let wsSql = await WsSql.open(conf);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
const taos = require("@tdengine/websocket");
|
||||
|
||||
async function createConnect() {
|
||||
try {
|
||||
let url = 'ws://127.0.0.1:6041'
|
||||
let conf = new taos.WSConfig(url)
|
||||
conf.setUser('root')
|
||||
conf.setPwd('taosdata')
|
||||
conf.setDb('db')
|
||||
conf.setTimeOut(500)
|
||||
let wsSql = await taos.sqlConnect(conf)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ Flink Connector 支持所有能运行 Flink 1.19 及以上版本的平台。
|
|||
## 版本历史
|
||||
| Flink Connector 版本 | 主要变化 | TDengine 版本 |
|
||||
| ------------------| ------------------------------------ | ---------------- |
|
||||
| 2.0.2 | Table Sink 支持 RowKind.UPDATE_BEFORE、RowKind.UPDATE_AFTER 和 RowKind.DELETE 类型| - |
|
||||
| 2.0.1 | Sink 支持对所有继承自 RowData 并已实现的类型进行数据写入| - |
|
||||
| 2.0.0 | 1. 支持 SQL 查询 TDengine 数据库中的数据<br/> 2. 支持 CDC 订阅 TDengine 数据库中的数据<br/> 3. 支持 Table SQL 方式读取和写入 TDengine 数据库| 3.3.5.1 及以上版本 |
|
||||
| 1.0.0 | 支持 Sink 功能,将来着其他数据源的数据写入到 TDengine| 3.3.2.0 及以上版本|
|
||||
|
@ -112,7 +113,7 @@ env.getCheckpointConfig().setCheckpointingMode(CheckpointingMode.AT_LEAST_ONCE);
|
|||
<dependency>
|
||||
<groupId>com.taosdata.flink</groupId>
|
||||
<artifactId>flink-connector-tdengine</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
|
|
@ -4,17 +4,21 @@ sidebar_label: taos
|
|||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
TDengine 命令行程序(以下简称 TDengine CLI)是用户操作 TDengine 实例并与之交互的最简洁最常用工具。 使用前需要安装 TDengine Server 安装包或 TDengine Client 安装包。
|
||||
TDengine 命令行程序(以下简称 TDengine CLI)是用户操作 TDengine 实例并与之交互最简洁常用工具。
|
||||
|
||||
## 启动
|
||||
## 工具获取
|
||||
|
||||
要进入 TDengine CLI,您在终端执行 `taos` 即可。
|
||||
TDengine CLI 是 TDengine 服务器及客户端安装包中默认安装组件,安装后即可使用,参考 [TDengine 安装](../../../get-started/)
|
||||
|
||||
## 运行
|
||||
|
||||
进入 TDengine CLI 交互执行模式,在终端命令行执行:
|
||||
|
||||
```bash
|
||||
taos
|
||||
```
|
||||
|
||||
如果连接服务成功,将会打印出欢迎消息和版本信息。如果失败,则会打印错误消息。
|
||||
如果连接服务成功,将会打印出欢迎消息和版本信息。若失败,打印错误消息。
|
||||
|
||||
TDengine CLI 的提示符号如下:
|
||||
|
||||
|
@ -22,42 +26,24 @@ TDengine CLI 的提示符号如下:
|
|||
taos>
|
||||
```
|
||||
|
||||
进入 TDengine CLI 后,你可执行各种 SQL 语句,包括插入、查询以及各种管理命令。
|
||||
进入 TDengine CLI 后,可执行各种 SQL 语句,包括插入、查询以及各种管理命令。
|
||||
退出 TDengine CLI, 执行 `q` 或 `quit` 或 `exit` 回车即可
|
||||
```shell
|
||||
taos> quit
|
||||
```
|
||||
|
||||
|
||||
## 执行 SQL 脚本
|
||||
|
||||
在 TDengine CLI 里可以通过 `source` 命令来运行脚本文件中的多条 SQL 命令。
|
||||
|
||||
```sql
|
||||
taos> source <filename>;
|
||||
```
|
||||
|
||||
## 在线修改显示字符宽度
|
||||
|
||||
可以在 TDengine CLI 里使用如下命令调整字符显示宽度
|
||||
|
||||
```sql
|
||||
taos> SET MAX_BINARY_DISPLAY_WIDTH <nn>;
|
||||
```
|
||||
|
||||
如显示的内容后面以 ... 结尾时,表示该内容已被截断,可通过本命令修改显示字符宽度以显示完整的内容。
|
||||
|
||||
## 命令行参数
|
||||
|
||||
您可通过配置命令行参数来改变 TDengine CLI 的行为。以下为常用的几个命令行参数:
|
||||
### 常用参数
|
||||
可通过配置命令行参数来改变 TDengine CLI 的行为。以下为常用的几个命令行参数:
|
||||
|
||||
- -h HOST: 要连接的 TDengine 服务端所在服务器的 FQDN, 默认为连接本地服务
|
||||
- -P PORT: 指定服务端所用端口号
|
||||
- -u USER: 连接时使用的用户名
|
||||
- -p PASSWORD: 连接服务端时使用的密码,特殊字符如 `! & ( ) < > ; |` 需使用字符 `\` 进行转义处理
|
||||
- -h HOST: 要连接的 TDengine 服务端所在服务器的 FQDN, 默认值: 127.0.0.1
|
||||
- -P PORT: 指定服务端所用端口号,默认值:6030
|
||||
- -u USER: 连接时使用的用户名,默认值:root
|
||||
- -p PASSWORD: 连接服务端时使用的密码,特殊字符如 `! & ( ) < > ; |` 需使用字符 `\` 进行转义处理, 默认值:taosdata
|
||||
- -?, --help: 打印出所有命令行参数
|
||||
|
||||
还有更多其他参数:
|
||||
### 更多参数
|
||||
|
||||
- -a AUTHSTR: 连接服务端的授权信息
|
||||
- -A: 通过用户名和密码计算授权信息
|
||||
|
@ -79,27 +65,58 @@ taos> SET MAX_BINARY_DISPLAY_WIDTH <nn>;
|
|||
- -z TIMEZONE: 指定时区,默认为本地时区
|
||||
- -V: 打印出当前版本号
|
||||
|
||||
示例:
|
||||
### 非交互式执行
|
||||
|
||||
使用 `-s` 参数可进行非交互式执行 SQL,执行完成后退出,此模式适合在自动化脚本中使用。
|
||||
如以下命令连接到服务器 h1.taos.com, 执行 -s 指定的 SQL:
|
||||
```bash
|
||||
taos -h h1.taos.com -s "use db; show tables;"
|
||||
```
|
||||
|
||||
## 配置文件
|
||||
### taosc 配置文件
|
||||
|
||||
也可以通过配置文件中的参数设置来控制 TDengine CLI 的行为。可用配置参数请参考[客户端配置](../../components/taosc)
|
||||
使用 `-c` 参数改变 `taosc` 客户端加载配置文件的位置,客户端配置参数参考 [客户端配置](../../components/taosc)
|
||||
以下命令指定了 `taosc` 客户端加载 `/root/cfg/` 下的 `taos.cfg` 配置文件
|
||||
```bash
|
||||
taos -c /root/cfg/
|
||||
```
|
||||
|
||||
## 错误代码表
|
||||
在 TDengine 3.3.4.8 版本后 TDengine CLI 在返回错误信息中返回了具体错误码,用户可到 TDengine 官网错误码页面查找具体原因及解决措施,见:[错误码参考表](https://docs.taosdata.com/reference/error-code/)
|
||||
## 执行 SQL 脚本
|
||||
|
||||
## TDengine CLI TAB 键补全
|
||||
在 TDengine CLI 里可以通过 `source` 命令来运行脚本文件中的多条 SQL 命令。
|
||||
|
||||
```sql
|
||||
taos> source <filename>;
|
||||
```
|
||||
|
||||
## 数据导入/导出
|
||||
|
||||
### 导出查询结果
|
||||
|
||||
- 可以使用符号 “>>” 导出查询结果到某个文件中,语法为: sql 查询语句 >> ‘输出文件名’; 输出文件如果不写路径的话,将输出至当前目录下。如 select * from d0 >> ‘/root/d0.csv’; 将把查询结果输出到 /root/d0.csv 中。
|
||||
|
||||
### 数据从文件导入
|
||||
|
||||
- 可以使用 insert into table_name file '输入文件名',把上一步中导出的数据文件再导入到指定表中。如 insert into d0 file '/root/d0.csv'; 表示把上面导出的数据全部再导致至 d0 表中。
|
||||
|
||||
## 设置字符类型显示宽度
|
||||
|
||||
可以在 TDengine CLI 里使用如下命令调整字符显示宽度
|
||||
|
||||
```sql
|
||||
taos> SET MAX_BINARY_DISPLAY_WIDTH <nn>;
|
||||
```
|
||||
|
||||
如显示的内容后面以 ... 结尾时,表示该内容已被截断,可通过本命令修改显示字符宽度以显示完整的内容。
|
||||
|
||||
## TAB 键自动补全
|
||||
|
||||
- TAB 键前为空命令状态下按 TAB 键,会列出 TDengine CLI 支持的所有命令
|
||||
- TAB 键前为空格状态下按 TAB 键,会显示此位置可以出现的所有命令词的第一个,再次按 TAB 键切为下一个
|
||||
- TAB 键前为字符串,会搜索与此字符串前缀匹配的所有可出现命令词,并显示第一个,再次按 TAB 键切为下一个
|
||||
- 输入反斜杠 `\` + TAB 键, 会自动补全为列显示模式命令词 `\G;`
|
||||
|
||||
## TDengine CLI 小技巧
|
||||
## 使用小技巧
|
||||
|
||||
- 可以使用上下光标键查看历史输入的指令
|
||||
- 在 TDengine CLI 中使用 `alter user` 命令可以修改用户密码,缺省密码为 `taosdata`
|
||||
|
@ -107,10 +124,5 @@ taos -h h1.taos.com -s "use db; show tables;"
|
|||
- 执行 `RESET QUERY CACHE` 可清除本地表 Schema 的缓存
|
||||
- 批量执行 SQL 语句。可以将一系列的 TDengine CLI 命令(以英文 ; 结尾,每个 SQL 语句为一行)按行存放在文件里,在 TDengine CLI 里执行命令 `source <file-name>` 自动执行该文件里所有的 SQL 语句
|
||||
|
||||
## TDengine CLI 导出查询结果到文件中
|
||||
|
||||
- 可以使用符号 “>>” 导出查询结果到某个文件中,语法为: sql 查询语句 >> ‘输出文件名’; 输出文件如果不写路径的话,将输出至当前目录下。如 select * from d0 >> ‘/root/d0.csv’; 将把查询结果输出到 /root/d0.csv 中。
|
||||
|
||||
## TDengine CLI 导入文件中的数据到表中
|
||||
|
||||
- 可以使用 insert into table_name file '输入文件名',把上一步中导出的数据文件再导入到指定表中。如 insert into d0 file '/root/d0.csv'; 表示把上面导出的数据全部再导致至 d0 表中。
|
||||
## 错误代码表
|
||||
在 TDengine 3.3.4.8 版本后 TDengine CLI 在返回错误信息中返回了具体错误码,用户可到 TDengine 官网错误码页面查找具体原因及解决措施,见:[错误码参考表](https://docs.taosdata.com/reference/error-code/)
|
||||
|
|
|
@ -6,44 +6,24 @@ toc_max_heading_level: 4
|
|||
|
||||
taosdump 是为开源用户提供的 TDengine 数据备份/恢复工具,备份数据文件采用标准 [ Apache AVRO ](https://avro.apache.org/) 格式,方便与外界生态交换数据。taosdump 提供多种数据备份及恢复选项来满足不同需求,可通过 --help 查看支持的全部选项。
|
||||
|
||||
## 工具获取
|
||||
|
||||
## 安装
|
||||
taosdump 是 TDengine 服务器及客户端安装包中默认安装组件,安装后即可使用,参考 [TDengine 安装](../../../get-started/)
|
||||
|
||||
taosdump 是 TDengine 安装包中默认安装组件,安装 TDengine 后即可使用,可参考 [TDengine 安装](../../../get-started/)
|
||||
## 运行
|
||||
taosdump 需在命令行终端中运行,运行时必须带参数,指明是备份操作或还原操作,如:
|
||||
``` bash
|
||||
taosdump -h dev126 -D test -o /root/test/
|
||||
```
|
||||
以上命令表示备份主机名为 `dev126` 机器上的 `test` 数据库到 `/root/test/` 目录下
|
||||
|
||||
``` bash
|
||||
taosdump -h dev126 -i /root/test/
|
||||
```
|
||||
以上命令表示把 `/root/test/` 目录下之前备份的数据文件恢复到主机名为 `dev126` 的主机上
|
||||
|
||||
|
||||
## 常用使用场景
|
||||
|
||||
### taosdump 备份数据
|
||||
|
||||
1. 备份所有数据库:指定 `-A` 或 `--all-databases` 参数;
|
||||
2. 备份多个指定数据库:使用 `-D db1,db2,...` 参数;
|
||||
3. 备份指定数据库中某些超级表或普通表:使用 `dbname stbname1 stbname2 tbname1 tbname2 ...` 参数,注意这种输入序列第一个参数为数据库名称,且只支持一个数据库,第二个和之后的参数为该数据库中的超级表或普通表名称,中间以空格分隔;
|
||||
4. 备份系统 log 库:TDengine 集群通常会包含一个系统数据库,名为 `log`,这个数据库内的数据为 TDengine 自我运行的数据,taosdump 默认不会对 log 库进行备份。如果有特定需求对 log 库进行备份,可以使用 `-a` 或 `--allow-sys` 命令行参数。
|
||||
5. “宽容”模式备份:taosdump 1.4.1 之后的版本提供 `-n` 参数和 `-L` 参数,用于备份数据时不使用转义字符和“宽容”模式,可以在表名、列名、标签名没使用转义字符的情况下减少备份数据时间和备份数据占用空间。如果不确定符合使用 `-n` 和 `-L` 条件时请使用默认参数进行“严格”模式进行备份。转义字符的说明请参考[官方文档](../../taos-sql/escape)。
|
||||
6. `-o` 参数指定的目录下如果已存在备份文件,为防止数据被覆盖,taosdump 会报错并退出,请更换其它空目录或清空原来数据后再备份。
|
||||
7. 目前 taosdump 不支持数据断点继备功能,一旦数据备份中断,需要从头开始。如果备份需要很长时间,建议使用(-S -E 选项)指定开始/结束时间进行分段备份的方法,
|
||||
|
||||
:::tip
|
||||
- taosdump 1.4.1 之后的版本提供 `-I` 参数,用于解析 avro 文件 schema 和数据,如果指定 `-s` 参数将只解析 schema。
|
||||
- taosdump 1.4.2 之后的备份使用 `-B` 参数指定的批次数,默认值为 16384,如果在某些环境下由于网络速度或磁盘性能不足导致 "Error actual dump .. batch .." 可以通过 `-B` 参数调整为更小的值进行尝试。
|
||||
- taosdump 的导出不支持中断恢复,所以当进程意外终止后,正确的处理方式是删除当前已导出或生成的所有相关文件。
|
||||
- taosdump 的导入支持中断恢复,但是当进程重新启动时,会收到一些“表已经存在”的提示,可以忽视。
|
||||
|
||||
:::
|
||||
|
||||
### taosdump 恢复数据
|
||||
|
||||
- 恢复指定路径下的数据文件:使用 `-i` 参数加上数据文件所在路径。如前面提及,不应该使用同一个目录备份不同数据集合,也不应该在同一路径多次备份同一数据集,否则备份数据会造成覆盖或多次备份。
|
||||
- taosdump 支持数据恢复至新数据库名下,参数是 -W, 详细见命令行参数说明。
|
||||
|
||||
|
||||
:::tip
|
||||
taosdump 内部使用 TDengine stmt binding API 进行恢复数据的写入,为提高数据恢复性能,目前使用 16384 为一次写入批次。如果备份数据中有比较多列数据,可能会导致产生 "WAL size exceeds limit" 错误,此时可以通过使用 `-B` 参数调整为一个更小的值进行尝试。
|
||||
|
||||
:::
|
||||
|
||||
## 详细命令行参数列表
|
||||
## 命令行参数
|
||||
|
||||
以下为 taosdump 详细命令行参数列表:
|
||||
|
||||
|
@ -119,3 +99,34 @@ for any corresponding short options.
|
|||
|
||||
Report bugs to <support@taosdata.com>.
|
||||
```
|
||||
|
||||
## 常用使用场景
|
||||
|
||||
### taosdump 备份数据
|
||||
|
||||
1. 备份所有数据库:指定 `-A` 或 `--all-databases` 参数;
|
||||
2. 备份多个指定数据库:使用 `-D db1,db2,...` 参数;
|
||||
3. 备份指定数据库中某些超级表或普通表:使用 `dbname stbname1 stbname2 tbname1 tbname2 ...` 参数,注意这种输入序列第一个参数为数据库名称,且只支持一个数据库,第二个和之后的参数为该数据库中的超级表或普通表名称,中间以空格分隔;
|
||||
4. 备份系统 log 库:TDengine 集群通常会包含一个系统数据库,名为 `log`,这个数据库内的数据为 TDengine 自我运行的数据,taosdump 默认不会对 log 库进行备份。如果有特定需求对 log 库进行备份,可以使用 `-a` 或 `--allow-sys` 命令行参数。
|
||||
5. “宽容”模式备份:taosdump 1.4.1 之后的版本提供 `-n` 参数和 `-L` 参数,用于备份数据时不使用转义字符和“宽容”模式,可以在表名、列名、标签名没使用转义字符的情况下减少备份数据时间和备份数据占用空间。如果不确定符合使用 `-n` 和 `-L` 条件时请使用默认参数进行“严格”模式进行备份。转义字符的说明请参考[官方文档](../../taos-sql/escape)。
|
||||
6. `-o` 参数指定的目录下如果已存在备份文件,为防止数据被覆盖,taosdump 会报错并退出,请更换其它空目录或清空原来数据后再备份。
|
||||
7. 目前 taosdump 不支持数据断点继备功能,一旦数据备份中断,需要从头开始。如果备份需要很长时间,建议使用(-S -E 选项)指定开始/结束时间进行分段备份的方法,
|
||||
|
||||
:::tip
|
||||
- taosdump 1.4.1 之后的版本提供 `-I` 参数,用于解析 avro 文件 schema 和数据,如果指定 `-s` 参数将只解析 schema。
|
||||
- taosdump 1.4.2 之后的备份使用 `-B` 参数指定的批次数,默认值为 16384,如果在某些环境下由于网络速度或磁盘性能不足导致 "Error actual dump .. batch .." 可以通过 `-B` 参数调整为更小的值进行尝试。
|
||||
- taosdump 的导出不支持中断恢复,所以当进程意外终止后,正确的处理方式是删除当前已导出或生成的所有相关文件。
|
||||
- taosdump 的导入支持中断恢复,但是当进程重新启动时,会收到一些“表已经存在”的提示,可以忽视。
|
||||
|
||||
:::
|
||||
|
||||
### taosdump 恢复数据
|
||||
|
||||
- 恢复指定路径下的数据文件:使用 `-i` 参数加上数据文件所在路径。如前面提及,不应该使用同一个目录备份不同数据集合,也不应该在同一路径多次备份同一数据集,否则备份数据会造成覆盖或多次备份。
|
||||
- taosdump 支持数据恢复至新数据库名下,参数是 -W, 详细见命令行参数说明。
|
||||
|
||||
|
||||
:::tip
|
||||
taosdump 内部使用 TDengine stmt binding API 进行恢复数据的写入,为提高数据恢复性能,目前使用 16384 为一次写入批次。如果备份数据中有比较多列数据,可能会导致产生 "WAL size exceeds limit" 错误,此时可以通过使用 `-B` 参数调整为一个更小的值进行尝试。
|
||||
|
||||
:::
|
|
@ -6,9 +6,9 @@ toc_max_heading_level: 4
|
|||
|
||||
taosBenchmark 是 TDengine 产品性能基准测试工具,提供对 TDengine 产品写入、查询及订阅性能测试,输出性能指标。
|
||||
|
||||
## 安装
|
||||
## 工具获取
|
||||
|
||||
taosBenchmark 是 TDengine 安装包中默认安装组件,安装 TDengine 后即可使用,参考 [TDengine 安装](../../../get-started/)
|
||||
taosBenchmark 是 TDengine 服务器及客户端安装包中默认安装组件,安装后即可使用,参考 [TDengine 安装](../../../get-started/)
|
||||
|
||||
## 运行
|
||||
|
||||
|
@ -87,7 +87,7 @@ taosBenchmark -f <json file>
|
|||
|
||||
查看更多 json 配置文件示例可 [点击这里](https://github.com/taosdata/TDengine/tree/main/tools/taos-tools/example)
|
||||
|
||||
## 命令行参数详解
|
||||
## 命令行参数
|
||||
| 命令行参数 | 功能说明 |
|
||||
| ---------------------------- | ----------------------------------------------- |
|
||||
| -f/--file \<json file> | 要使用的 JSON 配置文件,由该文件指定所有参数,本参数与命令行其他参数不能同时使用。没有默认值 |
|
||||
|
@ -159,12 +159,10 @@ SUCC: insert delay, min: 19.6780ms, avg: 64.9390ms, p90: 94.6900ms, p95: 105.187
|
|||
查询性能测试主要输出查询请求速度 QPS 指标, 输出格式如下:
|
||||
``` bash
|
||||
complete query with 3 threads and 10000 query delay avg: 0.002686s min: 0.001182s max: 0.012189s p90: 0.002977s p95: 0.003493s p99: 0.004645s SQL command: select ...
|
||||
INFO: Total specified queries: 30000
|
||||
INFO: Spend 26.9530 second completed total queries: 30000, the QPS of all threads: 1113.049
|
||||
```
|
||||
- 第一行表示 3 个线程每个线程执行 10000 次查询及查询请求延时百分位分布情况,`SQL command` 为测试的查询语句
|
||||
- 第二行表示总共完成了 10000 * 3 = 30000 次查询总数
|
||||
- 第三行表示查询总耗时为 26.9653 秒,每秒查询率(QPS)为:1113.049 次/秒
|
||||
- 第二行表示查询总耗时为 26.9653 秒,每秒查询率(QPS)为:1113.049 次/秒
|
||||
- 如果在查询中设置了 `continue_if_fail` 选项为 `yes`,在最后一行中会输出失败请求个数及错误率,格式 error + 失败请求个数 (错误率)
|
||||
- QPS = 成功请求数量 / 花费时间(单位秒)
|
||||
- 错误率 = 失败请求数量 /(成功请求数量 + 失败请求数量)
|
||||
|
@ -185,7 +183,7 @@ INFO: Consumed total msgs: 3000, total rows: 30000000
|
|||
- 4 ~ 6 行是测试完成后每个消费者总体统计,统计共消费了多少条消息,共计多少行
|
||||
- 第 7 行所有消费者总体统计,`msgs` 表示共消费了多少条消息, `rows` 表示共消费了多少行数据
|
||||
|
||||
## 配置文件参数详解
|
||||
## 配置文件参数
|
||||
|
||||
### 通用配置参数
|
||||
|
||||
|
@ -217,7 +215,7 @@ INFO: Consumed total msgs: 3000, total rows: 30000000
|
|||
“continue_if_fail”: “yes”, 失败 taosBenchmark 警告用户,并继续写入
|
||||
“continue_if_fail”: “smart”, 如果子表不存在失败,taosBenchmark 会建立子表并继续写入
|
||||
|
||||
#### 数据库相关配置参数
|
||||
#### 数据库相关
|
||||
|
||||
创建数据库时的相关参数在 json 配置文件中的 `dbinfo` 中配置,个别具体参数如下。其余参数均与 TDengine 中 `create database` 时所指定的数据库参数相对应,详见[../../taos-sql/database]
|
||||
|
||||
|
@ -225,23 +223,7 @@ INFO: Consumed total msgs: 3000, total rows: 30000000
|
|||
|
||||
- **drop** : 数据库已存在时是否删除,可选项为 "yes" 或 "no", 默认为 “yes”
|
||||
|
||||
#### 流式计算相关配置参数
|
||||
|
||||
创建流式计算的相关参数在 json 配置文件中的 `stream` 中配置,具体参数如下。
|
||||
|
||||
- **stream_name** : 流式计算的名称,必填项。
|
||||
|
||||
- **stream_stb** : 流式计算对应的超级表名称,必填项。
|
||||
|
||||
- **stream_sql** : 流式计算的sql语句,必填项。
|
||||
|
||||
- **trigger_mode** : 流式计算的触发模式,可选项。
|
||||
|
||||
- **watermark** : 流式计算的水印,可选项。
|
||||
|
||||
- **drop** : 是否创建流式计算,可选项为 "yes" 或者 "no", 为 "no" 时不创建。
|
||||
|
||||
#### 超级表相关配置参数
|
||||
#### 超级表相关
|
||||
|
||||
创建超级表时的相关参数在 json 配置文件中的 `super_tables` 中配置,具体参数如下。
|
||||
|
||||
|
@ -303,7 +285,7 @@ INFO: Consumed total msgs: 3000, total rows: 30000000
|
|||
- **sqls** : 字符串数组类型,指定超级表创建成功后要执行的 sql 数组,sql 中指定表名前面要带数据库名,否则会报未指定数据库错误
|
||||
|
||||
|
||||
#### 标签列与数据列配置参数
|
||||
#### 标签列与数据列
|
||||
|
||||
指定超级表标签列与数据列的配置参数分别在 `super_tables` 中的 `columns` 和 `tag` 中。
|
||||
|
||||
|
@ -338,11 +320,11 @@ INFO: Consumed total msgs: 3000, total rows: 30000000
|
|||
|
||||
- **fillNull**: 字符串类型,指定此列是否随机插入 NULL 值,可指定为 “true” 或 "false", 只有当 generate_row_rule 为 2 时有效
|
||||
|
||||
#### 插入行为配置参数
|
||||
#### 插入行为相关
|
||||
|
||||
- **thread_count** : 插入数据的线程数量,默认为 8。
|
||||
|
||||
- **thread_bind_vgroup** : 写入时 vgroup 是否和写入线程绑定,绑定后可提升写入速度, 取值为 "yes" 或 "no",默认值为 “no”, 设置为 “no” 后与原来行为一致。 当设为 “yes” 时,如果 thread_count 大于写入数据库 vgroups 数量, thread_count 自动调整为 vgroups 数量;如果 thread_count 小于 vgroups 数量,写入线程数量不做调整,一个线程写完一个 vgroup 数据后再写下一个,同时保持一个 vgroup 同时只能由一个线程写入的规则。
|
||||
**thread_bind_vgroup** : 写入时 vgroup 是否和写入线程绑定,绑定后可提升写入速度, 取值为 "yes" 或 "no",默认值为 “no”, 设置为 “no” 后与原来行为一致。 当设为 “yes” 时,如果 thread_count 大于写入数据库 vgroups 数量, thread_count 自动调整为 vgroups 数量;如果 thread_count 小于 vgroups 数量,写入线程数量不做调整,一个线程写完一个 vgroup 数据后再写下一个,同时保持一个 vgroup 同时只能由一个线程写入的规则。
|
||||
|
||||
- **create_table_thread_count** : 建表的线程数量,默认为 8。
|
||||
|
||||
|
@ -374,7 +356,7 @@ interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为
|
|||
|
||||
其它通用参数详见[通用配置参数](#通用配置参数)。
|
||||
|
||||
#### 执行指定查询语句的配置参数
|
||||
#### 执行指定查询语句
|
||||
|
||||
查询指定表(可以指定超级表、子表或普通表)的配置参数在 `specified_table_query` 中设置。
|
||||
|
||||
|
@ -385,7 +367,7 @@ interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为
|
|||
`查询总次数` = `sqls` 个数 * `query_times` * `threads`
|
||||
|
||||
`混合查询`:`sqls` 中所有 sql 分成 `threads` 个组,每个线程执行一组, 每个 sql 都需执行 `query_times` 次查询
|
||||
`查询总次数` = `sqls` 个数 * `query_times`
|
||||
`查询总次数` = `sqls` 个数 * `query_times`
|
||||
|
||||
- **query_interval** : 查询时间间隔,单位: millisecond,默认值为 0。
|
||||
|
||||
|
@ -395,7 +377,7 @@ interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为
|
|||
- **sql**: 执行的 SQL 命令,必填。
|
||||
- **result**: 保存查询结果的文件,未指定则不保存。
|
||||
|
||||
#### 查询超级表的配置参数
|
||||
#### 查询超级表
|
||||
|
||||
查询超级表的配置参数在 `super_table_query` 中设置。
|
||||
超级表查询的线程模式与上面介绍的指定查询语句查询的 `正常查询` 模式相同,不同之处是本 `sqls` 使用所有子表填充。
|
||||
|
@ -415,8 +397,6 @@ interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为
|
|||
|
||||
订阅场景下 `filetype` 必须设置为 `subscribe`,该参数及其它通用参数详见[通用配置参数](#通用配置参数)
|
||||
|
||||
#### 执行指定订阅语句的配置参数
|
||||
|
||||
订阅指定表(可以指定超级表、子表或者普通表)的配置参数在 `specified_table_query` 中设置。
|
||||
|
||||
- **threads/concurrent** : 执行 SQL 的线程数,默认为 1。
|
||||
|
@ -425,7 +405,7 @@ interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为
|
|||
- **sql** : 执行的 SQL 命令,必填。
|
||||
|
||||
|
||||
#### 配置文件中数据类型书写对照表
|
||||
### 配置文件中数据类型书写对照表
|
||||
|
||||
| # | **引擎** | **taosBenchmark**
|
||||
| --- | :----------------: | :---------------:
|
||||
|
|
|
@ -215,7 +215,7 @@ SHOW db_name.ALIVE;
|
|||
|
||||
查询数据库 db_name 的可用状态,返回值 0:不可用 1:完全可用 2:部分可用(即数据库包含的 VNODE 部分节点可用,部分节点不可用)
|
||||
|
||||
## 查看DB 的磁盘空间占用
|
||||
## 查看 DB 的磁盘空间占用
|
||||
|
||||
```sql
|
||||
select * from INFORMATION_SCHEMA.INS_DISK_USAGE where db_name = 'db_name'
|
||||
|
|
|
@ -24,6 +24,8 @@ Node.js 连接器源码托管在 [GitHub](https://github.com/taosdata/taos-conne
|
|||
|
||||
| Node.js 连接器 版本 | 主要变化 | TDengine 版本 |
|
||||
| ------------------| ----------------------| ----------------|
|
||||
| 3.1.4 | 修改 readme | - |
|
||||
| 3.1.3 | 升级了 es5-ext 版本,解决低版本的漏洞 | - |
|
||||
| 3.1.2 | 对数据协议和解析进行了优化,性能得到大幅提升| - |
|
||||
| 3.1.1 | 优化了数据传输性能 | 3.3.2.0 及更高版本 |
|
||||
| 3.1.0 | 新版本发布,支持 WebSocket 连接 | 3.2.0.0 及更高版本 |
|
||||
|
@ -130,16 +132,20 @@ Node.js 连接器(`@tdengine/websocket`), 其通过 taosAdapter 提供的 We
|
|||
除了通过指定的 URL 获取连接,还可以使用 WSConfig 指定建立连接时的参数。
|
||||
|
||||
```js
|
||||
try {
|
||||
let url = 'ws://127.0.0.1:6041'
|
||||
let conf = WsSql.NewConfig(url)
|
||||
conf.setUser('root')
|
||||
conf.setPwd('taosdata')
|
||||
conf.setDb('db')
|
||||
conf.setTimeOut(500)
|
||||
let wsSql = await WsSql.open(conf);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
const taos = require("@tdengine/websocket");
|
||||
|
||||
async function createConnect() {
|
||||
try {
|
||||
let url = 'ws://127.0.0.1:6041'
|
||||
let conf = new taos.WSConfig(url)
|
||||
conf.setUser('root')
|
||||
conf.setPwd('taosdata')
|
||||
conf.setDb('db')
|
||||
conf.setTimeOut(500)
|
||||
let wsSql = await taos.sqlConnect(conf)
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -310,5 +310,17 @@ TDinsight插件中展示的数据是通过taosKeeper和taosAdapter服务收集
|
|||
### 34 超级表带 TAG 过滤查子查数据与直接查子表哪个块?
|
||||
直接查子表更快。超级表带 TAG 过滤查询子查数据是为满足查询方便性,同时可对多个子表中数据进行过滤,如果目的是追求性能并已明确查询子表,直接从子表查性能更高
|
||||
|
||||
### 35 如何查看数据压缩率指标?
|
||||
TDengine 目前只提供以表为统计单位的压缩率,数据库及整体还未提供,查看命令是在客户端 taos-CLI 中执行 `SHOW TABLE DISTRIBUTED table_name;` 命令,table_name 为要查看压缩率的表,可以为超级表、普通表及子表,详细可 [查看此处](https://docs.taosdata.com/reference/taos-sql/show/#show-table-distributed)
|
||||
### 35 如何查看数据库的数据压缩率和磁盘占用指标?
|
||||
TDengine 3.3.5.0 之前的版本,只提供以表为统计单位的压缩率,数据库及整体还未提供,查看命令是在客户端 taos-CLI 中执行 `SHOW TABLE DISTRIBUTED table_name;` 命令,table_name 为要查看压缩率的表,可以为超级表、普通表及子表,详细可 [查看此处](https://docs.taosdata.com/reference/taos-sql/show/#show-table-distributed)
|
||||
|
||||
TDengine 3.3.5.0 及以上的版本,还提供了数据库整体压缩率和磁盘空间占用统计。查看数据库整体的数据压缩率和磁盘空间占用的命令为 `SHOW db_name.disk_info;`,查看数据库各个模块的磁盘空间占用的命令为 `SELECT * FROM INFORMATION_SCHEMA.INS_DISK_USAGE WHERE db_name='db_name';`,db_name 为要查看的数据库名称。详细可 [查看此处](https://docs.taosdata.com/reference/taos-sql/database/#%E6%9F%A5%E7%9C%8B-db-%E7%9A%84%E7%A3%81%E7%9B%98%E7%A9%BA%E9%97%B4%E5%8D%A0%E7%94%A8)
|
||||
|
||||
### 36 短时间内,通过 systemd 重启 taosd 超过一定次数后重启失败,报错:start-limit-hit。
|
||||
问题描述:
|
||||
TDengine 3.3.5.1 及以上的版本,taosd.service 的 systemd 配置文件中,StartLimitInterval 参数从 60 秒调整为 900 秒。若在 900 秒内 taosd 服务重启达到 3 次,后续通过 systemd 启动 taosd 服务时会失败,执行 `systemctl status taosd.service` 显示错误:Failed with result 'start-limit-hit'。
|
||||
|
||||
问题原因:
|
||||
TDengine 3.3.5.1 之前的版本,StartLimitInterval 为 60 秒。若在 60 秒内无法完成 3 次重启(例如,因从 WAL(预写式日志)中恢复大量数据导致启动时间较长),则下一个 60 秒周期内的重启会重新计数,导致系统持续不断地重启 taosd 服务。为避免无限重启问题,将 StartLimitInterval 由 60 秒调整为 900 秒。因此,在使用 systemd 短时间内多次启动 taosd 时遇到 start-limit-hit 错误的机率增多。
|
||||
|
||||
问题解决:
|
||||
1)通过 systemd 重启 taosd 服务:推荐方法是先执行命令 `systemctl reset-failed taosd.service` 重置失败计数器,然后再通过 `systemctl restart taosd.service` 重启;若需长期调整,可手动修改 /etc/systemd/system/taosd.service 文件,将 StartLimitInterval 调小或将 StartLimitBurst 调大(注:重新安装 taosd 会重置该参数,需要重新修改),执行 `systemctl daemon-reload` 重新加载配置,然后再重启。2)也可以不通过 systemd 而是通过 taosd 命令直接重启 taosd 服务,此时不受 StartLimitInterval 和 StartLimitBurst 参数限制。
|
||||
|
|
|
@ -385,13 +385,24 @@ static void taosReserveOldLog(char *oldName, char *keepName) {
|
|||
|
||||
static void taosKeepOldLog(char *oldName) {
|
||||
if (oldName[0] != 0) {
|
||||
char compressFileName[PATH_MAX + 20];
|
||||
snprintf(compressFileName, PATH_MAX + 20, "%s.gz", oldName);
|
||||
if (taosCompressFile(oldName, compressFileName) == 0) {
|
||||
int32_t code = taosRemoveFile(oldName);
|
||||
if (code != 0) {
|
||||
TAOS_UNUSED(printf("failed to remove file:%s, reason:%s\n", oldName, tstrerror(code)));
|
||||
}
|
||||
int32_t code = 0, lino = 0;
|
||||
TdFilePtr oldFile = NULL;
|
||||
if ((oldFile = taosOpenFile(oldName, TD_FILE_READ))) {
|
||||
TAOS_CHECK_GOTO(taosLockFile(oldFile), &lino, _exit2);
|
||||
char compressFileName[PATH_MAX + 20];
|
||||
snprintf(compressFileName, PATH_MAX + 20, "%s.gz", oldName);
|
||||
TAOS_CHECK_GOTO(taosCompressFile(oldName, compressFileName), &lino, _exit1);
|
||||
TAOS_CHECK_GOTO(taosRemoveFile(oldName), &lino, _exit1);
|
||||
_exit1:
|
||||
TAOS_UNUSED(taosUnLockFile(oldFile));
|
||||
_exit2:
|
||||
TAOS_UNUSED(taosCloseFile(&oldFile));
|
||||
} else {
|
||||
code = terrno;
|
||||
}
|
||||
if (code != 0 && tsLogEmbedded == 1) { // print error messages only in embedded log mode
|
||||
// avoid using uWarn or uError, as they may open a new log file and potentially cause a deadlock.
|
||||
fprintf(stderr, "WARN: failed at line %d to keep old log file:%s, reason:%s\n", lino, oldName, tstrerror(code));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1041,7 +1052,7 @@ static void taosWriteLog(SLogBuff *pLogBuf) {
|
|||
}
|
||||
|
||||
#define LOG_ROTATE_INTERVAL 3600
|
||||
#if !defined(TD_ENTERPRISE) || defined(ASSERT_NOT_CORE)
|
||||
#if !defined(TD_ENTERPRISE) || defined(ASSERT_NOT_CORE) || defined(GRANTS_CFG)
|
||||
#define LOG_INACTIVE_TIME 7200
|
||||
#define LOG_ROTATE_BOOT 900
|
||||
#else
|
||||
|
|
|
@ -47,6 +47,80 @@ class TDTestCase:
|
|||
break
|
||||
return buildPath
|
||||
|
||||
def checkLogBak(self, logPath, expectLogBak):
|
||||
if platform.system().lower() == 'windows':
|
||||
return True
|
||||
result = False
|
||||
try:
|
||||
for file in os.listdir(logPath):
|
||||
file_path = os.path.join(logPath, file)
|
||||
if os.path.isdir(file_path):
|
||||
continue
|
||||
if file.endswith('.gz'):
|
||||
if expectLogBak:
|
||||
result = True
|
||||
else:
|
||||
raise Exception(f"Error: Found .gz file: {file_path}")
|
||||
if '.' in file:
|
||||
prefix, num_part = file.split('.', 1)
|
||||
logNum=0
|
||||
if num_part.isdigit():
|
||||
logNum = int(num_part)
|
||||
if logNum > 100:
|
||||
if not expectLogBak:
|
||||
raise Exception(f"Error: Found log file number >= 100: {file_path}")
|
||||
except Exception as e:
|
||||
raise Exception(f"Error: error occurred. Reason: {e}")
|
||||
return result
|
||||
|
||||
def checkTargetStrInFiles(self, filePaths, targetStr):
|
||||
result = False
|
||||
for filePath in filePaths:
|
||||
if not os.path.exists(filePath):
|
||||
continue
|
||||
try:
|
||||
with open(filePath, 'r', encoding='utf-8') as file:
|
||||
for line in file:
|
||||
if targetStr in line:
|
||||
result = True
|
||||
break
|
||||
except Exception as e:
|
||||
continue
|
||||
return result
|
||||
|
||||
def logRotateOccurred(self, logFiles, targetStr, maxRetry=15):
|
||||
result = False
|
||||
for i in range(maxRetry):
|
||||
if self.checkTargetStrInFiles(logFiles, targetStr):
|
||||
result = True
|
||||
break
|
||||
tdLog.info(f"wait {i+1} second(s) for log rotate")
|
||||
time.sleep(1)
|
||||
return result
|
||||
|
||||
def checkLogCompress(self):
|
||||
tdLog.info("Running check log compress")
|
||||
dnodePath = self.buildPath + "/../sim/dnode1"
|
||||
logPath = f"{dnodePath}/log"
|
||||
taosdLogFiles = [f"{logPath}/taosdlog.0", f"{logPath}/taosdlog.1"]
|
||||
logRotateStr="process log rotation"
|
||||
logRotateResult = self.logRotateOccurred(taosdLogFiles, logRotateStr)
|
||||
tdSql.checkEqual(True, logRotateResult)
|
||||
tdSql.checkEqual(False, self.checkLogBak(logPath, False))
|
||||
tdSql.execute("alter all dnodes 'logKeepDays 3'")
|
||||
tdSql.execute("alter all dnodes 'numOfLogLines 1000'")
|
||||
tdSql.execute("alter all dnodes 'debugFlag 143'")
|
||||
logCompress=False
|
||||
for i in range(30):
|
||||
logCompress=self.checkLogBak(logPath, True)
|
||||
if logCompress:
|
||||
break
|
||||
tdLog.info(f"wait {i+1} second(s) for log compress")
|
||||
time.sleep(1)
|
||||
tdSql.checkEqual(True, logCompress)
|
||||
tdSql.execute("alter all dnodes 'numOfLogLines 1000000'")
|
||||
tdSql.execute("alter all dnodes 'debugFlag 131'")
|
||||
|
||||
def prepareCfg(self, cfgPath, cfgDict):
|
||||
tdLog.info("make dir %s" % cfgPath)
|
||||
os.makedirs(cfgPath, exist_ok=True)
|
||||
|
@ -338,6 +412,7 @@ class TDTestCase:
|
|||
tdSql.checkEqual(True, os.path.exists(f"{dnodePath}/log/taoslog0.0"))
|
||||
|
||||
def run(self):
|
||||
self.checkLogCompress()
|
||||
self.checkLogOutput()
|
||||
self.checkLogRotate()
|
||||
self.closeTaosd()
|
||||
|
|
|
@ -411,9 +411,11 @@ func (p *Processor) Prepare() {
|
|||
|
||||
func (p *Processor) withDBName(tableName string) string {
|
||||
b := pool.BytesPoolGet()
|
||||
b.WriteByte('`')
|
||||
b.WriteString(p.db)
|
||||
b.WriteByte('.')
|
||||
b.WriteString("`.`")
|
||||
b.WriteString(tableName)
|
||||
b.WriteByte('`')
|
||||
return b.String()
|
||||
}
|
||||
|
||||
|
|
|
@ -119,3 +119,9 @@ func Test_getStatusStr(t *testing.T) {
|
|||
assert.Equal(t, tt.expected, res)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_withDBName(t *testing.T) {
|
||||
processor := &Processor{db: "db"}
|
||||
res := processor.withDBName("test")
|
||||
assert.Equal(t, res, "`db`.`test`")
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
import "testing"
|
||||
|
||||
func TestEmpty(t *testing.T) {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue