[BUG] use is follower instead of is master to obey the freeze protocol

This commit is contained in:
Handora 2023-11-23 14:17:28 +00:00 committed by ob-robot
parent 49ff319c6c
commit b09169edf6
2 changed files with 9 additions and 3 deletions

View File

@ -576,6 +576,7 @@ int ObFreezer::ls_freeze_task()
int ret = OB_SUCCESS;
share::ObLSID ls_id = get_ls_id();
const int64_t start = ObTimeUtility::current_time();
int64_t last_submit_log_time = start;
uint32_t freeze_clock = get_freeze_clock();
TRANS_LOG(INFO, "[Freezer] freeze_clock", K(ls_id), K(freeze_clock));
@ -583,7 +584,12 @@ int ObFreezer::ls_freeze_task()
// this means that all memtables can be dumped
while (!get_ls_data_checkpoint()->ls_freeze_finished()) {
if (TC_REACH_TIME_INTERVAL(5 * 1000 * 1000)) {
if (need_resubmit_log()) {
if (need_resubmit_log() ||
// In order to prevent the txn has already passed the try_submit test
// while failing to submit some logs due to an unexpected bug, we need
// retry to submit the log to go around the above case
(ObTimeUtility::current_time() - last_submit_log_time >= 1_min)) {
last_submit_log_time = ObTimeUtility::current_time();
int64_t read_lock = LSLOCKALL;
int64_t write_lock = 0;
ObLSLockGuard lock_ls(ls_, ls_->lock_, read_lock, write_lock);

View File

@ -1306,7 +1306,7 @@ int ObLSTxCtxMgr::traverse_tx_to_submit_redo_log(ObTransID &fail_tx_id)
int ret = OB_SUCCESS;
RLockGuard guard(rwlock_);
ObTxSubmitLogFunctor fn(ObTxSubmitLogFunctor::SUBMIT_REDO_LOG);
if (is_master_() && OB_FAIL(ls_tx_ctx_map_.for_each(fn))) {
if (!is_follower_() && OB_FAIL(ls_tx_ctx_map_.for_each(fn))) {
if (OB_SUCCESS != fn.get_result()) {
// get real ret code
ret = fn.get_result();
@ -1324,7 +1324,7 @@ int ObLSTxCtxMgr::traverse_tx_to_submit_next_log()
int ret = OB_SUCCESS;
RLockGuard guard(rwlock_);
ObTxSubmitLogFunctor fn(ObTxSubmitLogFunctor::SUBMIT_NEXT_LOG);
if (is_master_() && OB_FAIL(ls_tx_ctx_map_.for_each(fn))) {
if (!is_follower_() && OB_FAIL(ls_tx_ctx_map_.for_each(fn))) {
if (OB_SUCCESS != fn.get_result()) {
// get real ret code
ret = fn.get_result();