Skip to content

Commit a60d00e

Browse files
authored
[to dev/1.3] reduce error log when compaction service is stopped & fix bugs (#16755)
* reduce error log when compaction service is stopped * fix writer for compaction tests * fix npe
1 parent 3d79e36 commit a60d00e

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
@@ -165,7 +165,8 @@ protected void handleException(Logger logger, Exception e) {
165165
} else if (e instanceof InterruptedException
166166
|| Thread.interrupted()
167167
|| e instanceof StopReadTsFileByInterruptException
168-
|| !tsFileManager.isAllowCompaction()) {
168+
|| !tsFileManager.isAllowCompaction()
169+
|| CompactionTaskManager.getInstance().isStopAllCompactionWorker()) {
169170
logger.warn(
170171
"{}-{} [Compaction] {} task interrupted",
171172
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
@@ -117,14 +117,14 @@ public InnerSpaceCompactionTask(
117117
}
118118

119119
protected static class InnerCompactionTaskFilesView {
120-
protected List<TsFileResource> sortedAllSourceFilesInTask;
121-
protected List<TsFileResource> sourceFilesInCompactionPerformer;
122-
protected List<TsFileResource> skippedSourceFiles;
120+
protected List<TsFileResource> sortedAllSourceFilesInTask = Collections.emptyList();
121+
protected List<TsFileResource> sourceFilesInCompactionPerformer = Collections.emptyList();
122+
protected List<TsFileResource> skippedSourceFiles = Collections.emptyList();
123123
protected boolean sequence;
124-
protected List<TsFileResource> sourceFilesInLog;
125-
protected List<TsFileResource> targetFilesInLog;
126-
protected List<TsFileResource> targetFilesInPerformer;
127-
protected List<TsFileResource> renamedTargetFiles;
124+
protected List<TsFileResource> sourceFilesInLog = Collections.emptyList();
125+
protected List<TsFileResource> targetFilesInLog = Collections.emptyList();
126+
protected List<TsFileResource> targetFilesInPerformer = Collections.emptyList();
127+
protected List<TsFileResource> renamedTargetFiles = Collections.emptyList();
128128

129129
protected long selectedFileSize;
130130
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;
@@ -50,7 +52,9 @@ public class CompactionTestFileWriter implements Closeable {
5052

5153
public CompactionTestFileWriter(TsFileResource emptyFile) throws IOException {
5254
this.resource = emptyFile;
53-
fileWriter = new TsFileIOWriter(emptyFile.getTsFile());
55+
fileWriter =
56+
new CompactionTsFileWriter(
57+
emptyFile.getTsFile(), 1024 * 1024 * 1024, CompactionType.INNER_SEQ_COMPACTION);
5458
}
5559

5660
public IDeviceID startChunkGroup(String deviceNameWithoutParentPath) throws IOException {

0 commit comments

Comments
 (0)