Skip to content

Support IoTDB 2.0 REST API in table model#552

Open
FireAlbel wants to merge 1 commit into
thulab:masterfrom
FireAlbel:master
Open

Support IoTDB 2.0 REST API in table model#552
FireAlbel wants to merge 1 commit into
thulab:masterfrom
FireAlbel:master

Conversation

@FireAlbel

Copy link
Copy Markdown

Changes

  • Support /rest/table/v1/insertTablet in IoTDB Table Model.
  • Add database, table, column_names, column_categories, and data_types.
  • Generate row-oriented values with the device_id TAG.
  • Restrict Table Model cleanup to the current benchmark database.
  • Validate both HTTP status and IoTDB business response code.
  • Apply WRITE_OPERATION_TIMEOUT_MS to OkHttp connect/read/write timeouts.
  • Preserve original exceptions in failed benchmark statuses.
  • Make REST port configurable, defaulting to 18080.

Tests

  • Added REST Table Model unit tests using MockWebServer.
  • Core tests: 150 passed.
  • IoTDB REST tests: 4 passed.
  • Maven package completed successfully.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/insertTablet with table payload fields (database, table, column_names, column_categories, data_types, row-oriented values).
  • 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 mockwebserver test dependency; add REST_PORT configuration.

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.

Comment on lines 93 to +96
try {
Response response = client.newCall(request).execute();
String body = response.body() == null ? "" : response.body().string();
boolean success = isSuccessful(response, body);
Comment on lines 186 to 190
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();

@SpriCoder SpriCoder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL~

}
if (benchmarkPassword != null && !benchmarkPassword.isEmpty()) {
config.setPASSWORD(benchmarkPassword);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe We need to maintain this thing in docs or somewhere

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, take a look at the review of copliot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants