Skip to content

Commit 1932715

Browse files
authored
[To dev/1.3] Fixed the bug that the unclosed file may be degraded when directly deleted (#17024) (#17660)
1 parent f241857 commit 1932715

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/tsfile/TsFileResource.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,11 +639,13 @@ public void removeModFile() throws IOException {
639639
* file physically.
640640
*/
641641
public boolean remove() {
642-
forceMarkDeleted();
643642
// To release the memory occupied by pipe if held by it
644643
// Note that pipe can safely handle the case that the time index does not exist
645644
isEmpty();
646-
degradeTimeIndex();
645+
if (getStatus() != TsFileResourceStatus.UNCLOSED) {
646+
degradeTimeIndex();
647+
}
648+
forceMarkDeleted();
647649
try {
648650
fsFactory.deleteIfExists(file);
649651
fsFactory.deleteIfExists(

0 commit comments

Comments
 (0)