forbid scheduling deleted tablet to do restore
This commit is contained in:
parent
7d436f6857
commit
302ae6802c
@ -591,6 +591,24 @@ int ObLSRestoreHandler::check_tablet_restore_finish_(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLSRestoreHandler::check_tablet_deleted(const ObTabletHandle &tablet_handle, bool &is_deleted)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
// TODO(chongrong.th) need to think about transfer out deleted in 4.2
|
||||
is_deleted = false;
|
||||
ObTabletStatus::Status tablet_status = ObTabletStatus::Status::MAX;
|
||||
if (!tablet_handle.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid tablet handle", K(ret));
|
||||
} else if (OB_FAIL(tablet_handle.get_obj()->get_tablet_status(tablet_status))) {
|
||||
LOG_WARN("failed to get tablet status", K(ret));
|
||||
} else if (ObTabletStatus::Status::DELETED == tablet_status) {
|
||||
is_deleted = true;
|
||||
const ObTabletID tablet_id = tablet_handle.get_obj()->get_tablet_meta().tablet_id_;
|
||||
LOG_INFO("tablet deleted", K(tablet_id), K(tablet_status));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
void ObLSRestoreHandler::wakeup()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -983,6 +1001,7 @@ int ObILSRestoreState::reload_tablet_()
|
||||
}
|
||||
|
||||
while (OB_SUCC(ret)) {
|
||||
bool is_deleted = false;
|
||||
if (OB_FAIL(iterator.get_next_tablet(tablet_handle))) {
|
||||
if (OB_ITER_END == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
@ -990,6 +1009,9 @@ int ObILSRestoreState::reload_tablet_()
|
||||
} else {
|
||||
LOG_WARN("fail to get next tablet", K(ret));
|
||||
}
|
||||
} else if (OB_FAIL(ObLSRestoreHandler::check_tablet_deleted(tablet_handle, is_deleted))) {
|
||||
LOG_WARN("failed to check tablet need schedule restore", K(ret), K(tablet_handle));
|
||||
} else if (is_deleted) {
|
||||
} else if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tablet is nullptr", K(ret));
|
||||
@ -1082,6 +1104,7 @@ int ObILSRestoreState::upload_wait_restore_tablet_()
|
||||
bool is_finish = false;
|
||||
while (OB_SUCC(ret)) {
|
||||
is_finish = false;
|
||||
bool is_deleted = false;
|
||||
if (OB_FAIL(iterator.get_next_tablet(tablet_handle))) {
|
||||
if (OB_ITER_END == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
@ -1089,6 +1112,9 @@ int ObILSRestoreState::upload_wait_restore_tablet_()
|
||||
} else {
|
||||
LOG_WARN("fail to get next tablet", K(ret));
|
||||
}
|
||||
} else if (OB_FAIL(ObLSRestoreHandler::check_tablet_deleted(tablet_handle, is_deleted))) {
|
||||
LOG_WARN("failed to check tablet need schedule restore", K(ret), K(tablet_handle));
|
||||
} else if (is_deleted) {
|
||||
} else if (nullptr == (tablet = tablet_handle.get_obj())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("tablet is nullptr", K(ret));
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
const share::ObLSRestoreStatus &leader_restore_status, const int64_t leader_proposal_id);
|
||||
static int check_tablet_restore_finish_(const share::ObLSRestoreStatus &ls_restore_status,
|
||||
const ObTabletMeta &tablet_meta, bool &is_finish);
|
||||
static int check_tablet_deleted(const ObTabletHandle &tablet_handle, bool &is_deleted);
|
||||
void wakeup();
|
||||
void stop() { ATOMIC_STORE(&is_stop_, true); } // when remove ls, set this
|
||||
int safe_to_destroy(bool &is_safe);
|
||||
|
@ -392,6 +392,9 @@ int ObLSRestoreTaskMgr::check_tablet_deleted_or_restored_(storage::ObLS &ls, con
|
||||
} else if (nullptr == (tablet = tablet_handle.get_obj())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("nullptr tablet", K(ret));
|
||||
} else if (OB_FAIL(ObLSRestoreHandler::check_tablet_deleted(tablet_handle, is_deleted))) {
|
||||
LOG_WARN("failed to check tablet deleted", K(ret), K(tablet_handle));
|
||||
} else if (is_deleted) { // do nothing
|
||||
} else {
|
||||
const ObTabletMeta &tablet_meta = tablet->get_tablet_meta();
|
||||
if (OB_FAIL(ObLSRestoreHandler::check_tablet_restore_finish_(ls_restore_status, tablet_meta, is_restored))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user