This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch new_object_type
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 38bd51b1968d582905dd976927c5d693e3b11872
Author: shuwenwei <[email protected]>
AuthorDate: Mon Jul 14 15:18:24 2025 +0800

    fix ttl deletion
---
 .../apache/iotdb/TableModelSessionPoolExample.java   | 20 --------------------
 .../db/storageengine/rescon/disk/TierManager.java    | 10 ++++++++++
 .../org/apache/iotdb/db/utils/ObjectTypeUtils.java   |  9 +++++----
 3 files changed, 15 insertions(+), 24 deletions(-)

diff --git 
a/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java
 
b/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java
index 19b245653ba..cbf404b9676 100644
--- 
a/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java
+++ 
b/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java
@@ -128,26 +128,6 @@ public class TableModelSessionPoolExample {
         tablet.reset();
       }
 
-      // query device leader
-      List<Boolean> isSetTag = Arrays.asList(true, true, false, true);
-      String correctURL =
-          session.getDeviceLeaderURL("test2", Arrays.asList("test1", "1", 
"3"), isSetTag, 66);
-      System.out.println("Correct device leader URL: " + correctURL);
-      String errorDbURL =
-          session.getDeviceLeaderURL("test3", Arrays.asList("test1", "1", 
"3"), isSetTag, 66);
-      System.out.println("Error dbName device leader URL: " + errorDbURL);
-      String errorDeviceURL =
-          session.getDeviceLeaderURL("test2", Arrays.asList("test1", "3", 
"1"), isSetTag, 66);
-      System.out.println("Error deviceId device leader URL: " + 
errorDeviceURL);
-      List<Boolean> falseTagList = Arrays.asList(false, true, true, true);
-      String errorTagURL =
-          session.getDeviceLeaderURL("test2", Arrays.asList("test1", "1", 
"3"), falseTagList, 66);
-      System.out.println("Error tag device leader URL: " + errorTagURL);
-      String errorTimeURL =
-          session.getDeviceLeaderURL(
-              "test2", Arrays.asList("test1", "1", "3"), isSetTag, 
6666666666666666L);
-      System.out.println("Error time device leader URL: " + errorTimeURL);
-
       // query table data
       try (SessionDataSet dataSet =
           session.executeQueryStatement(
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/disk/TierManager.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/disk/TierManager.java
index 61bb6ffafba..6355880cebd 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/disk/TierManager.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/disk/TierManager.java
@@ -254,11 +254,21 @@ public class TierManager {
   }
 
   public Optional<File> getAbsoluteObjectFilePath(String filePath) {
+    return getAbsoluteObjectFilePath(filePath, false);
+  }
+
+  public Optional<File> getAbsoluteObjectFilePath(String filePath, boolean 
needTempFile) {
     for (String objectDir : objectDirs) {
       File objectFile = FSFactoryProducer.getFSFactory().getFile(objectDir, 
filePath);
       if (objectFile.exists()) {
         return Optional.of(objectFile);
       }
+      if (needTempFile) {
+        if (new File(objectFile.getPath() + ".tmp").exists()
+            || new File(objectFile.getPath() + ".back").exists()) {
+          return Optional.of(objectFile);
+        }
+      }
     }
     return Optional.empty();
   }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java
index c66e3ffd05d..ba33a964228 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java
@@ -50,20 +50,21 @@ public class ObjectTypeUtils {
     return file.get();
   }
 
-  public static Optional<File> getNullableObjectPathFromBinary(Binary binary) {
+  public static Optional<File> getNullableObjectPathFromBinary(
+      Binary binary, boolean needTempFile) {
     byte[] bytes = binary.getValues();
     String relativeObjectFilePath =
         new String(bytes, 8, bytes.length - 8, TSFileConfig.STRING_CHARSET);
-    return TIER_MANAGER.getAbsoluteObjectFilePath(relativeObjectFilePath);
+    return TIER_MANAGER.getAbsoluteObjectFilePath(relativeObjectFilePath, 
needTempFile);
   }
 
   public static void deleteObjectPathFromBinary(Binary binary) {
-    Optional<File> file = 
ObjectTypeUtils.getNullableObjectPathFromBinary(binary);
+    Optional<File> file = 
ObjectTypeUtils.getNullableObjectPathFromBinary(binary, true);
     if (!file.isPresent()) {
       return;
     }
     File tmpFile = new File(file.get().getPath() + ".tmp");
-    File bakFile = new File(file.get().getPath() + ".bak");
+    File bakFile = new File(file.get().getPath() + ".back");
     logger.info("Remove object file {}", file.get().getAbsolutePath());
     for (int i = 0; i < 2; i++) {
       try {

Reply via email to