BUGFIX: iter another ls if iter failed

This commit is contained in:
obdev 2022-11-04 08:36:50 +00:00 committed by wangzelin.wzl
parent a57c27ea23
commit 36e9ddef48
2 changed files with 32 additions and 14 deletions

View File

@ -64,27 +64,43 @@ bool ObAllVirtualLSInfo::is_need_process(uint64_t tenant_id)
return false;
}
int ObAllVirtualLSInfo::next_ls_info_(ObLSVTInfo &ls_info)
{
int ret = OB_SUCCESS;
ObLS *ls = nullptr;
do {
if (OB_FAIL(ls_iter_guard_->get_next(ls))) {
if (OB_ITER_END != ret) {
SERVER_LOG(WARN, "get_next_ls failed", K(ret));
}
} else if (NULL == ls) {
SERVER_LOG(WARN, "ls shouldn't NULL here", K(ls));
// try another ls
ret = OB_EAGAIN;
} else if (FALSE_IT(ls_id_ = ls->get_ls_id().id())) {
} else if (OB_FAIL(ls->get_ls_info(ls_info))) {
SERVER_LOG(WARN, "get ls info failed", K(ret), KPC(ls));
// try another ls
ret = OB_EAGAIN;
}
} while (OB_EAGAIN == ret);
return ret;
}
int ObAllVirtualLSInfo::process_curr_tenant(ObNewRow *&row)
{
int ret = OB_SUCCESS;
ObLSVTInfo ls_info;
ObLS *ls = nullptr;
if (NULL == allocator_) {
ret = OB_NOT_INIT;
SERVER_LOG(WARN, "allocator_ shouldn't be NULL", K(allocator_), K(ret));
} else if (FALSE_IT(start_to_read_ = true)) {
} else if (ls_iter_guard_.get_ptr() == nullptr && OB_FAIL(MTL(ObLSService*)->get_ls_iter(ls_iter_guard_, ObLSGetMod::OBSERVER_MOD))) {
SERVER_LOG(WARN, "get_ls_iter fail", K(ret));
} else if (OB_FAIL(ls_iter_guard_->get_next(ls))) {
} else if (OB_FAIL(next_ls_info_(ls_info))) {
if (OB_ITER_END != ret) {
SERVER_LOG(WARN, "get_next_ls failed", K(ret));
SERVER_LOG(WARN, "get next_ls_info failed", K(ret));
}
} else if (NULL == ls) {
ret = OB_ERR_UNEXPECTED;
SERVER_LOG(WARN, "ls shouldn't NULL here", K(ret), K(ls));
} else if (FALSE_IT(ls_id_ = ls->get_ls_id().id())) {
} else if (OB_FAIL(ls->get_ls_info(ls_info))) {
SERVER_LOG(WARN, "get ls info failed", K(ret), KPC(ls));
} else {
const int64_t col_count = output_column_ids_.count();
for (int64_t i = 0; OB_SUCC(ret) && i < col_count; ++i) {

View File

@ -42,6 +42,8 @@ class ObAllVirtualLSInfo : public common::ObVirtualTableScannerIterator,
virtual int process_curr_tenant(common::ObNewRow *&row) override;
// 释放上一个租户的资源
virtual void release_last_tenant() override;
private:
int next_ls_info_(ObLSVTInfo &ls_info);
private:
common::ObAddr addr_;
char ip_buf_[common::OB_IP_STR_BUFF];