feat: TsFile 2.x table-model real dataset (read + generate)#545
Open
SpriCoder wants to merge 15 commits into
Open
feat: TsFile 2.x table-model real dataset (read + generate)#545SpriCoder wants to merge 15 commits into
SpriCoder wants to merge 15 commits into
Conversation
…stribution DataReader.getInstance now returns a TsFileDataReader and RealMetaDataSchema picks TsFileSchemaReader, distributing whole *.tsfile files round-robin across data clients, when REAL_DATASET_FORMAT==TSFILE. The CSV device->file scheme is preserved unchanged. listTsFiles is promoted to public so the cross-package schema impl can reuse it.
…void NPE when client count > device count)
…PE on malformed/external datasets)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds TsFile 2.x table-model as a real-dataset format alongside CSV, selected by a new
REAL_DATASET_FORMAT=CSV|TSFILEconfig (defaultCSV). Works on both sides:generateDataMode): exports the synthetic dataset as TsFiles (one.tsfileper(client, table)underFILE_PATH/<table>/data_<clientId>.tsfile) plus aninfo.txtsnapshot.verificationWriteMode/verificationQueryMode): replays a TsFile dataset, streamingbatches grouped by device.
Semantic mapping: a benchmark device = a
device_idTAG value within a table; FIELD columns =sensors; TIME column = record timestamp.
coregains anorg.apache.tsfile:tsfile:2.2.1dependency(aligned with what
iotdb-2.0already resolves). CSV / Copy paths are unchanged.Key components (all in
core):conf/RealDatasetFormat+REAL_DATASET_FORMATwired throughConfig/ConfigDescriptor/config.propertiessource/TsFileTableModelMapping—SensorType↔TSDataType+ column classificationsource/TsFileSchemaReader,source/TsFileDataReader(read);extern/TsFileSchemaWriter,extern/TsFileDataWriter(generate)DataReader.getInstance,RealMetaDataSchema(file-level distribution),SchemaWriter.getBasicWriter,DataWriter.getDataWriterSchemaReader.checkDataSetlifted to the base (shared by CSV + TsFile) and hardened against a shorterinfo.txtGenerateDataWriteClientcloses the writer on finish (TsFile footer)Try it locally (generate → replay)
Two phases: generate writes a TsFile dataset to disk (no DB required); verify replays it into a
running IoTDB 2.0 (table model) with write/query verification.
Build
mvn clean package -pl iotdb-2.0 -am -Dmaven.test.skip=true cd iotdb-2.0/target/iot-benchmark-iotdb-2.0/iot-benchmark-iotdb-2.0Phase 1 — generate the TsFile dataset (no DB needed). In
conf/config.properties:Run
./benchmark.sh. Output (ls -R data/tsfile-demo):Phase 2 — replay into IoTDB 2.0 (table model) + verify. Start an IoTDB 2.0 instance, then in the
same
config.propertieschange only:Run
./benchmark.sh(write verification); then setBENCHMARK_WORK_MODE=verificationQueryModeand runagain (query verification).
Robustness — abnormal-config / malformed-dataset handling
Hardened against NPEs surfaced while running the flow end to end:
SCHEMA_CLIENT_NUMBER=DATA_CLIENT_NUMBER=20with 5devices): every client id now gets a (possibly empty) device bucket, so
SchemaClientno longer NPEs.device_idvalue, or a table with no TAG column): rows with nousable device identifier are skipped with a warning instead of NPEing in device-name parsing.
info.txt(afterREAL_DATASET_FORMATwas appended totoInfoText()):checkDataSet()treats a missing line as a difference instead of throwingIndexOutOfBounds.Test Plan
mvn -B test -pl core— full core suite green (incl. new unit + end-to-end round-trip + edge-case/NPE regression tests)mvn spotless:checkcleanmvn clean install -pl iotdb-2.0 -am -DskipTestsbuilds (cross-module, shares tsfile dep)RealMetaDataSchema+TsFileDataReader, values matchRealMetaDataSchemaTeststill passes (CSV path unchanged)generateDataMode+REAL_DATASET_FORMAT=TSFILE, thenverificationWriteModeFollow-ups (non-blocking)
DataReader.close()to release TsFile handles on early stop (currently matches existing CSV reader behavior — handles freed on normal exhaustion)