xy720 commented on code in PR #33700:
URL: https://github.com/apache/doris/pull/33700#discussion_r1568674719


##########
fe/fe-core/src/main/java/org/apache/doris/cloud/datasource/CloudInternalCatalog.java:
##########
@@ -625,6 +626,10 @@ public void 
erasePartitionDropBackendReplicas(List<Partition> partitions) {
                 }
             }
             partitionIds.add(partition.getId());
+            if (partition.hasData()) {

Review Comment:
   Partition visible version has a local cache. If there is already a local 
cache, here we won't send a rpc.
   Besides, we only need to know if the visible version is greater than 1.



##########
cloud/src/meta-service/meta_service_partition.cpp:
##########
@@ -600,47 +600,12 @@ void 
MetaServiceImpl::drop_partition(::google::protobuf::RpcController* controll
     if (!need_commit) return;
 
     // Update table version only when deleting non-empty partitions
-    if (request->has_db_id()) {
-        bool need_update_table_version = false;
-        for (auto part_id : request->partition_ids()) {
-            std::string partition_ver_key = partition_version_key(
-                    {instance_id, request->db_id(), request->table_id(), 
part_id});
-            std::string ver_val_str;
-            err = txn->get(partition_ver_key, &ver_val_str);
-            if (err != TxnErrorCode::TXN_OK && err != 
TxnErrorCode::TXN_KEY_NOT_FOUND) {
-                code = cast_as<ErrCategory::READ>(err);
-                ss << "failed to get partition version, table_id=" << 
request->table_id()
-                   << " partition_id=" << part_id << " key=" << 
hex(partition_ver_key)
-                   << " err=" << err;
-                msg = ss.str();
-                LOG_WARNING(msg);
-                return;
-            }
-            int64_t part_version = -1;
-            if (err == TxnErrorCode::TXN_KEY_NOT_FOUND) {
-                // may be it is an empty partition
-                part_version = 1;
-            } else {
-                VersionPB pb;
-                if (!pb.ParseFromString(ver_val_str)) {
-                    code = MetaServiceCode::PROTOBUF_PARSE_ERR;
-                    msg = "malformed partition version value";
-                    LOG_WARNING(msg).tag("partition_id", part_id);
-                    return;
-                }
-                part_version = pb.version();
-            }
-            if (part_version > 1) {
-                need_update_table_version = true;
-                break;
-            }
-        }
-        if (need_update_table_version) {
-            std::string ver_key =
-                    table_version_key({instance_id, request->db_id(), 
request->table_id()});
-            txn->atomic_add(ver_key, 1);

Review Comment:
   这样就分成两个fdb事务了,如果前一个成功了,没有办法去rollback前一个。



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