You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2024/09/10 07:05:09 UTC
(iotdb) branch rc/1.3.3 updated: fix index out of bound exception in settle compaction task (#13463)
This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch rc/1.3.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rc/1.3.3 by this push:
new 0a7d24f47c5 fix index out of bound exception in settle compaction task (#13463)
0a7d24f47c5 is described below
commit 0a7d24f47c56109358635caa96468570319a5a0c
Author: shuwenwei <55...@users.noreply.github.com>
AuthorDate: Tue Sep 10 15:05:04 2024 +0800
fix index out of bound exception in settle compaction task (#13463)
---
.../execute/task/SettleCompactionTask.java | 8 ++++++
.../settle/SettleCompactionTaskTest.java | 31 ++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/SettleCompactionTask.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/SettleCompactionTask.java
index 21ca36833d1..2a6d6e6099b 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/SettleCompactionTask.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/SettleCompactionTask.java
@@ -359,6 +359,14 @@ public class SettleCompactionTask extends InnerSpaceCompactionTask {
return totalModsFileSize;
}
+ @Override
+ public long getEstimatedMemoryCost() {
+ if (filesView.sourceFilesInCompactionPerformer.isEmpty()) {
+ return 0;
+ }
+ return super.getEstimatedMemoryCost();
+ }
+
@Override
public String toString() {
return storageGroupName
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/settle/SettleCompactionTaskTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/settle/SettleCompactionTaskTest.java
index 721dddc3532..0f10939527b 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/settle/SettleCompactionTaskTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/settle/SettleCompactionTaskTest.java
@@ -448,6 +448,37 @@ public class SettleCompactionTaskTest extends AbstractCompactionTest {
validateTargetDatas(sourceDatas, Collections.emptyList());
}
+ @Test
+ public void testTaskEstimateMemory()
+ throws IOException, MetadataException, WriteProcessException {
+ ICompactionPerformer performer = getPerformer();
+ if (performer instanceof ReadPointCompactionPerformer) {
+ // not implemented
+ return;
+ }
+ createFiles(3, 3, 10, 100, 0, 0, 0, 0, isAligned, true);
+ SettleCompactionTask task1 =
+ new SettleCompactionTask(
+ 0,
+ tsFileManager,
+ Collections.singletonList(seqResources.get(0)),
+ Arrays.asList(seqResources.get(1), seqResources.get(2)),
+ true,
+ performer,
+ 0);
+
+ SettleCompactionTask task2 =
+ new SettleCompactionTask(
+ 0, tsFileManager, seqResources, Collections.emptyList(), true, performer, 0);
+
+ SettleCompactionTask task3 =
+ new SettleCompactionTask(
+ 0, tsFileManager, Collections.emptyList(), seqResources, true, performer, 0);
+ Assert.assertTrue(task1.getEstimatedMemoryCost() > 0);
+ Assert.assertEquals(0, task2.getEstimatedMemoryCost());
+ Assert.assertTrue(task3.getEstimatedMemoryCost() > 0);
+ }
+
public static List<PartialPath> createTimeseries(
int deviceNum, int measurementNum, boolean isAligned) throws IllegalPathException {
List<PartialPath> timeseriesPath = new ArrayList<>();