caiconghui commented on a change in pull request #3051: Support sharding
tablet_map_lock into more small map locks to make good performance for tablet
manage task
URL: https://github.com/apache/incubator-doris/pull/3051#discussion_r389253244
##########
File path: be/src/olap/tablet_manager.cpp
##########
@@ -172,24 +183,29 @@ OLAPStatus
TabletManager::_add_tablet_to_map_unlocked(TTabletId tablet_id, Schem
RETURN_NOT_OK_LOG(tablet->register_tablet_into_dir(), Substitute(
"fail to register tablet into StorageEngine. data_dir=$0",
tablet->data_dir()->path()));
-
- _tablet_map[tablet_id].table_arr.push_back(tablet);
- _tablet_map[tablet_id].table_arr.sort(_cmp_tablet_by_create_time);
-
_partition_tablet_map[tablet->partition_id()].insert(tablet->get_tablet_info());
+ tablet_map_t& tablet_map = _get_tablet_map(tablet_id);
+ tablet_map[tablet_id].table_arr.push_back(tablet);
+ tablet_map[tablet_id].table_arr.sort(_cmp_tablet_by_create_time);
+ {
+ ReadLock rlock(&_partition_tablet_map_lock);
+
_partition_tablet_map[tablet->partition_id()].insert(tablet->get_tablet_info());
Review comment:
here should be wlock, to protect
_partition_tablet_map,_add_tablet_to_map_unlocked is that thread not obtained
_tablet_map_lock
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]