提交 dd5c1dd7 编写于 作者: M Minionyh 提交者: ob-robot

when tablet set exist, do loop handler to submit log

上级 1b9298bf
......@@ -952,9 +952,9 @@ int ObDupTableLSLeaseMgr::LeaderLeaseMgrStatFunctor::operator()(
}
// update cnt_ for next read
cnt_++;
DUP_TABLE_LOG(DEBUG, "insert one row in svr list", K(ret), K(tmp_stat), K(cnt_),
K(hash_pair.second.confirmed_lease_info_), K(collect_arr_));
// for debug
DUP_TABLE_LOG(INFO, "insert one row in svr list", K(ret), K(tmp_stat), K(cnt_),
K(hash_pair.second), K(collect_arr_));
}
return ret;
......
......@@ -1237,6 +1237,16 @@ int64_t ObLSDupTabletsMgr::get_readable_tablet_set_count()
return cnt;
}
int64_t ObLSDupTabletsMgr::get_need_confirm_tablet_set_count()
{
int64_t cnt = 0;
SpinRLockGuard guard(dup_tablets_lock_);
cnt = need_confirm_new_queue_.get_size();
return cnt;
}
int64_t ObLSDupTabletsMgr::get_all_tablet_set_count()
{
int64_t cnt = 0;
......@@ -1256,6 +1266,44 @@ int64_t ObLSDupTabletsMgr::get_all_tablet_set_count()
return cnt;
}
// check exist tablet or is logging
bool ObLSDupTabletsMgr::check_removing_tablet_exist()
{
bool bool_ret = false;
SpinRLockGuard guard(dup_tablets_lock_);
if (OB_ISNULL(removing_old_set_)) {
bool_ret = false;
} else if (removing_old_set_->size() > 0) {
bool_ret = true;
} else if (removing_old_set_->get_change_status()->is_modifiable()){
bool_ret = true;
} else {
bool_ret = false;
}
return bool_ret;
}
// check exist tablet or is logging
bool ObLSDupTabletsMgr::check_changing_new_tablet_exist()
{
bool bool_ret = false;
SpinRLockGuard guard(dup_tablets_lock_);
if (OB_ISNULL(changing_new_set_)) {
bool_ret = false;
} else if (changing_new_set_->size() > 0) {
bool_ret = true;
} else if (changing_new_set_->get_change_status()->is_modifiable()) {
bool_ret = true;
} else {
bool_ret = false;
}
return bool_ret;
}
int ObLSDupTabletsMgr::leader_takeover(const bool is_resume,
const bool recover_all_readable_from_ckpt)
{
......
......@@ -550,6 +550,9 @@ public:
int64_t get_dup_tablet_count();
bool has_dup_tablet();
int64_t get_readable_tablet_set_count();
int64_t get_need_confirm_tablet_set_count();
bool check_removing_tablet_exist();
bool check_changing_new_tablet_exist();
int64_t get_all_tablet_set_count();
int leader_takeover(const bool is_resume, const bool recover_all_readable_from_ckpt);
......
......@@ -657,6 +657,7 @@ int ObDupTableLSHandler::ls_loop_handle()
{
int ret = OB_SUCCESS;
int tmp_ret = OB_SUCCESS;
// TODO check stopped
if (!is_inited() || OB_ISNULL(lease_mgr_ptr_) || OB_ISNULL(tablets_mgr_ptr_)
|| OB_ISNULL(ts_sync_mgr_ptr_)) {
ret = OB_NOT_INIT;
......@@ -664,9 +665,13 @@ int ObDupTableLSHandler::ls_loop_handle()
} else if (!ls_state_helper_.is_active_ls()) {
ret = OB_LS_OFFLINE;
DUP_TABLE_LOG(WARN, "the ls is not active", K(ret), KPC(this));
} else if (!has_dup_tablet()) {
} else if (!check_tablet_set_exist()) {
// if tablet set not exist,
// return OB_NO_TABLET and remove ls id form map
// else do ls loop handle
ret = OB_NO_TABLET;
DUP_TABLE_LOG(INFO, "no dup tablet, no need to do loop worker", K(ret), KPC(tablets_mgr_ptr_));
DUP_TABLE_LOG(INFO, "no dup tablet, no need to do loop worker", K(ret),
KPC(tablets_mgr_ptr_));
} else {
if (ls_state_helper_.is_leader()) {
if (OB_ISNULL(log_operator_) || !log_operator_->is_busy()) {
......@@ -1104,6 +1109,37 @@ bool ObDupTableLSHandler::has_dup_tablet()
return has_dup;
}
// if return false, there are no tablets and tablet set need log
bool ObDupTableLSHandler::check_tablet_set_exist()
{
bool bool_ret = false;
if (OB_ISNULL(tablets_mgr_ptr_)) {
bool_ret = false;
} else {
int64_t readable_and_need_confirm_set_count =
tablets_mgr_ptr_->get_readable_tablet_set_count()
+ tablets_mgr_ptr_->get_need_confirm_tablet_set_count();
// if readable and need confirm set count > 0, return true
if (readable_and_need_confirm_set_count > 0 ) {
bool_ret = true;
} else {
// if changing new and removing set exist return true
bool chaning_and_removing_tablet_exist =
tablets_mgr_ptr_->check_changing_new_tablet_exist()
|| tablets_mgr_ptr_->check_removing_tablet_exist();
if (chaning_and_removing_tablet_exist) {
bool_ret = true;
} else {
bool_ret = false;
}
}
}
return bool_ret;
}
int ObDupTableLSHandler::get_local_ts_info(DupTableTsInfo &ts_info)
{
int ret = OB_SUCCESS;
......
......@@ -179,6 +179,7 @@ public:
public:
int64_t get_dup_tablet_count();
bool check_tablet_set_exist();
bool has_dup_tablet();
int gc_dup_tablets(const int64_t gc_ts, const int64_t max_task_interval);
int get_local_ts_info(DupTableTsInfo &ts_info);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册