zhannngchen commented on code in PR #46039:
URL: https://github.com/apache/doris/pull/46039#discussion_r1897887757


##########
cloud/src/meta-service/meta_service_txn.cpp:
##########
@@ -972,8 +972,39 @@ void process_mow_when_commit_txn(
         LOG(INFO) << "xxx remove delete bitmap lock, lock_key=" << 
hex(lock_keys[i])
                   << " txn_id=" << txn_id;
 
+        int64_t lock_id = lock_info.lock_id();
         for (auto tablet_id : table_id_tablet_ids[table_id]) {
             std::string pending_key = 
meta_pending_delete_bitmap_key({instance_id, tablet_id});
+
+            // check that if the pending info's lock_id is correct
+            std::string pending_val;
+            err = txn->get(pending_key, &pending_val);
+            if (err != TxnErrorCode::TXN_OK && err != 
TxnErrorCode::TXN_KEY_NOT_FOUND) {
+                ss << "failed to get delete bitmap pending info, instance_id=" 
<< instance_id
+                   << " tablet_id=" << tablet_id << " key=" << 
hex(pending_key) << " err=" << err;
+                msg = ss.str();
+                code = cast_as<ErrCategory::READ>(err);
+                return;
+            }
+
+            if (err == TxnErrorCode::TXN_KEY_NOT_FOUND) continue;
+
+            PendingDeleteBitmapPB pending_info;
+            if (!pending_info.ParseFromString(pending_val)) [[unlikely]] {
+                code = MetaServiceCode::PROTOBUF_PARSE_ERR;
+                msg = "failed to parse PendingDeleteBitmapPB";
+                return;
+            }
+
+            if (pending_info.lock_id() != lock_id) {

Review Comment:
   ```suggestion
               if (pending_info.has_lock_id() && pending_info.lock_id() != 
lock_id) {
   ```



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to