fix expr tmp result allocator sanity check core

This commit is contained in:
obdev
2022-10-25 18:11:07 +08:00
committed by wangzelin.wzl
parent 8e5fcb688f
commit 33c8a8dd8b
4 changed files with 8 additions and 3 deletions

View File

@ -40,7 +40,7 @@ ObEvalCtx::ObEvalCtx(ObExecContext &exec_ctx)
exec_ctx_(exec_ctx), exec_ctx_(exec_ctx),
tmp_alloc_(exec_ctx.get_eval_tmp_allocator()), tmp_alloc_(exec_ctx.get_eval_tmp_allocator()),
datum_caster_(NULL), datum_caster_(NULL),
tmp_alloc_used_(false), tmp_alloc_used_(exec_ctx.get_tmp_alloc_used()),
batch_idx_(0), batch_idx_(0),
batch_size_(0), batch_size_(0),
expr_res_alloc_(exec_ctx.get_eval_res_allocator()) expr_res_alloc_(exec_ctx.get_eval_res_allocator())

View File

@ -255,7 +255,7 @@ public:
// Can not use allocator for expression result. (ObExpr::get_str_res_mem() is used for result). // Can not use allocator for expression result. (ObExpr::get_str_res_mem() is used for result).
common::ObArenaAllocator &tmp_alloc_; common::ObArenaAllocator &tmp_alloc_;
ObDatumCaster *datum_caster_; ObDatumCaster *datum_caster_;
bool tmp_alloc_used_; bool &tmp_alloc_used_;
private: private:
int64_t batch_idx_; int64_t batch_idx_;
int64_t batch_size_; int64_t batch_size_;

View File

@ -121,7 +121,8 @@ ObExecContext::ObExecContext(ObIAllocator &allocator)
parent_ctx_(nullptr), parent_ctx_(nullptr),
nested_level_(0), nested_level_(0),
is_ps_prepare_stage_(false), is_ps_prepare_stage_(false),
register_op_id_(OB_INVALID_ID) register_op_id_(OB_INVALID_ID),
tmp_alloc_used_(false)
{ {
} }
@ -294,6 +295,7 @@ void ObExecContext::destroy_eval_allocator()
{ {
eval_res_allocator_.reset(); eval_res_allocator_.reset();
eval_tmp_allocator_.reset(); eval_tmp_allocator_.reset();
tmp_alloc_used_ = false;
} }
int ObExecContext::get_temp_expr_eval_ctx(const ObTempExpr &temp_expr, int ObExecContext::get_temp_expr_eval_ctx(const ObTempExpr &temp_expr,

View File

@ -286,6 +286,7 @@ public:
bool has_non_trivial_expr_op_ctx() const { return has_non_trivial_expr_op_ctx_; } bool has_non_trivial_expr_op_ctx() const { return has_non_trivial_expr_op_ctx_; }
void set_non_trivial_expr_op_ctx(bool v) { has_non_trivial_expr_op_ctx_ = v; } void set_non_trivial_expr_op_ctx(bool v) { has_non_trivial_expr_op_ctx_ = v; }
inline bool &get_tmp_alloc_used() { return tmp_alloc_used_; }
VIRTUAL_NEED_SERIALIZE_AND_DESERIALIZE; VIRTUAL_NEED_SERIALIZE_AND_DESERIALIZE;
protected: protected:
@ -613,6 +614,8 @@ protected:
bool is_ps_prepare_stage_; bool is_ps_prepare_stage_;
// for sql plan monitor // for sql plan monitor
int64_t register_op_id_; int64_t register_op_id_;
// indicate if eval_tmp_allocator_ is used
bool tmp_alloc_used_;
// ------------------- // -------------------
private: private:
DISALLOW_COPY_AND_ASSIGN(ObExecContext); DISALLOW_COPY_AND_ASSIGN(ObExecContext);