Fixed that InsertionCompactionSelection may skip a file deleted by another compaction (#17254) * Fixed that InsertionCompactionSelection may skip a file deleted by another compaction * Update
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/RewriteCrossSpaceCompactionSelector.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/RewriteCrossSpaceCompactionSelector.java index ffad8a4..8439687 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/RewriteCrossSpaceCompactionSelector.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/RewriteCrossSpaceCompactionSelector.java
@@ -490,6 +490,12 @@ nextSeqFileIndex = Math.min(nextSeqFileIndex, i); } if (!seqFile.containsDevice(deviceId)) { + // if the seqFile is deleted by another compaction concurrently, + // we cannot ensure whether the seqFile overlaps with the unseqFile. + // Let a later selection retry with compacted file. + if (!seqFile.hasDetailedDeviceInfo()) { + return result; + } continue; } DeviceInfo seqDeviceInfo = seqFile.getDeviceInfoById(deviceId);