revert fix DML thrashing during mini merge
This commit is contained in:
parent
407f9e41be
commit
a89131dffd
@ -1125,41 +1125,35 @@ int ObLSTabletService::update_tablet_table_store(
|
||||
} else {
|
||||
LOG_WARN("fail to acquire temporary tablet", K(ret), K(key));
|
||||
}
|
||||
} else if (FALSE_IT(time_guard.click("AcqTmpTab"))) {
|
||||
} else if (OB_FAIL(get_tablet_and_acquire_new(key, old_tablet_hdl, new_tablet_hdl, time_guard))) {
|
||||
LOG_WARN("fail to get old tablet and acquire new tablet buffer", K(ret), K(key));
|
||||
} else if (old_tablet_hdl.get_obj()->is_empty_shell()) {
|
||||
handle = old_tablet_hdl;
|
||||
} else {
|
||||
ObTablet *tmp_tablet = tmp_tablet_hdl.get_obj();
|
||||
ObTablet *old_tablet = old_tablet_hdl.get_obj();
|
||||
const ObTabletPersisterParam persist_param(ls_id, ls_->get_ls_epoch(), tablet_id);
|
||||
share::SCN not_used_scn;
|
||||
if (!is_mds_merge(param.compaction_info_.merge_type_) && OB_FAIL(tmp_tablet->init_for_merge(allocator, param, *old_tablet))) {
|
||||
LOG_WARN("failed to init tablet", K(ret), K(param), KPC(old_tablet));
|
||||
} else if (is_mds_merge(param.compaction_info_.merge_type_) && OB_FAIL(tmp_tablet->init_with_mds_sstable(allocator, *old_tablet, not_used_scn, param))) {
|
||||
LOG_WARN("failed to init tablet with mds", K(ret), K(param), KPC(old_tablet));
|
||||
} else if (FALSE_IT(time_guard.click("InitNew"))) {
|
||||
} else if (OB_FAIL(ObTabletPersister::persist_and_transform_tablet(persist_param, *tmp_tablet, new_tablet_hdl))) {
|
||||
LOG_WARN("fail to persist and transform tablet", K(ret), KPC(tmp_tablet), K(new_tablet_hdl));
|
||||
time_guard.click("Acquire");
|
||||
ObBucketHashWLockGuard lock_guard(bucket_lock_, tablet_id.hash());
|
||||
time_guard.click("Lock");
|
||||
if (OB_FAIL(direct_get_tablet(tablet_id, old_tablet_hdl))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id));
|
||||
} else if (old_tablet_hdl.get_obj()->is_empty_shell()) {
|
||||
handle = old_tablet_hdl;
|
||||
LOG_INFO("old tablet is empty shell tablet, should skip this operation", K(ret), "old_tablet", old_tablet_hdl.get_obj());
|
||||
} else {
|
||||
time_guard.click("PersistNew");
|
||||
ObBucketHashWLockGuard lock_guard(bucket_lock_, tablet_id.hash());
|
||||
time_guard.click("WLock");
|
||||
ObMetaDiskAddr &new_addr = new_tablet_hdl.get_obj()->tablet_addr_;
|
||||
ObMetaDiskAddr cur_addr;
|
||||
if (OB_FAIL(MTL(ObTenantMetaMemMgr *)->get_tablet_addr(key, cur_addr))) {
|
||||
LOG_WARN("fail to get tablet addr from t3m", K(ret), K(key));
|
||||
} else if (old_tablet->tablet_addr_ != cur_addr) {
|
||||
ret = OB_EAGAIN;
|
||||
LOG_INFO("The tablet address in tablet pointer has changed, please try again", K(ret), K(cur_addr),
|
||||
KPC(old_tablet));
|
||||
} else if (OB_FAIL(safe_update_cas_tablet(key, new_addr, old_tablet_hdl, new_tablet_hdl, time_guard))) {
|
||||
LOG_WARN("fail to update tablet", K(ret), K(key), K(new_addr));
|
||||
time_guard.click("GetTablet");
|
||||
ObTablet *old_tablet = old_tablet_hdl.get_obj();
|
||||
ObMetaDiskAddr disk_addr;
|
||||
const ObTabletPersisterParam persist_param(ls_id, ls_->get_ls_epoch(), tablet_id);
|
||||
share::SCN not_used_scn;
|
||||
if (!is_mds_merge(param.compaction_info_.merge_type_) && OB_FAIL(tmp_tablet->init_for_merge(allocator, param, *old_tablet))) {
|
||||
LOG_WARN("failed to init tablet", K(ret), K(param), KPC(old_tablet));
|
||||
} else if (is_mds_merge(param.compaction_info_.merge_type_) && OB_FAIL(tmp_tablet->init_with_mds_sstable(allocator, *old_tablet, not_used_scn, param))) {
|
||||
LOG_WARN("failed to init tablet with mds", K(ret), K(param), KPC(old_tablet));
|
||||
} else if (FALSE_IT(time_guard.click("InitNew"))) {
|
||||
} else if (OB_FAIL(ObTabletPersister::persist_and_transform_tablet(persist_param, *tmp_tablet, new_tablet_hdl))) {
|
||||
LOG_WARN("fail to persist and transform tablet", K(ret), KPC(tmp_tablet), K(new_tablet_hdl));
|
||||
} else if (FALSE_IT(disk_addr = new_tablet_hdl.get_obj()->tablet_addr_)) {
|
||||
} else if (OB_FAIL(safe_update_cas_tablet(key, disk_addr, old_tablet_hdl, new_tablet_hdl, time_guard))) {
|
||||
LOG_WARN("fail to update tablet", K(ret), K(key), K(disk_addr));
|
||||
} else {
|
||||
handle = new_tablet_hdl;
|
||||
time_guard.click("SLOGAndCAS");
|
||||
LOG_INFO("succeeded to build new tablet", K(ret), K(key), K(new_addr), K(param), K(handle));
|
||||
LOG_INFO("succeeded to build new tablet", K(ret), K(key), K(disk_addr), K(param), K(handle));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7161,37 +7155,5 @@ int ObLSTabletService::check_rollback_tablet_is_same_(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLSTabletService::get_tablet_and_acquire_new(
|
||||
const ObTabletMapKey &key,
|
||||
ObTabletHandle &old_tablet,
|
||||
ObTabletHandle &new_tablet,
|
||||
ObTimeGuard &time_guard)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletMemberWrapper<ObTabletTableStore> table_store_wrapper;
|
||||
ObBucketHashRLockGuard lock_guard(bucket_lock_, key.tablet_id_.hash());
|
||||
time_guard.click("RLock");
|
||||
if (OB_FAIL(direct_get_tablet(key.tablet_id_, old_tablet))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(key));
|
||||
} else if (FALSE_IT(time_guard.click("GetTablet"))) {
|
||||
} else if (old_tablet.get_obj()->is_empty_shell()) {
|
||||
LOG_INFO("old tablet is empty shell tablet, should skip this operation", K(ret), "old_tablet", old_tablet.get_obj());
|
||||
} else if (OB_FAIL(old_tablet.get_obj()->fetch_table_store(table_store_wrapper))) {
|
||||
LOG_WARN("fail to fetch table store", K(ret), K(old_tablet));
|
||||
} else {
|
||||
time_guard.click("FetchTabStor");
|
||||
const int64_t tablet_cache_size = old_tablet.get_obj()->get_try_cache_size();
|
||||
const int64_t try_cache_size = tablet_cache_size + table_store_wrapper.get_member()->get_deep_copy_size();
|
||||
const ObTabletPoolType type = try_cache_size > ObTenantMetaMemMgr::NORMAL_TABLET_POOL_SIZE
|
||||
? ObTabletPoolType::TP_LARGE : ObTabletPoolType::TP_NORMAL;
|
||||
const bool try_smaller_pool = tablet_cache_size > ObTenantMetaMemMgr::NORMAL_TABLET_POOL_SIZE ? false : true;
|
||||
if (OB_FAIL(ObTabletPersister::acquire_tablet(type, key, try_smaller_pool, new_tablet))) {
|
||||
LOG_WARN("fail to acquire tablet", K(ret), K(key), K(type));
|
||||
}
|
||||
time_guard.click("AcqNewTab");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace storage
|
||||
} // namespace oceanbase
|
||||
|
@ -577,11 +577,6 @@ private:
|
||||
int offline_gc_tablet_for_create_or_transfer_in_abort_();
|
||||
int offline_destroy_memtable_and_mds_table_();
|
||||
int mock_duplicated_rows_(blocksstable::ObDatumRowIterator *&duplicated_rows);
|
||||
int get_tablet_and_acquire_new(
|
||||
const ObTabletMapKey &key,
|
||||
ObTabletHandle &old_tablet,
|
||||
ObTabletHandle &new_tablet,
|
||||
ObTimeGuard &time_guard);
|
||||
private:
|
||||
static int replay_create_inner_tablet(
|
||||
common::ObArenaAllocator &allocator,
|
||||
|
@ -331,6 +331,9 @@ int ObTabletPersister::persist_and_transform_tablet(
|
||||
if (OB_UNLIKELY(param.is_shared_object())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("shared tablet meta persistence should not call this method", K(ret), K(lbt()));
|
||||
} else if (OB_UNLIKELY(new_handle.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("new handle should not be valid", K(ret), K(new_handle));
|
||||
} else if (OB_FAIL(inner_persist_and_transform_shared_tablet(param, old_tablet, new_handle))) {
|
||||
LOG_WARN("persist and transform fail", K(ret), K(param));
|
||||
}
|
||||
|
@ -295,11 +295,6 @@ public:
|
||||
const blocksstable::ObSSTableMacroInfo ¯o_info,
|
||||
ObBlockInfoSet &block_info_set);
|
||||
static int transform_empty_shell(const ObTabletPersisterParam ¶m, const ObTablet &old_tablet, ObTabletHandle &new_handle);
|
||||
static int acquire_tablet(
|
||||
const ObTabletPoolType &type,
|
||||
const ObTabletMapKey &key,
|
||||
const bool try_smaller_pool,
|
||||
ObTabletHandle &new_handle);
|
||||
private:
|
||||
#ifdef OB_BUILD_SHARED_STORAGE
|
||||
int delete_blocks_(
|
||||
@ -319,6 +314,11 @@ private:
|
||||
static int check_tablet_meta_ids(
|
||||
const ObIArray<blocksstable::MacroBlockId> &shared_meta_id_arr,
|
||||
const ObTablet &tablet);
|
||||
static int acquire_tablet(
|
||||
const ObTabletPoolType &type,
|
||||
const ObTabletMapKey &key,
|
||||
const bool try_smaller_pool,
|
||||
ObTabletHandle &new_handle);
|
||||
static int convert_tablet_to_mem_arg(
|
||||
const ObTablet &tablet,
|
||||
ObTabletTransformArg &arg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user