maria:bb-10.6-MDEV-31983-v3

Last commit made on 2023-10-23
Get this branch:
git clone -b bb-10.6-MDEV-31983-v3 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.6-MDEV-31983-v3
Repository:
lp:maria

Recent commits

321da8c... by Sergey Petrunia

MDEV-31983, more fixes.

Fix formatting

Add error handling:
- JOIN::make_range_rowid_filters() should return error immediately if
  it fails to build a filter.
- test_if_skip_sort_order() now will return an error if it gets an error
  from test_quick_select() call.
   = All callers check for this condition, too.

- "Range checked for each record" code now checks for test_quick_select
  errors, too.

33a4419... by Rex Johnston

MDEV-31983 jointable materialization subquery optimization ignoring

...errors, then failing ASSERT.

In optimizing a subselect, transforming it to a join, then attempting to
materialize that join, errors in evaluation of join conditions, flagged in
the thread are ignored for suffiently long to cause problems.

When executing an update SQL command, thd->abort_on_warning can cause
thd->error() to be set during evaluation in get_mm_tree() of attached
conditions. This need to be caught ASAP in test_quick_select(), the
caller of get_mm_tree() and returned as an error condition.

We change the return type of SQL_SELECT::test_quick_select() to allow
unambiguous detection of an error by the caller.

4941ac9... by Sergey Petrunia

MDEV-32113: utf8mb3_key_col=utf8mb4_value cannot be used for ref

(Variant#3: Allow cross-charset comparisons, use a special
CHARSET_INFO to create lookup keys. Review input addressed.)

Equalities that compare utf8mb{3,4}_general_ci strings, like:

  WHERE ... utf8mb3_key_col=utf8mb4_value (MB3-4-CMP)

can now be used to construct ref[const] access and also participate
in multiple-equalities.
This means that utf8mb3_key_col can be used for key-lookups when
compared with an utf8mb4 constant, field or expression using '=' or
'<=>' comparison operators.

This is controlled by optimizer_switch='cset_narrowing=on', which is
OFF by default.

IMPLEMENTATION
Item value comparison in (MB3-4-CMP) is done using utf8mb4_general_ci.
This is valid as any utf8mb3 value is also an utf8mb4 value.

When making index lookup value for utf8mb3_key_col, we do "Charset
Narrowing": characters that are in the Basic Multilingual Plane (=BMP) are
copied as-is, as they can be represented in utf8mb3. Characters that are
outside the BMP cannot be represented in utf8mb3 and are replaced
with U+FFFD, the "Replacement Character".

In utf8mb4_general_ci, the Replacement Character compares as equal to any
character that's not in BMP. Because of this, the constructed lookup value
will find all index records that would be considered equal by the original
condition (MB3-4-CMP).

Approved-by: Monty <email address hidden>

6a674c3... by Monty <email address hidden>

MDEV-32476 LeakSanitizer errors in get_quick_select or Assertion ...

Problem was that JOIN_TAB::cleanup() was not run because
JOIN::top_join_tab_count was not set in case of early errors.

Fixed by setting JOIN::tab_join_tab_count when JOIN_TAB's are allocated.

Something that should eventually be fixed:
- Cleaning up JOIN_TAB's is now done in 3 different loops.
  JOIN_TAB::cleanup() is only doing a partial cleanup. Other cleanups
  are done outside of JOIN_TAB::cleanup().

The above should be fixed so that JOIN_TAB::cleanup() is freeing
everything related to it's own memory, including all its sub JOIN_ TAB's.
JOIN::cleanup() should only loop over all it's top JOIN_TAB's and call
JOIN_TAB::cleanup() on these.
This will greatly simplify and speedup the current code (as we now do some
cleanup's twice).

a1b6bef... by Monty <email address hidden>

Fixed crash in is_stat_table() when using hash joins.

Other usage if persistent statistics is checking 'stats_is_read' in
caller, which is why this was not noticed earlier.

Other things:
- Simplified no_stat_values_provided

6991b1c... by Marko Mäkelä

Merge 10.5 into 10.6

85751ed... by THIRUNARAYANAN BALATHANDAYUTHAPANI

MDEV-31851 After crash recovery, undo tablespace fails to open

srv_all_undo_tablespaces_open(): While opening the extra unused
undo tablespaces, InnoDB should use ULINT_UNDEFINED instead of
SRV_SPACE_ID_UPPER_BOUND.

dbba1bb... by THIRUNARAYANAN BALATHANDAYUTHAPANI

MDEV-31851 After crash recovery, undo tablespace fails to open

recv_recovery_from_checkpoint_start(): InnoDB should add the
redo log block header + trailer size while checking the log
sequence number in log file with log sequence number in the
system tablespace first page.

2d6dc65... by Marko Mäkelä

MDEV-32144 fixup

In commit 384eb570a654261639dc1fc73c347f0d3759f567 the debug check
was relaxed in trx_undo_header_create(), not in the intended function
trx_undo_write_xid().

cfd1788... by Marko Mäkelä

MDEV-32511: Race condition between checkpoint and page write

fil_aio_callback(): Invoke fil_node_t::complete_write() before
releasing any page latch, so that in case a log checkpoint is
executed roughly concurrently with the first write into a file
since the previous checkpoint, we will not miss a fdatasync()
or fsync() call to make the write durable.