Skip to content

Commit

Permalink
fix: prepare 不支持full_export
Browse files Browse the repository at this point in the history
  • Loading branch information
cyz-2023 committed Nov 20, 2024
1 parent 0ff6d3a commit 53d7fb4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/logical_plan/logical_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2927,7 +2927,7 @@ int LogicalPlanner::create_scan_nodes() {
}

void LogicalPlanner::set_dml_txn_state(int64_t table_id) {
if (_ctx->is_explain || table_id == -1) {
if (_ctx->is_explain) {
return;
}
auto client = _ctx->client_conn;
Expand Down
7 changes: 5 additions & 2 deletions src/logical_plan/prepare_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ int PreparePlanner::stmt_prepare(const std::string& stmt_name, const std::string
prepare_ctx->client_conn = client;
prepare_ctx->get_runtime_state()->set_client_conn(client);
prepare_ctx->sql = stmt_sql;
prepare_ctx->is_full_export = false;

std::unique_ptr<LogicalPlanner> planner;
switch (prepare_ctx->stmt_type) {
Expand Down Expand Up @@ -248,7 +249,7 @@ int PreparePlanner::stmt_execute(const std::string& stmt_name, std::vector<pb::E
_ctx->stat_info.table = prepare_ctx->stat_info.table;
_ctx->stat_info.sample_sql << prepare_ctx->stat_info.sample_sql.str();
_ctx->stat_info.sign = prepare_ctx->stat_info.sign;
_ctx->is_full_export = prepare_ctx->is_full_export;
_ctx->is_full_export = false;
_ctx->debug_region_id = prepare_ctx->debug_region_id;
_ctx->execute_global_flow = prepare_ctx->execute_global_flow;
if (params.size() != prepare_ctx->placeholders.size()) {
Expand All @@ -268,7 +269,9 @@ int PreparePlanner::stmt_execute(const std::string& stmt_name, std::vector<pb::E
// TODO dml的plan复用
if (!prepare_ctx->is_select || prepare_ctx->sub_query_plans.size() > 0 || (prepare_ctx->root != nullptr && prepare_ctx->root->has_optimized())) {
// enable_2pc=true or table has global index need generate txn_id
set_dml_txn_state(prepare_ctx->prepared_table_id);
if (!prepare_ctx->is_select && prepare_ctx->prepared_table_id != -1) {
set_dml_txn_state(prepare_ctx->prepared_table_id);
}
_ctx->plan.CopyFrom(prepare_ctx->plan);
int ret = set_dml_local_index_binlog(prepare_ctx->prepared_table_id);
if (ret < 0) {
Expand Down
3 changes: 3 additions & 0 deletions src/logical_plan/select_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ bool SelectPlanner::is_full_export() {
if (_ctx->explain_type != EXPLAIN_NULL) {
return false;
}
if (_ctx->is_prepared) {
return false;
}
if (_ctx->debug_region_id != -1) {
return false;
}
Expand Down

0 comments on commit 53d7fb4

Please sign in to comment.