[CP][OBKV] disable put when has lob column && scan order invalid

This commit is contained in:
GroundWu 2024-05-23 06:42:25 +00:00 committed by ob-robot
parent f02af51238
commit 5eb7245307
4 changed files with 15 additions and 4 deletions

View File

@ -3079,12 +3079,14 @@ TEST_F(TestBatchExecute, secondary_index)
ASSERT_EQ(OB_SUCCESS, result_entity->get_property(C3, obj3));
//fprintf(stderr, "%ld: (%s,%s,%s)\n", i, S(obj1), S(obj2), S(obj3));
ASSERT_EQ(OB_SUCCESS, obj3.get_varchar(str));
if (i % 2 == 0) {
if (i < BATCH_SIZE/4) {
ASSERT_EQ(2+i*8, obj1.get_int());
ASSERT_EQ(1 , obj2.get_int());
ASSERT_EQ(2 + 4 * i, obj1.get_int()); // 2, 10, 18,...
ASSERT_TRUE(str == ObString::make_string(c3_values[(i%2==0)?1:5]));
} else {
ASSERT_EQ(4+(i-BATCH_SIZE/4)*8, obj1.get_int());
ASSERT_EQ(2 , obj2.get_int());
ASSERT_EQ(4 + (i - 1) * 4, obj1.get_int()); // 4, 12, 20,...
ASSERT_TRUE(str == ObString::make_string(c3_values[((i-BATCH_SIZE/4)%2==0)?2:6]));
}
}
ASSERT_EQ(OB_ITER_END, iter->get_next_entity(result_entity));

View File

@ -154,6 +154,8 @@ int ObTableCtx::construct_column_items()
LOG_WARN("fail to get cascaded column ids", K(ret), K(item), K(*col_schema));
} else if (OB_FAIL(column_items_.push_back(item))) {
LOG_WARN("fail to push back column item", K(ret), K_(column_items), K(item));
} else if (!has_lob_column_ && is_lob_storage(item.column_type_)) {
has_lob_column_ = true;
}
}
}
@ -1788,6 +1790,9 @@ int ObTableCtx::check_insert_up_can_use_put(bool &use_put)
} else if (ObTableOperationType::INSERT_OR_UPDATE != operation_type_) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid operation type", K(ret), K_(operation_type));
} else if (has_lob_column()) {
// has lob column cannot use put: may cause lob storeage leak when put row to lob meta table
can_use_put = false;
} else if (is_htable()) { // htable has no index and alway full filled.
can_use_put = true;
} else if (is_client_set_put_ && !related_index_ids_.empty()) {

View File

@ -183,6 +183,7 @@ public:
is_ttl_table_ = false;
is_skip_scan_ = false;
is_client_set_put_ = false;
has_lob_column_ = false;
binlog_row_image_type_ = ObBinlogRowImage::FULL;
is_full_table_scan_ = false;
}
@ -220,6 +221,7 @@ public:
K_(is_ttl_table),
K_(is_skip_scan),
K_(is_client_set_put),
K_(has_lob_column),
K_(binlog_row_image_type));
public:
//////////////////////////////////////// getter ////////////////////////////////////////////////
@ -318,6 +320,7 @@ public:
OB_INLINE const common::ObIArray<uint64_t> &get_agg_projs() const { return agg_cell_proj_; }
OB_INLINE ObPhysicalPlanCtx *get_physical_plan_ctx() { return exec_ctx_.get_physical_plan_ctx(); }
OB_INLINE bool has_auto_inc() { return has_auto_inc_; }
OB_INLINE bool has_lob_column() const { return has_lob_column_; }
//////////////////////////////////////// setter ////////////////////////////////////////////////
// for common
OB_INLINE void set_init_flag(bool is_init) { is_init_ = is_init; }
@ -523,6 +526,7 @@ private:
bool is_skip_scan_;
// for put
bool is_client_set_put_;
bool has_lob_column_;
int64_t binlog_row_image_type_;
// for audit
bool is_full_table_scan_;

View File

@ -32,7 +32,7 @@ int ObTableApiScanExecutor::init_das_scan_rtdef(const ObDASScanCtDef &das_ctdef,
const ObTableApiScanCtDef &tsc_ctdef = scan_spec_.get_ctdef();
bool is_lookup = (&das_ctdef == tsc_ctdef.lookup_ctdef_);
das_rtdef.timeout_ts_ = tb_ctx.get_timeout_ts();
das_rtdef.scan_flag_.scan_order_ = tb_ctx.get_scan_order();
das_rtdef.scan_flag_.scan_order_ = is_lookup ? ObQueryFlag::KeepOrder : tb_ctx.get_scan_order();
das_rtdef.scan_flag_.index_back_ = tb_ctx.is_index_back();
das_rtdef.scan_flag_.read_latest_ = tb_ctx.is_read_latest();
das_rtdef.need_check_output_datum_ = false;