Stop tablet service before wait ha dag
This commit is contained in:
@ -442,6 +442,7 @@ int ObLS::stop_()
|
|||||||
LOG_WARN("stop log handler failed", K(ret), KPC(this));
|
LOG_WARN("stop log handler failed", K(ret), KPC(this));
|
||||||
}
|
}
|
||||||
ls_migration_handler_.stop();
|
ls_migration_handler_.stop();
|
||||||
|
ls_tablet_svr_.stop();
|
||||||
is_stopped_ = true;
|
is_stopped_ = true;
|
||||||
|
|
||||||
if (OB_SUCC(ret)) {
|
if (OB_SUCC(ret)) {
|
||||||
|
|||||||
@ -82,7 +82,8 @@ ObLSTabletService::ObLSTabletService()
|
|||||||
bucket_lock_(),
|
bucket_lock_(),
|
||||||
rs_reporter_(nullptr),
|
rs_reporter_(nullptr),
|
||||||
allow_to_read_mgr_(),
|
allow_to_read_mgr_(),
|
||||||
is_inited_(false)
|
is_inited_(false),
|
||||||
|
is_stopped_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,6 +112,7 @@ int ObLSTabletService::init(
|
|||||||
} else {
|
} else {
|
||||||
ls_ = ls;
|
ls_ = ls;
|
||||||
rs_reporter_ = rs_reporter;
|
rs_reporter_ = rs_reporter;
|
||||||
|
is_stopped_ = false;
|
||||||
is_inited_ = true;
|
is_inited_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,9 +133,22 @@ void ObLSTabletService::destroy()
|
|||||||
bucket_lock_.destroy();
|
bucket_lock_.destroy();
|
||||||
rs_reporter_ = nullptr;
|
rs_reporter_ = nullptr;
|
||||||
ls_= nullptr;
|
ls_= nullptr;
|
||||||
|
is_stopped_ = false;
|
||||||
is_inited_ = false;
|
is_inited_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ObLSTabletService::stop()
|
||||||
|
{
|
||||||
|
int ret = OB_SUCCESS;
|
||||||
|
if (IS_NOT_INIT) {
|
||||||
|
ret = OB_NOT_INIT;
|
||||||
|
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||||
|
} else {
|
||||||
|
is_stopped_ = true;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int ObLSTabletService::offline()
|
int ObLSTabletService::offline()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
@ -1281,6 +1296,9 @@ int ObLSTabletService::update_tablet_ha_data_status(
|
|||||||
if (IS_NOT_INIT) {
|
if (IS_NOT_INIT) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||||
|
} else if (OB_UNLIKELY(is_stopped_)) {
|
||||||
|
ret = OB_NOT_RUNNING;
|
||||||
|
LOG_WARN("tablet service stopped", K(ret));
|
||||||
} else if (OB_UNLIKELY(!tablet_id.is_valid())
|
} else if (OB_UNLIKELY(!tablet_id.is_valid())
|
||||||
|| OB_UNLIKELY(!ObTabletDataStatus::is_valid(data_status))) {
|
|| OB_UNLIKELY(!ObTabletDataStatus::is_valid(data_status))) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
@ -1332,6 +1350,9 @@ int ObLSTabletService::update_tablet_ha_expected_status(
|
|||||||
if (IS_NOT_INIT) {
|
if (IS_NOT_INIT) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||||
|
} else if (OB_UNLIKELY(is_stopped_)) {
|
||||||
|
ret = OB_NOT_RUNNING;
|
||||||
|
LOG_WARN("tablet service stopped", K(ret));
|
||||||
} else if (OB_UNLIKELY(!tablet_id.is_valid())
|
} else if (OB_UNLIKELY(!tablet_id.is_valid())
|
||||||
|| OB_UNLIKELY(!ObTabletExpectedStatus::is_valid(expected_status))) {
|
|| OB_UNLIKELY(!ObTabletExpectedStatus::is_valid(expected_status))) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
@ -2770,7 +2791,13 @@ int ObLSTabletService::trim_rebuild_tablet(
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ObBucketHashWLockGuard lock_guard(bucket_lock_, tablet_id.hash());
|
ObBucketHashWLockGuard lock_guard(bucket_lock_, tablet_id.hash());
|
||||||
if (OB_UNLIKELY(!tablet_id.is_valid())) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
|
ret = OB_NOT_INIT;
|
||||||
|
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||||
|
} else if (OB_UNLIKELY(is_stopped_)) {
|
||||||
|
ret = OB_NOT_RUNNING;
|
||||||
|
LOG_WARN("tablet service stopped", K(ret));
|
||||||
|
} else if (OB_UNLIKELY(!tablet_id.is_valid())) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid argument", K(ret), K(tablet_id));
|
LOG_WARN("invalid argument", K(ret), K(tablet_id));
|
||||||
} else if (is_rollback && OB_FAIL(rollback_rebuild_tablet(tablet_id))) {
|
} else if (is_rollback && OB_FAIL(rollback_rebuild_tablet(tablet_id))) {
|
||||||
@ -2797,6 +2824,9 @@ int ObLSTabletService::create_or_update_migration_tablet(
|
|||||||
if (OB_UNLIKELY(!is_inited_)) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||||
|
} else if (OB_UNLIKELY(is_stopped_)) {
|
||||||
|
ret = OB_NOT_RUNNING;
|
||||||
|
LOG_WARN("tablet service stopped", K(ret));
|
||||||
} else if (OB_UNLIKELY(!mig_tablet_param.is_valid())
|
} else if (OB_UNLIKELY(!mig_tablet_param.is_valid())
|
||||||
|| OB_UNLIKELY(ls_id != ls_->get_ls_id())) {
|
|| OB_UNLIKELY(ls_id != ls_->get_ls_id())) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
@ -2829,6 +2859,9 @@ int ObLSTabletService::rebuild_create_tablet(
|
|||||||
if (OB_UNLIKELY(!is_inited_)) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||||
|
} else if (OB_UNLIKELY(is_stopped_)) {
|
||||||
|
ret = OB_NOT_RUNNING;
|
||||||
|
LOG_WARN("tablet service stopped", K(ret));
|
||||||
} else if (OB_UNLIKELY(!mig_tablet_param.is_valid())
|
} else if (OB_UNLIKELY(!mig_tablet_param.is_valid())
|
||||||
|| OB_UNLIKELY(ls_id != ls_->get_ls_id())) {
|
|| OB_UNLIKELY(ls_id != ls_->get_ls_id())) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
@ -2907,6 +2940,9 @@ int ObLSTabletService::finish_copy_migration_sstable(
|
|||||||
if (OB_UNLIKELY(!is_inited_)) {
|
if (OB_UNLIKELY(!is_inited_)) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||||
|
} else if (OB_UNLIKELY(is_stopped_)) {
|
||||||
|
ret = OB_NOT_RUNNING;
|
||||||
|
LOG_WARN("tablet service stopped", K(ret));
|
||||||
} else if (OB_UNLIKELY(!tablet_id.is_valid() || !sstable_key.is_valid())) {
|
} else if (OB_UNLIKELY(!tablet_id.is_valid() || !sstable_key.is_valid())) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid arguments", K(ret), K(tablet_id), K(sstable_key));
|
LOG_WARN("invalid arguments", K(ret), K(tablet_id), K(sstable_key));
|
||||||
@ -2947,6 +2983,9 @@ int ObLSTabletService::build_ha_tablet_new_table_store(
|
|||||||
if (IS_NOT_INIT) {
|
if (IS_NOT_INIT) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("not inited", K(ret), K_(is_inited));
|
LOG_WARN("not inited", K(ret), K_(is_inited));
|
||||||
|
} else if (OB_UNLIKELY(is_stopped_)) {
|
||||||
|
ret = OB_NOT_RUNNING;
|
||||||
|
LOG_WARN("tablet service stopped", K(ret));
|
||||||
} else if (OB_UNLIKELY(!tablet_id.is_valid() || !param.is_valid())) {
|
} else if (OB_UNLIKELY(!tablet_id.is_valid() || !param.is_valid())) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("invalid args", K(ret), K(tablet_id), K(param));
|
LOG_WARN("invalid args", K(ret), K(tablet_id), K(param));
|
||||||
|
|||||||
@ -104,6 +104,7 @@ public:
|
|||||||
virtual ~ObLSTabletService();
|
virtual ~ObLSTabletService();
|
||||||
public:
|
public:
|
||||||
int init(ObLS *ls, observer::ObIMetaReport *rs_reporter);
|
int init(ObLS *ls, observer::ObIMetaReport *rs_reporter);
|
||||||
|
int stop();
|
||||||
void destroy();
|
void destroy();
|
||||||
int offline();
|
int offline();
|
||||||
int online();
|
int online();
|
||||||
@ -780,6 +781,7 @@ private:
|
|||||||
observer::ObIMetaReport *rs_reporter_;
|
observer::ObIMetaReport *rs_reporter_;
|
||||||
AllowToReadMgr allow_to_read_mgr_;
|
AllowToReadMgr allow_to_read_mgr_;
|
||||||
bool is_inited_;
|
bool is_inited_;
|
||||||
|
bool is_stopped_;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int64_t ObLSTabletService::get_tablet_count() const
|
inline int64_t ObLSTabletService::get_tablet_count() const
|
||||||
|
|||||||
Reference in New Issue
Block a user