gavinchou commented on code in PR #60544:
URL: https://github.com/apache/doris/pull/60544#discussion_r2797125957


##########
cloud/src/meta-service/meta_service.cpp:
##########
@@ -1209,15 +1209,36 @@ void 
MetaServiceImpl::update_tablet(::google::protobuf::RpcController* controlle
                 }
 
                 
schema_pb.set_disable_auto_compaction(tablet_meta_info.disable_auto_compaction());
+                // Directly overwrite schema KV instead of using put_schema_kv,
+                // because put_schema_kv skips writing when the key already 
exists.
                 auto key = meta_schema_key(
                         {instance_id, tablet_meta.index_id(), 
tablet_meta.schema_version()});
-                put_schema_kv(code, msg, txn.get(), key, schema_pb);
-                if (code != MetaServiceCode::OK) return;
+                LOG_INFO("overwrite schema kv for disable_auto_compaction 
update")
+                        .tag("key", hex(key))
+                        .tag("disable_auto_compaction", 
tablet_meta_info.disable_auto_compaction());
+                // Remove old blob chunks first to avoid orphaned KVs when
+                // the value format or size changes across versions.
+                ValueBuf old_val;
+                auto get_err = cloud::blob_get(txn.get(), key, &old_val);
+                if (get_err == TxnErrorCode::TXN_OK) {
+                    old_val.remove(txn.get());

Review Comment:
   the `remove` is unnecessary



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

Reply via email to