From 60eeafb3d0ef8c86c2b1b8f9a211b80c9ca043e7 Mon Sep 17 00:00:00 2001 From: fengdeyiji <546976189@qq.com> Date: Wed, 19 Jul 2023 12:42:18 +0000 Subject: [PATCH] [Election] make [decentralized elect]/[change leader] use differenct priority definition --- .../election_priority_impl.cpp | 5 +- .../election_priority_impl.h | 1 + .../palf/election/algorithm/election_impl.h | 16 ++-- .../election/interface/election_priority.h | 1 + src/storage/ls/ob_ls_tablet_service.cpp | 23 +++--- .../meta_mem/ob_tenant_meta_mem_mgr.cpp | 19 +++-- .../ob_mds_table_merge_task.cpp | 9 ++- .../runtime_utility/mds_tenant_service.cpp | 2 +- src/storage/tablet/ob_tablet.cpp | 46 ++++++----- .../tablet/ob_tablet_create_delete_helper.cpp | 5 +- src/storage/tablet/ob_tablet_persister.cpp | 81 ++++++++++--------- src/storage/tablet/ob_tablet_slog_helper.cpp | 7 +- 12 files changed, 123 insertions(+), 92 deletions(-) diff --git a/src/logservice/leader_coordinator/election_priority_impl/election_priority_impl.cpp b/src/logservice/leader_coordinator/election_priority_impl/election_priority_impl.cpp index 18f45cf5a9..d5d4cae320 100644 --- a/src/logservice/leader_coordinator/election_priority_impl/election_priority_impl.cpp +++ b/src/logservice/leader_coordinator/election_priority_impl/election_priority_impl.cpp @@ -192,6 +192,7 @@ private: int ElectionPriorityImpl::compare_with(const ElectionPriority &rhs, const uint64_t compare_version, + const bool decentralized_voting, int &result, ObStringHolder &reason) const { @@ -210,11 +211,11 @@ int ElectionPriorityImpl::compare_with(const ElectionPriority &rhs, result = 0; COORDINATOR_LOG(WARN, "compare between invalid priority"); } else if (functor1.get_closest_priority()->is_valid() && !functor2.get_closest_priority()->is_valid()) { - result = 1; + result = decentralized_voting ? 1 : 0; (void) reason.assign("compare with invalid rhs priority"); COORDINATOR_LOG(WARN, "rhs priority is invalid", KR(ret), K(MTL_ID()), K(*this), K(rhs), K(compare_version), K(result), K(reason)); } else if (!functor1.get_closest_priority()->is_valid() && functor2.get_closest_priority()->is_valid()) { - result = -1; + result = decentralized_voting ? -1 : 0; (void) reason.assign("compare with invalid lhs priority"); COORDINATOR_LOG(WARN, "lhs priority is invalid", KR(ret), K(MTL_ID()), K(*this), K(rhs), K(compare_version), K(result), K(reason)); } else if (CLICK_FAIL(functor1.get_closest_priority()->compare(*functor2.get_closest_priority(), result, reason))) { diff --git a/src/logservice/leader_coordinator/election_priority_impl/election_priority_impl.h b/src/logservice/leader_coordinator/election_priority_impl/election_priority_impl.h index 5379cbb685..f84bf6629f 100644 --- a/src/logservice/leader_coordinator/election_priority_impl/election_priority_impl.h +++ b/src/logservice/leader_coordinator/election_priority_impl/election_priority_impl.h @@ -163,6 +163,7 @@ public: // 在priority间进行比较的方法 virtual int compare_with(const palf::election::ElectionPriority &rhs, const uint64_t compare_version, + const bool decentralized_voting, int &result, ObStringHolder &reason) const; virtual int get_size_of_impl_type() const; diff --git a/src/logservice/palf/election/algorithm/election_impl.h b/src/logservice/palf/election/algorithm/election_impl.h index dbce022d29..44054abc6e 100644 --- a/src/logservice/palf/election/algorithm/election_impl.h +++ b/src/logservice/palf/election/algorithm/election_impl.h @@ -147,12 +147,12 @@ private:// 定向暴露给友元类 bool is_rhs_message_higher_(const MSG &lhs, const MSG &rhs, ObStringHolder &reason, - const bool compare_with_ip_port, + const bool decentralized_voting, const LogPhase phase) const { ELECT_TIME_GUARD(500_ms); #define PRINT_WRAPPER KR(ret), K(rhs_is_higher), K(compare_result), K(reason), K(lhs), K(rhs),\ - K(compare_with_ip_port), KPC(self_priority), KPC(lhs_priority),\ + K(decentralized_voting), KPC(self_priority), KPC(lhs_priority),\ KPC(rhs_priority), K(*this) int ret = OB_SUCCESS; bool rhs_is_higher = false; @@ -192,7 +192,7 @@ private:// 定向暴露给友元类 if (rhs.is_buffer_valid()) {// 如果rhs消息的优先级非空,rhs消息高于lhs消息 rhs_is_higher = true; (void) reason.assign("priority is valid"); - } else if (compare_with_ip_port && rhs.get_sender() < lhs.get_sender()) {// 如果lhs的消息和rhs消息的优先级都是空的,那么比较IP + } else if (decentralized_voting && rhs.get_sender() < lhs.get_sender()) {// 如果lhs的消息和rhs消息的优先级都是空的,那么比较IP rhs_is_higher = true; (void) reason.assign("IP-PORT(priority invalid)"); } else { @@ -212,7 +212,7 @@ private:// 定向暴露给友元类 LOG_PHASE(WARN, phase, "self ever seen min_cluster_version is 0, can only compare IP-PORT"); } if (can_only_compare_ip_port) { - if (compare_with_ip_port && rhs.get_sender() < lhs.get_sender()) { + if (decentralized_voting && rhs.get_sender() < lhs.get_sender()) { rhs_is_higher = true; (void) reason.assign("IP-PORT(priority invalid)"); } else { @@ -237,13 +237,17 @@ private:// 定向暴露给友元类 pos2))) { LOG_PHASE(WARN, phase, "deserialize new message priority failed"); (void) reason.assign("DESERIALIZE FAIL"); - } else if (CLICK_FAIL(lhs_priority->compare_with(*rhs_priority, compare_version, compare_result, reason))) { + } else if (CLICK_FAIL(lhs_priority->compare_with(*rhs_priority, + compare_version, + decentralized_voting, + compare_result, + reason))) { LOG_PHASE(WARN, phase, "compare priority failed"); (void) reason.assign("COMPARE FAIL"); } else { if (compare_result < 0) { rhs_is_higher = true; - } else if (compare_result == 0 && compare_with_ip_port) { + } else if (compare_result == 0 && decentralized_voting) { if (rhs.get_sender() < lhs.get_sender()) { rhs_is_higher = true; (void) reason.assign("IP-PORT(priority equal)"); diff --git a/src/logservice/palf/election/interface/election_priority.h b/src/logservice/palf/election/interface/election_priority.h index 523ec770cc..de45e7a36a 100644 --- a/src/logservice/palf/election/interface/election_priority.h +++ b/src/logservice/palf/election/interface/election_priority.h @@ -39,6 +39,7 @@ public: // 在priority间进行比较的方法 virtual int compare_with(const ElectionPriority &rhs, const uint64_t compare_version, + const bool decentralized_voting, int &result, common::ObStringHolder &reason) const = 0; virtual int get_size_of_impl_type() const = 0; diff --git a/src/storage/ls/ob_ls_tablet_service.cpp b/src/storage/ls/ob_ls_tablet_service.cpp index 150d029939..87956e5c7c 100755 --- a/src/storage/ls/ob_ls_tablet_service.cpp +++ b/src/storage/ls/ob_ls_tablet_service.cpp @@ -1449,6 +1449,7 @@ int ObLSTabletService::build_new_tablet_from_mds_table( const common::ObTabletID &tablet_id, const share::SCN &flush_scn) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; common::ObArenaAllocator allocator("BuildMSD"); const share::ObLSID &ls_id = ls_->get_ls_id(); @@ -1464,15 +1465,15 @@ int ObLSTabletService::build_new_tablet_from_mds_table( } else if (OB_UNLIKELY(!tablet_id.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid args", K(ret), K(tablet_id)); - } else if (OB_FAIL(ObTabletCreateDeleteHelper::acquire_tmp_tablet(key, allocator, tmp_tablet_hdl))) { + } else if (CLICK_FAIL(ObTabletCreateDeleteHelper::acquire_tmp_tablet(key, allocator, tmp_tablet_hdl))) { LOG_WARN("failed to acquire tablet", K(ret), K(key)); } else { ObTablet *tmp_tablet = tmp_tablet_hdl.get_obj(); time_guard.click("Acquire"); + CLICK(); ObBucketHashWLockGuard lock_guard(bucket_lock_, tablet_id.hash()); time_guard.click("Lock"); - - if (OB_FAIL(direct_get_tablet(tablet_id, old_tablet_handle))) { + if (CLICK_FAIL(direct_get_tablet(tablet_id, old_tablet_handle))) { LOG_WARN("failed to get tablet", K(ret), K(tablet_id)); } else if (old_tablet_handle.get_obj()->is_empty_shell()) { LOG_INFO("old tablet is empty shell tablet, should skip mds table dump operation", K(ret), @@ -1486,21 +1487,22 @@ int ObLSTabletService::build_new_tablet_from_mds_table( ObTabletMdsData mds_data; if (OB_FAIL(ret)) { - } else if (OB_FAIL(old_tablet->read_mds_table(arena_allocator, mds_data, true))) { + } else if (CLICK_FAIL(old_tablet->read_mds_table(arena_allocator, mds_data, true))) { LOG_WARN("failed to read mds table", K(ret)); - } else if (OB_FAIL(tmp_tablet->init(allocator, *old_tablet, flush_scn, mds_data, old_tablet->mds_data_))) { + } else if (CLICK_FAIL(tmp_tablet->init(allocator, *old_tablet, flush_scn, mds_data, old_tablet->mds_data_))) { LOG_WARN("failed to init tablet", K(ret), KPC(old_tablet), K(flush_scn)); - } else if (OB_FAIL(ObTabletPersister::persist_and_transform_tablet(*tmp_tablet, new_tablet_handle))) { + } else if (CLICK_FAIL(ObTabletPersister::persist_and_transform_tablet(*tmp_tablet, new_tablet_handle))) { LOG_WARN("fail to persist and transform tablet", K(ret), KPC(tmp_tablet), K(new_tablet_handle)); } else if (FALSE_IT(disk_addr = new_tablet_handle.get_obj()->tablet_addr_)) { - } else if (OB_FAIL(ObTabletSlogHelper::write_update_tablet_slog(ls_id, tablet_id, disk_addr))) { - LOG_WARN("fail to write update tablet slog", K(ret), K(ls_id), K(tablet_id), K(disk_addr)); + } else if (CLICK_FAIL(ObTabletSlogHelper::write_update_tablet_slog(ls_id, tablet_id, disk_addr))) { } else if (FALSE_IT(time_guard.click("WrSlog"))) { - } else if (OB_FAIL(t3m->compare_and_swap_tablet(key, old_tablet_handle, new_tablet_handle))) { + LOG_WARN("fail to write update tablet slog", K(ret), K(ls_id), K(tablet_id), K(disk_addr)); + } else if (CLICK_FAIL(t3m->compare_and_swap_tablet(key, old_tablet_handle, new_tablet_handle))) { LOG_ERROR("failed to compare and swap tablet", K(ret), K(key), K(disk_addr), K(old_tablet_handle)); ob_usleep(1000 * 1000); ob_abort(); } else { + CLICK(); time_guard.click("CASwap"); LOG_INFO("succeeded to build new tablet", K(ret), K(disk_addr), K(new_tablet_handle), K(mds_data)); } @@ -1912,10 +1914,11 @@ int ObLSTabletService::get_tablet_with_timeout( int ObLSTabletService::direct_get_tablet(const common::ObTabletID &tablet_id, ObTabletHandle &handle) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; const ObTabletMapKey key(ls_->get_ls_id(), tablet_id); - if (OB_FAIL(ObTabletCreateDeleteHelper::get_tablet(key, handle))) { + if (CLICK_FAIL(ObTabletCreateDeleteHelper::get_tablet(key, handle))) { LOG_WARN("failed to get tablet from t3m", K(ret), K(key)); } diff --git a/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp b/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp index bc35e5cbbb..7a8d4bbcb0 100755 --- a/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp +++ b/src/storage/meta_mem/ob_tenant_meta_mem_mgr.cpp @@ -1340,6 +1340,7 @@ int ObTenantMetaMemMgr::acquire_tmp_tablet( common::ObArenaAllocator &allocator, ObTabletHandle &tablet_handle) { + TIMEGUARD_INIT(STORAGE, 10_ms); int ret = OB_SUCCESS; void *buf = nullptr; tablet_handle.reset(); @@ -1358,16 +1359,17 @@ int ObTenantMetaMemMgr::acquire_tmp_tablet( tablet_handle.get_obj()->set_allocator(&allocator); tablet_handle.disallow_copy_and_assign(); bool is_exist = false; + CLICK(); ObBucketHashWLockGuard lock_guard(bucket_lock_, key.hash()); - if (OB_FAIL(has_tablet(key, is_exist))) { + if (CLICK_FAIL(has_tablet(key, is_exist))) { LOG_WARN("fail to check tablet existence", K(ret), K(key)); } else if (is_exist) { ObTabletPointerHandle ptr_handle(tablet_map_); - if (OB_FAIL(tablet_map_.set_attr_for_obj(key, tablet_handle))) { + if (CLICK_FAIL(tablet_map_.set_attr_for_obj(key, tablet_handle))) { LOG_WARN("fail to set attribute for tablet", K(ret), K(key), K(tablet_handle)); - } else if (OB_FAIL(tablet_map_.get(key, ptr_handle))) { + } else if (CLICK_FAIL(tablet_map_.get(key, ptr_handle))) { LOG_WARN("fail to get tablet pointer handle", K(ret), K(key), K(tablet_handle)); - } else if (OB_FAIL(tablet_handle.get_obj()->assign_pointer_handle(ptr_handle))) { + } else if (CLICK_FAIL(tablet_handle.get_obj()->assign_pointer_handle(ptr_handle))) { LOG_WARN("fail to set tablet pointer handle for tablet", K(ret), K(key)); } } else { @@ -1375,7 +1377,7 @@ int ObTenantMetaMemMgr::acquire_tmp_tablet( LOG_WARN("The tablet pointer isn't exist, don't support to acquire", K(ret), K(key)); } } - if (OB_FAIL(ret)) { + if (CLICK_FAIL(ret)) { tablet_handle.reset(); } return ret; @@ -1771,6 +1773,7 @@ int ObTenantMetaMemMgr::compare_and_swap_tablet( const ObTabletHandle &old_handle, ObTabletHandle &new_handle) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; const ObMetaDiskAddr &new_addr = new_handle.get_obj()->get_tablet_addr(); const ObTablet *old_tablet = old_handle.get_obj(); @@ -1790,9 +1793,9 @@ int ObTenantMetaMemMgr::compare_and_swap_tablet( LOG_WARN("invalid argument", K(ret), K(key), K(new_addr), K(old_handle), K(new_handle)); } else { ObBucketHashWLockGuard lock_guard(bucket_lock_, key.hash()); - if (OB_FAIL(tablet_map_.compare_and_swap_addr_and_object(key, new_addr, old_handle, new_handle))) { + if (CLICK_FAIL(tablet_map_.compare_and_swap_addr_and_object(key, new_addr, old_handle, new_handle))) { LOG_WARN("fail to compare and swap tablet", K(ret), K(key), K(new_addr), K(old_handle), K(new_handle)); - } else if (OB_FAIL(update_tablet_buffer_header(old_handle.get_obj(), new_handle.get_obj()))) { + } else if (CLICK_FAIL(update_tablet_buffer_header(old_handle.get_obj(), new_handle.get_obj()))) { LOG_WARN("fail to update tablet buffer header", K(ret), K(old_handle), K(new_handle)); } else if (old_handle.get_obj() != new_handle.get_obj()) { // skip first init, old_handle == new_handle // TODO zhouxinlan.zxl update min minor sstable by link @@ -1801,7 +1804,7 @@ int ObTenantMetaMemMgr::compare_and_swap_tablet( if (OB_ISNULL(t_ptr = reinterpret_cast(ptr_hdl.get_resource_ptr()))) { ret = common::OB_ERR_UNEXPECTED; LOG_WARN("fail to get tablet pointer", K(ret), K(key), K(ptr_hdl)); - } else if (OB_FAIL(t_ptr->add_tablet_to_old_version_chain( + } else if (CLICK_FAIL(t_ptr->add_tablet_to_old_version_chain( reinterpret_cast(old_handle.get_obj())))) { LOG_WARN("fail to add tablet to old version chain", K(ret), K(key), KPC(old_tablet)); } diff --git a/src/storage/multi_data_source/ob_mds_table_merge_task.cpp b/src/storage/multi_data_source/ob_mds_table_merge_task.cpp index 8a0ad92f18..c710c0f770 100644 --- a/src/storage/multi_data_source/ob_mds_table_merge_task.cpp +++ b/src/storage/multi_data_source/ob_mds_table_merge_task.cpp @@ -50,6 +50,7 @@ int ObMdsTableMergeTask::init(const ObMdsTableMergeDagParam ¶m) int ObMdsTableMergeTask::process() { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; int tmp_ret = OB_SUCCESS; ObLSService *ls_service = MTL(ObLSService*); @@ -66,24 +67,24 @@ int ObMdsTableMergeTask::process() if (OB_UNLIKELY(!is_inited_)) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret), K_(is_inited)); - } else if (OB_FAIL(ls_service->get_ls(ls_id, ls_handle, ObLSGetMod::STORAGE_MOD))) { + } else if (MDS_FAIL(ls_service->get_ls(ls_id, ls_handle, ObLSGetMod::STORAGE_MOD))) { LOG_WARN("failed to get ls", K(ret), K(ls_id)); } else if (OB_ISNULL(ls = ls_handle.get_ls())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("ls is null", K(ret), K(ls_id), K(ls_handle)); - } else if (OB_FAIL(ls->get_tablet(tablet_id, tablet_handle, 0, ObMDSGetTabletMode::READ_WITHOUT_CHECK))) { + } else if (MDS_FAIL(ls->get_tablet(tablet_id, tablet_handle, 0, ObMDSGetTabletMode::READ_WITHOUT_CHECK))) { LOG_WARN("failed to get tablet", K(ret), K(tablet_id)); } else if (OB_ISNULL(tablet = tablet_handle.get_obj())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("tablet is null", K(ret), K(ls_id), K(tablet_handle)); - } else if (OB_FAIL(ls->get_tablet_svr()->build_new_tablet_from_mds_table(tablet_id, flush_scn))) { + } else if (MDS_FAIL(ls->get_tablet_svr()->build_new_tablet_from_mds_table(tablet_id, flush_scn))) { LOG_WARN("failed to build new tablet from mds table", K(ret), K(ls_id), K(tablet_id), K(flush_scn)); } else { share::dag_yield(); } // always notify flush ret - if (OB_NOT_NULL(tablet) && OB_TMP_FAIL(tablet->notify_mds_table_flush_ret(flush_scn, ret))) { + if (CLICK() && OB_NOT_NULL(tablet) && OB_TMP_FAIL(tablet->notify_mds_table_flush_ret(flush_scn, ret))) { LOG_WARN("failed to notify mds table flush ret", K(tmp_ret), K(ls_id), K(tablet_id), K(flush_scn), "flush_ret", ret); } diff --git a/src/storage/multi_data_source/runtime_utility/mds_tenant_service.cpp b/src/storage/multi_data_source/runtime_utility/mds_tenant_service.cpp index 691535264a..930f868ee7 100644 --- a/src/storage/multi_data_source/runtime_utility/mds_tenant_service.cpp +++ b/src/storage/multi_data_source/runtime_utility/mds_tenant_service.cpp @@ -399,7 +399,7 @@ int ObTenantMdsTimer::process_with_tablet_(ObTablet &tablet) if (OB_EAGAIN != ret) { MDS_LOG_GC(WARN, "fail to gc mds table"); } else { - MDS_LOG_GC(INFO, "try gc mds table need do again later"); + MDS_LOG_GC(TRACE, "try gc mds table need do again later"); } } else { MDS_LOG_GC(INFO, "success do try gc mds table"); diff --git a/src/storage/tablet/ob_tablet.cpp b/src/storage/tablet/ob_tablet.cpp index 7f74e739ad..a9fcd7ede2 100755 --- a/src/storage/tablet/ob_tablet.cpp +++ b/src/storage/tablet/ob_tablet.cpp @@ -365,6 +365,7 @@ int ObTablet::init( const ObTabletMdsData &mds_table_data, const ObTabletMdsData &base_data) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; allocator_ = &allocator; common::ObArenaAllocator tmp_arena_allocator("InitTabletMDS"); @@ -381,36 +382,36 @@ int ObTablet::init( || OB_ISNULL(log_handler_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("tablet pointer handle is invalid", K(ret), K_(pointer_hdl), K_(memtable_mgr), K_(log_handler)); - } else if (OB_FAIL(old_tablet.fetch_table_store(old_table_store_wrapper))) { + } else if (CLICK_FAIL(old_tablet.fetch_table_store(old_table_store_wrapper))) { LOG_WARN("failed to fetch old table store", K(ret), K(old_tablet)); - } else if (OB_FAIL(old_table_store_wrapper.get_member(old_table_store))) { + } else if (CLICK_FAIL(old_table_store_wrapper.get_member(old_table_store))) { LOG_WARN("failed to get old table store", K(ret)); - } else if (OB_FAIL(old_tablet.load_storage_schema(tmp_arena_allocator, old_storage_schema))) { + } else if (CLICK_FAIL(old_tablet.load_storage_schema(tmp_arena_allocator, old_storage_schema))) { LOG_WARN("failed to load storage schema", K(ret), K(old_tablet)); - } else if (OB_FAIL(tablet_meta_.init(old_tablet.tablet_meta_, flush_scn))) { + } else if (CLICK_FAIL(tablet_meta_.init(old_tablet.tablet_meta_, flush_scn))) { LOG_WARN("failed to init tablet meta", K(ret), K(old_tablet), K(flush_scn)); - } else if (OB_FAIL(pull_memtables())) { + } else if (CLICK_FAIL(pull_memtables())) { LOG_WARN("fail to pull memtable", K(ret)); - } else if (OB_FAIL(ObTabletObjLoadHelper::alloc_and_new(allocator, table_store_addr_.ptr_))) { + } else if (CLICK_FAIL(ObTabletObjLoadHelper::alloc_and_new(allocator, table_store_addr_.ptr_))) { LOG_WARN("fail to alloc and new table store object", K(ret), K_(table_store_addr)); - } else if (OB_FAIL(table_store_addr_.get_ptr()->init(*allocator_, *this, *old_table_store))) { + } else if (CLICK_FAIL(table_store_addr_.get_ptr()->init(*allocator_, *this, *old_table_store))) { LOG_WARN("fail to init table store", K(ret), KPC(old_table_store)); - } else if (OB_FAIL(get_finish_medium_scn(finish_medium_scn))) { + } else if (CLICK_FAIL(get_finish_medium_scn(finish_medium_scn))) { LOG_WARN("failed to get finish medium scn", K(ret)); - } else if (OB_FAIL(mds_data_.init(allocator, mds_table_data, base_data, finish_medium_scn))) { + } else if (CLICK_FAIL(mds_data_.init(allocator, mds_table_data, base_data, finish_medium_scn))) { LOG_WARN("failed to init mds data", K(ret), K(finish_medium_scn)); } else { ALLOC_AND_INIT(allocator, storage_schema_addr_, *old_storage_schema); } - if (FAILEDx(build_read_info(*allocator_))) { + if (CLICK() && FAILEDx(build_read_info(*allocator_))) { LOG_WARN("failed to build read info", K(ret)); - } else if (OB_FAIL(check_medium_list())) { + } else if (CLICK_FAIL(check_medium_list())) { LOG_WARN("failed to check medium list", K(ret), KPC(this)); - } else if (OB_FAIL(check_sstable_column_checksum())) { + } else if (CLICK_FAIL(check_sstable_column_checksum())) { LOG_WARN("failed to check sstable column checksum", K(ret), KPC(this)); } else if (FALSE_IT(set_mem_addr())) { - } else if (OB_FAIL(inner_inc_macro_ref_cnt())) { + } else if (CLICK_FAIL(inner_inc_macro_ref_cnt())) { LOG_WARN("failed to increase macro ref cnt", K(ret)); } else { if (old_tablet.get_tablet_meta().has_next_tablet_) { @@ -683,6 +684,7 @@ int ObTablet::init( int ObTablet::fetch_table_store(ObTabletMemberWrapper &wrapper) const { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; if (OB_UNLIKELY(!table_store_addr_.is_valid())) { ret = OB_INVALID_ARGUMENT; @@ -698,10 +700,10 @@ int ObTablet::fetch_table_store(ObTabletMemberWrapper &wrapp } else { ObStorageMetaHandle handle; ObStorageMetaKey meta_key(MTL_ID(), table_store_addr_.addr_); - if (OB_FAIL(OB_STORE_CACHE.get_storage_meta_cache().get_meta( - ObStorageMetaValue::MetaType::TABLE_STORE, meta_key, handle, this))) { + if (CLICK_FAIL(OB_STORE_CACHE.get_storage_meta_cache().get_meta( + ObStorageMetaValue::MetaType::TABLE_STORE, meta_key, handle, this))) { LOG_WARN("get meta failed", K(ret), K(meta_key)); - } else if (OB_FAIL(wrapper.set_cache_handle(handle))) { + } else if (CLICK_FAIL(wrapper.set_cache_handle(handle))) { LOG_WARN("wrapper set cache handle failed", K(ret), K(meta_key), K_(table_store_addr)); } } @@ -5010,6 +5012,7 @@ int ObTablet::build_memtable(common::ObIArray &handle_array, co int ObTablet::read_mds_table(common::ObIAllocator &allocator, ObTabletMdsData &mds_data, const bool for_flush) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; mds_data.reset(); mds::MdsTableHandle mds_table_handle; @@ -5017,9 +5020,9 @@ int ObTablet::read_mds_table(common::ObIAllocator &allocator, ObTabletMdsData &m if (OB_UNLIKELY(!is_inited_)) { ret = OB_NOT_INIT; LOG_WARN("not inited", K(ret), K_(is_inited)); - } else if (OB_FAIL(mds_data.init(allocator))) { + } else if (CLICK_FAIL(mds_data.init(allocator))) { LOG_WARN("failed to init mds data", K(ret)); - } else if (OB_FAIL(inner_get_mds_table(mds_table_handle))) { + } else if (CLICK_FAIL(inner_get_mds_table(mds_table_handle))) { if (OB_ENTRY_NOT_EXIST == ret) { ret = OB_SUCCESS; LOG_INFO("mds table does not exist, may be released", K(ret), @@ -5030,7 +5033,7 @@ int ObTablet::read_mds_table(common::ObIAllocator &allocator, ObTabletMdsData &m } } else { ObTabletDumpMdsNodeOperator op(mds_data, allocator); - if (OB_FAIL(mds_table_handle.for_each_unit_from_small_key_to_big_from_old_node_to_new_to_dump(op, for_flush))) { + if (CLICK_FAIL(mds_table_handle.for_each_unit_from_small_key_to_big_from_old_node_to_new_to_dump(op, for_flush))) { LOG_WARN("failed to traverse mds table", K(ret)); } } @@ -5068,6 +5071,7 @@ int ObTablet::notify_mds_table_flush_ret( const share::SCN &flush_scn, const int flush_ret) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; mds::MdsTableHandle mds_table; const share::ObLSID &ls_id = tablet_meta_.ls_id_; @@ -5079,9 +5083,9 @@ int ObTablet::notify_mds_table_flush_ret( } else if (is_ls_inner_tablet()) { ret = OB_NOT_SUPPORTED; LOG_WARN("inner tablet does not have mds table", K(ret), K(ls_id), K(tablet_id)); - } else if (OB_FAIL(inner_get_mds_table(mds_table))) { + } else if (CLICK_FAIL(inner_get_mds_table(mds_table))) { LOG_WARN("failed to get mds table", K(ret), K(ls_id), K(tablet_id)); - } else if (!mds_table.is_valid()) { + } else if (CLICK() && !mds_table.is_valid()) { ret = OB_ERR_UNEXPECTED; LOG_WARN("mds table is null", K(ret), K(ls_id), K(tablet_id)); } else { diff --git a/src/storage/tablet/ob_tablet_create_delete_helper.cpp b/src/storage/tablet/ob_tablet_create_delete_helper.cpp index 6eaa8b1cfd..ebd55e6758 100755 --- a/src/storage/tablet/ob_tablet_create_delete_helper.cpp +++ b/src/storage/tablet/ob_tablet_create_delete_helper.cpp @@ -34,6 +34,7 @@ #include "storage/tx_storage/ob_ls_service.h" #include "share/scn.h" #include "observer/omt/ob_tenant_config_mgr.h" +#include "share/ob_occam_time_guard.h" #define USING_LOG_PREFIX STORAGE @@ -57,6 +58,7 @@ int ObTabletCreateDeleteHelper::get_tablet( ObTabletHandle &handle, const int64_t timeout_us) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; static const int64_t SLEEP_TIME_US = 10; ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*); @@ -489,12 +491,13 @@ int ObTabletCreateDeleteHelper::acquire_tmp_tablet( common::ObArenaAllocator &allocator, ObTabletHandle &handle) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; ObTenantMetaMemMgr *t3m = MTL(ObTenantMetaMemMgr*); if (OB_UNLIKELY(!key.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arguments", K(ret), K(key)); - } else if (OB_FAIL(t3m->acquire_tmp_tablet(WashTabletPriority::WTP_HIGH, key, allocator, handle))) { + } else if (CLICK_FAIL(t3m->acquire_tmp_tablet(WashTabletPriority::WTP_HIGH, key, allocator, handle))) { LOG_WARN("fail to acquire temporary tablet", K(ret), K(key)); } else if (OB_ISNULL(handle.get_obj())) { ret = OB_ERR_UNEXPECTED; diff --git a/src/storage/tablet/ob_tablet_persister.cpp b/src/storage/tablet/ob_tablet_persister.cpp index 7314484ce6..d1817d8399 100644 --- a/src/storage/tablet/ob_tablet_persister.cpp +++ b/src/storage/tablet/ob_tablet_persister.cpp @@ -86,6 +86,7 @@ int ObTabletPersister::persist_and_transform_tablet( const ObTablet &old_tablet, ObTabletHandle &new_handle) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; common::ObArenaAllocator allocator; common::ObSEArray tablet_meta_write_ctxs; @@ -94,12 +95,12 @@ int ObTabletPersister::persist_and_transform_tablet( if (OB_UNLIKELY(!old_tablet.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid old tablet to persist", K(ret), K(old_tablet)); - } else if (OB_FAIL(recursively_persist( + } else if (CLICK_FAIL(recursively_persist( old_tablet, allocator, tablet_meta_write_ctxs, sstable_meta_write_ctxs, new_handle))) { LOG_WARN("fail to recursively persist and fill tablet", K(ret), K(old_tablet)); - } else if (OB_FAIL(check_tablet_meta_ids(tablet_meta_write_ctxs, *(new_handle.get_obj())))) { + } else if (CLICK_FAIL(check_tablet_meta_ids(tablet_meta_write_ctxs, *(new_handle.get_obj())))) { LOG_WARN("fail to check whether tablet meta's macro ids match", K(ret), K(tablet_meta_write_ctxs), KPC(new_handle.get_obj())); - } else if (OB_FAIL(persist_4k_tablet(allocator, new_handle))) { + } else if (CLICK_FAIL(persist_4k_tablet(allocator, new_handle))) { LOG_WARN("fail to persist 4k tablet", K(ret), K(new_handle), KPC(new_handle.get_obj())); } else { FLOG_INFO("succeed to persist 4k tablet", K(&old_tablet), K(new_handle.get_obj())); @@ -114,14 +115,15 @@ int ObTabletPersister::recursively_persist( common::ObIArray &sstable_meta_write_ctxs, ObTabletHandle &new_handle) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; - if (OB_FAIL(persist_and_fill_tablet( + if (CLICK_FAIL(persist_and_fill_tablet( old_tablet, allocator, tablet_meta_write_ctxs, sstable_meta_write_ctxs, new_handle))) { LOG_WARN("fail to persist and fill tablet", K(ret), K(old_tablet)); } else if (old_tablet.get_tablet_meta().has_next_tablet_) { ObTabletHandle new_next_handle; const ObTablet &old_next_tablet = *(old_tablet.get_next_tablet_guard().get_obj()); - if (OB_FAIL(recursively_persist( + if (CLICK_FAIL(recursively_persist( old_next_tablet, allocator, tablet_meta_write_ctxs, sstable_meta_write_ctxs, new_next_handle))) { LOG_WARN("fail to recursively persist and fill next tablet", K(ret), K(old_next_tablet), K(tablet_meta_write_ctxs), K(sstable_meta_write_ctxs)); @@ -137,18 +139,19 @@ int ObTabletPersister::convert_tablet_to_mem_arg( ObTabletMemberWrapper &auto_inc_seq, ObTabletTransformArg &arg) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; arg.reset(); if (OB_UNLIKELY(!tablet.is_valid())) { ret = OB_NOT_INIT; LOG_WARN("old tablet isn't valid, don't allow to degrade tablet memory", K(ret), K(tablet)); - } else if (OB_FAIL(arg.tablet_status_cache_.assign(tablet.mds_data_.tablet_status_cache_))) { + } else if (CLICK_FAIL(arg.tablet_status_cache_.assign(tablet.mds_data_.tablet_status_cache_))) { LOG_WARN("fail to assign tablet status cache", K(ret), K(tablet)); - } else if (OB_FAIL(arg.aux_tablet_info_cache_.assign(tablet.mds_data_.aux_tablet_info_cache_))) { + } else if (CLICK_FAIL(arg.aux_tablet_info_cache_.assign(tablet.mds_data_.aux_tablet_info_cache_))) { LOG_WARN("fail to assign aux tablet info cache", K(ret), K(tablet)); - } else if (OB_FAIL(arg.tablet_meta_.assign(tablet.tablet_meta_))) { + } else if (CLICK_FAIL(arg.tablet_meta_.assign(tablet.tablet_meta_))) { LOG_WARN("fail to assign tablet meta", K(ret), K(tablet)); - } else if (OB_FAIL(tablet.fetch_autoinc_seq(auto_inc_seq))) { + } else if (CLICK_FAIL(tablet.fetch_autoinc_seq(auto_inc_seq))) { LOG_WARN("fail to fetch autoinc seq", K(ret), K(tablet)); } else { arg.auto_inc_seq_ptr_ = auto_inc_seq.get_member(); @@ -174,6 +177,7 @@ int ObTabletPersister::convert_tablet_to_disk_arg( ObTabletMemberWrapper &auto_inc_seq, ObTabletTransformArg &arg) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; arg.reset(); @@ -199,34 +203,34 @@ int ObTabletPersister::convert_tablet_to_disk_arg( const ObTabletComplexAddr &committed_aux_tablet_info_addr = tablet.mds_data_.aux_tablet_info_.committed_kv_; const ObTabletComplexAddr &medium_info_list_addr = tablet.mds_data_.medium_info_list_; - if (OB_FAIL(arg.tablet_status_cache_.assign(tablet.mds_data_.tablet_status_cache_))) { + if (CLICK_FAIL(arg.tablet_status_cache_.assign(tablet.mds_data_.tablet_status_cache_))) { LOG_WARN("fail to assign tablet status cache", K(ret), K(tablet)); - } else if (OB_FAIL(arg.aux_tablet_info_cache_.assign(tablet.mds_data_.aux_tablet_info_cache_))) { + } else if (CLICK_FAIL(arg.aux_tablet_info_cache_.assign(tablet.mds_data_.aux_tablet_info_cache_))) { LOG_WARN("fail to assign aux tablet info cache", K(ret), K(tablet)); - } else if (OB_FAIL(arg.tablet_meta_.assign(tablet.tablet_meta_))) { + } else if (CLICK_FAIL(arg.tablet_meta_.assign(tablet.tablet_meta_))) { LOG_WARN("fail to assign tablet meta", K(ret), K(tablet)); } else if (FALSE_IT(arg.rowkey_read_info_ptr_ = tablet.rowkey_read_info_)) { } else if (FALSE_IT(arg.extra_medium_info_ = tablet.mds_data_.extra_medium_info_)) { - } else if (OB_FAIL(fetch_wrapper_and_write_info(allocator, fetch_table_store, table_store, write_infos, sstable_meta_write_ctxs))) { + } else if (CLICK_FAIL(fetch_wrapper_and_write_info(allocator, fetch_table_store, table_store, write_infos, sstable_meta_write_ctxs))) { LOG_WARN("fail to fetch table store wrapper and write info", K(ret)); - } else if (OB_FAIL(fetch_wrapper_and_write_info( + } else if (CLICK_FAIL(fetch_wrapper_and_write_info( allocator, fetch_auto_inc_seq, auto_inc_seq, write_infos, tablet_meta_write_ctxs))) { LOG_WARN("fail to fetch auto inc seq wrapper and write info", K(ret)); } else if (FALSE_IT(arg.auto_inc_seq_ptr_ = auto_inc_seq.get_member())) { - } else if (OB_FAIL(load_member_and_write_info( + } else if (CLICK_FAIL(load_member_and_write_info( allocator, load_storage_schema, storage_schema, write_infos))) { LOG_WARN("fail to load storage schema and write info", K(ret)); - } else if (OB_FAIL(load_dump_kv_and_fill_write_info(allocator, uncommitted_tablet_status_addr, write_infos))) { + } else if (CLICK_FAIL(load_dump_kv_and_fill_write_info(allocator, uncommitted_tablet_status_addr, write_infos))) { LOG_WARN("fail to load tablet status uncommitted kv", K(ret), K(uncommitted_tablet_status_addr)); - } else if (OB_FAIL(load_dump_kv_and_fill_write_info(allocator, committed_tablet_status_addr, write_infos))) { + } else if (CLICK_FAIL(load_dump_kv_and_fill_write_info(allocator, committed_tablet_status_addr, write_infos))) { LOG_WARN("fail to load tablet status committed kv", K(ret), K(committed_tablet_status_addr)); - } else if (OB_FAIL(load_dump_kv_and_fill_write_info(allocator, uncommitted_aux_tablet_info_addr, write_infos))) { + } else if (CLICK_FAIL(load_dump_kv_and_fill_write_info(allocator, uncommitted_aux_tablet_info_addr, write_infos))) { LOG_WARN("fail to load aux tablet info uncommitted kv", K(ret), K(uncommitted_aux_tablet_info_addr)); - } else if (OB_FAIL(load_dump_kv_and_fill_write_info(allocator, committed_aux_tablet_info_addr, write_infos))) { + } else if (CLICK_FAIL(load_dump_kv_and_fill_write_info(allocator, committed_aux_tablet_info_addr, write_infos))) { LOG_WARN("fail to load aux tablet info committed kv", K(ret), K(committed_aux_tablet_info_addr)); - } else if (OB_FAIL(write_and_fill_args(write_infos, arg, tablet_meta_write_ctxs))) { + } else if (CLICK_FAIL(write_and_fill_args(write_infos, arg, tablet_meta_write_ctxs))) { LOG_WARN("fail to write and fill address", K(ret), K(write_infos), K(auto_inc_seq)); - } else if (OB_FAIL(load_medium_info_list_and_write(allocator, medium_info_list_addr, arg.medium_info_list_addr_, tablet_meta_write_ctxs))) { + } else if (CLICK_FAIL(load_medium_info_list_and_write(allocator, medium_info_list_addr, arg.medium_info_list_addr_, tablet_meta_write_ctxs))) { LOG_WARN("fail to load medium info list and write", K(ret), K(medium_info_list_addr)); } else { const int64_t try_cache_size = sizeof(ObTablet) @@ -248,6 +252,7 @@ int ObTabletPersister::persist_and_fill_tablet( common::ObIArray &sstable_meta_write_ctxs, ObTabletHandle &new_handle) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; common::ObSEArray write_infos; ObTabletTransformArg arg; @@ -262,16 +267,16 @@ int ObTabletPersister::persist_and_fill_tablet( if (OB_FAIL(convert_tablet_to_mem_arg(old_tablet, auto_inc_seq, arg))) { LOG_WARN("fail to conver tablet to mem arg", K(ret), K(old_tablet)); } - } else if (OB_FAIL(convert_tablet_to_disk_arg( + } else if (CLICK_FAIL(convert_tablet_to_disk_arg( allocator, old_tablet, tablet_meta_write_ctxs, sstable_meta_write_ctxs, type, auto_inc_seq, arg))) { LOG_WARN("fail to conver tablet to disk arg", K(ret), K(old_tablet)); } else if (sizeof(old_tablet) + old_tablet.rowkey_read_info_->get_deep_copy_size() > ObTenantMetaMemMgr::NORMAL_TABLET_POOL_SIZE) { try_smaller_pool = false; } - if (FAILEDx(acquire_tablet(type, key, try_smaller_pool, new_handle))) { + if (CLICK() && FAILEDx(acquire_tablet(type, key, try_smaller_pool, new_handle))) { LOG_WARN("fail to acquire tablet", K(ret), K(key), K(type)); - } else if (OB_FAIL(transform(arg, new_handle.get_buf(), new_handle.get_buf_len()))) { + } else if (CLICK_FAIL(transform(arg, new_handle.get_buf(), new_handle.get_buf_len()))) { LOG_WARN("fail to transform old tablet", K(ret), K(arg), K(new_handle), K(type)); } @@ -282,6 +287,7 @@ int ObTabletPersister::check_tablet_meta_ids( const common::ObIArray &tablet_meta_write_ctxs, const ObTablet &tablet) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; ObSArray meta_ids; ObSArray ctx_ids; @@ -290,14 +296,15 @@ int ObTabletPersister::check_tablet_meta_ids( LOG_WARN("fail to parse meta addr", K(ret), K(tablet_meta_write_ctxs.at(i).addr_)); } } - if (OB_FAIL(ret)) { + if (CLICK_FAIL(ret)) { // do nothing - } else if (OB_FAIL(tablet.get_tablet_meta_ids(meta_ids))) { + } else if (CLICK_FAIL(tablet.get_tablet_meta_ids(meta_ids))) { LOG_WARN("fail to get tablet meta ids", K(ret), K(tablet)); } else if (meta_ids.count() != ctx_ids.count()) { ret = OB_ERR_UNEXPECTED; LOG_WARN("tablet meta's macro ids don't match", K(ret), K(meta_ids.count()), K(ctx_ids.count())); } else { + CLICK(); for (int64_t i = 0; OB_SUCC(ret) && i < ctx_ids.count(); i++) { for (int64_t j = 0; OB_SUCC(ret) && j < meta_ids.count(); j++) { if (meta_ids.at(j) == ctx_ids.at(i)) { @@ -344,23 +351,24 @@ int ObTabletPersister::acquire_tablet( int ObTabletPersister::persist_4k_tablet(common::ObArenaAllocator &allocator, ObTabletHandle &new_handle) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; ObTablet *new_tablet = new_handle.get_obj(); ObTenantCheckpointSlogHandler *ckpt_slog_hanlder = MTL(ObTenantCheckpointSlogHandler*); common::ObSEArray write_infos; ObSharedBlockWriteHandle handle; ObSharedBlocksWriteCtx write_ctx; - if (OB_FAIL(fill_write_info(allocator, new_tablet, write_infos))) { + if (CLICK_FAIL(fill_write_info(allocator, new_tablet, write_infos))) { LOG_WARN("fail to fill write info", K(ret), KPC(new_tablet)); } else if (OB_ISNULL(ckpt_slog_hanlder)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected error, ckpt slog handler is nullptr", K(ret), KP(ckpt_slog_hanlder)); - } else if (OB_FAIL(ckpt_slog_hanlder->get_shared_block_reader_writer().async_write(write_infos.at(0), handle))) { + } else if (CLICK_FAIL(ckpt_slog_hanlder->get_shared_block_reader_writer().async_write(write_infos.at(0), handle))) { LOG_WARN("fail to async write", K(ret), K(write_infos)); - } else if (OB_FAIL(handle.get_write_ctx(write_ctx))) { + } else if (CLICK_FAIL(handle.get_write_ctx(write_ctx))) { LOG_WARN("fail to batch get address", K(ret), K(handle)); } else if (FALSE_IT(new_tablet->set_tablet_addr(write_ctx.addr_))) { - } else if (OB_FAIL(new_tablet->inc_macro_ref_cnt())) { + } else if (CLICK_FAIL(new_tablet->inc_macro_ref_cnt())) { LOG_WARN("fail to increase macro ref cnt for new tablet", K(ret), KPC(new_tablet)); } return ret; @@ -403,6 +411,7 @@ int ObTabletPersister::transform( char *buf, const int64_t len) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; ObTablet *tiny_tablet = reinterpret_cast(buf); if (len <= sizeof(ObTablet) || OB_ISNULL(buf)) { @@ -424,7 +433,7 @@ int ObTabletPersister::transform( if (OB_UNLIKELY(remain < rowkey_read_info_size)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("tablet memory buffer not enough for rowkey read info", K(ret), K(remain), K(rowkey_read_info_size)); - } else if (OB_FAIL(arg.rowkey_read_info_ptr_->deep_copy( + } else if (CLICK_FAIL(arg.rowkey_read_info_ptr_->deep_copy( buf + start_pos, remain, tiny_tablet->rowkey_read_info_))) { LOG_WARN("fail to deep copy rowkey read info to tablet", K(ret), KPC(arg.rowkey_read_info_ptr_)); } else if (OB_ISNULL(tiny_tablet->rowkey_read_info_)) { @@ -447,11 +456,11 @@ int ObTabletPersister::transform( LOG_WARN("fail to allocate a buffer", K(ret), "sizeof", sizeof(ObTabletTableStore)); } else { table_store = new (ptr) ObTabletTableStore(); - if (OB_FAIL(table_store->init(allocator, *tiny_tablet))) { + if (CLICK_FAIL(table_store->init(allocator, *tiny_tablet))) { LOG_WARN("fail to init table store", K(ret), K(*tiny_tablet)); } } - } else if (OB_FAIL(load_table_store(allocator, *tiny_tablet, arg.table_store_addr_, table_store))) { + } else if (CLICK_FAIL(load_table_store(allocator, *tiny_tablet, arg.table_store_addr_, table_store))) { LOG_WARN("fail to load table store", K(ret), KPC(tiny_tablet), K(arg.table_store_addr_)); } } @@ -459,12 +468,12 @@ int ObTabletPersister::transform( if (OB_SUCC(ret)) { int64_t table_store_size = table_store->get_deep_copy_size(); if (OB_LIKELY((remain - table_store_size) >= 0)) { - if (OB_FAIL(table_store->batch_cache_sstable_meta(allocator, remain - table_store_size))) { + if (CLICK_FAIL(table_store->batch_cache_sstable_meta(allocator, remain - table_store_size))) { LOG_WARN("fail to batch cache sstable meta", K(ret), K(remain), K(table_store_size)); } else { ObIStorageMetaObj *table_store_obj = nullptr; table_store_size = table_store->get_deep_copy_size(); - if (OB_FAIL(table_store->deep_copy(buf + start_pos, remain, table_store_obj))) { + if (CLICK_FAIL(table_store->deep_copy(buf + start_pos, remain, table_store_obj))) { LOG_WARN("fail to deep copy table store v2", K(ret), K(table_store)); } else if (OB_ISNULL(table_store_obj)) { ret = OB_ERR_UNEXPECTED; @@ -487,7 +496,7 @@ int ObTabletPersister::transform( ObIStorageMetaObj *auto_inc_obj = nullptr; const int auto_inc_seq_size = arg.auto_inc_seq_ptr_->get_deep_copy_size(); if (OB_LIKELY((remain - auto_inc_seq_size) > 0)) { - if(OB_FAIL(arg.auto_inc_seq_ptr_->deep_copy(buf + start_pos, remain, auto_inc_obj))) { + if(CLICK_FAIL(arg.auto_inc_seq_ptr_->deep_copy(buf + start_pos, remain, auto_inc_obj))) { LOG_WARN("fail to deep copy auto inc seq", K(ret), K(arg.auto_inc_seq_ptr_)); } else { tiny_tablet->mds_data_.auto_inc_seq_.ptr_ = static_cast(auto_inc_obj); diff --git a/src/storage/tablet/ob_tablet_slog_helper.cpp b/src/storage/tablet/ob_tablet_slog_helper.cpp index 9c96c37321..e1932b245a 100755 --- a/src/storage/tablet/ob_tablet_slog_helper.cpp +++ b/src/storage/tablet/ob_tablet_slog_helper.cpp @@ -35,12 +35,13 @@ int ObTabletSlogHelper::write_update_tablet_slog( const common::ObTabletID &tablet_id, const ObMetaDiskAddr &disk_addr) { + TIMEGUARD_INIT(STORAGE, 10_ms, 5_s); int ret = OB_SUCCESS; const ObTabletMapKey tablet_key(ls_id, tablet_id); if (OB_UNLIKELY(!ls_id.is_valid() || !tablet_id.is_valid() || !disk_addr.is_valid())) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid arguments", K(ret), K(ls_id), K(tablet_id), K(disk_addr)); - } else if (OB_FAIL(THE_IO_DEVICE->fsync_block())) { // make sure that all data or meta written on the macro block is flushed + } else if (CLICK_FAIL(THE_IO_DEVICE->fsync_block())) { // make sure that all data or meta written on the macro block is flushed LOG_WARN("fail to fsync_block", K(ret)); } else { ObUpdateTabletLog slog_entry(ls_id, tablet_id, disk_addr); @@ -48,11 +49,11 @@ int ObTabletSlogHelper::write_update_tablet_slog( log_param.cmd_ = ObIRedoModule::gen_cmd(ObRedoLogMainType::OB_REDO_LOG_TENANT_STORAGE, ObRedoLogSubType::OB_REDO_LOG_UPDATE_TABLET); log_param.data_ = &slog_entry; - if (OB_FAIL(MTL(ObStorageLogger*)->write_log(log_param))) { + if (CLICK_FAIL(MTL(ObStorageLogger*)->write_log(log_param))) { LOG_WARN("fail to write slog for creating tablet", K(ret), K(log_param)); } else { do { - if (OB_FAIL(MTL(ObTenantCheckpointSlogHandler*)->report_slog(tablet_key, log_param.disk_addr_))) { + if (CLICK_FAIL(MTL(ObTenantCheckpointSlogHandler*)->report_slog(tablet_key, log_param.disk_addr_))) { if (OB_ALLOCATE_MEMORY_FAILED != ret) { LOG_WARN("fail to report slog", K(ret), K(tablet_key)); } else if (REACH_TIME_INTERVAL(1000 * 1000L)) { // 1s