fix defensive detection bug for replaying log task
This commit is contained in:
		@ -79,13 +79,20 @@ int ObLSAdapter::replay(ObLogReplayTask *replay_task)
 | 
				
			|||||||
    if (common::OB_INVALID_TIMESTAMP == replay_task->first_handle_ts_) {
 | 
					    if (common::OB_INVALID_TIMESTAMP == replay_task->first_handle_ts_) {
 | 
				
			||||||
      replay_task->first_handle_ts_ = start_ts;
 | 
					      replay_task->first_handle_ts_ = start_ts;
 | 
				
			||||||
      replay_task->print_error_ts_ = start_ts;
 | 
					      replay_task->print_error_ts_ = start_ts;
 | 
				
			||||||
    } else if ((start_ts - replay_task->print_error_ts_) > MAX_SINGLE_RETRY_WARNING_TIME_THRESOLD) {
 | 
					    } else {
 | 
				
			||||||
      replay_task->retry_cost_ = start_ts - replay_task->first_handle_ts_;
 | 
					      replay_task->retry_cost_ = start_ts - replay_task->first_handle_ts_;
 | 
				
			||||||
 | 
					      if ((start_ts - replay_task->print_error_ts_) > MAX_SINGLE_RETRY_WARNING_TIME_THRESOLD) {
 | 
				
			||||||
 | 
					        if (replay_task->retry_cost_ > 100 * 1000 *1000 && REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
 | 
				
			||||||
 | 
					          CLOG_LOG(ERROR, "single replay task retry cost too much time. replay may be delayed",
 | 
				
			||||||
 | 
					                   K(ret), KPC(replay_task));
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
          CLOG_LOG(WARN, "single replay task retry cost too much time. replay may be delayed",
 | 
					          CLOG_LOG(WARN, "single replay task retry cost too much time. replay may be delayed",
 | 
				
			||||||
                KPC(replay_task));
 | 
					                   K(ret), KPC(replay_task));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        replay_task->print_error_ts_ = start_ts;
 | 
					        replay_task->print_error_ts_ = start_ts;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  replay_task->replay_cost_ = ObTimeUtility::fast_current_time() - start_ts;
 | 
					  replay_task->replay_cost_ = ObTimeUtility::fast_current_time() - start_ts;
 | 
				
			||||||
  if (replay_task->replay_cost_ > MAX_SINGLE_REPLAY_WARNING_TIME_THRESOLD) {
 | 
					  if (replay_task->replay_cost_ > MAX_SINGLE_REPLAY_WARNING_TIME_THRESOLD) {
 | 
				
			||||||
    if (replay_task->replay_cost_ > MAX_SINGLE_REPLAY_ERROR_TIME_THRESOLD
 | 
					    if (replay_task->replay_cost_ > MAX_SINGLE_REPLAY_ERROR_TIME_THRESOLD
 | 
				
			||||||
 | 
				
			|||||||
@ -820,13 +820,8 @@ int ObLogReplayService::do_replay_task_(ObLogReplayTask *replay_task,
 | 
				
			|||||||
      replay_status->dec_pending_task(replay_task->log_size_);
 | 
					      replay_status->dec_pending_task(replay_task->log_size_);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } else if (OB_FAIL(ls_adapter_->replay(replay_task))) {
 | 
					  } else if (OB_FAIL(ls_adapter_->replay(replay_task))) {
 | 
				
			||||||
    if (replay_task->retry_cost_ > 60 * 1000 *1000 &&
 | 
					 | 
				
			||||||
        REACH_TIME_INTERVAL(1 * 1000 * 1000)) {
 | 
					 | 
				
			||||||
      CLOG_LOG(ERROR, "ls do replay retry failed last for long time", K(ret), KPC(replay_task));
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
    CLOG_LOG(WARN, "ls do replay failed", K(ret), KPC(replay_task));
 | 
					    CLOG_LOG(WARN, "ls do replay failed", K(ret), KPC(replay_task));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  if (OB_SUCC(ret) && need_replay) {
 | 
					  if (OB_SUCC(ret) && need_replay) {
 | 
				
			||||||
    if (replay_task->is_post_barrier_) {
 | 
					    if (replay_task->is_post_barrier_) {
 | 
				
			||||||
      if (OB_FAIL(replay_status->set_post_barrier_finished(replay_task->lsn_))) {
 | 
					      if (OB_FAIL(replay_status->set_post_barrier_finished(replay_task->lsn_))) {
 | 
				
			||||||
 | 
				
			|||||||
@ -506,6 +506,8 @@ void ObLogReplayTask::reset()
 | 
				
			|||||||
  is_raw_write_ = false;
 | 
					  is_raw_write_ = false;
 | 
				
			||||||
  first_handle_ts_ = common::OB_INVALID_TIMESTAMP;
 | 
					  first_handle_ts_ = common::OB_INVALID_TIMESTAMP;
 | 
				
			||||||
  print_error_ts_ = common::OB_INVALID_TIMESTAMP;
 | 
					  print_error_ts_ = common::OB_INVALID_TIMESTAMP;
 | 
				
			||||||
 | 
					  replay_cost_ = common::OB_INVALID_TIMESTAMP;
 | 
				
			||||||
 | 
					  retry_cost_ = common::OB_INVALID_TIMESTAMP;
 | 
				
			||||||
  log_buf_ = NULL;
 | 
					  log_buf_ = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -141,8 +141,8 @@ public:
 | 
				
			|||||||
  bool is_raw_write_;
 | 
					  bool is_raw_write_;
 | 
				
			||||||
  int64_t first_handle_ts_;
 | 
					  int64_t first_handle_ts_;
 | 
				
			||||||
  int64_t print_error_ts_;
 | 
					  int64_t print_error_ts_;
 | 
				
			||||||
  int64_t replay_cost_; //此任务重试的总耗时时间
 | 
					  int64_t replay_cost_; //此任务回放成功时的当次处理时间
 | 
				
			||||||
  int64_t retry_cost_; //此任务回放成功时的当次处理时间
 | 
					  int64_t retry_cost_; //此任务重试的总耗时时间
 | 
				
			||||||
  void *log_buf_;
 | 
					  void *log_buf_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TO_STRING_KV(K(ls_id_),
 | 
					  TO_STRING_KV(K(ls_id_),
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user