w41ter commented on code in PR #60208:
URL: https://github.com/apache/doris/pull/60208#discussion_r2735039247


##########
cloud/src/recycler/recycler.cpp:
##########
@@ -1077,6 +1077,43 @@ int 
InstanceRecycler::check_recycle_and_tmp_rowset_exists(int64_t tablet_id,
     return 0;
 }
 
+int InstanceRecycler::check_rowset_snapshot_ref(int64_t tablet_id, const 
std::string& rowset_id,
+                                                bool* has_snapshot_ref) {
+    *has_snapshot_ref = false;
+    std::unique_ptr<Transaction> txn;
+    TxnErrorCode err = txn_kv_->create_txn(&txn);
+    if (err != TxnErrorCode::TXN_OK) {
+        LOG_WARNING("failed to create txn when checking rowset snapshot ref")
+                .tag("instance_id", instance_id_)
+                .tag("tablet_id", tablet_id)
+                .tag("rowset_id", rowset_id)
+                .tag("err", err);
+        return -1;
+    }
+
+    // Check if versioned rowset key exists - if exists, rowset is still 
referenced
+    std::string meta_rowset_key = versioned::meta_rowset_key({instance_id_, 
tablet_id, rowset_id});
+    ValueBuf val_buf;
+    err = blob_get(txn.get(), meta_rowset_key, &val_buf);

Review Comment:
   The meta rowset in the versioned key space is split into two kinds:
   - load rowset meta key
   - compact rowset meta key
   
   You can refer to `OperationLogRecycler::recycle_rowset_meta` for details.
   
   It seems the `versioned::meta_rowset_key` is added by accident.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to