diff --git a/src/observer/ob_rpc_processor_simple.cpp b/src/observer/ob_rpc_processor_simple.cpp index d477548712..6ffbd71e8a 100644 --- a/src/observer/ob_rpc_processor_simple.cpp +++ b/src/observer/ob_rpc_processor_simple.cpp @@ -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; } diff --git a/src/share/ls/ob_ls_creator.cpp b/src/share/ls/ob_ls_creator.cpp index 8adf61d22c..46786ebe44 100644 --- a/src/share/ls/ob_ls_creator.cpp +++ b/src/share/ls/ob_ls_creator.cpp @@ -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)); } } } diff --git a/src/share/ob_rpc_struct.cpp b/src/share/ob_rpc_struct.cpp index e3ee3fc498..bddef77c0c 100644 --- a/src/share/ob_rpc_struct.cpp +++ b/src/share/ob_rpc_struct.cpp @@ -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; } diff --git a/src/share/ob_rpc_struct.h b/src/share/ob_rpc_struct.h index 536cc4983d..095ddfe778 100644 --- a/src/share/ob_rpc_struct.h +++ b/src/share/ob_rpc_struct.h @@ -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