fix bug Batch optimization may cause auto-increment column jumps

This commit is contained in:
yishenglanlingzui
2023-03-16 00:13:32 +00:00
committed by ob-robot
parent 01ad74c050
commit b9ae891ab1
3 changed files with 8 additions and 1 deletions

View File

@ -2513,6 +2513,7 @@ int ObSql::generate_stmt(ParseResult &parse_result,
resolver_ctx.is_ddl_from_primary_ = context.is_ddl_from_primary_;
resolver_ctx.is_cursor_ = context.is_cursor_;
resolver_ctx.is_batch_stmt_ = context.multi_stmt_item_.is_batched_multi_stmt();
resolver_ctx.batch_stmt_num_ = context.multi_stmt_item_.get_batched_stmt_cnt();
if (NULL != pc_ctx && pc_ctx->is_remote_executor_) {
resolver_ctx.need_check_col_dup_
= !(context.is_prepare_protocol_ && parse_result.question_mark_ctx_.by_ordinal_ && pc_ctx->is_original_ps_mode_);

View File

@ -2795,7 +2795,11 @@ int ObDelUpdResolver::get_value_row_size(uint64_t& value_row_size)
} else if (del_upd_stmt->is_insert_stmt()) {
ObInsertStmt *insert_stmt = static_cast<ObInsertStmt*>(del_upd_stmt);
if (!insert_stmt->value_from_select()) {
value_row_size = insert_stmt->get_insert_row_count();
if (params_.is_batch_stmt_) {
value_row_size = params_.batch_stmt_num_;
} else {
value_row_size = insert_stmt->get_insert_row_count();
}
}
}
return ret;

View File

@ -327,6 +327,7 @@ struct ObResolverParams
have_same_table_name_(false),
is_default_param_(false),
is_batch_stmt_(false),
batch_stmt_num_(0),
new_gen_did_(common::OB_INVALID_ID - 1),
new_gen_cid_(common::OB_MAX_TMP_COLUMN_ID),
new_gen_qid_(1),
@ -388,6 +389,7 @@ public:
bool have_same_table_name_;
bool is_default_param_;
bool is_batch_stmt_;
int64_t batch_stmt_num_;
private:
uint64_t new_gen_did_;
uint64_t new_gen_cid_;