Support IoTDB 2.0 REST API in table model#552
Conversation
There was a problem hiding this comment.
Pull request overview
Adds IoTDB 2.0 REST API support for the Table Model in the iot-benchmark IoTDB 2.0 module, including table-oriented payload generation, configurable REST port, improved response validation, and dedicated unit tests for the REST Table Model behavior.
Changes:
- Add Table Model REST insert support via
/rest/table/v1/insertTabletwith table payload fields (database,table,column_names,column_categories,data_types, row-orientedvalues). - Improve REST client behavior (timeouts from
WRITE_OPERATION_TIMEOUT_MS, validate HTTP + business code, restrict cleanup scope, preserve exceptions for insert failures). - Add MockWebServer-based unit tests and introduce
mockwebservertest dependency; addREST_PORTconfiguration.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| iotdb-2.0/src/test/java/cn/edu/tsinghua/iot/benchmark/iotdb200/IoTDBRestAPITest.java | Adds unit tests validating Table Model endpoints/payloads, cleanup scope, business-code failure handling, and timeout configuration. |
| iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/IoTDBRestAPI.java | Implements Table Model REST endpoints/payload generation, config-driven REST port/timeouts, and response validation. |
| iotdb-2.0/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb200/IoTDB.java | Adds constructor option to skip DML strategy initialization (used by REST tests). |
| iotdb-2.0/pom.xml | Adds OkHttp MockWebServer as a test dependency. |
| core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/ConfigDescriptor.java | Loads REST port and allows TABLE mode when insert mode is REST; adds some env overrides. |
| core/src/main/java/cn/edu/tsinghua/iot/benchmark/conf/Config.java | Introduces REST_PORT config with default 18080. |
| configuration/conf/config.properties | Documents REST_PORT configuration option. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try { | ||
| Response response = client.newCall(request).execute(); | ||
| String body = response.body() == null ? "" : response.body().string(); | ||
| boolean success = isSuccessful(response, body); |
| try { | ||
| Response response = client.newCall(request).execute(); | ||
| String body = response.body().string(); | ||
| IoTDBRestQueryResult queryResult = new Gson().fromJson(body, IoTDBRestQueryResult.class); | ||
| IoTDBRestQueryResult queryResult = GSON.fromJson(body, IoTDBRestQueryResult.class); | ||
| response.close(); |
| } | ||
| if (benchmarkPassword != null && !benchmarkPassword.isEmpty()) { | ||
| config.setPASSWORD(benchmarkPassword); | ||
| } |
There was a problem hiding this comment.
This component is designed to inject usernames and passwords through environment variables for cloud server-side testing, so as to enhance the robustness of configuration.
There was a problem hiding this comment.
Maybe We need to maintain this thing in docs or somewhere
There was a problem hiding this comment.
By the way, take a look at the review of copliot
Changes
/rest/table/v1/insertTabletin IoTDB Table Model.database,table,column_names,column_categories, anddata_types.valueswith thedevice_idTAG.WRITE_OPERATION_TIMEOUT_MSto OkHttp connect/read/write timeouts.18080.Tests