Skip to content

Commit a7f1527

Browse files
authored
reduce error log when compaction service is stopped & fix bugs (#16756)
* reduce error log when compaction service is stopped * fix writer for compaction tests * fix npe
1 parent 3a63220 commit a7f1527

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/AbstractCompactionTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ protected void handleException(Logger logger, Exception e) {
164164
} else if (e instanceof InterruptedException
165165
|| Thread.interrupted()
166166
|| e instanceof StopReadTsFileByInterruptException
167-
|| !tsFileManager.isAllowCompaction()) {
167+
|| !tsFileManager.isAllowCompaction()
168+
|| CompactionTaskManager.getInstance().isStopAllCompactionWorker()) {
168169
logger.warn(
169170
"{}-{} [Compaction] {} task interrupted",
170171
storageGroupName,

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/InnerSpaceCompactionTask.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ public InnerSpaceCompactionTask(
116116
}
117117

118118
protected static class InnerCompactionTaskFilesView {
119-
protected List<TsFileResource> sortedAllSourceFilesInTask;
120-
protected List<TsFileResource> sourceFilesInCompactionPerformer;
121-
protected List<TsFileResource> skippedSourceFiles;
119+
protected List<TsFileResource> sortedAllSourceFilesInTask = Collections.emptyList();
120+
protected List<TsFileResource> sourceFilesInCompactionPerformer = Collections.emptyList();
121+
protected List<TsFileResource> skippedSourceFiles = Collections.emptyList();
122122
protected boolean sequence;
123-
protected List<TsFileResource> sourceFilesInLog;
124-
protected List<TsFileResource> targetFilesInLog;
125-
protected List<TsFileResource> targetFilesInPerformer;
126-
protected List<TsFileResource> renamedTargetFiles;
123+
protected List<TsFileResource> sourceFilesInLog = Collections.emptyList();
124+
protected List<TsFileResource> targetFilesInLog = Collections.emptyList();
125+
protected List<TsFileResource> targetFilesInPerformer = Collections.emptyList();
126+
protected List<TsFileResource> renamedTargetFiles = Collections.emptyList();
127127

128128
protected long selectedFileSize;
129129
protected int sumOfCompactionCount;

iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/utils/CompactionTestFileWriter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.apache.iotdb.db.storageengine.dataregion.compaction.utils;
2121

22+
import org.apache.iotdb.db.storageengine.dataregion.compaction.io.CompactionTsFileWriter;
23+
import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.constant.CompactionType;
2224
import org.apache.iotdb.db.storageengine.dataregion.tsfile.TsFileResource;
2325

2426
import org.apache.tsfile.enums.TSDataType;
@@ -49,7 +51,9 @@ public class CompactionTestFileWriter implements Closeable {
4951

5052
public CompactionTestFileWriter(TsFileResource emptyFile) throws IOException {
5153
this.resource = emptyFile;
52-
fileWriter = new TsFileIOWriter(emptyFile.getTsFile());
54+
fileWriter =
55+
new CompactionTsFileWriter(
56+
emptyFile.getTsFile(), 1024 * 1024 * 1024, CompactionType.INNER_SEQ_COMPACTION);
5357
}
5458

5559
public IDeviceID startChunkGroup(String deviceNameWithoutParentPath) throws IOException {

0 commit comments

Comments
 (0)