fix concurrent execution of reload and reset merge_info

This commit is contained in:
LiefB
2023-07-13 11:53:53 +00:00
committed by ob-robot
parent 647ba966b3
commit 65bb8d8f29
3 changed files with 18 additions and 3 deletions

View File

@ -916,6 +916,7 @@ int ObMajorMergeScheduler::do_update_and_reload(const int64_t epoch)
LOG_WARN("fail to reload freeze_info_mgr", KR(ret));
}
if (OB_FAIL(ret)) {
// reset merge info with lock, so as to avoid concurrent execution with reload merge info
zone_merge_mgr_->reset_merge_info();
freeze_info_mgr_->reset_freeze_info();
LOG_WARN("fail to reload", KR(ret));

View File

@ -102,7 +102,7 @@ int ObZoneMergeManagerBase::reload()
}
if (OB_SUCC(ret)) {
reset_merge_info();
reset_merge_info_without_lock();
if (OB_FAIL(global_merge_info_.assign(global_merge_info))) {
LOG_WARN("fail to assign", KR(ret), K(global_merge_info));
}
@ -143,7 +143,7 @@ int ObZoneMergeManagerBase::try_reload()
return ret;
}
void ObZoneMergeManagerBase::reset_merge_info()
void ObZoneMergeManagerBase::reset_merge_info_without_lock()
{
zone_count_ = 0;
global_merge_info_.reset();
@ -1532,5 +1532,18 @@ int ObZoneMergeManager::adjust_global_merge_info(const int64_t expected_epoch)
return ret;
}
void ObZoneMergeManager::reset_merge_info()
{
int ret = OB_SUCCESS;
SpinWLockGuard guard(write_lock_);
{
ObZoneMergeMgrGuard shadow_guard(lock_,
*(static_cast<ObZoneMergeManagerBase *> (this)), shadow_, ret);
if (OB_SUCC(ret)) {
shadow_.reset_merge_info_without_lock();
}
}
}
} // namespace rootserver
} // namespace oceanbase

View File

@ -32,7 +32,7 @@ public:
int init(const uint64_t tenant_id, common::ObMySQLProxy &proxy);
virtual int reload();
virtual int try_reload();
void reset_merge_info();
void reset_merge_info_without_lock();
int is_in_merge(bool &merge) const;
int is_merge_error(bool &merge_error) const;
@ -139,6 +139,7 @@ public:
virtual int update_global_merge_info_after_merge(const int64_t expected_epoch);
virtual int try_update_zone_merge_info(const int64_t expected_epoch);
virtual int adjust_global_merge_info(const int64_t expected_epoch);
void reset_merge_info();
public:
class ObZoneMergeMgrGuard