[FEAT MERGE] 4.x Dup Table
Co-authored-by: Minionyh <minions.yh@gmail.com> Co-authored-by: BinChenn <binchenn.bc@gmail.com> Co-authored-by: ChangerR <dingjinchengyx@163.com>
This commit is contained in:
@ -203,17 +203,6 @@ int ObDirectReceiveOp::setup_next_scanner()
|
||||
LOG_WARN("while fetching first scanner, the remote rcode is not OB_SUCCESS",
|
||||
K(ret), K(err_msg),
|
||||
"dst_addr", to_cstring(resp_handler->get_dst_addr()));
|
||||
if (is_data_not_readable_err(ret)) {
|
||||
// 读到落后太多的备机或者正在回放日志的副本了,
|
||||
// 将远端的这个observer加进retry info的invalid servers中
|
||||
ObQueryRetryInfo &retry_info = my_session->get_retry_info_for_update();
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (
|
||||
add_ret = retry_info.add_invalid_server_distinctly(
|
||||
resp_handler->get_dst_addr(), true)))) {
|
||||
LOG_WARN("fail to add remote addr to invalid servers distinctly", K(ret), K(add_ret),
|
||||
K(resp_handler->get_dst_addr()), K(retry_info));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scanner_ = scanner;
|
||||
first_request_received_ = true;
|
||||
@ -257,17 +246,6 @@ int ObDirectReceiveOp::setup_next_scanner()
|
||||
LOG_WARN("while getting more scanner, the remote rcode is not OB_SUCCESS",
|
||||
K(ret), K(err_msg),
|
||||
"dst_addr", to_cstring(resp_handler->get_dst_addr()));
|
||||
if (is_data_not_readable_err(ret)) {
|
||||
// 读到落后太多的备机或者正在回放日志的副本了,
|
||||
// 将远端的这个observer加进retry info的invalid servers中
|
||||
ObQueryRetryInfo &retry_info = my_session->get_retry_info_for_update();
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (
|
||||
add_ret = retry_info.add_invalid_server_distinctly(
|
||||
resp_handler->get_dst_addr(), true)))) {
|
||||
LOG_WARN("fail to add remote addr to invalid servers distinctly", K(ret), K(add_ret),
|
||||
K(resp_handler->get_dst_addr()), K(retry_info));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scanner_ = result_scanner;
|
||||
found_rows_ += scanner_->get_found_rows();
|
||||
|
||||
@ -205,16 +205,6 @@ void ObExecutorRpcImpl::deal_with_rpc_timeout_err(ObExecutorRpcCtx &rpc_ctx,
|
||||
LOG_DEBUG("rpc return OB_TIMEOUT, but it is actually not timeout, "
|
||||
"change error code to OB_CONNECT_ERROR", K(err),
|
||||
K(timeout_timestamp), K(cur_timestamp));
|
||||
ObQueryRetryInfo *retry_info = rpc_ctx.get_retry_info_for_update();
|
||||
if (NULL != retry_info) {
|
||||
int a_ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (a_ret = retry_info->add_invalid_server_distinctly(
|
||||
dist_server)))) {
|
||||
LOG_WARN_RET(a_ret, "fail to add invalid server distinctly", K(a_ret), K(dist_server));
|
||||
} else {
|
||||
//LOG_INFO("YZFDEBUG add invalid server distinctly", K(a_ret), K(dist_server), "p", &retry_info->get_invalid_servers());
|
||||
}
|
||||
}
|
||||
err = OB_RPC_CONNECT_ERROR;
|
||||
} else {
|
||||
LOG_DEBUG("rpc return OB_TIMEOUT, and it is actually timeout, "
|
||||
|
||||
@ -717,16 +717,7 @@ int ObRemoteBaseExecuteP<T>::execute_with_sql(ObRemoteTask &task)
|
||||
NULL, session->get_effective_tenant_id())) {
|
||||
ret = OB_ERR_REMOTE_SCHEMA_NOT_FULL;
|
||||
}
|
||||
if (is_master_changed_error(ret)
|
||||
|| is_partition_change_error(ret)
|
||||
|| is_get_location_timeout_error(ret)) {
|
||||
ObTaskExecutorCtx &task_exec_ctx = exec_ctx_.get_task_exec_ctx();
|
||||
LOG_DEBUG("remote execute failed, begin to refresh location cache nonblocking", K(ret));
|
||||
int refresh_err = ObTaskExecutorCtxUtil::refresh_location_cache(task_exec_ctx, true);
|
||||
if (OB_SUCCESS != refresh_err) {
|
||||
LOG_WARN("refresh location cache failed", K(ret), K(refresh_err));
|
||||
}
|
||||
}
|
||||
DAS_CTX(exec_ctx_).get_location_router().refresh_location_cache(true, ret);
|
||||
}
|
||||
//监控项统计结束
|
||||
exec_end_timestamp_ = ObTimeUtility::current_time();
|
||||
|
||||
@ -245,16 +245,7 @@ int ObRemoteScheduler::execute_with_sql(ObExecContext &ctx, ObPhysicalPlan *phy_
|
||||
*handler,
|
||||
has_sent_task,
|
||||
has_transfer_err))) {
|
||||
int add_ret = OB_SUCCESS;
|
||||
if (is_data_not_readable_err(ret) || is_server_down_error(ret)) {
|
||||
// 读到落后太多的备机或者正在回放日志的副本了,
|
||||
// 将远端的这个observer加进retry info的invalid servers中
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (add_ret =
|
||||
retry_info->add_invalid_server_distinctly(task.get_runner_svr(), true)))) {
|
||||
LOG_WARN("fail to add remote addr to invalid servers distinctly",
|
||||
K(ret), K(add_ret), K(task), K(*retry_info));
|
||||
}
|
||||
}
|
||||
LOG_WARN("task execute failed", K(ret));
|
||||
}
|
||||
|
||||
// handle tx relative info if plan involved in transaction
|
||||
|
||||
@ -77,17 +77,6 @@ int ObRemoteTaskExecutor::execute(ObExecContext &query_ctx, ObJob *job, ObTaskIn
|
||||
has_transfer_err))) {
|
||||
bool skip_failed_tasks = false;
|
||||
int check_ret = OB_SUCCESS;
|
||||
int add_ret = OB_SUCCESS;
|
||||
if (is_data_not_readable_err(ret) || is_server_down_error(ret)) {
|
||||
// 读到落后太多的备机或者正在回放日志的副本了,
|
||||
// 将远端的这个observer加进retry info的invalid servers中
|
||||
if (OB_UNLIKELY(OB_SUCCESS != (
|
||||
add_ret = retry_info->add_invalid_server_distinctly(
|
||||
task_info->get_task_location().get_server(), true)))) {
|
||||
LOG_WARN("fail to add remote addr to invalid servers distinctly", K(ret), K(add_ret),
|
||||
K(task_info->get_task_location().get_server()), K(*retry_info));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS != (check_ret = should_skip_failed_tasks(*task_info, skip_failed_tasks))) {
|
||||
// check fail, set ret to check_ret
|
||||
LOG_WARN("fail to check if it should skip failed tasks", K(ret), K(check_ret), K(*job));
|
||||
|
||||
@ -59,9 +59,6 @@ ObTaskExecutorCtx::ObTaskExecutorCtx(ObExecContext &exec_context)
|
||||
: task_resp_handler_(NULL),
|
||||
virtual_part_servers_(exec_context.get_allocator()),
|
||||
exec_ctx_(&exec_context),
|
||||
partition_infos_(exec_context.get_allocator()),
|
||||
need_renew_location_cache_(false),
|
||||
need_renew_tablet_keys_(exec_context.get_allocator()),
|
||||
expected_worker_cnt_(0),
|
||||
minimal_worker_cnt_(0),
|
||||
admited_worker_cnt_(0),
|
||||
@ -143,34 +140,6 @@ int ObTaskExecutorCtx::append_table_location(const ObCandiTableLoc &phy_location
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTaskExecutorCtx::add_need_renew_tablet_keys_distinctly(const ObTabletID &tablet_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool has_found = false;
|
||||
if (OB_UNLIKELY(!tablet_id.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("partition key is invalid", K(ret), K(tablet_id));
|
||||
}
|
||||
FOREACH_X(it, need_renew_tablet_keys_, OB_SUCC(ret) && !has_found) {
|
||||
if (tablet_id == *it) {
|
||||
has_found = true;
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && !has_found) {
|
||||
if (OB_FAIL(need_renew_tablet_keys_.push_back(tablet_id))) {
|
||||
LOG_WARN("fail to push back partition key", K(ret), K(tablet_id));
|
||||
} else {
|
||||
LOG_DEBUG("add dated partition location key", K(tablet_id));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
const ObTablePartitionInfoArray &ObTaskExecutorCtx::get_partition_infos() const
|
||||
{
|
||||
return partition_infos_;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// Utility
|
||||
@ -289,7 +258,7 @@ int ObTaskExecutorCtxUtil::nonblock_renew(
|
||||
if (NULL == GCTX.location_service_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("loc_cache is NULL", K(ret));
|
||||
} else if (OB_FAIL(GCTX.location_service_->nonblock_renew(GET_MY_SESSION(*exec_ctx)->get_effective_tenant_id(),
|
||||
} else if (OB_FAIL(GCTX.location_service_->nonblock_renew(GET_MY_SESSION(*exec_ctx)->get_effective_tenant_id(),
|
||||
tablet_id))) {
|
||||
LOG_WARN("nonblock_renew failed", K(tablet_id), K(ret));
|
||||
}
|
||||
@ -307,71 +276,13 @@ int ObTaskExecutorCtx::nonblock_renew_with_limiter(
|
||||
if (NULL == GCTX.location_service_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tmp_loc_cache is NULL", K(ret));
|
||||
} else if (OB_FAIL(GCTX.location_service_->nonblock_renew(GET_MY_SESSION(*exec_ctx_)->get_effective_tenant_id(),
|
||||
} else if (OB_FAIL(GCTX.location_service_->nonblock_renew(GET_MY_SESSION(*exec_ctx_)->get_effective_tenant_id(),
|
||||
tablet_id))) {
|
||||
LOG_WARN("nonblock_renew failed", K(tablet_id), K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//TODO: @wangzhennan.wzn Provide new interface to refresh location according to different error codes.
|
||||
// Refresh_location_cache should refresh location of ls/tablet/vtable.
|
||||
|
||||
// obmp_query中重试整个SQL之前,可能需要调用本接口来刷新Location,以避免总是发给了错误的服务器
|
||||
int ObTaskExecutorCtxUtil::refresh_location_cache(ObTaskExecutorCtx &task_exec_ctx,
|
||||
bool is_nonblock)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
NG_TRACE_TIMES(1, get_location_cache_begin);
|
||||
bool is_cache_hit = false;
|
||||
ObLSLocation dummy_loc;
|
||||
DASTableLocList &table_locs = DAS_CTX(*task_exec_ctx.get_exec_context()).get_table_loc_list();
|
||||
FOREACH_X(tmp_node, table_locs, OB_SUCC(ret)) {
|
||||
ObDASTableLoc *table_loc = *tmp_node;
|
||||
for (DASTabletLocListIter tablet_node = table_loc->tablet_locs_begin();
|
||||
OB_SUCC(ret) && tablet_node != table_loc->tablet_locs_end(); ++tablet_node) {
|
||||
const ObDASTabletLoc *tablet_loc = *tablet_node;
|
||||
if (is_nonblock) {
|
||||
const int64_t expire_renew_time = 0; //表示在刷location cache之前不清空现有的location cache
|
||||
if (OB_FAIL(nonblock_renew(task_exec_ctx.get_exec_context(),
|
||||
tablet_loc->tablet_id_,
|
||||
expire_renew_time))) {
|
||||
LOG_WARN("LOCATION: fail to nonblock renew location cache", K(ret), K(tablet_loc->tablet_id_), K(expire_renew_time));
|
||||
} else {
|
||||
#if !defined(NDEBUG)
|
||||
LOG_INFO("LOCATION: nonblock renew success", K(tablet_loc->tablet_id_), K(expire_renew_time));
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
const int64_t expire_renew_time = INT64_MAX; // means must renew location
|
||||
bool is_cache_hit = false;
|
||||
dummy_loc.reset();
|
||||
ObLSID ls_id = tablet_loc->ls_id_;
|
||||
if (OB_FAIL(GCTX.location_service_->get(GET_MY_SESSION(*task_exec_ctx.get_exec_context())->get_effective_tenant_id(),
|
||||
tablet_loc->tablet_id_,
|
||||
expire_renew_time,
|
||||
is_cache_hit,
|
||||
ls_id))) {
|
||||
LOG_WARN("fail to get ls id", K(ret));
|
||||
} else if (OB_FAIL(GCTX.location_service_->get(GCONF.cluster_id,
|
||||
GET_MY_SESSION(*task_exec_ctx.get_exec_context())->get_effective_tenant_id(),
|
||||
tablet_loc->ls_id_,
|
||||
0, /*not force to renew*/
|
||||
is_cache_hit,
|
||||
dummy_loc))) {
|
||||
LOG_WARN("failed to get location", K(tablet_loc->ls_id_), K(ret));
|
||||
} else {
|
||||
#if !defined(NDEBUG)
|
||||
LOG_INFO("LOCATION: refresh table cache succ", K(tablet_loc->tablet_id_), K(dummy_loc));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NG_TRACE_TIMES(1, get_location_cache_end);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ObTaskExecutorCtx::set_self_addr(const common::ObAddr &self_addr)
|
||||
{
|
||||
UNUSED(self_addr);
|
||||
|
||||
@ -73,16 +73,6 @@ public:
|
||||
int get_addr_by_virtual_partition_id(int64_t partition_id, common::ObAddr &addr);
|
||||
int set_table_locations(const ObTablePartitionInfoArray &table_partition_infos);
|
||||
int append_table_location(const ObCandiTableLoc &phy_location_info);
|
||||
inline void set_need_renew_location_cache(bool need_renew_location_cache)
|
||||
{
|
||||
need_renew_location_cache_ = need_renew_location_cache;
|
||||
}
|
||||
inline bool is_need_renew_location_cache() const { return need_renew_location_cache_; }
|
||||
inline const common::ObList<ObTabletID, common::ObIAllocator> &get_need_renew_tablet_keys() const
|
||||
{
|
||||
return need_renew_tablet_keys_;
|
||||
}
|
||||
int add_need_renew_tablet_keys_distinctly(const ObTabletID &tablet_id);
|
||||
|
||||
const ObTablePartitionInfoArray &get_partition_infos() const;
|
||||
inline RemoteExecuteStreamHandle* get_stream_handler()
|
||||
@ -202,12 +192,6 @@ private:
|
||||
CalcVirtualPartitionIdParams calc_params_;
|
||||
//
|
||||
ObExecContext *exec_ctx_;
|
||||
//
|
||||
common::ObFixedArray<ObTablePartitionInfo*, common::ObIAllocator> partition_infos_;
|
||||
// 每次执行完之后是否需要刷新location cache
|
||||
bool need_renew_location_cache_;
|
||||
// 需要刷新location cache的partition key
|
||||
common::ObList<ObTabletID, common::ObIAllocator> need_renew_tablet_keys_;
|
||||
// PX 记录执行预期整个 Query 需要的线程数,以及实际分配的线程数
|
||||
int64_t expected_worker_cnt_; // query expected worker count computed by optimizer
|
||||
int64_t minimal_worker_cnt_; // minimal worker count to support execute this query
|
||||
@ -255,7 +239,6 @@ public:
|
||||
static int get_stream_handler(ObExecContext &ctx, RemoteExecuteStreamHandle *&handler);
|
||||
static int get_task_executor_rpc(ObExecContext &ctx, ObExecutorRpcImpl *&rpc);
|
||||
|
||||
static int refresh_location_cache(ObTaskExecutorCtx &task_exec_ctx, bool is_nonblock);
|
||||
template<typename DEST_TYPE, typename SRC_TYPE>
|
||||
static int merge_task_result_meta(DEST_TYPE &dest, const SRC_TYPE &task_meta);
|
||||
}; /* class ObTaskExecutorCtxUtil */
|
||||
|
||||
Reference in New Issue
Block a user