gavinchou commented on code in PR #58459:
URL: https://github.com/apache/doris/pull/58459#discussion_r2583753397


##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -2567,30 +2567,57 @@ void 
MetaServiceImpl::commit_rowset(::google::protobuf::RpcController* controlle
         return;
     }
 
-    // Check if the compaction/sc tablet job has finished
-    bool is_versioned_read = is_version_read_enabled(instance_id);
-    if (config::enable_tablet_job_check && request->has_tablet_job_id() &&
-        !request->tablet_job_id().empty()) {
-        if (!check_job_existed(txn.get(), code, msg, instance_id, tablet_id, 
rowset_id,
-                               request->tablet_job_id(), is_versioned_read, 
resource_mgr_.get())) {
+    auto recycle_rs_key = recycle_rowset_key({instance_id, tablet_id, 
rowset_id});
+    std::string recycle_rs_val;
+    err = txn->get(recycle_rs_key, &recycle_rs_val);
+    if (err == TxnErrorCode::TXN_OK) {
+        RecycleRowsetPB recycle_rowset;
+        if (!recycle_rowset.ParseFromString(recycle_rs_val)) {
+            code = MetaServiceCode::PROTOBUF_PARSE_ERR;
+            msg = fmt::format("malformed recycle rowset value. key={}", 
hex(recycle_rs_key));
             return;
         }
-    }
-
-    // Check if the commit rowset request is invalid.
-    // If the transaction has been finished, it means this commit rowset is a 
timeout retry request.
-    // In this case, do not write the recycle key again, otherwise it may 
cause data loss.
-    // If the rowset has load id, it means it is a load request, otherwise it 
is a
-    // compaction/sc request.
-    if (config::enable_load_txn_status_check && rowset_meta.has_load_id() &&
-        !check_transaction_status(TxnStatusPB::TXN_STATUS_PREPARED, txn.get(), 
instance_id,
-                                  rowset_meta.txn_id(), code, msg)) {
-        LOG(WARNING) << "commit rowset failed, txn_id=" << rowset_meta.txn_id()
-                     << ", tablet_id=" << tablet_id << ", rowset_id=" << 
rowset_id
-                     << ", rowset_state=" << rowset_meta.rowset_state() << ", 
msg=" << msg;
+        auto rs_meta = recycle_rowset.rowset_meta();
+        if (rs_meta.has_recycle_state() && (rs_meta.recycle_state() == 
RecycleStatePB::RECYCLING ||
+                                            rs_meta.recycle_state() == 
RecycleStatePB::RECYCLED)) {
+            code = MetaServiceCode::JOB_EXPIRED;
+            msg = "rowset has already been marked as recycled";
+            return;
+        }
+    } else if (err == TxnErrorCode::TXN_KEY_NOT_FOUND) {
+        code = MetaServiceCode::ROWSET_META_NOT_FOUND;
+        msg = "recycle rowset key not found";
+        return;
+    } else {
+        code = cast_as<ErrCategory::READ>(err);
+        msg = fmt::format("failed to get recycle rowset, err={}", err);
         return;
     }
 
+    // // Check if the compaction/sc tablet job has finished
+    bool is_versioned_read = is_version_read_enabled(instance_id);
+    // if (config::enable_tablet_job_check && request->has_tablet_job_id() &&

Review Comment:
   do not comment out, make `enable_tablet_job_check` and 
`enable_load_txn_status_check` default to false.
   and, add more comment to describe the behavior



-- 
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