提交 36e9ddef 编写于 作者: O obdev 提交者: wangzelin.wzl

BUGFIX: iter another ls if iter failed

上级 a57c27ea
......@@ -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) {
......
......@@ -25,24 +25,26 @@ namespace observer
class ObAllVirtualLSInfo : public common::ObVirtualTableScannerIterator,
public omt::ObMultiTenantOperator
{
public:
public:
ObAllVirtualLSInfo();
virtual ~ObAllVirtualLSInfo();
public:
public:
virtual int inner_get_next_row(common::ObNewRow *&row);
virtual void reset();
inline void set_addr(common::ObAddr &addr)
{
addr_ = addr;
}
private:
private:
// 过滤得到需要处理的租户
virtual bool is_need_process(uint64_t tenant_id) override;
// 处理当前迭代的租户
virtual int process_curr_tenant(common::ObNewRow *&row) override;
// 释放上一个租户的资源
virtual void release_last_tenant() override;
private:
private:
int next_ls_info_(ObLSVTInfo &ls_info);
private:
common::ObAddr addr_;
char ip_buf_[common::OB_IP_STR_BUFF];
char state_name_[common::MAX_LS_STATE_LENGTH];
......@@ -50,7 +52,7 @@ class ObAllVirtualLSInfo : public common::ObVirtualTableScannerIterator,
/* 跨租户访问的资源必须由ObMultiTenantOperator来处理释放*/
int64_t ls_id_;
ObSharedGuard<storage::ObLSIterator> ls_iter_guard_;
private:
private:
DISALLOW_COPY_AND_ASSIGN(ObAllVirtualLSInfo);
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册