gavinchou commented on code in PR #32989:
URL: https://github.com/apache/doris/pull/32989#discussion_r1545288390
##########
cloud/src/meta-service/meta_service_partition.cpp:
##########
@@ -597,11 +597,45 @@ 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 needUpdateTableVersion = 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()
Review Comment:
also print the code to msg
--
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]