提交 f2b3572e 编写于 作者: L lck0 提交者: wangzelin.wzl

patch some bugfixs into opensource

上级 821da37d
...@@ -82,6 +82,8 @@ int ObSyncPlanDriver::response_result(ObMySQLResultSet& result) ...@@ -82,6 +82,8 @@ int ObSyncPlanDriver::response_result(ObMySQLResultSet& result)
retry_ctrl_.test_and_save_retry_state(gctx_, ctx_, result, ret, cli_ret); retry_ctrl_.test_and_save_retry_state(gctx_, ctx_, result, ret, cli_ret);
LOG_WARN("result response failed, check if need retry", K(ret), K(cli_ret), K(retry_ctrl_.need_retry())); LOG_WARN("result response failed, check if need retry", K(ret), K(cli_ret), K(retry_ctrl_.need_retry()));
ret = cli_ret; ret = cli_ret;
} else {
ObResultSet::refresh_location_cache(result.get_exec_context().get_task_exec_ctx(), true, ret);
} }
// After judging whether you need to retry, we won't judge whether to retry later // After judging whether you need to retry, we won't judge whether to retry later
THIS_WORKER.disable_retry(); THIS_WORKER.disable_retry();
......
...@@ -100,6 +100,7 @@ int ObInnerSQLResult::open() ...@@ -100,6 +100,7 @@ int ObInnerSQLResult::open()
ret = OB_INIT_TWICE; ret = OB_INIT_TWICE;
LOG_WARN("result set already open", K(ret)); LOG_WARN("result set already open", K(ret));
} else if (OB_FAIL(result_set_->sync_open())) { } else if (OB_FAIL(result_set_->sync_open())) {
ObResultSet::refresh_location_cache(result_set_->get_exec_context().get_task_exec_ctx(), true, ret);
LOG_WARN("open result set failed", K(ret)); LOG_WARN("open result set failed", K(ret));
// move after precess_retry(). // move after precess_retry().
// result_set_->close(); // result_set_->close();
...@@ -147,6 +148,7 @@ int ObInnerSQLResult::inner_close(bool need_retry) ...@@ -147,6 +148,7 @@ int ObInnerSQLResult::inner_close(bool need_retry)
WITH_CONTEXT(mem_context_) WITH_CONTEXT(mem_context_)
{ {
if (OB_FAIL(result_set_->close(need_retry))) { if (OB_FAIL(result_set_->close(need_retry))) {
ObResultSet::refresh_location_cache(result_set_->get_exec_context().get_task_exec_ctx(), true, ret);
LOG_WARN("result set close failed", K(ret), K(need_retry)); LOG_WARN("result set close failed", K(ret), K(need_retry));
} }
} }
...@@ -168,6 +170,7 @@ int ObInnerSQLResult::next() ...@@ -168,6 +170,7 @@ int ObInnerSQLResult::next()
{ {
if (OB_FAIL(result_set_->get_next_row(row_))) { if (OB_FAIL(result_set_->get_next_row(row_))) {
if (OB_ITER_END != ret) { if (OB_ITER_END != ret) {
ObResultSet::refresh_location_cache(result_set_->get_exec_context().get_task_exec_ctx(), true, ret);
LOG_WARN("get next row failed", K(ret)); LOG_WARN("get next row failed", K(ret));
} }
} }
......
...@@ -405,7 +405,6 @@ OB_DEF_SERIALIZE(ObTableModify) ...@@ -405,7 +405,6 @@ OB_DEF_SERIALIZE(ObTableModify)
} }
OB_UNIS_ENCODE(is_pdml_index_maintain_); OB_UNIS_ENCODE(is_pdml_index_maintain_);
OB_UNIS_ENCODE(table_location_uncertain_); OB_UNIS_ENCODE(table_location_uncertain_);
OB_UNIS_ENCODE(is_pdml_index_maintain_);
return ret; return ret;
} }
...@@ -487,7 +486,6 @@ OB_DEF_DESERIALIZE(ObTableModify) ...@@ -487,7 +486,6 @@ OB_DEF_DESERIALIZE(ObTableModify)
OB_UNIS_DECODE_EXPR_DLIST(ObSqlExpression, tsc_virtual_column_exprs_, my_phy_plan_); OB_UNIS_DECODE_EXPR_DLIST(ObSqlExpression, tsc_virtual_column_exprs_, my_phy_plan_);
OB_UNIS_DECODE(is_pdml_index_maintain_); OB_UNIS_DECODE(is_pdml_index_maintain_);
OB_UNIS_DECODE(table_location_uncertain_); OB_UNIS_DECODE(table_location_uncertain_);
OB_UNIS_DECODE(is_pdml_index_maintain_);
return ret; return ret;
} }
...@@ -532,7 +530,6 @@ OB_DEF_SERIALIZE_SIZE(ObTableModify) ...@@ -532,7 +530,6 @@ OB_DEF_SERIALIZE_SIZE(ObTableModify)
len += get_dlist_serialize_size(tsc_virtual_column_exprs_); len += get_dlist_serialize_size(tsc_virtual_column_exprs_);
OB_UNIS_ADD_LEN(is_pdml_index_maintain_); OB_UNIS_ADD_LEN(is_pdml_index_maintain_);
OB_UNIS_ADD_LEN(table_location_uncertain_); OB_UNIS_ADD_LEN(table_location_uncertain_);
OB_UNIS_ADD_LEN(is_pdml_index_maintain_);
return len; return len;
} }
......
...@@ -980,34 +980,30 @@ int ObParallelDfoScheduler::dispatch_sqc( ...@@ -980,34 +980,30 @@ int ObParallelDfoScheduler::dispatch_sqc(
} else { } else {
LOG_WARN("fail to wait all async init sqc", K(ret), K(exec_ctx)); LOG_WARN("fail to wait all async init sqc", K(ret), K(exec_ctx));
} }
} } else {
int saved_ret = ret; const ObArray<ObSqcAsyncCB*>& callbacks = proxy.get_callbacks();
ret = OB_SUCCESS; ARRAY_FOREACH(callbacks, idx) {
const ObArray<ObSqcAsyncCB*>& callbacks = proxy.get_callbacks(); const ObSqcAsyncCB* cb = callbacks.at(idx);
ARRAY_FOREACH(callbacks, idx) const ObPxRpcInitSqcResponse& resp = (*cb).get_result();
{ ObPxSqcMeta& sqc = *sqcs.at(idx);
const ObSqcAsyncCB* cb = callbacks.at(idx); sqc.set_need_report(true);
const ObPxRpcInitSqcResponse& resp = (*cb).get_result(); if (!fast_sqc) {
ObPxSqcMeta& sqc = *sqcs.at(idx); ObPxInitSqcResultMsg pkt;
if (sqc.need_report() && !fast_sqc) { pkt.dfo_id_ = sqc.get_dfo_id();
ObPxInitSqcResultMsg pkt; pkt.sqc_id_ = sqc.get_sqc_id();
pkt.dfo_id_ = sqc.get_dfo_id(); pkt.rc_ = resp.rc_;
pkt.sqc_id_ = sqc.get_sqc_id(); pkt.task_count_ = resp.reserved_thread_count_;
pkt.rc_ = resp.rc_; if (resp.reserved_thread_count_ < sqc.get_max_task_count()) {
pkt.task_count_ = resp.reserved_thread_count_; LOG_INFO("SQC do not have enough thread, Downgraded thread allocation", K(resp), K(sqc));
if (resp.reserved_thread_count_ < sqc.get_max_task_count()) { }
LOG_INFO("SQC do not have enough thread, Downgraded thread allocation", K(resp), K(sqc)); if (OB_FAIL(pkt.partitions_info_.assign(resp.partitions_info_))) {
} LOG_WARN("Failed to assign partition info", K(ret));
if (OB_FAIL(pkt.partitions_info_.assign(resp.partitions_info_))) { } else if (OB_FAIL(proc_.on_sqc_init_msg(exec_ctx, pkt))) {
LOG_WARN("Failed to assign partition info", K(ret)); LOG_WARN("fail to do sqc init callback", K(resp), K(pkt), K(ret));
} else if (OB_FAIL(proc_.on_sqc_init_msg(exec_ctx, pkt))) { }
LOG_WARN("fail to do sqc init callback", K(resp), K(pkt), K(ret));
} }
} }
} }
if (saved_ret != OB_SUCCESS) {
ret = saved_ret;
}
return ret; return ret;
} }
......
...@@ -75,6 +75,17 @@ int ObInitSqcP::process() ...@@ -75,6 +75,17 @@ int ObInitSqcP::process()
} else { } else {
/*do nothing*/ /*do nothing*/
} }
if (OB_FAIL(ret) && OB_NOT_NULL(sqc_handler)) {
if (unregister_interrupt_) {
ObPxRpcInitSqcArgs &arg = sqc_handler->get_sqc_init_arg();
UNSET_INTERRUPTABLE(arg.sqc_.get_interrupt_id().px_interrupt_id_);
unregister_interrupt_ = false;
}
ObPxSqcHandler::release_handler(sqc_handler);
arg_.sqc_handler_ = nullptr;
}
// 非rpc框架的错误内容设置到response消息中
// rpc框架的错误码在process中返回OB_SUCCESS
result_.rc_ = ret; result_.rc_ = ret;
// return value by result_.rc_ // return value by result_.rc_
return OB_SUCCESS; return OB_SUCCESS;
...@@ -137,17 +148,21 @@ int ObInitSqcP::after_process() ...@@ -137,17 +148,21 @@ int ObInitSqcP::after_process()
ret = startup_normal_sqc(*sqc_handler); ret = startup_normal_sqc(*sqc_handler);
} }
/** if (!no_need_startup_normal_sqc) {
* clear interrupt if (unregister_interrupt_) {
*/ if (OB_ISNULL(sqc_handler = arg_.sqc_handler_)
if (unregister_interrupt_) { || !sqc_handler->valid()) {
ObPxRpcInitSqcArgs& arg = sqc_handler->get_sqc_init_arg(); ret = OB_ERR_UNEXPECTED;
UNSET_INTERRUPTABLE(arg.sqc_.get_interrupt_id().px_interrupt_id_); LOG_WARN("Invalid sqc handler", K(ret), KPC(sqc_handler));
} else {
ObPxRpcInitSqcArgs &arg = sqc_handler->get_sqc_init_arg();
UNSET_INTERRUPTABLE(arg.sqc_.get_interrupt_id().px_interrupt_id_);
}
}
ObPxSqcHandler::release_handler(sqc_handler);
arg_.sqc_handler_ = nullptr;
} }
ObPxSqcHandler::release_handler(sqc_handler);
arg_.sqc_handler_ = nullptr;
return ret; return ret;
} }
......
...@@ -200,7 +200,6 @@ int ObPxSqcAsyncProxy::wait_all() ...@@ -200,7 +200,6 @@ int ObPxSqcAsyncProxy::wait_all()
} else { } else {
results_.at(idx) = &cb_result; results_.at(idx) = &cb_result;
} }
sqcs_.at(idx)->set_need_report(true);
} else { } else {
// RPC framework error, need no retry // RPC framework error, need no retry
ret = callback.get_ret_code().rcode_; ret = callback.get_ret_code().rcode_;
...@@ -273,10 +272,6 @@ void ObPxSqcAsyncProxy::fail_process() ...@@ -273,10 +272,6 @@ void ObPxSqcAsyncProxy::fail_process()
LOG_DEBUG("async sql fails, wait all callbacks", K(return_cb_count_), K(callbacks_.count())); LOG_DEBUG("async sql fails, wait all callbacks", K(return_cb_count_), K(callbacks_.count()));
callback.set_visited(true); callback.set_visited(true);
} }
// same condition with ObPxSqcAsyncProxy::wait_all().
if (callback.get_ret_code().rcode_ == OB_SUCCESS && callback.is_processed()) {
sqcs_.at(idx)->set_need_report(true);
}
} }
} }
cond_.wait_us(500); cond_.wait_us(500);
......
...@@ -261,6 +261,7 @@ int ObPxThreadWorker::run_at(ObPxRpcInitTaskArgs& task_arg, omt::ObPxPool& px_po ...@@ -261,6 +261,7 @@ int ObPxThreadWorker::run_at(ObPxRpcInitTaskArgs& task_arg, omt::ObPxPool& px_po
if (OB_SUCCESS != tmp_ret) { if (OB_SUCCESS != tmp_ret) {
LOG_WARN("fail increase thread count. abort!", K(tmp_ret), K(ret)); LOG_WARN("fail increase thread count. abort!", K(tmp_ret), K(ret));
ret = tmp_ret; ret = tmp_ret;
break;
} }
} }
usleep(5000); usleep(5000);
......
...@@ -1096,6 +1096,19 @@ int ObResultSet::init_cmd_exec_context(ObExecContext& exec_ctx) ...@@ -1096,6 +1096,19 @@ int ObResultSet::init_cmd_exec_context(ObExecContext& exec_ctx)
return ret; return ret;
} }
void ObResultSet::refresh_location_cache(ObTaskExecutorCtx &task_exec_ctx, bool is_nonblock, int err)
{
if (OB_NOT_MASTER == err || OB_PARTITION_NOT_EXIST == err || is_server_down_error(err)) {
int err2 = ObTaskExecutorCtxUtil::refresh_location_cache(task_exec_ctx,
is_nonblock);
if (OB_SUCCESS != err2) {
LOG_WARN("fail to refresh location cache", K(err2), K(is_nonblock), K(err));
}
LOG_TRACE("partition change or not master or no response, refresh location cache", K(err));
}
}
// obmp_query中重试整个SQL之前,可能需要调用本接口来刷新Location,以避免总是发给了错误的服务器
int ObResultSet::refresh_location_cache(bool is_nonblock) int ObResultSet::refresh_location_cache(bool is_nonblock)
{ {
return ObTaskExecutorCtxUtil::refresh_location_cache(get_exec_context().get_task_exec_ctx(), is_nonblock); return ObTaskExecutorCtxUtil::refresh_location_cache(get_exec_context().get_task_exec_ctx(), is_nonblock);
......
...@@ -188,6 +188,7 @@ public: ...@@ -188,6 +188,7 @@ public:
stmt::StmtType get_inner_stmt_type() const; stmt::StmtType get_inner_stmt_type() const;
stmt::StmtType get_literal_stmt_type() const; stmt::StmtType get_literal_stmt_type() const;
int64_t get_query_string_id() const; int64_t get_query_string_id() const;
static void refresh_location_cache(ObTaskExecutorCtx &task_exec_ctx, bool is_nonblock, int err);
int refresh_location_cache(bool is_nonblock); int refresh_location_cache(bool is_nonblock);
int check_and_nonblock_refresh_location_cache(); int check_and_nonblock_refresh_location_cache();
bool need_execute_remote_sql_async() const bool need_execute_remote_sql_async() const
......
...@@ -1240,12 +1240,13 @@ int ObRawExprPrinter::print(ObSysFunRawExpr* expr) ...@@ -1240,12 +1240,13 @@ int ObRawExprPrinter::print(ObSysFunRawExpr* expr)
break; break;
} }
case T_FUN_SYS_LNNVL: { case T_FUN_SYS_LNNVL: {
DATA_PRINTF("%.*s", LEN_AND_PTR(func_name)); DATA_PRINTF("(%.*s", LEN_AND_PTR(func_name));
if (1 != expr->get_param_count()) { if (1 != expr->get_param_count()) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("param count should be equal 1", K(ret), K(expr->get_param_count())); LOG_WARN("param count should be equal 1", K(ret), K(expr->get_param_count()));
} else { } else {
PRINT_EXPR(expr->get_param_expr(0)); PRINT_EXPR(expr->get_param_expr(0));
DATA_PRINTF(")");
} }
break; break;
} }
......
...@@ -3390,6 +3390,7 @@ int ObRawExprResolverImpl::process_lnnvl_node(const ParseNode* node, ObRawExpr*& ...@@ -3390,6 +3390,7 @@ int ObRawExprResolverImpl::process_lnnvl_node(const ParseNode* node, ObRawExpr*&
switch (param_type) { switch (param_type) {
case T_FUN_SYS_LNNVL: case T_FUN_SYS_LNNVL:
case T_FUN_SYS_REGEXP_LIKE: case T_FUN_SYS_REGEXP_LIKE:
case T_OP_EXISTS:
case T_OP_IS: case T_OP_IS:
case T_OP_IS_NOT: case T_OP_IS_NOT:
case T_OP_LIKE: case T_OP_LIKE:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册