You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by sh...@apache.org on 2025/07/14 07:18:36 UTC

(iotdb) branch object_type updated (3619f4082ab -> 0eac637cb20)

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

shuwenwei pushed a change to branch object_type
in repository https://gitbox.apache.org/repos/asf/iotdb.git


 discard 3619f4082ab fix ttl deletion
     new 0eac637cb20 fix ttl deletion

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (3619f4082ab)
            \
             N -- N -- N   refs/heads/object_type (0eac637cb20)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


(iotdb) 01/01: fix ttl deletion

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0eac637cb206275d60fa4bf210d529e1a0d84dd0
Author: shuwenwei <s1...@gmail.com>
AuthorDate: Mon Jul 14 15:18:24 2025 +0800

    fix ttl deletion
---
 .../java/org/apache/iotdb/TableModelSessionPoolExample.java    |  2 +-
 .../apache/iotdb/db/storageengine/rescon/disk/TierManager.java | 10 ++++++++++
 .../main/java/org/apache/iotdb/db/utils/ObjectTypeUtils.java   |  9 +++++----
 3 files changed, 16 insertions(+), 5 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 0109cacc2c0..811b034eb4b 100644
--- a/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java
+++ b/example/session/src/main/java/org/apache/iotdb/TableModelSessionPoolExample.java
@@ -141,7 +141,7 @@ public class TableModelSessionPoolExample {
       System.out.println("Correct device leader URL: " + correctURL);
       try {
         String errorDbURL =
-                session.getDeviceLeaderURL("test3", Arrays.asList("test1", "1", "3"), isSetTag, 66);
+            session.getDeviceLeaderURL("test3", Arrays.asList("test1", "1", "3"), isSetTag, 66);
         System.out.println("Error dbName device leader URL: " + errorDbURL);
       } catch (StatementExecutionException e) {
         System.out.println(e.getMessage());
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 {