1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-29753 An error is wrongly reported during INSERT with vcol index

See also commits aa8a31da and 64678c for a Bug #22990029 fix.

In this scenario INSERT chose to check if delete unmarking is available for
a just deleted record. To build an update vector, it needed to calculate
the vcols as well. Since this INSERT was not IGNORE-flagged, recalculation
failed.

Solutiuon: temporarily set abort_on_warning=true, while calculating the
column for delete-unmarked insert.
This commit is contained in:
Nikita Malyavin
2022-10-10 19:41:09 +03:00
parent 3cd2c1e8b6
commit 128356b4b1
7 changed files with 75 additions and 9 deletions

View File

@@ -8158,9 +8158,10 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
/*
Calculate the virtual field value for a specified field.
@param vf A field to calculate
@param ignore_warnings Ignore calculation warnings. This usually
means that a calculation is internal and is
not expected to fail.
@param ignore_warnings Ignore the warnings and also make the
calculations permissive. This usually means
that a calculation is internal and is not
expected to fail.
*/
int TABLE::update_virtual_field(Field *vf, bool ignore_warnings)
{
@@ -8169,8 +8170,13 @@ int TABLE::update_virtual_field(Field *vf, bool ignore_warnings)
Counting_error_handler count_errors;
Suppress_warnings_error_handler warning_handler;
in_use->push_internal_handler(&count_errors);
bool abort_on_warning;
if (ignore_warnings)
{
abort_on_warning= in_use->abort_on_warning;
in_use->abort_on_warning= false;
in_use->push_internal_handler(&warning_handler);
}
/*
TODO: this may impose memory leak until table flush.
See comment in
@@ -8183,7 +8189,12 @@ int TABLE::update_virtual_field(Field *vf, bool ignore_warnings)
in_use->restore_active_arena(expr_arena, &backup_arena);
in_use->pop_internal_handler();
if (ignore_warnings)
{
in_use->abort_on_warning= abort_on_warning;
in_use->pop_internal_handler();
// This is an internal calculation, we expect it to always succeed
DBUG_ASSERT(count_errors.errors == 0);
}
DBUG_RETURN(count_errors.errors);
}