From 1fcf2c2aae2017edb8bd517a3e574d6cd0ddd8b7 Mon Sep 17 00:00:00 2001 From: "shenyunlong.syl" Date: Tue, 17 Dec 2024 11:18:34 +0000 Subject: [PATCH] [OBKV] fix observer coredump or report -4016 when execute multi-cf hbase put with lob column --- src/observer/table/ob_table_batch_service.cpp | 18 ++++++++++++------ src/share/table/ob_table.h | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/observer/table/ob_table_batch_service.cpp b/src/observer/table/ob_table_batch_service.cpp index 87d164bca..cc76d85de 100644 --- a/src/observer/table/ob_table_batch_service.cpp +++ b/src/observer/table/ob_table_batch_service.cpp @@ -191,11 +191,17 @@ int ObTableBatchService::adjust_entities(ObTableBatchCtx &ctx) ObTableCtx &tb_ctx = ctx.tb_ctx_; // first entity has beed adjusted when create tb_ctx - for (int64_t i = 1; OB_SUCC(ret) && i < ctx.ops_->count(); ++i) { - const ObTableOperation &op = ctx.ops_->at(i); - tb_ctx.set_entity(&op.entity()); - if (OB_FAIL(tb_ctx.adjust_entity())) { - LOG_WARN("fail to adjust entity", K(ret)); + // but in hbase, the tb_ctx maybe reused and first entity + // also need to be adjusted + for (int64_t i = 0; OB_SUCC(ret) && i < ctx.ops_->count(); ++i) { + if (i == 0 && ctx.entity_type_ != ObTableEntityType::ET_HKV) { + // do noting + } else { + const ObTableOperation &op = ctx.ops_->at(i); + tb_ctx.set_entity(&op.entity()); + if (OB_FAIL(tb_ctx.adjust_entity())) { + LOG_WARN("fail to adjust entity", K(ret)); + } } } @@ -773,7 +779,7 @@ int ObTableBatchService::htable_put(ObTableBatchCtx &ctx) const ObTableOperation &op = ctx.ops_->at(i); ObTableOperationResult single_op_result; tb_ctx.set_entity(&op.entity()); - if (i > 0 && OB_FAIL(tb_ctx.adjust_entity())) { // first entity adjust in init_single_op_tb_ctx + if (OB_FAIL(tb_ctx.adjust_entity())) { // first entity adjust in init_single_op_tb_ctx LOG_WARN("fail to adjust entity", K(ret)); } else if (OB_FAIL(ObTableOpWrapper::process_op_with_spec(tb_ctx, spec, single_op_result))) { LOG_WARN("fail to process op with spec", K(ret)); diff --git a/src/share/table/ob_table.h b/src/share/table/ob_table.h index 8a9f62b98..349a4819e 100644 --- a/src/share/table/ob_table.h +++ b/src/share/table/ob_table.h @@ -1743,7 +1743,7 @@ public: OB_INLINE void set_tablet_id(ObTabletID tablet_id) { tablet_id_ = tablet_id; } OB_INLINE void set_option_flag(uint64_t option_flag) { option_flag_ = option_flag; } - OB_INLINE int add_single_op(ObTableSingleOp single_op) { return single_ops_.push_back(single_op); } + OB_INLINE int add_single_op(const ObTableSingleOp &single_op) { return single_ops_.push_back(single_op); } TO_STRING_KV(K_(tablet_id), K_(option_flag),