[CP] fix backup check rebuild seq use rebuild seq not correct issue
This commit is contained in:
		@ -3777,7 +3777,9 @@ int ObLSBackupPrepareTask::may_need_advance_checkpoint_()
 | 
				
			|||||||
  if (OB_ISNULL(ls_backup_ctx_)) {
 | 
					  if (OB_ISNULL(ls_backup_ctx_)) {
 | 
				
			||||||
    ret = OB_ERR_UNEXPECTED;
 | 
					    ret = OB_ERR_UNEXPECTED;
 | 
				
			||||||
    LOG_WARN("ls backup ctx should not be null", K(ret));
 | 
					    LOG_WARN("ls backup ctx should not be null", K(ret));
 | 
				
			||||||
  } else if (OB_FAIL(fetch_backup_ls_meta_(rebuild_seq, backup_clog_checkpoint_scn))) {
 | 
					  } else if (OB_FAIL(fetch_cur_ls_rebuild_seq_(rebuild_seq))) {
 | 
				
			||||||
 | 
					    LOG_WARN("failed to fetch cur ls rebuild seq", K(ret), K_(param));
 | 
				
			||||||
 | 
					  } else if (OB_FAIL(fetch_backup_ls_meta_(backup_clog_checkpoint_scn))) {
 | 
				
			||||||
    LOG_WARN("failed to fetch backup ls meta checkpoint ts", K(ret), K_(param));
 | 
					    LOG_WARN("failed to fetch backup ls meta checkpoint ts", K(ret), K_(param));
 | 
				
			||||||
  } else if (FALSE_IT(ls_backup_ctx_->rebuild_seq_ = rebuild_seq)) {
 | 
					  } else if (FALSE_IT(ls_backup_ctx_->rebuild_seq_ = rebuild_seq)) {
 | 
				
			||||||
    // assign rebuild seq
 | 
					    // assign rebuild seq
 | 
				
			||||||
@ -3811,10 +3813,33 @@ int ObLSBackupPrepareTask::may_need_advance_checkpoint_()
 | 
				
			|||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ObLSBackupPrepareTask::fetch_backup_ls_meta_(int64_t &rebuild_seq, SCN &clog_checkpoint_scn)
 | 
					int ObLSBackupPrepareTask::fetch_cur_ls_rebuild_seq_(int64_t &rebuild_seq)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  int ret = OB_SUCCESS;
 | 
				
			||||||
 | 
					  rebuild_seq = -1;
 | 
				
			||||||
 | 
					  storage::ObLSHandle ls_handle;
 | 
				
			||||||
 | 
					  storage::ObLS *ls = NULL;
 | 
				
			||||||
 | 
					  const uint64_t tenant_id = param_.tenant_id_;
 | 
				
			||||||
 | 
					  const share::ObLSID &ls_id = param_.ls_id_;
 | 
				
			||||||
 | 
					  MTL_SWITCH(tenant_id) {
 | 
				
			||||||
 | 
					    ObLSMetaPackage cur_ls_meta;
 | 
				
			||||||
 | 
					    if (OB_FAIL(get_ls_handle(tenant_id, ls_id, ls_handle))) {
 | 
				
			||||||
 | 
					      LOG_WARN("failed to get ls handle", K(ret), K(tenant_id), K(ls_id));
 | 
				
			||||||
 | 
					    } else if (OB_ISNULL(ls = ls_handle.get_ls())) {
 | 
				
			||||||
 | 
					      ret = OB_ERR_UNEXPECTED;
 | 
				
			||||||
 | 
					      LOG_WARN("log stream not exist", K(ret), K(ls_id));
 | 
				
			||||||
 | 
					    } else if (OB_FAIL(ls->get_ls_meta_package(cur_ls_meta))) {
 | 
				
			||||||
 | 
					      LOG_WARN("failed to get ls meta package", K(ret), K(tenant_id), K(ls_id));
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      rebuild_seq = cur_ls_meta.ls_meta_.get_rebuild_seq();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return ret;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int ObLSBackupPrepareTask::fetch_backup_ls_meta_(share::SCN &clog_checkpoint_scn)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  int ret = OB_SUCCESS;
 | 
					  int ret = OB_SUCCESS;
 | 
				
			||||||
  rebuild_seq = 0;
 | 
					 | 
				
			||||||
  clog_checkpoint_scn.reset();
 | 
					  clog_checkpoint_scn.reset();
 | 
				
			||||||
  ObLSMetaPackage ls_meta_package;
 | 
					  ObLSMetaPackage ls_meta_package;
 | 
				
			||||||
  share::ObBackupDataStore store;
 | 
					  share::ObBackupDataStore store;
 | 
				
			||||||
@ -3826,7 +3851,6 @@ int ObLSBackupPrepareTask::fetch_backup_ls_meta_(int64_t &rebuild_seq, SCN &clog
 | 
				
			|||||||
    ret = OB_INVALID_ARGUMENT;
 | 
					    ret = OB_INVALID_ARGUMENT;
 | 
				
			||||||
    LOG_WARN("invalid ls meta package", K(ret), K(ls_meta_package));
 | 
					    LOG_WARN("invalid ls meta package", K(ret), K(ls_meta_package));
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    rebuild_seq = ls_meta_package.ls_meta_.get_rebuild_seq();
 | 
					 | 
				
			||||||
    clog_checkpoint_scn = ls_meta_package.ls_meta_.get_clog_checkpoint_scn();
 | 
					    clog_checkpoint_scn = ls_meta_package.ls_meta_.get_clog_checkpoint_scn();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
 | 
				
			|||||||
@ -451,6 +451,8 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  int may_need_advance_checkpoint_();
 | 
					  int may_need_advance_checkpoint_();
 | 
				
			||||||
 | 
					  int fetch_cur_ls_rebuild_seq_(int64_t &rebuild_seq);
 | 
				
			||||||
 | 
					  int fetch_backup_ls_meta_(share::SCN &clog_checkpoint_scn);
 | 
				
			||||||
  int check_tx_data_can_explain_user_data_();
 | 
					  int check_tx_data_can_explain_user_data_();
 | 
				
			||||||
  int get_backup_tx_data_table_filled_tx_scn_(share::SCN &filled_tx_scn);
 | 
					  int get_backup_tx_data_table_filled_tx_scn_(share::SCN &filled_tx_scn);
 | 
				
			||||||
  int prepare_meta_index_store_(ObBackupMetaIndexStore &meta_index_store);
 | 
					  int prepare_meta_index_store_(ObBackupMetaIndexStore &meta_index_store);
 | 
				
			||||||
@ -459,7 +461,6 @@ private:
 | 
				
			|||||||
  int get_cur_ls_min_filled_tx_scn_(share::SCN &min_filled_tx_scn);
 | 
					  int get_cur_ls_min_filled_tx_scn_(share::SCN &min_filled_tx_scn);
 | 
				
			||||||
  int get_tablet_min_filled_tx_scn_(ObTabletHandle &tablet_handle,
 | 
					  int get_tablet_min_filled_tx_scn_(ObTabletHandle &tablet_handle,
 | 
				
			||||||
      share::SCN &min_filled_tx_scn, bool &has_minor_sstable);
 | 
					      share::SCN &min_filled_tx_scn, bool &has_minor_sstable);
 | 
				
			||||||
  int fetch_backup_ls_meta_(int64_t &rebuild_seq, share::SCN &clog_checkpoint_scn);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
  bool is_inited_;
 | 
					  bool is_inited_;
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user