deardeng commented on code in PR #36786:
URL: https://github.com/apache/doris/pull/36786#discussion_r1670422764


##########
cloud/src/meta-service/meta_service_partition.cpp:
##########
@@ -614,4 +621,94 @@ void 
MetaServiceImpl::drop_partition(::google::protobuf::RpcController* controll
     }
 }
 
+void check_create_table(std::string instance_id, std::shared_ptr<TxnKv> txn_kv,
+                        const CheckKVRequest* request, CheckKVResponse* 
response,
+                        MetaServiceCode* code, std::string* msg,
+                        check_create_table_type get_check_info) {
+    std::unique_ptr<Transaction> txn;
+    TxnErrorCode err = txn_kv->create_txn(&txn);
+    if (err != TxnErrorCode::TXN_OK) {
+        *code = cast_as<ErrCategory::READ>(err);
+        *msg = "failed to create txn";
+        return;
+    }
+    auto& [keys, hint, key_func] = get_check_info(request);
+    if (keys.empty()) {
+        *code = MetaServiceCode::INVALID_ARGUMENT;
+        *msg = "empty keys";
+        return;
+    }
+
+    for (auto id : keys) {
+        auto key = key_func(instance_id, id);
+        err = check_recycle_key_exist(txn.get(), key);
+        if (err == TxnErrorCode::TXN_KEY_NOT_FOUND) {
+            continue;
+        } else if (err == TxnErrorCode::TXN_OK) {
+            // find not match, prepare commit
+            *code = MetaServiceCode::ALREADY_EXISTED;

Review Comment:
   ALREADY_EXISTED



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