caiconghui commented on a change in pull request #8486:
URL: https://github.com/apache/incubator-doris/pull/8486#discussion_r829143069
##########
File path: be/src/olap/tablet_manager.cpp
##########
@@ -1340,38 +1221,25 @@ OLAPStatus
TabletManager::_drop_tablet_directly_unlocked(TTabletId tablet_id,
return OLAP_SUCCESS;
}
-TabletSharedPtr TabletManager::_get_tablet_unlocked(TTabletId tablet_id,
SchemaHash schema_hash) {
- VLOG_NOTICE << "begin to get tablet. tablet_id=" << tablet_id
- << ", schema_hash=" << schema_hash;
+TabletSharedPtr TabletManager::_get_tablet_unlocked(TTabletId tablet_id) {
+ VLOG_NOTICE << "begin to get tablet. tablet_id=" << tablet_id;
tablet_map_t& tablet_map = _get_tablet_map(tablet_id);
- tablet_map_t::iterator it = tablet_map.find(tablet_id);
- if (it != tablet_map.end()) {
- for (TabletSharedPtr tablet : it->second.table_arr) {
- CHECK(tablet != nullptr) << "tablet is nullptr. tablet_id=" <<
tablet_id;
- if (tablet->equal(tablet_id, schema_hash)) {
- VLOG_NOTICE << "get tablet success. tablet_id=" << tablet_id
- << ", schema_hash=" << schema_hash;
- return tablet;
- }
- }
+ if (tablet_map.find(tablet_id) != tablet_map.end()) {
Review comment:
keep the iterator, and just return value , not find again
##########
File path: be/src/olap/tablet_manager.cpp
##########
@@ -89,42 +85,39 @@ TabletManager::~TabletManager() {
DEREGISTER_HOOK_METRIC(tablet_meta_mem_consumption);
}
-OLAPStatus TabletManager::_add_tablet_unlocked(TTabletId tablet_id, SchemaHash
schema_hash,
- const TabletSharedPtr& tablet,
bool update_meta,
- bool force) {
+OLAPStatus TabletManager::_add_tablet_unlocked(TTabletId tablet_id, const
TabletSharedPtr& tablet,
+ bool update_meta, bool force) {
OLAPStatus res = OLAP_SUCCESS;
VLOG_NOTICE << "begin to add tablet to TabletManager. "
- << "tablet_id=" << tablet_id << ", schema_hash=" << schema_hash
+ << "tablet_id=" << tablet_id
<< ", force=" << force;
TabletSharedPtr existed_tablet = nullptr;
tablet_map_t& tablet_map = _get_tablet_map(tablet_id);
- for (TabletSharedPtr item : tablet_map[tablet_id].table_arr) {
- if (item->equal(tablet_id, schema_hash)) {
- existed_tablet = item;
- break;
- }
+ if (tablet_map.find(tablet_id) != tablet_map.end()) {
Review comment:
use iterator?
--
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]