Copilot commented on code in PR #64574:
URL: https://github.com/apache/doris/pull/64574#discussion_r3422229991


##########
be/src/cloud/cloud_meta_mgr.cpp:
##########
@@ -618,7 +618,7 @@ Status CloudMetaMgr::_log_mow_delete_bitmap(CloudTablet* 
tablet, GetRowsetRespon
             std::vector<RowsetSharedPtr> old_rowsets;
             RowsetIdUnorderedSet old_rowset_ids;
             {
-                std::lock_guard<std::shared_mutex> 
rlock(tablet->get_header_lock());
+                std::lock_guard rlock(tablet->get_header_lock());
                 
RETURN_IF_ERROR(tablet->get_all_rs_id_unlocked(old_max_version, 
&old_rowset_ids));
                 old_rowsets = tablet->get_rowset_by_ids(&old_rowset_ids);
             }

Review Comment:
   This scope only reads tablet metadata (rowset ids + rowset pointers) and 
doesn’t mutate state, so taking the header lock exclusively via std::lock_guard 
unnecessarily blocks concurrent readers. Use std::shared_lock here to match the 
“shared meta lock” contract and improve concurrency.



##########
be/src/storage/rowset_builder.cpp:
##########
@@ -147,7 +147,7 @@ void RowsetBuilder::_garbage_collection(bool cancel_txn) {
 Status BaseRowsetBuilder::init_mow_context(std::shared_ptr<MowContext>& 
mow_context) {
     DCHECK(is_data_builder());
 
-    std::lock_guard<std::shared_mutex> lck(tablet()->get_header_lock());
+    std::lock_guard lck(tablet()->get_header_lock());
     _max_version_in_flush_phase = tablet()->max_version_unlocked();

Review Comment:
   This section only reads tablet state (max_version + rowset ids) but takes 
the header lock exclusively via std::lock_guard. Prefer std::shared_lock so 
other readers aren’t blocked while building the MoW context.



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