fix add_row use wrong row_size leads core

This commit is contained in:
18523270951@163.com 2023-06-28 12:18:07 +00:00 committed by ob-robot
parent 5b9655c0e7
commit 3d5098aa3f
3 changed files with 13 additions and 11 deletions

View File

@ -60,6 +60,8 @@ public:
virtual int64_t to_string(char *buffer, int64_t length) const;
inline int64_t get_block_size() const { return LOCAL_BLOCK_SIZE; }
inline const BlockAllocatorT &get_block_allocator() const { return block_alloc_; }
void set_tenant_id(int64_t tenant_id) { block_alloc_.set_tenant_id(tenant_id); }
void set_ctx_id(int64_t ctx_id) { block_alloc_.set_ctx_id(ctx_id); }
virtual bool empty() const;

View File

@ -812,6 +812,8 @@ int ObAggregateProcessor::init()
end_partial_rollup_idx_ = 0;
removal_info_.reset();
set_tenant_id(eval_ctx_.exec_ctx_.get_my_session()->get_effective_tenant_id());
group_rows_.set_tenant_id(eval_ctx_.exec_ctx_.get_my_session()->get_effective_tenant_id());
group_rows_.set_ctx_id(ObCtxIds::DEFAULT_CTX_ID);
if (OB_ISNULL(eval_ctx_.exec_ctx_.get_my_session())) {
ret = OB_ERR_UNEXPECTED;

View File

@ -244,7 +244,7 @@ int ObChunkDatumStore::Block::add_row(const common::ObIArray<ObExpr*> &exprs, Ob
StoredRow *sr = NULL;
if (OB_FAIL(StoredRow::build(sr, exprs, ctx, buf->head(), row_size, row_extend_size))) {
LOG_WARN("build stored row failed", K(ret));
} else if (OB_FAIL(buf->advance(row_size))) {
} else if (OB_FAIL(buf->advance(sr->row_size_))) {
LOG_WARN("fill buffer head failed", K(ret), K(buf), K(row_size));
} else {
rows_++;
@ -2186,7 +2186,7 @@ OB_DEF_SERIALIZE(ObChunkDatumStore)
} else if (ObCtxIds::WORK_AREA == ser_ctx_id) {
ser_ctx_id = OLD_WORK_AREA_ID;
} else {
LOG_ERROR_RET(OB_ERR_UNEXPECTED, "unexpected ctx id", K(ser_ctx_id), K(lbt()));
LOG_WARN_RET(OB_ERR_UNEXPECTED, "unexpected ctx id", K(ser_ctx_id), K(lbt()));
}
}
LST_DO_CODE(OB_UNIS_ENCODE,
@ -2232,15 +2232,13 @@ OB_DEF_DESERIALIZE(ObChunkDatumStore)
tenant_id_,
ctx_id_,
mem_limit_);
if (ObCtxIds::MAX_CTX_ID <= OLD_WORK_AREA_ID) {
if (ObCtxIds::DEFAULT_CTX_ID == ctx_id_
|| ObCtxIds::WORK_AREA == ctx_id_) {
// do nothing
} else if (OLD_WORK_AREA_ID == ctx_id_) {
ctx_id_ = ObCtxIds::WORK_AREA;
} else {
LOG_ERROR_RET(OB_ERR_UNEXPECTED, "unexpected ctx id", K(ctx_id_), K(lbt()));
}
if (ObCtxIds::DEFAULT_CTX_ID == ctx_id_
|| ObCtxIds::WORK_AREA == ctx_id_) {
// do nothing
} else if (OLD_WORK_AREA_ID == ctx_id_) {
ctx_id_ = ObCtxIds::WORK_AREA;
} else {
LOG_WARN_RET(OB_ERR_UNEXPECTED, "unexpected ctx id", K(ctx_id_), K(lbt()));
}
if (!is_inited()) {
if (OB_FAIL(init(mem_limit_, tenant_id_,