diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f0108e530..74119f2c8 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -75,7 +75,7 @@ jobs:
id: compile-benchmark
run: |
cd ${{ github.workspace }}/iot-benchmark
- mvn clean package -am -pl core,influxdb,influxdb-2.0,tdengine,timescaledb,iotdb-1.0,iotdb-1.1,iotdb-0.13,iotdb-1.3 -DskipTests
+ mvn clean package -am -pl core,influxdb,influxdb-2.0,tdengine,timescaledb,iotdb-1.0,iotdb-1.1,iotdb-1.3 -DskipTests
# get time
- name: collect common info
shell: bash
@@ -98,16 +98,6 @@ jobs:
Java Version: java${{ matrix.java_version }}
draft: false
prerelease: false
- #---0.13
- - name: Upload benchmark-iotdb-0.13
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create-release.outputs.upload_url }}
- asset_path: ${{ github.workspace }}/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13.zip
- asset_name: benchmark-iotdb-0.13-java${{ matrix.java_version }}.zip
- asset_content_type: application/zip
#---1.0
- name: Upload benchmark-iotdb-1.0
uses: actions/upload-release-asset@v1
diff --git a/.github/workflows/release_history_commit.yml b/.github/workflows/release_history_commit.yml
index 8700c230f..d496f81ac 100644
--- a/.github/workflows/release_history_commit.yml
+++ b/.github/workflows/release_history_commit.yml
@@ -46,7 +46,7 @@ jobs:
id: compile-benchmark
run: |
cd ${{ github.workspace }}/iot-benchmark
- mvn clean package -am -pl core,influxdb,influxdb-2.0,tdengine,tdengine-3.0,timescaledb,iotdb-1.0,iotdb-1.1,iotdb-0.13 -DskipTests
+ mvn clean package -am -pl core,influxdb,influxdb-2.0,tdengine,tdengine-3.0,timescaledb,iotdb-1.0,iotdb-1.1,iotdb-1.3 -DskipTests
# get time
- name: collect common info
shell: bash
@@ -69,16 +69,6 @@ jobs:
Java Version: java${{ matrix.java_version }}
draft: false
prerelease: false
- #---0.13
- - name: Upload benchmark-iotdb-0.13
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create-release.outputs.upload_url }}
- asset_path: ${{ github.workspace }}/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13.zip
- asset_name: benchmark-iotdb-0.13-java${{ matrix.java_version }}.zip
- asset_content_type: application/zip
#---1.0
- name: Upload benchmark-iotdb-1.0
uses: actions/upload-release-asset@v1
diff --git a/README-cn.md b/README-cn.md
index f2b50f7e1..3ab4d0486 100644
--- a/README-cn.md
+++ b/README-cn.md
@@ -127,7 +127,7 @@ iot-benchmark的特点如下:
1. Java 8
2. Maven:不建议使用镜像源,国内可以使用阿里云镜像源。
3. 合适版本的数据库
- 1. Apache IoTDB >= v0.13([获取方式](https://github.com/apache/iotdb))
+ 1. Apache IoTDB >= v1.0([获取方式](https://github.com/apache/iotdb))
2. 其他的对应版本的数据库
4. CSV的记录模式只能在Linux系统中使用,记录测试过程中的相关系统信息。
5. 我们建议使用MacOs或Linux系统,本文以MacOS和Linux系统为例,如果使用Windows系统,请使用`conf`文件夹下的`benchmark.bat`脚本启动benchmark。
@@ -137,8 +137,8 @@ iot-benchmark的特点如下:
| :------------: | :-------------------: | :------------------------------------------------------------------------------- |
| 常规测试模式 | testWithDefaultPath | 支持多种读和写操作的混合负载 |
| 生成数据模式 | generateDataMode | Benchmark生成数据集到FILE_PATH路径中 |
-| 正确性写入模式 | verificationWriteMode | 从FILE_PATH路径中加载数据集进行写入,目前支持 IoTDB v0.13 及更新的版本 |
-| 正确性查询模式 | verificationQueryMode | 从FILE_PATH路径中加载数据集和数据库中进行比对,目前支持 IoTDB v0.13 及更新的版本 |
+| 正确性写入模式 | verificationWriteMode | 从FILE_PATH路径中加载数据集进行写入,目前支持 IoTDB v1.0 及更新的版本 |
+| 正确性查询模式 | verificationQueryMode | 从FILE_PATH路径中加载数据集和数据库中进行比对,目前支持 IoTDB v1.0 及更新的版本 |
## 5.3. iot-benchmark的编译构建
@@ -150,16 +150,15 @@ mvn clean package -Dmaven.test.skip=true
该命令会编译iot-benchmark的core模块,和所有其他相关的数据库。
-在完成编译后,以IoTDB v0.13为例,你可以进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`文件夹下,使用`./benchmark.sh`来启动对IoTDB v0.13的测试。
+在完成编译后,以IoTDB v1.0为例,你可以进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`文件夹下,使用`./benchmark.sh`来启动对IoTDB v1.0的测试。
-默认的配置文件存放在`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13/conf`下,您可以编辑`config.properties`来完成配置,请**注意的是,您需要将配置文件中的DB_SWITCH参数调整为您需要被测数据库**,其对应关系和可能取值如下所示:
+默认的配置文件存放在`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0/conf`下,您可以编辑`config.properties`来完成配置,请**注意的是,您需要将配置文件中的DB_SWITCH参数调整为您需要被测数据库**,其对应关系和可能取值如下所示:
| 数据库 | 版本 | 对应子项目 | DB_SWITCH |
| :------------------: | :------: | :-----------------: | :----------------------------------------------------------------------------------------------------------: |
| IoTDB | 1.3 | iotdb-1.3 | IoTDB-130-JDBC
IoTDB-130-SESSION_BY_TABLET
IoTDB-130-SESSION_BY_RECORD
IoTDB-130-SESSION_BY_RECORDS |
| IoTDB | 1.1 | iotdb-1.1 | IoTDB-110-JDBC
IoTDB-110-SESSION_BY_TABLET
IoTDB-110-SESSION_BY_RECORD
IoTDB-110-SESSION_BY_RECORDS |
| IoTDB | 1.0 | iotdb-1.0 | IoTDB-100-JDBC
IoTDB-100-SESSION_BY_TABLET
IoTDB-100-SESSION_BY_RECORD
IoTDB-100-SESSION_BY_RECORDS |
-| IoTDB | 0.13 | iotdb-0.13 | IoTDB-013-JDBC
IoTDB-013-SESSION_BY_TABLET
IoTDB-013-SESSION_BY_RECORD
IoTDB-013-SESSION_BY_RECORDS |
| InfluxDB | v1.x | influxdb | InfluxDB |
| InfluxDB | v2.0 | influxdb-2.0 | InfluxDB-2.0 |
| QuestDB | v6.0.7 | questdb | QuestDB |
@@ -210,7 +209,7 @@ CPU:I7-11700
```properties
HOST=127.0.0.1
PORT=6667
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
BENCHMARK_WORK_MODE=testWithDefaultPath
OPERATION_PROPORTION=1:0:0:0:0:0:0:0:0:0:0
GROUP_NUMBER=10
@@ -228,7 +227,7 @@ LOOP=10000
在启动测试之前,您需要在本机的6667端口启动IoTDB服务。
-之后您进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
+之后您进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
```sh
> ./benchmark.sh
@@ -258,7 +257,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -368,7 +367,7 @@ MAX_K=170000
HOST=127.0.0.1
PORT=6667
IS_DELETE_DATA=false
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
BENCHMARK_WORK_MODE=testWithDefaultPath
OPERATION_PROPORTION=0:1:1:1:1:1:1:1:1:1:1
GROUP_NUMBER=10
@@ -400,7 +399,7 @@ GROUP_BY_TIME_UNIT=20000
在启动测试之前,您需要在本机的6667端口启动IoTDB服务。
-之后您进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
+之后您进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
```sh
> ./benchmark.sh
@@ -429,7 +428,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -511,7 +510,7 @@ VALUE_RANGE_QUERY_DESC 5.44 0.52 2.05 2.68 3.62
HOST=127.0.0.1
PORT=6667
IS_DELETE_DATA=false
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
BENCHMARK_WORK_MODE=testWithDefaultPath
OPERATION_PROPORTION=1:1:1:1:1:1:1:1:1:1:1
GROUP_NUMBER=10
@@ -542,7 +541,7 @@ GROUP_BY_TIME_UNIT=20000
在启动测试之前,您需要在本机的6667端口启动IoTDB服务。
-之后您进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
+之后您进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
```sh
> ./benchmark.sh
@@ -571,7 +570,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -650,7 +649,7 @@ VALUE_RANGE_QUERY_DESC 13.19 0.37 0.65 0.86 1.46
HOST=127.0.0.1
PORT=6667
IS_DELETE_DATA=false
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
BENCHMARK_WORK_MODE=testWithDefaultPath
OPERATION_PROPORTION=1:1:1:1:1:1:1:1:1:1:1
GROUP_NUMBER=10
@@ -681,7 +680,7 @@ GROUP_BY_TIME_UNIT=20000
在启动测试之前,您需要在本机的6667端口启动IoTDB服务。
-之后您进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
+之后您进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
```sh
> ./benchmark.sh
@@ -700,7 +699,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -791,7 +790,7 @@ MONITOR_INTERVAL=0
在启动测试之前,您需要在本机的6667端口启动IoTDB服务。
-之后您进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
+之后您进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
```sh
> ./benchmark.sh
@@ -855,7 +854,7 @@ BIG_BATCH_SIZE=100
### 6.7.2. Benchmark的启动
-您进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
+您进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
```sh
> ./benchmark.sh
@@ -921,7 +920,7 @@ SENSORS=[s_0, s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9]
## 6.8. 正确性写入模式(单数据库,外部数据集)
-为了验证数据集写入的正确性,您可以使用该模式写入生成数据模式中生成的数据集,目前该模式仅支持IoTDB v0.13 及更新的版本和InfluxDB v1.x
+为了验证数据集写入的正确性,您可以使用该模式写入生成数据模式中生成的数据集,目前该模式仅支持IoTDB v1.0 及更新的版本和InfluxDB v1.x
### 6.8.1. Benchmark的配置
@@ -962,7 +961,7 @@ IS_COPY_MODE=true
在启动测试之前,您需要在本机的6667端口启动IoTDB服务。
-之后您进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
+之后您进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
```sh
> ./benchmark.sh
@@ -991,7 +990,7 @@ BENCHMARK_WORK_MODE=verificationWriteMode
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -1035,7 +1034,7 @@ INGESTION 0.52 0.02 0.02 0.03 0.03
在运行这个模式之前需要先使用正确性写入模式写入数据到数据库。
-为了验证数据集写入的正确性,您可以使用该模式查询写入到数据库中的数据集,目前该模式仅支持IoTDB v0.13 和 InfluxDB v1.x
+为了验证数据集写入的正确性,您可以使用该模式查询写入到数据库中的数据集,目前该模式仅支持IoTDB v1.0 和 InfluxDB v1.x
### 6.9.1. Benchmark的配置
@@ -1057,7 +1056,7 @@ BIG_BATCH_SIZE=100
在启动测试之前,您需要在本机的6667端口启动IoTDB服务。
-之后您进入到`iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
+之后您进入到`iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`中运行如下命令来启动Benchmark(目前仅Unix/OS X系统中执行如下脚本):
```sh
> ./benchmark.sh
@@ -1085,7 +1084,7 @@ BENCHMARK_WORK_MODE=verificationQueryMode
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -1130,7 +1129,7 @@ VERIFICATION_QUERY 14.48 0.96 11.40 12.67 14.43
为了更方便、快速完成正确性验证,iot-benchmark也支持双数据库模式。
1. 对于上文中提到的所有测试场景,除特别说明,均支持双数据库进行。请在`verification`项目中**启动测试**。
-2. 对于下文中的正确性验证的相关测试场景,均必须在双数据库模式下运行,并且目前仅支持IoTDB v0.13 及更新的版本和timescaledb。
+2. 对于下文中的正确性验证的相关测试场景,均必须在双数据库模式下运行,并且目前仅支持IoTDB v1.0 及更新的版本和timescaledb。
为了完成双数据库配置,您需要对`config.properties`完成如下修改:
@@ -1170,7 +1169,7 @@ IS_POINT_COMPARISON=false
```
BENCHMARK_WORK_MODE=testWithDefaultPath
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=127.0.0.1
PORT=6667
OPERATION_PROPORTION=1:0:0:0:0:0:0:0:0:0:0
@@ -1216,7 +1215,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=true
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
ANOTHER DBConfig=
DB_SWITCH=TimescaleDB
@@ -1300,7 +1299,7 @@ IS_POINT_COMPARISON=true
```
BENCHMARK_WORK_MODE=testWithDefaultPath
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=127.0.0.1
PORT=6667
OPERATION_PROPORTION=1:0:0:0:0:0:0:0:0:0:0
@@ -1346,7 +1345,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=true
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
ANOTHER DBConfig=
DB_SWITCH=TimescaleDB
@@ -1414,7 +1413,7 @@ IS_COMPARISON=true
```
BENCHMARK_WORK_MODE=testWithDefaultPath
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=127.0.0.1
PORT=6667
OPERATION_PROPORTION=0:1:1:1:1:1:1:1:1:1:1
@@ -1459,7 +1458,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=true
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
ANOTHER DBConfig=
DB_SWITCH=TimescaleDB
@@ -1561,7 +1560,7 @@ VALUE_RANGE_QUERY_DESC 1.61 0.14 0.30 0.43 0.72
[快速指引](./tdengine/README.md)
# 8. 正确性验证的进一步说明
-1. 目前正确性验证部分仅支持IoTDB v0.13 及更新的版本和TimeScaleDB
+1. 目前正确性验证部分仅支持IoTDB v1.0 及更新的版本和TimeScaleDB
2. [快速指引](verification/README.md)
# 9. 自动化脚本
@@ -1629,7 +1628,7 @@ LOOP=50 DEVICE_NUMBER=20 TEST
2. iot-benchmark的所有的数据库测试的实现均在各个maven子项目中。
3. 如果你想要使用IDEA等编辑器运行Benchmark:
1. 可以在每一个maven子项目下找到test文件目录下的TestEntrance,运行对应测试。
- 2. 以IoTDB 0.13为例,你可以运行`iotdb-0.13/src/main/test/cn/edu/tsinghua/iotdb/benchmark/TestEntrance`
+ 2. 以IoTDB 1.0为例,你可以运行`iotdb-1.0/src/main/test/cn/edu/tsinghua/iotdb/benchmark/TestEntrance`
# 11. 相关文章
Benchmark Time Series Database with iot-benchmark for IoT Scenarios
diff --git a/README.md b/README.md
index 8440d6672..d8f022c5a 100644
--- a/README.md
+++ b/README.md
@@ -124,7 +124,7 @@ To use iot-benchmark, you need to have:
1. Java 8
2. Maven: It is not recommended to use the mirror.
3. The appropriate version of the database
- - Apache IoTDB >= v0.13 ([Get it!](https://github.com/apache/iotdb))
+ - Apache IoTDB >= v1.0 ([Get it!](https://github.com/apache/iotdb))
- His corresponding version of the database
4. CSV recording modes can only be used in Linux systems to record relevant system information during the test.
@@ -134,8 +134,8 @@ To use iot-benchmark, you need to have:
| :------------------------: | :-------------------: | :-------------------------------------------------------------------------------------------------------------------------------- |
| Conventional test mode | testWithDefaultPath | Supports mixed loads of multiple read and write operations |
| Generate data mode | generateDataMode | Benchmark generates the data set to the FILE_PATH path |
-| Write mode of verification | verificationWriteMode | Load the data set from the FILE_PATH path for writing, currently supports IoTDB v0.13 and newer version is supported |
-| Query mode of verification | verificationQueryMode | Load the data set from the FILE_PATH path and compare it with the database. Currently, IoTDB v0.13 and newer version is supported |
+| Write mode of verification | verificationWriteMode | Load the data set from the FILE_PATH path for writing, currently supports IoTDB v1.0 and newer version is supported |
+| Query mode of verification | verificationQueryMode | Load the data set from the FILE_PATH path and compare it with the database. Currently, IoTDB v1.0 and newer version is supported |
## 5.3. Build of iot-benchmark
@@ -147,16 +147,15 @@ mvn clean package -Dmaven.test.skip=true
This will compile all versions of IoTDB and other database benchmarks. if you want to compile a specific database, go to the package and run the above command.
-After, for example, you can go to `/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`, and run `./benchmark.sh` to start iot-benchmark.
+After, for example, you can go to `/iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`, and run `./benchmark.sh` to start iot-benchmark.
-The default configuration file is stored under `iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13/conf`, you can edit `config.properties` to complete the configuration, please **note that you need to Adjust the DB_SWITCH parameter in the configuration file to the database you need to be tested**. The corresponding relationship and possible values are as follows:
+The default configuration file is stored under `iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0/conf`, you can edit `config.properties` to complete the configuration, please **note that you need to Adjust the DB_SWITCH parameter in the configuration file to the database you need to be tested**. The corresponding relationship and possible values are as follows:
| Database | Version | Corresponding Sub-project | DB_SWITCH |
| :------------------: | :------: | :-----------------------: | :----------------------------------------------------------------------------------------------------------: |
| IoTDB | 1.3 | iotdb-1.3 | IoTDB-130-JDBC
IoTDB-130-SESSION_BY_TABLET
IoTDB-130-SESSION_BY_RECORD
IoTDB-130-SESSION_BY_RECORDS |
| IoTDB | 1.1 | iotdb-1.1 | IoTDB-110-JDBC
IoTDB-110-SESSION_BY_TABLET
IoTDB-110-SESSION_BY_RECORD
IoTDB-110-SESSION_BY_RECORDS |
| IoTDB | 1.0 | iotdb-1.0 | IoTDB-100-JDBC
IoTDB-100-SESSION_BY_TABLET
IoTDB-100-SESSION_BY_RECORD
IoTDB-100-SESSION_BY_RECORDS |
-| IoTDB | 0.13 | iotdb-0.13 | IoTDB-013-JDBC
IoTDB-013-SESSION_BY_TABLET
IoTDB-013-SESSION_BY_RECORD
IoTDB-013-SESSION_BY_RECORDS |
| InfluxDB | v1.x | influxdb | InfluxDB |
| InfluxDB | v2.0 | influxdb-2.0 | InfluxDB-2.0 |
| QuestDB | v6.0.7 | questdb | QuestDB |
@@ -209,7 +208,7 @@ edit the corresponding parameters in the ```config.properties``` file as followi
```properties
HOST=127.0.0.1
PORT=6667
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
BENCHMARK_WORK_MODE=testWithDefaultPath
OPERATION_PROPORTION=1:0:0:0:0:0:0:0:0:0:0
GROUP_NUMBER=10
@@ -227,7 +226,7 @@ Currently, you can edit other configs, more config in [config.properties](config
Before running the test, you need to open the IoTDB service on port 6667.
-Then, you can go to `/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`, and run the startup script, currently we only support Unix/OS X system:
+Then, you can go to `/iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`, and run the startup script, currently we only support Unix/OS X system:
```sh
> ./benchmark.sh
@@ -257,7 +256,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -366,7 +365,7 @@ Edit the corresponding parameters in the ```config.properties``` file as followi
HOST=127.0.0.1
PORT=6667
IS_DELETE_DATA=false
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
BENCHMARK_WORK_MODE=testWithDefaultPath
OPERATION_PROPORTION=0:1:1:1:1:1:1:1:1:1:1
GROUP_NUMBER=10
@@ -399,7 +398,7 @@ GROUP_BY_TIME_UNIT=20000
Before running the test, you need to open the IoTDB service on port 6667.
-Then, you can go to `/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`, and run the startup script, currently we only support Unix/OS X system:
+Then, you can go to `/iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`, and run the startup script, currently we only support Unix/OS X system:
```sh
> ./benchmark.sh
@@ -428,7 +427,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -511,7 +510,7 @@ Modify the relevant parameters in the ```config.properties``` file as follows (p
HOST=127.0.0.1
PORT=6667
IS_DELETE_DATA=false
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
BENCHMARK_WORK_MODE=testWithDefaultPath
OPERATION_PROPORTION=1:1:1:1:1:1:1:1:1:1:1
GROUP_NUMBER=10
@@ -542,7 +541,7 @@ GROUP_BY_TIME_UNIT=20000
Before starting the test, you need to start the IoTDB service on port 6667 of the machine.
-Then you enter `iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13` and run the following command to start Benchmark (currently only execute the following script in Unix/OS X system):
+Then you enter `iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0` and run the following command to start Benchmark (currently only execute the following script in Unix/OS X system):
```sh
> ./benchmark.sh
@@ -571,7 +570,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -650,7 +649,7 @@ Modify the relevant parameters in the ```config.properties``` file as follows (p
HOST=127.0.0.1
PORT=6667
IS_DELETE_DATA=false
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
BENCHMARK_WORK_MODE=testWithDefaultPath
OPERATION_PROPORTION=1:1:1:1:1:1:1:1:1:1:1
GROUP_NUMBER=10
@@ -681,7 +680,7 @@ GROUP_BY_TIME_UNIT=20000
Before starting the test, you need to start the IoTDB service on port 6667 of the machine.
-Then you enter `iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13` and run the following command to start Benchmark (currently only execute the following script in Unix/OS X system):
+Then you enter `iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0` and run the following command to start Benchmark (currently only execute the following script in Unix/OS X system):
```sh
> ./benchmark.sh
@@ -710,7 +709,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -800,7 +799,7 @@ MONITOR_INTERVAL=0
Before running the test, you need to open the IoTDB service on port 6667.
-Then, you can go to `/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`, and run the startup script, currently we only support Unix/OS X system:
+Then, you can go to `/iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`, and run the startup script, currently we only support Unix/OS X system:
```sh
> ./benchmark.sh
@@ -861,7 +860,7 @@ BIG_BATCH_SIZE=100
### 6.7.2. Start
-Then, you can go to `/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`, and run the startup script, currently we only support Unix/OS X system:
+Then, you can go to `/iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`, and run the startup script, currently we only support Unix/OS X system:
```sh
> ./benchmark.sh
@@ -928,7 +927,7 @@ SENSORS=[s_0, s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9]
## 6.8. Write mode for Verificaiton (single database, external data set)
-In order to verify the correctness of the data set writing, you can use this mode to write the data set generated in the generated data mode. Currently this mode only supports IoTDB v0.13 and newer version, influxdb v1.x
+In order to verify the correctness of the data set writing, you can use this mode to write the data set generated in the generated data mode. Currently this mode only supports IoTDB v1.0 and newer version, influxdb v1.x
### 6.8.1. Configure
@@ -973,7 +972,7 @@ After that, you can start it.
Before running the test, you need to open the IoTDB service on port 6667.
-Then, you can go to `/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`, and run the startup script, currently we only support Unix/OS X system:
+Then, you can go to `/iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`, and run the startup script, currently we only support Unix/OS X system:
```sh
> ./benchmark.sh
@@ -1002,7 +1001,7 @@ BENCHMARK_WORK_MODE=verificationWriteMode
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -1046,7 +1045,7 @@ INGESTION 0.52 0.02 0.02 0.03 0.03
Before running this mode, you need to use the correctness write mode to write data to the database.
-In order to verify the correctness of the data set writing, you can use this mode to query the data set written to the database. Currently this mode only supports IoTDB v0.13 and newer version, influxdb v1.x
+In order to verify the correctness of the data set writing, you can use this mode to query the data set written to the database. Currently this mode only supports IoTDB v1.0 and newer version, influxdb v1.x
### 6.9.1. Configure
@@ -1069,7 +1068,7 @@ BIG_BATCH_SIZE=100
Before running the test, you need to open the IoTDB service on port 6667.
-Then, you can go to `/iot-benchmark/iotdb-0.13/target/iot-benchmark-iotdb-0.13`, and run the startup script, currently we only support Unix/OS X system:
+Then, you can go to `/iot-benchmark/iotdb-1.0/target/iot-benchmark-iotdb-1.0`, and run the startup script, currently we only support Unix/OS X system:
```sh
> ./benchmark.sh
@@ -1098,7 +1097,7 @@ BENCHMARK_WORK_MODE=verificationQueryMode
########### Database Connection Information ###########
DOUBLE_WRITE=false
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
########### Data Mode ###########
GROUP_NUMBER=10
@@ -1143,7 +1142,7 @@ VERIFICATION_QUERY 14.48 0.96 11.40 12.67 14.43
In order to more conveniently and quickly complete the correctness verification, iot-benchmark also supports dual database mode.
1. For all the test scenarios mentioned above, unless otherwise specified, dual databases are supported. Please **start the test** in the `verification` project.
-2. For the relevant test scenarios for correctness verification below, all must be run in dual database mode, and currently **only supports** iotdb-0.13 and newer version, and timescaledb.
+2. For the relevant test scenarios for correctness verification below, all must be run in dual database mode, and currently **only supports** iotdb-1.0 and newer version, and timescaledb.
In order to complete the dual database configuration, you need to make the following modifications to `config.properties`:
@@ -1182,7 +1181,7 @@ In addition, please modify the following configuration in `config.properties`:
```
BENCHMARK_WORK_MODE=testWithDefaultPath
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=127.0.0.1
PORT=6667
OPERATION_PROPORTION=1:0:0:0:0:0:0:0:0:0:0
@@ -1228,7 +1227,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=true
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
ANOTHER DBConfig=
DB_SWITCH=TimescaleDB
@@ -1312,7 +1311,7 @@ In addition, please modify the following configuration in `config.properties`:
```
BENCHMARK_WORK_MODE=testWithDefaultPath
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=127.0.0.1
PORT=6667
OPERATION_PROPORTION=1:0:0:0:0:0:0:0:0:0:0
@@ -1358,7 +1357,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=true
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
ANOTHER DBConfig=
DB_SWITCH=TimescaleDB
@@ -1426,7 +1425,7 @@ In addition, please modify the following configuration in `config.properties` (N
```
BENCHMARK_WORK_MODE=testWithDefaultPath
-DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=127.0.0.1
PORT=6667
OPERATION_PROPORTION=0:1:1:1:1:1:1:1:1:1:1
@@ -1472,7 +1471,7 @@ BENCHMARK_WORK_MODE=testWithDefaultPath
########### Database Connection Information ###########
DOUBLE_WRITE=true
DBConfig=
- DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+ DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
HOST=[127.0.0.1]
ANOTHER DBConfig=
DB_SWITCH=TimescaleDB
@@ -1583,7 +1582,7 @@ VALUE_RANGE_QUERY_DESC 1.61 0.14 0.30 0.43 0.72
# 8. Further explanation of correctness verification
-1. Now verification **only support** IoTDB v0.13 and newer version, TimescaleDB
+1. Now verification **only support** IoTDB v1.0 and newer version, TimescaleDB
2. [Quick Start](verification/README.md)
# 9. Perform Multiple Tests Automatically
@@ -1637,7 +1636,7 @@ In this case, if you want to know what is going on, you can check the log inform
2. The realization of all database tests of iot-benchmark are in each maven sub-project.
3. If you want to use an editor such as IDEA to run Benchmark:
1. You can find TestEntrance in the test file directory under each maven subproject, and run the corresponding test.
- 2. Taking IoTDB 0.13 as an example, you can run `iotdb-0.13/src/main/test/cn/edu/tsinghua/iotdb/benchmark/TestEntrance`
+ 2. Taking IoTDB 1.0 as an example, you can run `iotdb-1.0/src/main/test/cn/edu/tsinghua/iotdb/benchmark/TestEntrance`
# 11. Related Article
diff --git a/configuration/conf/README-cn.md b/configuration/conf/README-cn.md
index 65a94dac3..51e24dd4d 100644
--- a/configuration/conf/README-cn.md
+++ b/configuration/conf/README-cn.md
@@ -13,7 +13,7 @@
DNW=1时,搭配效果应与加入跨设备Batch之前完全一致,**此处分析DNW>1的情况**
- 与DB_SWITCH:
- - 数据库版本:目前支持IoTDB-013、IoTDB-110
+ - 数据库版本:IoTDB-110及更新版本
- insert方式:SESSION_BY_RECORDS模式允许DNW>1,SESSION_BY_RECORD、SESSION_BY_TABLET模式只允许DNW=1,参数不匹配则报错"The combination of DEVICE_NUM_PER_WRITE and insert-mode is not supported"
- 与BATCH_SIZE_PER_WRITE:BATCH_SIZE_PER_WRITE含义为单次向单个设备写入的行数,单次写入的总行数为DNW×BATCH_SIZE_PER_WRITE
- 与IS_CLIENT_BIND:支持true与false
diff --git a/configuration/conf/README.md b/configuration/conf/README.md
index ac55784fa..8bdece818 100644
--- a/configuration/conf/README.md
+++ b/configuration/conf/README.md
@@ -15,7 +15,7 @@ When `DNW`=1, the combination effect should be exactly the same as before adding
So we only analyze the case where `DNW`>1.
- With `DB_SWITCH`:
- - Database version: Currently only supports `IoTDB-013`.
+ - Database version: Currently only supports `IoTDB-110` and newer.
- Insert mode: `SESSION_BY_RECORDS` mode allows `DNW`>1, `SESSION_BY_RECORD` and `SESSION_BY_TABLET` modes only allow `DNW`=1, and an error will be reported if the parameters do not match("The combination of DEVICE_NUM_PER_WRITE and insert-mode is not supported").
- With `BATCH_SIZE_PER_WRITE`: `BATCH_SIZE_PER_WRITE` refers to the number of rows written to a single device in a single write operation. The total number of rows written in a single operation is `DNW` × `BATCH_SIZE_PER_WRITE`.
- With `IS_CLIENT_BIND`: True and false are both supported.
diff --git a/configuration/conf/config.properties b/configuration/conf/config.properties
index 55f8f02d6..8e08611fc 100644
--- a/configuration/conf/config.properties
+++ b/configuration/conf/config.properties
@@ -76,7 +76,7 @@
# IS_DOUBLE_WRITE=false
# 另一个写入的数据库,目前的格式为{name}{-version}{-insert mode}(注意-号)其全部参考值参见README文件
-# ANOTHER_DB_SWITCH=IoTDB-013-SESSION_BY_TABLET
+# ANOTHER_DB_SWITCH=IoTDB-100-SESSION_BY_TABLET
# 另一个写入的数据库的主机
# ANOTHER_HOST=127.0.0.1
@@ -177,7 +177,7 @@
# 是否使用vector
# VECTOR=true
-# 是否使用Debug模式,仅支持iotdb-0.13
+# 是否使用Debug模式,仅支持iotdb
# IOTDB_USE_DEBUG=false
# 使用DEBUG查询的比率 [0, 1]
diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Config.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Config.java
index 42f92e7a6..fc8400faf 100644
--- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Config.java
+++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Config.java
@@ -218,7 +218,7 @@ public class Config {
private String TEMPLATE_NAME = "BenchmarkTemplate";
/** Whether to use vector */
private boolean VECTOR = true;
- /** whether to use debug in iotdb-0.13 */
+ /** whether to use debug in iotdb */
private boolean IOTDB_USE_DEBUG = false;
/** the ratio of use debug */
private double IOTDB_USE_DEBUG_RATIO = 0.01;
diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/ConfigDescriptor.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/ConfigDescriptor.java
index 1d8d041c5..cd1a7c4b7 100644
--- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/ConfigDescriptor.java
+++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/ConfigDescriptor.java
@@ -715,11 +715,10 @@ private void checkQuery() {
private boolean checkDatabaseVerification(DBConfig dbConfig) {
boolean result = false;
if (dbConfig.getDB_SWITCH().getType() == DBType.IoTDB) {
- // support after iotdb 0.13
+ // support after iotdb 1.0
if (dbConfig.getDB_SWITCH().getVersion() == DBVersion.IOTDB_130
|| dbConfig.getDB_SWITCH().getVersion() == DBVersion.IOTDB_110
- || dbConfig.getDB_SWITCH().getVersion() == DBVersion.IOTDB_100
- || dbConfig.getDB_SWITCH().getVersion() == DBVersion.IOTDB_013) {
+ || dbConfig.getDB_SWITCH().getVersion() == DBVersion.IOTDB_100) {
result = true;
}
} else if (dbConfig.getDB_SWITCH().getType() == DBType.InfluxDB) {
@@ -735,7 +734,7 @@ private boolean checkDatabaseVerification(DBConfig dbConfig) {
}
if (!result) {
LOGGER.error(
- "Verification only support between iotdb v0.13 and newer version, timescaledb and influxdb 1.x");
+ "Verification only support between iotdb v1.0 and newer version, timescaledb and influxdb 1.x");
}
return result;
}
diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Constants.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Constants.java
index d660a55f7..09373b5b0 100644
--- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Constants.java
+++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Constants.java
@@ -69,12 +69,6 @@ public class Constants {
public static final String IOTDB100_ROUNDROBIN_SESSION_CLASS =
"cn.edu.tsinghua.iot.benchmark.iotdb100.IoTDBClusterSession";
- public static final String IOTDB013_JDBC_CLASS = "cn.edu.tsinghua.iot.benchmark.iotdb013.IoTDB";
- public static final String IOTDB013_SESSION_CLASS =
- "cn.edu.tsinghua.iot.benchmark.iotdb013.IoTDBSession";
- public static final String IOTDB013_ROUNDROBIN_SESSION_CLASS =
- "cn.edu.tsinghua.iot.benchmark.iotdb013.IoTDBClusterSession";
-
public static final String INFLUXDB_CLASS = "cn.edu.tsinghua.iot.benchmark.influxdb.InfluxDB";
public static final String INFLUXDB2_CLASS = "cn.edu.tsinghua.iot.benchmark.influxdb2.InfluxDB";
public static final String CNOSDB_CLASS = "cn.edu.tsinghua.iot.benchmark.cnosdb.CnosDB";
diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/DBFactory.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/DBFactory.java
index 83b80824c..5b3740d6c 100644
--- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/DBFactory.java
+++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/DBFactory.java
@@ -77,19 +77,6 @@ public IDatabase getDatabase(DBConfig dbConfig) throws SQLException {
dbClass = Constants.IOTDB100_SESSION_CLASS;
}
break;
- // IoTDB 0.13
- case DB_IOT_013_JDBC:
- dbClass = Constants.IOTDB013_JDBC_CLASS;
- break;
- case DB_IOT_013_SESSION_BY_TABLET:
- case DB_IOT_013_SESSION_BY_RECORD:
- case DB_IOT_013_SESSION_BY_RECORDS:
- if (config.isIS_ALL_NODES_VISIBLE()) {
- dbClass = Constants.IOTDB013_ROUNDROBIN_SESSION_CLASS;
- } else {
- dbClass = Constants.IOTDB013_SESSION_CLASS;
- }
- break;
case DB_INFLUX:
dbClass = Constants.INFLUXDB_CLASS;
break;
diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/enums/DBSwitch.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/enums/DBSwitch.java
index a33a1349e..9d01a7d03 100644
--- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/enums/DBSwitch.java
+++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/enums/DBSwitch.java
@@ -44,13 +44,6 @@ public enum DBSwitch {
DBType.IoTDB, DBVersion.IOTDB_100, DBInsertMode.INSERT_USE_SESSION_RECORD),
DB_IOT_100_SESSION_BY_RECORDS(
DBType.IoTDB, DBVersion.IOTDB_100, DBInsertMode.INSERT_USE_SESSION_RECORDS),
- DB_IOT_013_JDBC(DBType.IoTDB, DBVersion.IOTDB_013, DBInsertMode.INSERT_USE_JDBC),
- DB_IOT_013_SESSION_BY_TABLET(
- DBType.IoTDB, DBVersion.IOTDB_013, DBInsertMode.INSERT_USE_SESSION_TABLET),
- DB_IOT_013_SESSION_BY_RECORD(
- DBType.IoTDB, DBVersion.IOTDB_013, DBInsertMode.INSERT_USE_SESSION_RECORD),
- DB_IOT_013_SESSION_BY_RECORDS(
- DBType.IoTDB, DBVersion.IOTDB_013, DBInsertMode.INSERT_USE_SESSION_RECORDS),
DB_DOUBLE_IOT(DBType.DoubleIoTDB, null, null),
DB_INFLUX(DBType.InfluxDB, null, null),
diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/enums/DBVersion.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/enums/DBVersion.java
index 192c63d63..669bd0584 100644
--- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/enums/DBVersion.java
+++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/tsdb/enums/DBVersion.java
@@ -23,7 +23,6 @@ public enum DBVersion {
IOTDB_130("130"),
IOTDB_110("110"),
IOTDB_100("100"),
- IOTDB_013("013"),
InfluxDB_2("2.x"),
TimescaleDB_Cluster("cluster"),
TDengine_3("3");
diff --git a/iotdb-0.13/pom.xml b/iotdb-0.13/pom.xml
deleted file mode 100644
index 0ef6194cf..000000000
--- a/iotdb-0.13/pom.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-
-
-
- 4.0.0
-
- cn.edu.tsinghua
- iot-benchmark
- 1.0.0
- ../pom.xml
-
- iotdb-0.13
- Benchmark IoTDB 0.13
-
-
-
- cn.edu.tsinghua
- core
- ${project.version}
-
-
- org.apache.iotdb
- iotdb-jdbc
- 0.13.4
-
-
- org.apache.iotdb
- iotdb-session
- 0.13.4
-
-
-
-
- iot-benchmark-iotdb-0.13
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 3.1.0
-
-
-
- server-assembly
- package
-
- single
-
-
-
- src/assembly/assembly.xml
-
- false
-
-
- true
- true
-
-
-
-
-
-
-
-
-
diff --git a/iotdb-0.13/src/assembly/assembly.xml b/iotdb-0.13/src/assembly/assembly.xml
deleted file mode 100644
index b7b529671..000000000
--- a/iotdb-0.13/src/assembly/assembly.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
- IoTDB-0.13
-
- dir
- zip
-
- true
-
-
- lib
-
-
-
-
- ${maven.multiModuleProjectDirectory}/configuration/bin/
- bin
- 0755
-
-
- ${maven.multiModuleProjectDirectory}/configuration/conf/
- conf
-
-
-
-
-
-
-
-
- 0755
-
-
-
- 0755
-
-
-
-
- 0755
-
-
-
-
-
-
-
-
-
diff --git a/iotdb-0.13/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb013/IoTDB.java b/iotdb-0.13/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb013/IoTDB.java
deleted file mode 100644
index 2e43fe13b..000000000
--- a/iotdb-0.13/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb013/IoTDB.java
+++ /dev/null
@@ -1,932 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package cn.edu.tsinghua.iot.benchmark.iotdb013;
-
-import org.apache.iotdb.isession.template.Template;
-import org.apache.iotdb.isession.util.Version;
-import org.apache.iotdb.rpc.IoTDBConnectionException;
-import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.session.Session;
-import org.apache.iotdb.session.template.MeasurementNode;
-import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-
-import cn.edu.tsinghua.iot.benchmark.client.operation.Operation;
-import cn.edu.tsinghua.iot.benchmark.conf.Config;
-import cn.edu.tsinghua.iot.benchmark.conf.ConfigDescriptor;
-import cn.edu.tsinghua.iot.benchmark.entity.Batch.IBatch;
-import cn.edu.tsinghua.iot.benchmark.entity.DeviceSummary;
-import cn.edu.tsinghua.iot.benchmark.entity.Record;
-import cn.edu.tsinghua.iot.benchmark.entity.Sensor;
-import cn.edu.tsinghua.iot.benchmark.entity.enums.SensorType;
-import cn.edu.tsinghua.iot.benchmark.exception.DBConnectException;
-import cn.edu.tsinghua.iot.benchmark.measurement.Status;
-import cn.edu.tsinghua.iot.benchmark.schema.schemaImpl.DeviceSchema;
-import cn.edu.tsinghua.iot.benchmark.tsdb.DBConfig;
-import cn.edu.tsinghua.iot.benchmark.tsdb.IDatabase;
-import cn.edu.tsinghua.iot.benchmark.tsdb.TsdbException;
-import cn.edu.tsinghua.iot.benchmark.utils.TimeUtils;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.AggRangeQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.AggRangeValueQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.AggValueQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.DeviceQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.GroupByQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.LatestPointQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.PreciseQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.RangeQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.ValueRangeQuery;
-import cn.edu.tsinghua.iot.benchmark.workload.query.impl.VerificationQuery;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-/** this class will create more than one connection. */
-public class IoTDB implements IDatabase {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(IoTDB.class);
- private static final String ALREADY_KEYWORD = "already";
- private static final String TEMPLATE_NAME = "BenchmarkTemplate";
- private static final AtomicBoolean templateInit = new AtomicBoolean(false);
- protected final String DELETE_SERIES_SQL;
- protected SingleNodeJDBCConnection ioTDBConnection;
-
- protected static final Config config = ConfigDescriptor.getInstance().getConfig();
- protected static final CyclicBarrier templateBarrier =
- new CyclicBarrier(config.getCLIENT_NUMBER());
- protected static final CyclicBarrier schemaBarrier = new CyclicBarrier(config.getCLIENT_NUMBER());
- protected static Set storageGroups = Collections.synchronizedSet(new HashSet<>());
- protected final String ROOT_SERIES_NAME;
- protected ExecutorService service;
- protected Future> future;
- protected DBConfig dbConfig;
- protected Random random = new Random(config.getDATA_SEED());
-
- public IoTDB(DBConfig dbConfig) {
- this.dbConfig = dbConfig;
- ROOT_SERIES_NAME = "root." + dbConfig.getDB_NAME();
- DELETE_SERIES_SQL = "delete storage group root." + dbConfig.getDB_NAME() + ".*";
- }
-
- @Override
- public void init() throws TsdbException {
- if (ioTDBConnection == null) {
- try {
- ioTDBConnection = new SingleNodeJDBCConnection(dbConfig);
- ioTDBConnection.init();
- this.service = Executors.newSingleThreadExecutor();
- } catch (Exception e) {
- throw new TsdbException(e);
- }
- }
- }
-
- @Override
- public void cleanup() {
- try (Statement statement = ioTDBConnection.getConnection().createStatement()) {
- statement.execute(DELETE_SERIES_SQL);
- LOGGER.info("Finish clean data!");
- } catch (Exception e) {
- LOGGER.warn("No Data to Clean!");
- }
- }
-
- @Override
- public void close() throws TsdbException {
- if (ioTDBConnection != null) {
- ioTDBConnection.close();
- }
- if (service != null) {
- service.shutdownNow();
- }
- if (future != null) {
- future.cancel(true);
- }
- }
-
- @Override
- public Double registerSchema(List schemaList) throws TsdbException {
- // create timeseries one by one is too slow in current cluster server.
- // therefore, we use session to create time series in batch.
- long start = System.nanoTime();
- long end;
- if (config.hasWrite()) {
- Map> sessionListMap = new HashMap<>();
- try {
- // open meta session
- if (!config.isIS_ALL_NODES_VISIBLE()) {
- Session metaSession =
- new Session.Builder()
- .host(dbConfig.getHOST().get(0))
- .port(Integer.parseInt(dbConfig.getPORT().get(0)))
- .username(dbConfig.getUSERNAME())
- .password(dbConfig.getPASSWORD())
- .version(Version.V_0_13)
- .build();
- metaSession.open(config.isENABLE_THRIFT_COMPRESSION());
- sessionListMap.put(metaSession, createTimeseries(schemaList));
- } else {
- int sessionNumber = dbConfig.getHOST().size();
- List keys = new ArrayList<>();
- for (int i = 0; i < sessionNumber; i++) {
- Session metaSession =
- new Session.Builder()
- .host(dbConfig.getHOST().get(i))
- .port(Integer.parseInt(dbConfig.getPORT().get(i)))
- .username(dbConfig.getUSERNAME())
- .password(dbConfig.getPASSWORD())
- .version(Version.V_0_13)
- .build();
- metaSession.open(config.isENABLE_THRIFT_COMPRESSION());
- keys.add(metaSession);
- sessionListMap.put(metaSession, new ArrayList<>());
- }
- for (int i = 0; i < schemaList.size(); i++) {
- sessionListMap
- .get(keys.get(i % sessionNumber))
- .add(createTimeseries(schemaList.get(i)));
- }
- }
-
- if (config.isTEMPLATE() && templateInit.compareAndSet(false, true)) {
- Template template = null;
- if (config.isTEMPLATE() && schemaList.size() > 0) {
- template = createTemplate(schemaList.get(0));
- }
- start = System.nanoTime();
- int sessionIndex = random.nextInt(sessionListMap.size());
- Session templateSession = new ArrayList<>(sessionListMap.keySet()).get(sessionIndex);
- registerTemplate(templateSession, template);
- } else {
- start = System.nanoTime();
- }
- templateBarrier.await();
- for (Map.Entry> pair : sessionListMap.entrySet()) {
- registerStorageGroups(pair.getKey(), pair.getValue());
- }
- schemaBarrier.await();
- if (!config.isTEMPLATE()) {
- for (Map.Entry> pair : sessionListMap.entrySet()) {
- registerTimeseries(pair.getKey(), pair.getValue());
- }
- }
- } catch (Exception e) {
- throw new TsdbException(e);
- } finally {
- if (sessionListMap.size() != 0) {
- Set sessions = sessionListMap.keySet();
- for (Session session : sessions) {
- try {
- session.close();
- } catch (IoTDBConnectionException e) {
- LOGGER.error("Schema-register session cannot be closed: {}", e.getMessage());
- }
- }
- }
- }
- }
- end = System.nanoTime();
- return TimeUtils.convertToSeconds(end - start, "ns");
- }
-
- /** create template */
- private Template createTemplate(DeviceSchema deviceSchema) {
- Template template = null;
- if (config.isTEMPLATE()) {
- if (config.isVECTOR()) {
- template = new Template(TEMPLATE_NAME, true);
- } else {
- template = new Template(TEMPLATE_NAME, false);
- }
- try {
- for (Sensor sensor : deviceSchema.getSensors()) {
- MeasurementNode measurementNode =
- new MeasurementNode(
- sensor.getName(),
- Enum.valueOf(TSDataType.class, sensor.getSensorType().name),
- Enum.valueOf(TSEncoding.class, getEncodingType(sensor.getSensorType())),
- Enum.valueOf(CompressionType.class, config.getCOMPRESSOR()));
- template.addToTemplate(measurementNode);
- }
- } catch (StatementExecutionException e) {
- LOGGER.error(e.getMessage());
- return null;
- }
- }
- return template;
- }
-
- /** register template */
- private void registerTemplate(Session metaSession, Template template)
- throws IoTDBConnectionException, IOException {
- try {
- metaSession.createSchemaTemplate(template);
- } catch (StatementExecutionException ignore) {
- // do nothing
- }
- }
-
- private void registerStorageGroups(Session metaSession, List schemaList)
- throws TsdbException {
- // get all storage groups
- Set groups = new HashSet<>();
- for (TimeseriesSchema timeseriesSchema : schemaList) {
- DeviceSchema schema = timeseriesSchema.getDeviceSchema();
- synchronized (IoTDB.class) {
- if (!storageGroups.contains(schema.getGroup())) {
- groups.add(schema.getGroup());
- storageGroups.add(schema.getGroup());
- }
- }
- }
- // register storage groups
- for (String group : groups) {
- try {
- metaSession.setStorageGroup(ROOT_SERIES_NAME + "." + group);
- if (config.isTEMPLATE()) {
- metaSession.setSchemaTemplate(TEMPLATE_NAME, ROOT_SERIES_NAME + "." + group);
- }
- } catch (Exception e) {
- handleRegisterException(e);
- }
- }
- }
-
- private TimeseriesSchema createTimeseries(DeviceSchema deviceSchema) {
- List paths = new ArrayList<>();
- List tsDataTypes = new ArrayList<>();
- List tsEncodings = new ArrayList<>();
- List compressionTypes = new ArrayList<>();
- for (Sensor sensor : deviceSchema.getSensors()) {
- if (config.isVECTOR()) {
- paths.add(sensor.getName());
- } else {
- paths.add(getSensorPath(deviceSchema, sensor.getName()));
- }
- SensorType datatype = sensor.getSensorType();
- tsDataTypes.add(Enum.valueOf(TSDataType.class, datatype.name));
- tsEncodings.add(Enum.valueOf(TSEncoding.class, getEncodingType(datatype)));
- compressionTypes.add(Enum.valueOf(CompressionType.class, config.getCOMPRESSOR()));
- }
- TimeseriesSchema timeseriesSchema =
- new TimeseriesSchema(deviceSchema, paths, tsDataTypes, tsEncodings, compressionTypes);
- if (config.isVECTOR()) {
- timeseriesSchema.setDeviceId(getDevicePath(deviceSchema));
- }
- return timeseriesSchema;
- }
-
- private List createTimeseries(List schemaList) {
- List timeseriesSchemas = new ArrayList<>();
- for (DeviceSchema deviceSchema : schemaList) {
- TimeseriesSchema timeseriesSchema = createTimeseries(deviceSchema);
- timeseriesSchemas.add(timeseriesSchema);
- }
- return timeseriesSchemas;
- }
-
- private void registerTimeseries(Session metaSession, List timeseriesSchemas)
- throws TsdbException {
- // create time series
- for (TimeseriesSchema timeseriesSchema : timeseriesSchemas) {
- try {
- if (config.isVECTOR()) {
- metaSession.createAlignedTimeseries(
- timeseriesSchema.getDeviceId(),
- timeseriesSchema.getPaths(),
- timeseriesSchema.getTsDataTypes(),
- timeseriesSchema.getTsEncodings(),
- timeseriesSchema.getCompressionTypes(),
- null);
- } else {
- metaSession.createMultiTimeseries(
- timeseriesSchema.getPaths(),
- timeseriesSchema.getTsDataTypes(),
- timeseriesSchema.getTsEncodings(),
- timeseriesSchema.getCompressionTypes(),
- null,
- null,
- null,
- null);
- }
- } catch (Exception e) {
- handleRegisterException(e);
- }
- }
- }
-
- private void handleRegisterException(Exception e) throws TsdbException {
- // ignore if already has the time series
- if (!e.getMessage().contains(ALREADY_KEYWORD) && !e.getMessage().contains("300")) {
- LOGGER.error("Register IoTDB schema failed because ", e);
- throw new TsdbException(e);
- }
- }
-
- @Override
- public Status insertOneBatch(IBatch batch) throws DBConnectException {
- try (Statement statement = ioTDBConnection.getConnection().createStatement()) {
- for (Record record : batch.getRecords()) {
- String sql =
- getInsertOneBatchSql(
- batch.getDeviceSchema(), record.getTimestamp(), record.getRecordDataValue());
- statement.addBatch(sql);
- }
- statement.executeBatch();
- return new Status(true);
- } catch (Exception e) {
- return new Status(false, 0, e, e.toString());
- }
- }
-
- /**
- * Q1: PreciseQuery SQL: select {sensors} from {devices} where time = {time}
- *
- * @param preciseQuery universal precise query condition parameters
- * @return
- */
- @Override
- public Status preciseQuery(PreciseQuery preciseQuery) {
- String strTime = preciseQuery.getTimestamp() + "";
- String sql = getSimpleQuerySqlHead(preciseQuery.getDeviceSchema()) + " WHERE time = " + strTime;
- return executeQueryAndGetStatus(sql, Operation.PRECISE_QUERY);
- }
-
- /**
- * Q2: RangeQuery SQL: select {sensors} from {devices} where time >= {startTime} and time <=
- * {endTime}
- *
- * @param rangeQuery universal range query condition parameters
- * @return
- */
- @Override
- public Status rangeQuery(RangeQuery rangeQuery) {
- String sql =
- getRangeQuerySql(
- rangeQuery.getDeviceSchema(),
- rangeQuery.getStartTimestamp(),
- rangeQuery.getEndTimestamp());
- return executeQueryAndGetStatus(sql, Operation.RANGE_QUERY);
- }
-
- /**
- * Q3: ValueRangeQuery SQL: select {sensors} from {devices} where time >= {startTime} and time <=
- * {endTime} and {sensors} > {value}
- *
- * @param valueRangeQuery contains universal range query with value filter parameters
- * @return
- */
- @Override
- public Status valueRangeQuery(ValueRangeQuery valueRangeQuery) {
- String sql = getValueRangeQuerySql(valueRangeQuery);
- return executeQueryAndGetStatus(sql, Operation.VALUE_RANGE_QUERY);
- }
-
- /**
- * Q4: AggRangeQuery SQL: select {AggFun}({sensors}) from {devices} where time >= {startTime} and
- * time <= {endTime}
- *
- * @param aggRangeQuery contains universal aggregation query with time filter parameters
- * @return
- */
- @Override
- public Status aggRangeQuery(AggRangeQuery aggRangeQuery) {
- String aggQuerySqlHead =
- getAggQuerySqlHead(aggRangeQuery.getDeviceSchema(), aggRangeQuery.getAggFun());
- String sql =
- addWhereTimeClause(
- aggQuerySqlHead, aggRangeQuery.getStartTimestamp(), aggRangeQuery.getEndTimestamp());
- return executeQueryAndGetStatus(sql, Operation.AGG_RANGE_QUERY);
- }
-
- /**
- * Q5: AggValueQuery SQL: select {AggFun}({sensors}) from {devices} where {sensors} > {value}
- *
- * @param aggValueQuery contains universal aggregation query with value filter parameters
- * @return
- */
- @Override
- public Status aggValueQuery(AggValueQuery aggValueQuery) {
- String aggQuerySqlHead =
- getAggQuerySqlHead(aggValueQuery.getDeviceSchema(), aggValueQuery.getAggFun());
- String sql =
- aggQuerySqlHead
- + " WHERE "
- + getValueFilterClause(
- aggValueQuery.getDeviceSchema(), (int) aggValueQuery.getValueThreshold())
- .substring(4);
- return executeQueryAndGetStatus(sql, Operation.AGG_VALUE_QUERY);
- }
-
- /**
- * Q6: AggRangeValueQuery SQL: select {AggFun}({sensors}) from {devices} where time >= {startTime}
- * and time <= {endTime} and {sensors} > {value}
- *
- * @param aggRangeValueQuery contains universal aggregation query with time and value filters
- * parameters
- * @return
- */
- @Override
- public Status aggRangeValueQuery(AggRangeValueQuery aggRangeValueQuery) {
- String aggQuerySqlHead =
- getAggQuerySqlHead(aggRangeValueQuery.getDeviceSchema(), aggRangeValueQuery.getAggFun());
- String sql =
- addWhereTimeClause(
- aggQuerySqlHead,
- aggRangeValueQuery.getStartTimestamp(),
- aggRangeValueQuery.getEndTimestamp());
- sql +=
- getValueFilterClause(
- aggRangeValueQuery.getDeviceSchema(), (int) aggRangeValueQuery.getValueThreshold());
- return executeQueryAndGetStatus(sql, Operation.AGG_RANGE_VALUE_QUERY);
- }
-
- /**
- * Q7: GroupByQuery SQL: select {AggFun}({sensors}) from {devices} group by ([{start}, {end}],
- * {Granularity}ms)
- *
- * @param groupByQuery contains universal group by query condition parameters
- * @return
- */
- @Override
- public Status groupByQuery(GroupByQuery groupByQuery) {
- String aggQuerySqlHead =
- getAggQuerySqlHead(groupByQuery.getDeviceSchema(), groupByQuery.getAggFun());
- String sql =
- addGroupByClause(
- aggQuerySqlHead,
- groupByQuery.getStartTimestamp(),
- groupByQuery.getEndTimestamp(),
- groupByQuery.getGranularity());
- return executeQueryAndGetStatus(sql, Operation.GROUP_BY_QUERY);
- }
-
- /**
- * Q8: LatestPointQuery SQL: select last {sensors} from {devices}
- *
- * @param latestPointQuery contains universal latest point query condition parameters
- * @return
- */
- @Override
- public Status latestPointQuery(LatestPointQuery latestPointQuery) {
- String aggQuerySqlHead = getLatestPointQuerySql(latestPointQuery.getDeviceSchema());
- return executeQueryAndGetStatus(aggQuerySqlHead, Operation.LATEST_POINT_QUERY);
- }
-
- /**
- * Q9: RangeQuery SQL: select {sensors} from {devices} where time >= {startTime} and time <=
- * {endTime} order by time desc
- *
- * @param rangeQuery universal range query condition parameters
- * @return
- */
- @Override
- public Status rangeQueryOrderByDesc(RangeQuery rangeQuery) {
- String sql =
- getRangeQuerySql(
- rangeQuery.getDeviceSchema(),
- rangeQuery.getStartTimestamp(),
- rangeQuery.getEndTimestamp())
- + " order by time desc";
- return executeQueryAndGetStatus(sql, Operation.RANGE_QUERY_ORDER_BY_TIME_DESC);
- }
-
- /**
- * Q10: ValueRangeQuery SQL: select {sensors} from {devices} where time >= {startTime} and time <=
- * {endTime} and {sensors} > {value} order by time desc
- *
- * @param valueRangeQuery contains universal range query with value filter parameters
- * @return
- */
- @Override
- public Status valueRangeQueryOrderByDesc(ValueRangeQuery valueRangeQuery) {
- String sql = getValueRangeQuerySql(valueRangeQuery) + " order by time desc";
- return executeQueryAndGetStatus(sql, Operation.VALUE_RANGE_QUERY_ORDER_BY_TIME_DESC);
- }
-
- /**
- * Generate simple query header.
- *
- * @param devices schema list of query devices
- * @return Simple Query header. e.g. Select sensors from devices
- */
- protected String getSimpleQuerySqlHead(List devices) {
- StringBuilder builder = new StringBuilder();
- builder.append("SELECT ");
- List querySensors = devices.get(0).getSensors();
- builder.append(querySensors.get(0).getName());
- for (int i = 1; i < querySensors.size(); i++) {
- builder.append(", ").append(querySensors.get(i).getName());
- }
- return addFromClause(devices, builder);
- }
-
- private String getAggQuerySqlHead(List devices, String aggFun) {
- StringBuilder builder = new StringBuilder();
- builder.append("SELECT ");
- List querySensors = devices.get(0).getSensors();
- builder.append(aggFun).append("(").append(querySensors.get(0).getName()).append(")");
- for (int i = 1; i < querySensors.size(); i++) {
- builder
- .append(", ")
- .append(aggFun)
- .append("(")
- .append(querySensors.get(i).getName())
- .append(")");
- }
- return addFromClause(devices, builder);
- }
-
- /**
- * Add from Clause
- *
- * @param devices
- * @param builder
- * @return From clause, e.g. FROM devices
- */
- private String addFromClause(List devices, StringBuilder builder) {
- builder.append(" FROM ").append(getDevicePath(devices.get(0)));
- for (int i = 1; i < devices.size(); i++) {
- builder.append(", ").append(getDevicePath(devices.get(i)));
- }
- return builder.toString();
- }
-
- private String getValueRangeQuerySql(ValueRangeQuery valueRangeQuery) {
- String rangeQuerySql =
- getRangeQuerySql(
- valueRangeQuery.getDeviceSchema(),
- valueRangeQuery.getStartTimestamp(),
- valueRangeQuery.getEndTimestamp());
- String valueFilterClause =
- getValueFilterClause(
- valueRangeQuery.getDeviceSchema(), (int) valueRangeQuery.getValueThreshold());
- return rangeQuerySql + valueFilterClause;
- }
-
- private String getValueFilterClause(List deviceSchemas, int valueThreshold) {
- StringBuilder builder = new StringBuilder();
- for (DeviceSchema deviceSchema : deviceSchemas) {
- for (Sensor sensor : deviceSchema.getSensors()) {
- builder
- .append(" AND ")
- .append(getDevicePath(deviceSchema))
- .append(".")
- .append(sensor.getName())
- .append(" > ")
- .append(valueThreshold);
- }
- }
- return builder.toString();
- }
-
- private String getLatestPointQuerySql(List devices) {
- StringBuilder builder = new StringBuilder();
- builder.append("SELECT last ");
- List querySensors = devices.get(0).getSensors();
- builder.append(querySensors.get(0).getName());
- for (int i = 1; i < querySensors.size(); i++) {
- builder.append(", ").append(querySensors.get(i).getName());
- }
- return addFromClause(devices, builder);
- }
-
- private String getRangeQuerySql(List deviceSchemas, long start, long end) {
- return addWhereTimeClause(getSimpleQuerySqlHead(deviceSchemas), start, end);
- }
-
- private String addWhereTimeClause(String prefix, long start, long end) {
- String startTime = start + "";
- String endTime = end + "";
- return prefix + " WHERE time >= " + startTime + " AND time <= " + endTime;
- }
-
- private String addGroupByClause(String prefix, long start, long end, long granularity) {
- return prefix + " group by ([" + start + "," + end + ")," + granularity + "ms) ";
- }
-
- /**
- * convert deviceSchema to the format
- *
- * @param deviceSchema
- * @return format, e.g. root.group_1.d_1
- */
- protected String getDevicePath(DeviceSchema deviceSchema) {
- StringBuilder name = new StringBuilder(ROOT_SERIES_NAME);
- name.append(".").append(deviceSchema.getGroup());
- for (Map.Entry pair : deviceSchema.getTags().entrySet()) {
- name.append(".").append(pair.getValue());
- }
- name.append(".").append(deviceSchema.getDevice());
- return name.toString();
- }
-
- protected Status executeQueryAndGetStatus(String sql, Operation operation) {
- String executeSQL;
- if (config.isIOTDB_USE_DEBUG() && random.nextDouble() < config.getIOTDB_USE_DEBUG_RATIO()) {
- executeSQL = "debug " + sql;
- } else {
- executeSQL = sql;
- }
- if (!config.isIS_QUIET_MODE()) {
- LOGGER.info("{} query SQL: {}", Thread.currentThread().getName(), executeSQL);
- }
- AtomicLong queryResultPointNum = new AtomicLong();
- AtomicBoolean isOk = new AtomicBoolean(true);
- try (Statement statement = ioTDBConnection.getConnection().createStatement()) {
- List> records = new ArrayList<>();
- future =
- service.submit(
- () -> {
- long resultNum = 0;
- try (ResultSet resultSet = statement.executeQuery(executeSQL)) {
- while (resultSet.next()) {
- switch (operation) {
- case LATEST_POINT_QUERY:
- resultNum++;
- break;
- default:
- resultNum += resultSet.getMetaData().getColumnCount() - 1;
- break;
- }
- if (config.isIS_COMPARISON()) {
- List