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


##########
cloud/src/meta-service/meta_service_partition.cpp:
##########
@@ -599,12 +599,48 @@ void 
MetaServiceImpl::drop_partition(::google::protobuf::RpcController* controll
     }
     if (!need_commit) return;
 
-    // update table versions
+    // Update table version only when deleting non-empty partitions
     if (request->has_db_id()) {
-        std::string ver_key =
-                table_version_key({instance_id, request->db_id(), 
request->table_id()});
-        txn->atomic_add(ver_key, 1);
-        LOG_INFO("update table version").tag("ver_key", hex(ver_key));
+        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)
+                   << " code=" << code;

Review Comment:
   ```suggestion
                      << " err=" << err;
   ```



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