wait readonly request done for some time before offline ls

This commit is contained in:
obdev
2023-07-04 03:12:23 +00:00
committed by ob-robot
parent e8866b5f23
commit a4bf0af7c9
12 changed files with 194 additions and 104 deletions

View File

@ -694,6 +694,7 @@ void ObLS::destroy()
// TODO: (yanyuan.cxf) destroy all the sub module.
int ret = OB_SUCCESS;
int tmp_ret = OB_SUCCESS;
int64_t start_ts = ObTimeUtility::current_time();
if (tenant_id_ != OB_INVALID_TENANT_ID) {
if (tenant_id_ != MTL_ID()) {
LOG_ERROR("ls destroy happen in wrong tenant ctx", K(tenant_id_), K(MTL_ID()));
@ -702,7 +703,7 @@ void ObLS::destroy()
}
transaction::ObTransService *txs_svr = MTL(transaction::ObTransService *);
FLOG_INFO("ObLS destroy", K(this), K(*this), K(lbt()));
if (OB_TMP_FAIL(offline_())) {
if (OB_TMP_FAIL(offline_(start_ts))) {
LOG_WARN("ls offline failed.", K(tmp_ret), K(ls_meta_.ls_id_));
} else if (OB_TMP_FAIL(stop_())) {
LOG_WARN("ls stop failed.", K(tmp_ret), K(ls_meta_.ls_id_));
@ -844,10 +845,12 @@ void ObLS::destroy()
startup_transfer_info_.reset();
}
int ObLS::offline_tx_()
int ObLS::offline_tx_(const int64_t start_ts)
{
int ret = OB_SUCCESS;
if (OB_FAIL(tx_table_.prepare_offline())) {
if (OB_FAIL(ls_tx_svr_.prepare_offline(start_ts))) {
LOG_WARN("prepare offline ls tx service failed", K(ret), K(ls_meta_));
} else if (OB_FAIL(tx_table_.prepare_offline())) {
LOG_WARN("tx table prepare offline failed", K(ret), K(ls_meta_));
} else if (OB_FAIL(ls_tx_svr_.offline())) {
LOG_WARN("offline ls tx service failed", K(ret), K(ls_meta_));
@ -868,7 +871,7 @@ int ObLS::offline_compaction_()
return ret;
}
int ObLS::offline_()
int ObLS::offline_(const int64_t start_ts)
{
int ret = OB_SUCCESS;
// only follower can do this.
@ -895,7 +898,7 @@ int ObLS::offline_()
LOG_WARN("weak read handler offline failed", K(ret), K(ls_meta_));
} else if (OB_FAIL(ls_ddl_log_handler_.offline())) {
LOG_WARN("ddl log handler offline failed", K(ret), K(ls_meta_));
} else if (OB_FAIL(offline_tx_())) {
} else if (OB_FAIL(offline_tx_(start_ts))) {
LOG_WARN("offline tx service failed", K(ret), K(ls_meta_));
} else if (OB_FAIL(dup_table_ls_handler_.offline())) {
LOG_WARN("offline dup table ls handler failed", K(ret), K(ls_meta_));
@ -928,7 +931,7 @@ int ObLS::offline()
{
ObLSLockGuard lock_myself(this, lock_, read_lock, write_lock);
// only follower can do this.
if (OB_FAIL(offline_())) {
if (OB_FAIL(offline_(start_ts))) {
LOG_WARN("ls offline failed", K(ret), K(ls_meta_));
}
}
@ -952,7 +955,7 @@ int ObLS::offline_without_lock()
do {
retry_times++;
{
if (OB_FAIL(offline_())) {
if (OB_FAIL(offline_(start_ts))) {
LOG_WARN("ls offline failed", K(ret), K(ls_meta_));
}
}
@ -1394,6 +1397,7 @@ int ObLS::finish_slog_replay()
ObMigrationStatus new_migration_status;
int64_t read_lock = 0;
int64_t write_lock = LSLOCKALL - LSLOCKLOGMETA;
const int64_t start_ts = ObTimeUtility::current_time();
ObLSLockGuard lock_myself(this, lock_, read_lock, write_lock);
if (OB_FAIL(get_migration_status(current_migration_status))) {
@ -1412,11 +1416,11 @@ int ObLS::finish_slog_replay()
} else if (OB_FAIL(start())) {
LOG_WARN("ls can not start to work", K(ret));
} else if (ObMigrationStatus::OB_MIGRATION_STATUS_REBUILD == new_migration_status) {
if (OB_FAIL(offline_())) {
if (OB_FAIL(offline_(start_ts))) {
LOG_WARN("failed to offline", K(ret), KPC(this));
}
} else if (is_enable_for_restore()) {
if (OB_FAIL(offline_())) {
if (OB_FAIL(offline_(start_ts))) {
LOG_WARN("failed to offline", K(ret), KPC(this));
} else if (OB_FAIL(log_handler_.enable_sync())) {
LOG_WARN("failed to enable sync", K(ret), KPC(this));