提交 10499651 编写于 作者: H Hongqin-Li 提交者: ob-robot

Fix presplit global index with null high bound

上级 e2eb969a
......@@ -2923,6 +2923,7 @@ int ObSplitSampler::query_ranges_(const uint64_t tenant_id, const ObString &db_n
ret = OB_ERR_UNEXPECTED;
LOG_WARN("invalid column count", KR(ret), K(column_count), K(sql));
} else {
bool has_null = false;
// build start_row_key
if (ranges.size() == 0) {
// copy low_bound_val to range.start_key_
......@@ -2938,6 +2939,9 @@ int ObSplitSampler::query_ranges_(const uint64_t tenant_id, const ObString &db_n
if (OB_FAIL(ret)) {
} else {
for (int64_t i = 0; i < column_count; i++) {
if (row->get_cell(i).is_null()) {
has_null = true;
}
objs[i] = row->get_cell(i);
}
......@@ -2951,6 +2955,8 @@ int ObSplitSampler::query_ranges_(const uint64_t tenant_id, const ObString &db_n
}
if (OB_FAIL(ret)) {
} else if (has_null) {
// null values are not allowed in range high bound
} else if (OB_FAIL(ranges.push_back(range))) {
LOG_WARN("range push back failed", KR(ret));
}
......
......@@ -762,6 +762,8 @@ int ObAddPartInfoHelper::add_high_bound_val_column(const P &part_option,
LOG_WARN("get tenant timezone map failed", K(ret), K(table_->get_tenant_id()));
} else if (OB_FAIL(table_->check_if_oracle_compat_mode(is_oracle_mode))) {
LOG_WARN("fail to get compat mode", KR(ret), KPC_(table));
} else if (OB_FAIL(ObPartitionUtils::check_range_high_bound_val(part_option.get_high_bound_val()))) {
LOG_WARN("Failed to check range high bound val", K(ret), K(part_option.get_high_bound_val()));
} else if (OB_FAIL(ObPartitionUtils::convert_rowkey_to_sql_literal(
is_oracle_mode, part_option.get_high_bound_val(), high_bound_val_,
OB_MAX_B_HIGH_BOUND_VAL_LENGTH, pos, false, &tz_info))) {
......@@ -1400,6 +1402,8 @@ int ObAddSplitIncPartHelper::add_split_partition_info()
if (OB_ISNULL(part)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("part array is null", KR(ret), K(index), K(inc_table_));
} else if (inc_table_->is_range_part() && OB_FAIL(ObPartitionUtils::check_range_high_bound_val(part->get_high_bound_val()))) {
LOG_WARN("failed to check range high bound val", KR(ret), KPC(part));
} else {
HEAP_VAR(ObAddIncPartDMLGenerator, part_dml_gen,
ori_table_, *part, part_array_size, index, schema_version_) {
......
......@@ -8077,6 +8077,17 @@ int ObPartitionUtils::convert_rows_to_sql_literal(
return ret;
}
int ObPartitionUtils::check_range_high_bound_val(const ObRowkey &high_bound_val)
{
int ret = OB_SUCCESS;
for (int64_t i = 0; OB_SUCC(ret) && i < high_bound_val.get_obj_cnt(); i++) {
if (OB_UNLIKELY(high_bound_val.get_obj_ptr()[i].is_null())) {
ret = OB_EER_NULL_IN_VALUES_LESS_THAN;
LOG_WARN("null value is not allowed in range high bound", K(ret), K(i), K(high_bound_val));
}
}
return ret;
}
int ObPartitionUtils::convert_rowkey_to_sql_literal(
const bool is_oracle_mode,
......
......@@ -3509,6 +3509,9 @@ public:
bool print_collation,
const common::ObTimeZoneInfo *tz_info);
// Check range partition's high_bound_val before write to inner table
static int check_range_high_bound_val(const common::ObRowkey &high_bound_val);
// Used to display the defined value of the LIST partition
static int convert_rows_to_sql_literal(
const bool is_oracle_mode,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册