You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/01/22 04:21:53 UTC

[GitHub] [incubator-doris] weizuo93 commented on a change in pull request #5278: [Bug] fix bug that dead lock may occur when drop tablet concurrent with tablet distribution interface

weizuo93 commented on a change in pull request #5278:
URL: https://github.com/apache/incubator-doris/pull/5278#discussion_r562378984



##########
File path: be/src/olap/tablet_manager.cpp
##########
@@ -1490,9 +1490,13 @@ void TabletManager::get_tablets_distribution_on_different_disks(
                     std::map<int64_t, std::map<DataDir*, int64_t>> &tablets_num_on_disk,
                     std::map<int64_t, std::map<DataDir*, std::vector<TabletSize>>> &tablets_info_on_disk) {
     std::vector<DataDir*> data_dirs = StorageEngine::instance()->get_stores();
-    ReadLock rlock(&_partition_tablet_map_lock);
-    std::map<int64_t, std::set<TabletInfo>>::iterator partition_iter = _partition_tablet_map.begin();
-    for (; partition_iter != _partition_tablet_map.end(); partition_iter++) {
+    std::map<int64_t, std::set<TabletInfo>> partition_tablet_map;
+    {
+        ReadLock rlock(&_partition_tablet_map_lock);

Review comment:
       > Could you please to add comment to explain why we need lock and copy the `_partition_tablet_map`?
   
   Done.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org