-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table model data deletion #13878
base: master
Are you sure you want to change the base?
Table model data deletion #13878
Conversation
# Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/LoadTsFileAnalyzer.java
# Conflicts: # pom.xml
…ble_data_deletion
…ble_data_deletion # Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/modification/IDPredicate.java
# Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/load/LoadTsFileManager.java
# Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/InsertionCrossSpaceCompactionTask.java
# Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionUtils.java
# Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
* Update IoTDBTableIT.java * Update DataNodeInternalRPCServiceImpl.java
// TODO: implement | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw Exception may be better? @Caideyipi @SteveYurongSu can plan when to support this.
...re/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
Outdated
Show resolved
Hide resolved
if (tsFileResource.getStartTime(device) < timeLowerBoundForCurrentDevice) { | ||
ttlDeletion = | ||
new Deletion( | ||
new TreeDeletionEntry( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should distinguish between tree models and table models for current device.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -194,8 +195,9 @@ public File getFileFromDataDirsIfAnyAdjuvantFileExists() { | |||
File file = FSFactoryProducer.getFSFactory().getFile(dataDir, partialFileString); | |||
if (file.exists() | |||
|| new File(file.getAbsolutePath() + TsFileResource.RESOURCE_SUFFIX).exists() | |||
|| new File(file.getAbsolutePath() + ModificationFile.FILE_SUFFIX).exists() | |||
|| new File(file.getAbsolutePath() + ModificationFile.COMPACTION_FILE_SUFFIX).exists()) { | |||
|| ModificationFileV1.getNormalMods(file).exists() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also check the compaction mods file v1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if (!checkAndDeleteFile(file)) { | ||
File resourceFile = | ||
getFileFromDataDirs(tsFileIdentifier.getFilePath() + TsFileResource.RESOURCE_SUFFIX); | ||
if (!checkAndDeleteFile(resourceFile)) { | ||
success = false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also check old version mods files and compaction mods files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -263,9 +263,9 @@ public void testCompactionWithAllDeletion() throws IOException, IllegalPathExcep | |||
writer.endFile(); | |||
} | |||
resource1 | |||
.getModFile() | |||
.write(new Deletion(new MeasurementPath(deviceID, ""), Long.MAX_VALUE, Long.MAX_VALUE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May use TableDeletionEntry because the device is table model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* drop column * Update IoTDBTableIT.java * Update IoTDBTableIT.java
…ble_data_deletion
# Conflicts: # iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
* adaptation * Fix * Update DeleteDevice.java * Update AnalyzeUtils.java * Update IoTDBDeviceIT.java
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
Grammar definition:
Examples:
Assumed table schema in examples:
vehicle1(deviceType STRING ID, deviceId STRING ID, s0 INT32 MEASUREMENT, s1 INT64 MEASUREMENT)
Supported examples:
Unsupported examples:
Evaluation
Notice: compaction is disabled in all tests to avoid files being removed.
Write performance
We evaluate the time consumption of a single deletion over different numbers of files involved.
The experiment is performed by writing x TsFiles on a 1C1D instance
and then performing a deletion on all of them 5 times,
recording the average time consumption.
Below are the results
"Before" refers to the master branch (using the tree model),
while "after" is this branch (using the table model).
The results show that the time consumption is linear to the number of files, which is expected.
The parallel deletion optimization reduces the time consumption to around 1/3.
It is noticeable that both lines go up suddenly after a threshold,
which is about 2400 for "after" and 3800 for "before".
It is most possible that the cache of the CPU or the disk is overflowed and the IO efficiency is thus reduced.
Read performance
We also experiment on the effects of deletions on queries.
In this test, we write 100 TsFiles, each only with 100 points of 1 time series.
Then, after writing x deletions, each like
DELETE FROM test.table1 WHERE deviceId = 'd0',
we perfom 10 queries like
SELECT * FROM test.table1
and record the average query latency.
The following picture gives the results:
Similarly, "Before" refers to the master branch (using the tree model),
while "after" is this branch (using the table model).
As expected, the more deletions are written the slower queries will be,
and the query latency is about linear to the number of deletions.
Compared with "Before", the "After" line may reduce the query latency by about 40%,
due to the more compact binary format.