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

w41ter pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c32b854486 [fix](cloud) Do not recycle operation log during 
WRITE_ONLY (#57848)
3c32b854486 is described below

commit 3c32b85448612c699a1f2bed423bfc62934a5b17
Author: walter <[email protected]>
AuthorDate: Tue Nov 11 10:33:50 2025 +0800

    [fix](cloud) Do not recycle operation log during WRITE_ONLY (#57848)
    
    because the data migrator will migrate single version keys into
    versioned keys and those keys need to be recycled later.
---
 cloud/src/recycler/recycler_operation_log.cpp | 18 +++---------------
 cloud/src/recycler/snapshot_data_migrator.cpp |  1 +
 cloud/test/recycler_operation_log_test.cpp    | 10 ++++++++++
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/cloud/src/recycler/recycler_operation_log.cpp 
b/cloud/src/recycler/recycler_operation_log.cpp
index 9ce409ebc47..c5a95901afa 100644
--- a/cloud/src/recycler/recycler_operation_log.cpp
+++ b/cloud/src/recycler/recycler_operation_log.cpp
@@ -595,10 +595,9 @@ static TxnErrorCode get_txn_info(TxnKv* txn_kv, 
std::string_view instance_id, in
 int InstanceRecycler::recycle_operation_logs() {
     if (!instance_info_.has_multi_version_status() ||
         (instance_info_.multi_version_status() != 
MultiVersionStatus::MULTI_VERSION_ENABLED &&
-         instance_info_.multi_version_status() != 
MultiVersionStatus::MULTI_VERSION_READ_WRITE &&
-         instance_info_.multi_version_status() != 
MultiVersionStatus::MULTI_VERSION_WRITE_ONLY)) {
-        LOG_INFO("instance {} is not multi-version enabled, skip recycling 
operation logs",
-                 instance_id_);
+         instance_info_.multi_version_status() != 
MultiVersionStatus::MULTI_VERSION_READ_WRITE)) {
+        VLOG_DEBUG << "instance " << instance_id_
+                   << " is not multi-version enabled, skip recycling operation 
logs.";
         return 0;
     }
 
@@ -646,17 +645,6 @@ int InstanceRecycler::recycle_operation_logs() {
             return -1;
         }
 
-        // Recycle operation log directly if multi_version_status is 
WRITE_ONLY.
-        if (!operation_log.has_min_timestamp() &&
-            instance_info_.multi_version_status() != 
MultiVersionStatus::MULTI_VERSION_WRITE_ONLY) {
-            LOG_WARNING("operation log has not set the min_timestamp")
-                    .tag("key", hex(key))
-                    .tag("version", log_versionstamp.version())
-                    .tag("order", log_versionstamp.order())
-                    .tag("log", operation_log.ShortDebugString());
-            return 0;
-        }
-
         if (recycle_checker.can_recycle(log_versionstamp, 
operation_log.min_timestamp())) {
             AnnotateTag tag("log_key", hex(key));
             int res = recycle_operation_log(log_versionstamp, 
std::move(operation_log));
diff --git a/cloud/src/recycler/snapshot_data_migrator.cpp 
b/cloud/src/recycler/snapshot_data_migrator.cpp
index 0222448307f..e51bdc52478 100644
--- a/cloud/src/recycler/snapshot_data_migrator.cpp
+++ b/cloud/src/recycler/snapshot_data_migrator.cpp
@@ -350,6 +350,7 @@ int InstanceDataMigrator::enable_instance_snapshot_switch() 
{
     }
 
     
instance_info.set_snapshot_switch_status(SnapshotSwitchStatus::SNAPSHOT_SWITCH_OFF);
+    instance_info.clear_migrated_key_sets();
     txn->atomic_add(system_meta_service_instance_update_key(), 1);
     txn->put(key, instance_info.SerializeAsString());
     err = txn->commit();
diff --git a/cloud/test/recycler_operation_log_test.cpp 
b/cloud/test/recycler_operation_log_test.cpp
index c685057f310..8b59321135e 100644
--- a/cloud/test/recycler_operation_log_test.cpp
+++ b/cloud/test/recycler_operation_log_test.cpp
@@ -2257,6 +2257,16 @@ TEST(OperationLogRecycleCheckerTest, InitAndBasicCheck) {
         ASSERT_TRUE(checker.can_recycle(old_version, 1)) << 
old_version.version();
     }
 
+    {
+        // Even a log has no min_timestamp, it can be recycled.
+        InstanceInfoPB instance_info;
+        OperationLogRecycleChecker checker(test_instance_id, txn_kv.get(), 
instance_info);
+        ASSERT_EQ(checker.init(), 0);
+
+        OperationLogPB op_log;
+        ASSERT_TRUE(checker.can_recycle(old_version, op_log.min_timestamp()));
+    }
+
     auto write_snapshot = [&]() {
         // Write snapshot
         SnapshotPB snapshot;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to