fix create ls member_list

Co-authored-by: maosy <630014370@qq.com>
This commit is contained in:
obdev
2023-01-28 13:51:49 +08:00
committed by ob-robot
parent 392e6bad5c
commit 735401c8d7
4 changed files with 25 additions and 7 deletions

View File

@ -1208,7 +1208,7 @@ int ObRpcCreateLSP::process()
COMMON_LOG(WARN, "failed create log stream", KR(ret), K(arg_));
}
}
result_.set_result(ret);
(void)result_.init(ret, GCTX.self_addr());
return ret;
}

View File

@ -429,12 +429,23 @@ int ObLSCreator::check_create_ls_result_(const int64_t rpc_count,
} else if (OB_SUCCESS != result->get_result()) {
LOG_WARN("rpc is failed", KR(ret), K(*result), K(i));
} else {
const ObAddr &addr = create_ls_proxy_.get_dests().at(i);
ObAddr addr;
if (result->get_addr().is_valid()) {
addr = result->get_addr();
} else if (create_ls_proxy_.get_dests().count() == create_ls_proxy_.get_results().count()) {
//one by one match
addr = create_ls_proxy_.get_dests().at(i);
}
//TODO other replica type
//can not get replica type from arg, arg and result is not match
if (OB_FAIL(member_list.add_member(ObMember(addr, timestamp)))) {
if (OB_FAIL(ret)) {
} else if (OB_UNLIKELY(!addr.is_valid())) {
ret = OB_NEED_RETRY;
LOG_WARN("addr is invalid, ls create failed", KR(ret), K(addr));
} else if (OB_FAIL(member_list.add_member(ObMember(addr, timestamp)))) {
LOG_WARN("failed to add member", KR(ret), K(addr));
}
LOG_TRACE("create ls result", KR(ret), K(i), K(addr), KPC(result), K(rpc_count));
}
}
}

View File

@ -6350,7 +6350,7 @@ DEF_TO_STRING(ObBatchCreateTabletArg)
OB_SERIALIZE_MEMBER(ObBatchCreateTabletArg, id_, major_frozen_scn_,
tablets_, table_schemas_);
OB_SERIALIZE_MEMBER(ObCreateLSResult, ret_);
OB_SERIALIZE_MEMBER(ObCreateLSResult, ret_, addr_);
bool ObCreateLSResult::is_valid() const
{
return true;
@ -6361,6 +6361,7 @@ int ObCreateLSResult::assign(const ObCreateLSResult &other)
if (this == &other) {
} else {
ret_ = other.ret_;
addr_ = other.addr_;
}
return ret;
}

View File

@ -2503,23 +2503,29 @@ struct ObCreateLSResult
{
OB_UNIS_VERSION(1);
public:
ObCreateLSResult(): ret_(common::OB_SUCCESS) {}
ObCreateLSResult(): ret_(common::OB_SUCCESS), addr_() {}
~ObCreateLSResult() {}
bool is_valid() const;
int assign(const ObCreateLSResult &other);
TO_STRING_KV(K_(ret));
void set_result(const int ret)
void init(const int ret, const ObAddr &addr)
{
ret_ = ret;
addr_ = addr;
}
TO_STRING_KV(K_(ret), K_(addr));
int get_result() const
{
return ret_;
}
const ObAddr &get_addr() const
{
return addr_;
}
private:
DISALLOW_COPY_AND_ASSIGN(ObCreateLSResult);
private:
int ret_;
ObAddr addr_;//for async rpc, dests and results not one-by-one mapping
};
struct ObSetMemberListArgV2