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 56dc78f71f2 [feat](recycler) ​​Compatibility between deleted instance 
recycling and cluster snapshots. (#55765)
56dc78f71f2 is described below

commit 56dc78f71f25f76c33a639d56a07e0758af573bd
Author: walter <[email protected]>
AuthorDate: Wed Sep 10 19:23:49 2025 +0800

    [feat](recycler) ​​Compatibility between deleted instance recycling and 
cluster snapshots. (#55765)
---
 cloud/src/meta-store/keys.cpp              |  49 +++++++++++
 cloud/src/meta-store/keys.h                |   7 ++
 cloud/src/recycler/recycler.cpp            |  59 ++++++++++++-
 cloud/src/recycler/recycler.h              |   3 +
 cloud/test/keys_test.cpp                   | 109 ++++++++++++++++++++++++
 cloud/test/recycler_operation_log_test.cpp | 128 ++++++++++++++++++++++++++++-
 cloud/test/recycler_test.cpp               |  32 +++++++-
 7 files changed, 381 insertions(+), 6 deletions(-)

diff --git a/cloud/src/meta-store/keys.cpp b/cloud/src/meta-store/keys.cpp
index e23f84771ab..ce334c254d3 100644
--- a/cloud/src/meta-store/keys.cpp
+++ b/cloud/src/meta-store/keys.cpp
@@ -18,6 +18,7 @@
 #include "meta-store/keys.h"
 
 #include <set>
+#include <string>
 
 #include "meta-store/codec.h"
 
@@ -554,6 +555,54 @@ std::string system_meta_service_encryption_key_info_key() {
 
 namespace versioned {
 
+std::string version_key_prefix(std::string_view instance_id) {
+    std::string out;
+    out.push_back(CLOUD_VERSIONED_KEY_SPACE03);
+    encode_bytes(VERSION_KEY_PREFIX, &out); // "version"
+    encode_bytes(instance_id, &out);        // instance_id
+    return out;
+}
+
+std::string index_key_prefix(std::string_view instance_id) {
+    std::string out;
+    out.push_back(CLOUD_VERSIONED_KEY_SPACE03);
+    encode_bytes(INDEX_INDEX_KEY_INFIX, &out); // "version"
+    encode_bytes(instance_id, &out);           // instance_id
+    return out;
+}
+
+std::string stats_key_prefix(std::string_view instance_id) {
+    std::string out;
+    out.push_back(CLOUD_VERSIONED_KEY_SPACE03);
+    encode_bytes(STATS_KEY_PREFIX, &out); // "stats"
+    encode_bytes(instance_id, &out);      // instance_id
+    return out;
+}
+
+std::string meta_key_prefix(std::string_view instance_id) {
+    std::string out;
+    out.push_back(CLOUD_VERSIONED_KEY_SPACE03);
+    encode_bytes(META_KEY_PREFIX, &out); // "meta"
+    encode_bytes(instance_id, &out);     // instance_id
+    return out;
+}
+
+std::string data_key_prefix(std::string_view instance_id) {
+    std::string out;
+    out.push_back(CLOUD_VERSIONED_KEY_SPACE03);
+    encode_bytes(DATA_KEY_PREFIX, &out); // "data"
+    encode_bytes(instance_id, &out);     // instance_id
+    return out;
+}
+
+std::string log_key_prefix(std::string_view instance_id) {
+    std::string out;
+    out.push_back(CLOUD_VERSIONED_KEY_SPACE03);
+    encode_bytes(LOG_KEY_PREFIX, &out); // "log"
+    encode_bytes(instance_id, &out);    // instance_id
+    return out;
+}
+
 
//==============================================================================
 // Version keys
 
//==============================================================================
diff --git a/cloud/src/meta-store/keys.h b/cloud/src/meta-store/keys.h
index 8ccd974e0b7..50cc9a6d1c9 100644
--- a/cloud/src/meta-store/keys.h
+++ b/cloud/src/meta-store/keys.h
@@ -437,6 +437,13 @@ std::string system_meta_service_encryption_key_info_key();
 namespace versioned {
 
 // clang-format off
+std::string version_key_prefix(std::string_view instance_id);
+std::string index_key_prefix(std::string_view instance_id);
+std::string stats_key_prefix(std::string_view instance_id);
+std::string meta_key_prefix(std::string_view instance_id);
+std::string data_key_prefix(std::string_view instance_id);
+std::string log_key_prefix(std::string_view instance_id);
+
 void partition_version_key(const PartitionVersionKeyInfo& in, std::string* 
out);
 static inline std::string partition_version_key(const PartitionVersionKeyInfo& 
in) { std::string s; partition_version_key(in, &s); return s; }
 
diff --git a/cloud/src/recycler/recycler.cpp b/cloud/src/recycler/recycler.cpp
index eb36a8ebe14..f6ea07341d7 100644
--- a/cloud/src/recycler/recycler.cpp
+++ b/cloud/src/recycler/recycler.cpp
@@ -741,6 +741,15 @@ int InstanceRecycler::recycle_deleted_instance() {
                      << "s, instance_id=" << instance_id_;
     };
 
+    bool has_snapshots = false;
+    if (has_cluster_snapshots(&has_snapshots) != 0) {
+        LOG(WARNING) << "check instance cluster snapshots failed, 
instance_id=" << instance_id_;
+        return -1;
+    } else if (has_snapshots) {
+        LOG(INFO) << "instance has cluster snapshots, skip recycling, 
instance_id=" << instance_id_;
+        return 0;
+    }
+
     // delete all remote data
     for (auto& [_, accessor] : accessor_map_) {
         if (stopped()) {
@@ -804,6 +813,24 @@ int InstanceRecycler::recycle_deleted_instance() {
     std::string dbm_start_key = 
versioned::meta_delete_bitmap_key({instance_id_, 0, ""});
     std::string dbm_end_key = versioned::meta_delete_bitmap_key({instance_id_, 
INT64_MAX, ""});
     txn->remove(dbm_start_key, dbm_end_key);
+    std::string versioned_version_key_start = 
versioned::version_key_prefix(instance_id_);
+    std::string versioned_version_key_end = 
versioned::version_key_prefix(instance_id_ + '\x00');
+    txn->remove(versioned_version_key_start, versioned_version_key_end);
+    std::string versioned_index_key_start = 
versioned::index_key_prefix(instance_id_);
+    std::string versioned_index_key_end = 
versioned::index_key_prefix(instance_id_ + '\x00');
+    txn->remove(versioned_index_key_start, versioned_index_key_end);
+    std::string versioned_stats_tablet_key_start = 
versioned::stats_key_prefix(instance_id_);
+    std::string versioned_stats_tablet_key_end = 
versioned::stats_key_prefix(instance_id_ + '\x00');
+    txn->remove(versioned_stats_tablet_key_start, 
versioned_stats_tablet_key_end);
+    std::string versioned_meta_key_start = 
versioned::meta_key_prefix(instance_id_);
+    std::string versioned_meta_key_end = 
versioned::meta_key_prefix(instance_id_ + '\x00');
+    txn->remove(versioned_meta_key_start, versioned_meta_key_end);
+    std::string versioned_data_key_start = 
versioned::data_key_prefix(instance_id_);
+    std::string versioned_data_key_end = 
versioned::data_key_prefix(instance_id_ + '\x00');
+    txn->remove(versioned_data_key_start, versioned_data_key_end);
+    std::string versioned_log_key_start = 
versioned::log_key_prefix(instance_id_);
+    std::string versioned_log_key_end = versioned::log_key_prefix(instance_id_ 
+ '\x00');
+    txn->remove(versioned_log_key_start, versioned_log_key_end);
     err = txn->commit();
     if (err != TxnErrorCode::TXN_OK) {
         LOG(WARNING) << "failed to delete all kv, instance_id=" << 
instance_id_ << ", err=" << err;
@@ -2157,12 +2184,12 @@ int 
InstanceRecycler::scan_tablet_and_statistics(int64_t tablet_id,
     }
     for (const auto& rs_meta : resp.rowset_meta()) {
         /*
-        * For compatibility, we skip the loop for [0-1] here. 
+        * For compatibility, we skip the loop for [0-1] here.
         * The purpose of this loop is to delete object files,
-        * and since [0-1] only has meta and doesn't have object files, 
-        * skipping it doesn't affect system correctness. 
+        * and since [0-1] only has meta and doesn't have object files,
+        * skipping it doesn't affect system correctness.
         *
-        * If not skipped, the check "if (!rs_meta.has_resource_id())" below 
+        * If not skipped, the check "if (!rs_meta.has_resource_id())" below
         * would return error -1 directly, causing the recycle operation to 
fail.
         *
         * [0-1] doesn't have resource id is a bug.
@@ -5225,4 +5252,28 @@ int InstanceRecycler::scan_and_statistics_restore_jobs() 
{
     return ret;
 }
 
+int InstanceRecycler::has_cluster_snapshots(bool *any) {
+    std::string snapshot_key = versioned::snapshot_full_key({instance_id_});
+    std::string begin_key = encode_versioned_key(snapshot_key, 
Versionstamp::min());
+    std::string end_key = encode_versioned_key(snapshot_key, 
Versionstamp::max());
+
+    std::unique_ptr<Transaction> txn;
+    TxnErrorCode err = txn_kv_->create_txn(&txn);
+    if (err != TxnErrorCode::TXN_OK) {
+        LOG(WARNING) << "failed to create txn. instance_id=" << instance_id_
+                        << ", err=" << err;
+        return -1;
+    }
+
+    std::unique_ptr<RangeGetIterator> iter;
+    err = txn->get(begin_key, end_key, &iter, false, 1);
+    if (err != TxnErrorCode::TXN_OK) {
+        LOG(WARNING) << "failed to get snapshot key. instance_id=" << 
instance_id_ << ", err=" << err;
+        return -1;
+    }
+
+    *any = iter->has_next();
+    return 0;
+}
+
 } // namespace doris::cloud
diff --git a/cloud/src/recycler/recycler.h b/cloud/src/recycler/recycler.h
index a414bbedc61..da88994c974 100644
--- a/cloud/src/recycler/recycler.h
+++ b/cloud/src/recycler/recycler.h
@@ -409,6 +409,9 @@ private:
     int recycle_rowset_meta_and_data(std::string_view rowset_meta_key,
                                      const RowsetMetaCloudPB& rowset_meta);
 
+    // Whether the instance has any snapshots, return 0 for success otherwise 
error.
+    int has_cluster_snapshots(bool* any);
+
 private:
     std::atomic_bool stopped_ {false};
     std::shared_ptr<TxnKv> txn_kv_;
diff --git a/cloud/test/keys_test.cpp b/cloud/test/keys_test.cpp
index 6b5559ff448..c6f04d1366d 100644
--- a/cloud/test/keys_test.cpp
+++ b/cloud/test/keys_test.cpp
@@ -1932,3 +1932,112 @@ TEST(KeysTest, RestoreJobKeysTest) {
         ASSERT_GT(encoded_key1, encoded_key);
     }
 }
+
+TEST(KeysTest, VersionedKeyPrefixTest) {
+    using namespace doris::cloud;
+    using namespace doris::cloud::versioned;
+    std::string instance_id = "test_instance_id";
+
+    // Test versioned key prefixes - these use key space 0x03
+    {
+        // versioned::version_key_prefix - 0x03 "version" ${instance_id}
+        std::string version_prefix = 
versioned::version_key_prefix(instance_id);
+        std::cout << "versioned::version_key_prefix: " << hex(version_prefix) 
<< std::endl;
+
+        std::string dec_version_prefix;
+        std::string dec_instance_id;
+        std::string_view key_sv(version_prefix);
+        remove_versioned_space_prefix(&key_sv);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_version_prefix), 0);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_instance_id), 0);
+        ASSERT_TRUE(key_sv.empty());
+
+        EXPECT_EQ("version", dec_version_prefix);
+        EXPECT_EQ(instance_id, dec_instance_id);
+    }
+
+    {
+        // versioned::index_key_prefix - 0x03 "index" ${instance_id}
+        std::string index_prefix = versioned::index_key_prefix(instance_id);
+        std::cout << "versioned::index_key_prefix: " << hex(index_prefix) << 
std::endl;
+
+        std::string dec_index_prefix;
+        std::string dec_instance_id;
+        std::string_view key_sv(index_prefix);
+        remove_versioned_space_prefix(&key_sv);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_index_prefix), 0);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_instance_id), 0);
+        ASSERT_TRUE(key_sv.empty());
+
+        EXPECT_EQ("index", dec_index_prefix);
+        EXPECT_EQ(instance_id, dec_instance_id);
+    }
+
+    {
+        // versioned::stats_key_prefix - 0x03 "stats" ${instance_id}
+        std::string stats_prefix = versioned::stats_key_prefix(instance_id);
+        std::cout << "versioned::stats_key_prefix: " << hex(stats_prefix) << 
std::endl;
+
+        std::string dec_stats_prefix;
+        std::string dec_instance_id;
+        std::string_view key_sv(stats_prefix);
+        remove_versioned_space_prefix(&key_sv);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_stats_prefix), 0);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_instance_id), 0);
+        ASSERT_TRUE(key_sv.empty());
+
+        EXPECT_EQ("stats", dec_stats_prefix);
+        EXPECT_EQ(instance_id, dec_instance_id);
+    }
+
+    {
+        // versioned::meta_key_prefix - 0x03 "meta" ${instance_id}
+        std::string meta_prefix = versioned::meta_key_prefix(instance_id);
+        std::cout << "versioned::meta_key_prefix: " << hex(meta_prefix) << 
std::endl;
+
+        std::string dec_meta_prefix;
+        std::string dec_instance_id;
+        std::string_view key_sv(meta_prefix);
+        remove_versioned_space_prefix(&key_sv);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_meta_prefix), 0);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_instance_id), 0);
+        ASSERT_TRUE(key_sv.empty());
+
+        EXPECT_EQ("meta", dec_meta_prefix);
+        EXPECT_EQ(instance_id, dec_instance_id);
+    }
+
+    {
+        // versioned::data_key_prefix - 0x03 "data" ${instance_id}
+        std::string data_prefix = versioned::data_key_prefix(instance_id);
+        std::cout << "versioned::data_key_prefix: " << hex(data_prefix) << 
std::endl;
+
+        std::string dec_data_prefix;
+        std::string dec_instance_id;
+        std::string_view key_sv(data_prefix);
+        remove_versioned_space_prefix(&key_sv);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_data_prefix), 0);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_instance_id), 0);
+        ASSERT_TRUE(key_sv.empty());
+
+        EXPECT_EQ("data", dec_data_prefix);
+        EXPECT_EQ(instance_id, dec_instance_id);
+    }
+
+    {
+        // versioned::log_key_prefix - 0x03 "log" ${instance_id}
+        std::string log_prefix = versioned::log_key_prefix(instance_id);
+        std::cout << "versioned::log_key_prefix: " << hex(log_prefix) << 
std::endl;
+
+        std::string dec_log_prefix;
+        std::string dec_instance_id;
+        std::string_view key_sv(log_prefix);
+        remove_versioned_space_prefix(&key_sv);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_log_prefix), 0);
+        ASSERT_EQ(decode_bytes(&key_sv, &dec_instance_id), 0);
+        ASSERT_TRUE(key_sv.empty());
+
+        EXPECT_EQ("log", dec_log_prefix);
+        EXPECT_EQ(instance_id, dec_instance_id);
+    }
+}
diff --git a/cloud/test/recycler_operation_log_test.cpp 
b/cloud/test/recycler_operation_log_test.cpp
index c150e44de40..7b54a80db73 100644
--- a/cloud/test/recycler_operation_log_test.cpp
+++ b/cloud/test/recycler_operation_log_test.cpp
@@ -1600,7 +1600,7 @@ TEST(RecycleOperationLogTest, RecycleSchemaChangeLog) {
     }
 
     // Create old tablet
-    { create_tablet(meta_service.get(), table_id, index_id, partition_id, 
old_tablet_id); }
+    create_tablet(meta_service.get(), table_id, index_id, partition_id, 
old_tablet_id);
 
     auto txn_kv = meta_service->txn_kv();
 
@@ -2092,6 +2092,132 @@ TEST(RecycleOperationLogTest, RecycleSchemaChangeLog) {
     }
 }
 
+TEST(RecycleOperationLogTest, RecycleDeletedInstance) {
+    auto txn_kv = std::make_shared<MemTxnKv>();
+    ASSERT_EQ(txn_kv->init(), 0);
+
+    InstanceInfoPB instance;
+    instance.set_instance_id(instance_id);
+    
instance.set_multi_version_status(MultiVersionStatus::MULTI_VERSION_WRITE_ONLY);
+    update_instance_info(txn_kv.get(), instance);
+
+    InstanceRecycler recycler(txn_kv, instance, thread_group,
+                              std::make_shared<TxnLazyCommitter>(txn_kv));
+    ASSERT_EQ(recycler.init(), 0);
+
+    uint64_t tablet_id = 1, partition_id = 2, index_id = 3, table_id = 4, 
db_id = 5;
+    {
+        // Create tablet meta
+        std::string tablet_meta_key = versioned::meta_tablet_key({instance_id, 
tablet_id});
+        doris::TabletMetaCloudPB tablet_meta;
+        tablet_meta.set_tablet_id(tablet_id);
+        tablet_meta.set_creation_time(::time(nullptr));
+
+        std::unique_ptr<Transaction> txn;
+        ASSERT_EQ(txn_kv->create_txn(&txn), TxnErrorCode::TXN_OK);
+        versioned_put(txn.get(), tablet_meta_key, 
tablet_meta.SerializeAsString());
+        ASSERT_EQ(txn->commit(), TxnErrorCode::TXN_OK);
+    }
+
+    {
+        // Put partition version
+        std::string partition_version_key =
+                versioned::partition_version_key({instance_id, partition_id});
+        VersionPB version;
+        version.set_version(12345);
+        version.set_update_time_ms(0);
+        std::unique_ptr<Transaction> txn;
+        ASSERT_EQ(txn_kv->create_txn(&txn), TxnErrorCode::TXN_OK);
+        versioned_put(txn.get(), partition_version_key, 
version.SerializeAsString());
+        ASSERT_EQ(txn->commit(), TxnErrorCode::TXN_OK);
+    }
+
+    {
+        // Put partition index
+        std::string partition_index_key =
+                versioned::partition_index_key({instance_id, partition_id});
+        PartitionIndexPB partition_index;
+        partition_index.set_table_id(table_id);
+        partition_index.set_db_id(db_id);
+
+        std::unique_ptr<Transaction> txn;
+        ASSERT_EQ(txn_kv->create_txn(&txn), TxnErrorCode::TXN_OK);
+        txn->put(partition_index_key, partition_index.SerializeAsString());
+        ASSERT_EQ(txn->commit(), TxnErrorCode::TXN_OK);
+    }
+
+    {
+        // Put rowset meta, tablet stats and data ref count
+        // Create rowset meta
+        std::string rowset_key = meta_rowset_key({instance_id, tablet_id, 2});
+        doris::RowsetMetaCloudPB rowset_meta;
+        rowset_meta.set_rowset_id(12345);
+        rowset_meta.set_rowset_id_v2("test_rowset_id");
+        rowset_meta.set_tablet_id(tablet_id);
+        rowset_meta.set_partition_id(partition_id);
+        rowset_meta.set_start_version(2);
+        rowset_meta.set_end_version(2);
+        rowset_meta.set_num_rows(100);
+        rowset_meta.set_data_disk_size(10000);
+        rowset_meta.set_index_disk_size(1000);
+        rowset_meta.set_total_disk_size(11000);
+
+        // Create tablet stats
+        std::string tablet_stats_key =
+                stats_tablet_key({instance_id, table_id, index_id, 
partition_id, tablet_id});
+        TabletStatsPB tablet_stats;
+        tablet_stats.set_num_rows(100);
+        tablet_stats.set_data_size(10000);
+        tablet_stats.set_num_rowsets(1);
+        tablet_stats.set_num_segments(1);
+        tablet_stats.set_index_size(1000);
+        tablet_stats.set_segment_size(11000);
+        tablet_stats.set_cumulative_point(1);
+
+        // Create data ref count
+        std::string data_ref_count_key =
+                versioned::data_rowset_ref_count_key({instance_id, tablet_id, 
"test_rowset_id"});
+        std::string ref_count = "1";
+
+        std::unique_ptr<Transaction> txn;
+        ASSERT_EQ(txn_kv->create_txn(&txn), TxnErrorCode::TXN_OK);
+        versioned::document_put(txn.get(), rowset_key, std::move(rowset_meta));
+        versioned_put(txn.get(), tablet_stats_key, 
tablet_stats.SerializeAsString());
+        versioned_put(txn.get(), data_ref_count_key, ref_count);
+        ASSERT_EQ(txn->commit(), TxnErrorCode::TXN_OK);
+    }
+
+    {
+        // Put operation logs
+        std::string log_key = versioned::log_key(instance_id);
+        Versionstamp versionstamp(123, 0);
+        OperationLogPB operation_log;
+        operation_log.set_min_timestamp(versionstamp.version());
+
+        // Create a commit txn log
+        auto* commit_txn = operation_log.mutable_commit_txn();
+        commit_txn->set_db_id(db_id);
+        commit_txn->set_txn_id(100);
+
+        std::unique_ptr<Transaction> txn;
+        ASSERT_EQ(txn_kv->create_txn(&txn), TxnErrorCode::TXN_OK);
+        versioned_put(txn.get(), log_key, operation_log.SerializeAsString());
+        ASSERT_EQ(txn->commit(), TxnErrorCode::TXN_OK);
+    }
+
+    {
+        // Mark instance deleted.
+        InstanceInfoPB deleted_instance = instance;
+        deleted_instance.set_status(InstanceInfoPB::DELETED);
+        update_instance_info(txn_kv.get(), deleted_instance);
+    }
+
+    ASSERT_EQ(recycler.recycle_deleted_instance(), 0);
+
+    // Verify all keys are deleted
+    ASSERT_TRUE(is_empty_range(txn_kv.get())) << dump_range(txn_kv.get());
+}
+
 // Test OperationLogRecycleChecker class
 TEST(OperationLogRecycleCheckerTest, InitAndBasicCheck) {
     auto txn_kv = std::make_shared<MemTxnKv>();
diff --git a/cloud/test/recycler_test.cpp b/cloud/test/recycler_test.cpp
index 2a9884fbaeb..026a4cc3897 100644
--- a/cloud/test/recycler_test.cpp
+++ b/cloud/test/recycler_test.cpp
@@ -3219,7 +3219,7 @@ TEST(RecyclerTest, recycle_deleted_instance) {
     int64_t txn_id_base = 114115;
     for (int i = 0; i < 100; ++i) {
         int64_t tablet_id = tablet_id_base + i;
-        // creare stats key
+        // create stats key
         create_tablet(txn_kv.get(), table_id, index_id, partition_id, 
tablet_id);
         for (int j = 0; j < 10; ++j) {
             auto rowset = create_rowset("recycle_tablet", tablet_id, index_id, 
5, schemas[j % 5]);
@@ -3244,6 +3244,36 @@ TEST(RecyclerTest, recycle_deleted_instance) {
         check_delete_bitmap_keys_size(txn_kv.get(), tablet_id, 10);
     }
 
+    {
+        // Create some snapshots
+        std::unique_ptr<Transaction> txn;
+        ASSERT_EQ(txn_kv->create_txn(&txn), TxnErrorCode::TXN_OK);
+
+        std::string snapshot_key = versioned::snapshot_full_key(instance_id);
+        SnapshotPB snapshot;
+        versioned_put(txn.get(), snapshot_key, snapshot.SerializeAsString());
+        ASSERT_EQ(txn->commit(), TxnErrorCode::TXN_OK);
+    }
+
+    ASSERT_EQ(0, recycler.recycle_deleted_instance());
+
+    {
+        // No thing to recycle
+        std::unique_ptr<Transaction> txn;
+        ASSERT_EQ(txn_kv->create_txn(&txn), TxnErrorCode::TXN_OK);
+        std::unique_ptr<RangeGetIterator> it;
+
+        std::string start_meta_key = meta_key_prefix(instance_id);
+        std::string end_meta_key = meta_key_prefix(instance_id + '\x00');
+        ASSERT_EQ(txn->get(start_meta_key, end_meta_key, &it), 
TxnErrorCode::TXN_OK);
+        ASSERT_GT(it->size(), 0);
+
+        // Now remove the snapshot key
+        std::string snapshot_key = versioned::snapshot_full_key(instance_id);
+        versioned_remove_all(txn.get(), snapshot_key);
+        ASSERT_EQ(txn->commit(), TxnErrorCode::TXN_OK);
+    }
+
     ASSERT_EQ(0, recycler.recycle_deleted_instance());
 
     // check if all the objects are deleted


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

Reply via email to