Fix error-code-overwritten problem and remove unused code in direct insert

This commit is contained in:
leftgeek
2023-06-02 02:54:52 +00:00
committed by ob-robot
parent a84b7a3e75
commit 1b80e45edc
3 changed files with 6 additions and 34 deletions

View File

@ -2029,11 +2029,6 @@ int ObStaticEngineCG::generate_insert_with_das(ObLogInsert &op, ObTableInsertSpe
spec.use_dist_das_ = op.is_multi_part_dml();
spec.gi_above_ = op.is_gi_above() && !spec.use_dist_das_;
spec.is_returning_ = op.is_returning();
// currently direct-insert does not support non-pdml situation
// if (GCONF._ob_enable_direct_load) {
// spec.plan_->set_append_table_id(op.get_append_table_id());
// spec.plan_->set_enable_append(op.get_plan()->get_optimizer_context().get_global_hint().has_append());
// }
}
}
for (int64_t i = 0; OB_SUCC(ret) && i < index_dml_infos.count(); ++i) {

View File

@ -26,7 +26,6 @@
#include "lib/profile/ob_perf_event.h"
#include "share/schema/ob_table_dml_param.h"
#include "share/ob_tablet_autoincrement_service.h"
#include "sql/engine/cmd/ob_table_direct_insert_service.h"
namespace oceanbase
@ -154,11 +153,6 @@ OB_INLINE int ObTableInsertOp::open_table_for_each()
const ObInsCtDef &ins_ctdef = *ctdefs.at(j);
if (OB_FAIL(ObDMLService::init_ins_rtdef(dml_rtctx_, ins_rtdef, ins_ctdef, trigger_clear_exprs_))) {
LOG_WARN("init insert rtdef failed", K(ret));
} else {
const ObPhysicalPlan *plan = GET_PHY_PLAN_CTX(ctx_)->get_phy_plan();
if (plan->get_enable_append() && (0 != plan->get_append_table_id())) {
ins_rtdef.das_rtdef_.direct_insert_task_id_ = 1;
}
}
}
if (OB_SUCC(ret) && !rtdefs.empty()) {
@ -405,16 +399,6 @@ int ObTableInsertOp::inner_open()
} else if (OB_FAIL(inner_open_with_das())) {
LOG_WARN("inner open with das failed", K(ret));
}
if (OB_SUCC(ret)) {
const ObPhysicalPlan *plan = GET_PHY_PLAN_CTX(ctx_)->get_phy_plan();
if (ObTableDirectInsertService::is_direct_insert(*plan)) {
int64_t task_id = 1;
if (OB_FAIL(ObTableDirectInsertService::open_task(plan->get_append_table_id(), task_id))) {
LOG_WARN("failed to open table direct insert task", KR(ret),
K(plan->get_append_table_id()), K(task_id));
}
}
}
return ret;
}
@ -437,14 +421,6 @@ int ObTableInsertOp::inner_close()
{
NG_TRACE(insert_close);
int ret = OB_SUCCESS;
const ObPhysicalPlan *plan = GET_PHY_PLAN_CTX(ctx_)->get_phy_plan();
if (ObTableDirectInsertService::is_direct_insert(*plan)) {
int64_t task_id = 1;
if (OB_FAIL(ObTableDirectInsertService::close_task(plan->get_append_table_id(), task_id))) {
LOG_WARN("failed to close table direct insert task", KR(ret),
K(plan->get_append_table_id()), K(task_id));
}
}
if (OB_FAIL(close_table_for_each())) {
LOG_WARN("close table for each failed", K(ret));
}

View File

@ -103,14 +103,15 @@ int ObPxMultiPartInsertOp::inner_get_next_row()
int ObPxMultiPartInsertOp::inner_close()
{
int ret = OB_SUCCESS;
int tmp_ret = OB_SUCCESS;
const ObPhysicalPlan *plan = GET_PHY_PLAN_CTX(ctx_)->get_phy_plan();
if (ObTableDirectInsertService::is_direct_insert(*plan)) {
int64_t task_id = ctx_.get_px_task_id() + 1;
int error_code = (static_cast<const ObPxMultiPartInsertOpInput *>(input_))->get_error_code();
if (OB_FAIL(ObTableDirectInsertService::close_task(plan->get_append_table_id(),
task_id,
error_code))) {
LOG_WARN("failed to close table direct insert task", KR(ret),
if (OB_TMP_FAIL(ObTableDirectInsertService::close_task(plan->get_append_table_id(),
task_id,
error_code))) {
LOG_WARN("failed to close table direct insert task", KR(tmp_ret),
K(plan->get_append_table_id()), K(task_id), K(error_code));
}
}
@ -119,7 +120,7 @@ int ObPxMultiPartInsertOp::inner_close()
} else {
data_driver_.destroy();
}
ret = (OB_SUCCESS == tmp_ret) ? ret : tmp_ret;
return ret;
}