1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge branch '10.6' into 10.9

This commit is contained in:
Oleksandr Byelkin
2023-08-04 08:01:06 +02:00
858 changed files with 12277 additions and 6177 deletions

View File

@@ -1962,19 +1962,25 @@ public:
Use this constructor if value->save_in_field() went precisely,
without any data rounding or truncation.
*/
SEL_ARG_LT(const uchar *key, Field *field)
SEL_ARG_LT(const uchar *key, const KEY_PART *key_part, Field *field)
:SEL_ARG_LE(key, field)
{ max_flag= NEAR_MAX; }
{
// Don't use open ranges for partial key_segments
if (!(key_part->flag & HA_PART_KEY_SEG))
max_flag= NEAR_MAX;
}
/*
Use this constructor if value->save_in_field() returned success,
but we don't know if rounding or truncation happened
(as some Field::store() do not report minor data changes).
*/
SEL_ARG_LT(THD *thd, const uchar *key, Field *field,
Item *value)
SEL_ARG_LT(THD *thd, const uchar *key,
const KEY_PART *key_part, Field *field, Item *value)
:SEL_ARG_LE(key, field)
{
if (stored_field_cmp_to_item(thd, field, value) == 0)
// Don't use open ranges for partial key_segments
if (!(key_part->flag & HA_PART_KEY_SEG) &&
stored_field_cmp_to_item(thd, field, value) == 0)
max_flag= NEAR_MAX;
}
};
@@ -2888,6 +2894,13 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
tree= cond->get_mm_tree(&param, &cond);
if (notnull_cond_tree)
tree= tree_and(&param, tree, notnull_cond_tree);
if (thd->trace_started() &&
param.alloced_sel_args >= SEL_ARG::MAX_SEL_ARGS)
{
Json_writer_object wrapper(thd);
Json_writer_object obj(thd, "sel_arg_alloc_limit_hit");
obj.add("alloced_sel_args", param.alloced_sel_args);
}
}
if (tree)
{
@@ -9002,7 +9015,8 @@ SEL_ARG *Field::stored_field_make_mm_leaf_bounded_int(RANGE_OPT_PARAM *param,
DBUG_RETURN(new (param->mem_root) SEL_ARG_IMPOSSIBLE(this));
longlong item_val= value->val_int();
if (op == SCALAR_CMP_LT && item_val > 0)
if (op == SCALAR_CMP_LT && ((item_val > 0)
|| (value->unsigned_flag && (ulonglong)item_val > 0 )))
op= SCALAR_CMP_LE; // e.g. rewrite (tinyint < 200) to (tinyint <= 127)
else if (op == SCALAR_CMP_GT && !unsigned_field &&
!value->unsigned_flag && item_val < 0)
@@ -9046,7 +9060,7 @@ SEL_ARG *Field::stored_field_make_mm_leaf(RANGE_OPT_PARAM *param,
case SCALAR_CMP_LE:
DBUG_RETURN(new (mem_root) SEL_ARG_LE(str, this));
case SCALAR_CMP_LT:
DBUG_RETURN(new (mem_root) SEL_ARG_LT(thd, str, this, value));
DBUG_RETURN(new (mem_root) SEL_ARG_LT(thd, str, key_part, this, value));
case SCALAR_CMP_GT:
DBUG_RETURN(new (mem_root) SEL_ARG_GT(thd, str, key_part, this, value));
case SCALAR_CMP_GE:
@@ -9075,7 +9089,7 @@ SEL_ARG *Field::stored_field_make_mm_leaf_exact(RANGE_OPT_PARAM *param,
case SCALAR_CMP_LE:
DBUG_RETURN(new (param->mem_root) SEL_ARG_LE(str, this));
case SCALAR_CMP_LT:
DBUG_RETURN(new (param->mem_root) SEL_ARG_LT(str, this));
DBUG_RETURN(new (param->mem_root) SEL_ARG_LT(str, key_part, this));
case SCALAR_CMP_GT:
DBUG_RETURN(new (param->mem_root) SEL_ARG_GT(str, key_part, this));
case SCALAR_CMP_GE: