maria:bb-10.2-MDEV-27025-MDEV-20605

Last commit made on 2022-02-17
Get this branch:
git clone -b bb-10.2-MDEV-27025-MDEV-20605 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.2-MDEV-27025-MDEV-20605
Repository:
lp:maria

Recent commits

06951f0... by Vlad Lesin

MDEV-20605 Awaken transaction can miss inserted by other transaction records due to wrong persistent cursor restoration

Backported from 10.5 20e9e804c131c6522bc7c469e4863e8d1eaa3ee0 and
5948d7602ec7f61937c368dcb134e6ec226a2990.

sel_restore_position_for_mysql() moves forward persistent cursor
position after btr_pcur_restore_position() call if cursor relative position
is BTR_PCUR_ON and the cursor points to the record with NOT the same field
values as in a stored record(and some other not important for this case
conditions).

It was done because btr_pcur_restore_position() sets
page_cur_mode_t mode to PAGE_CUR_LE for cursor->rel_pos == BTR_PCUR_ON
before opening cursor. So we are searching for the record less or equal
to stored one. And if the found record is not equal to stored one, then
it is less and we need to move cursor forward.

But there can be a situation when the stored record was purged, but the
new one with the same key but different value was inserted while
row_search_mvcc() was suspended. In this case, when the thread is
awaken, it will invoke sel_restore_position_for_mysql(), which, in turns,
invoke btr_pcur_restore_position(), which will return false because found
record don't match stored record, and
sel_restore_position_for_mysql() will move forward cursor position.

The above can lead to the case when awaken row_search_mvcc() do not see
records inserted by other transactions while it slept. The mtr test case
shows the example how it can be.

The fix is to return special value from persistent cursor restoring
function which would notify its caller that uniq fields of restored
record and stored record are the same, and in this case
sel_restore_position_for_mysql() don't move cursor forward.

Delete-marked records are correctly processed in row_search_mvcc().
Non-unique secondary indexes are "uniquified" by adding the PK, the
index->n_uniq should then be index->n_fields. So there is no need in
additional checks in the fix.

If transaction's readview can't see the changes made in secondary index
record, it requests clustered index record in row_search_mvcc() to check
its transaction id and get the correspondent record version. After this
row_search_mvcc() commits mtr to preserve clustered index latching
order, and starts mtr. Between those mtr commit and start secondary
index pages are unlatched, and purge has the ability to remove stored in
the cursor record, what causes rows duplication in result set for
non-locking reads, as cursor position is restored to the previously
visited record.

To solve this the changes are just switched off for non-locking reads,
it's quite simple solution, besides the changes don't make sense for
non-locking reads.

The more complex and effective from performance perspective solution is
to create mtr savepoint before clustered record requesting and rolling
back to that savepoint after that. See MDEV-27557.

One more solution is to have per-record transaction id for secondary
indexes. See MDEV-17598.

If any of those is implemented, just remove select_lock_type argument in
sel_restore_position_for_mysql().

78a8c37... by Marko Mäkelä

MDEV-27550: Disable galera.MW-328D

(cherry picked from commit 66465914c1a22ae30f96a57aca7e8635a2506f8d)

e5bce5c... by Vlad Lesin

MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock

Remove some tests from main.xa because the queries in the tests don't
cause deadlocks anymore. It's reasonable as this branch is only for
custom build. Fix the tests if the branch is merged to trunk.

1c9e772... by Vlad Lesin

MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock

The code was backported from 10.5 be8113861c2d12bb0f7048523f886cab53326d8e
commit. See that commit message for details.

Some tests in main.xa fail because the queries don't cause deadlock
anymore. As this backport is only for custom build, the tests will be
removed in the further commit. If we are going to commit it in trunk,
the tests must be fixed.

73c391a... by Marko Mäkelä

MDEV-27583 InnoDB uses different constants for FK cascade error message in SQL vs error log

convert_error_code_to_mysql(): Use the correct limit FK_MAX_CASCADE_DEL
in the error message. The DICT_FK_MAX_RECURSIVE_LOAD applies to
the number of foreign key constraints in table definitions,
not to the number of rows that are visited while processing
a foreign key constraint.

da64e50... by Marko Mäkelä

MDEV-27722 innodb_fts.innodb-fts-ddl fails with a wrong message on FreeBSD

On FreeBSD, the error message would say "Resource deadlock avoided".
Let us simply replace the error message string in the test.

9f429a2... by Jonathan Sabbe <email address hidden>

fix: Fix 'unknown type usermodehelper_t' issue after upgrading to MariaDB 10.4.24

e195685... by Larysa Sherepa

MDEV-27548 session_tracker_last_gtid.test fails with --repeat, added cleanup after the test

cf574cf... by Marko Mäkelä

MDEV-27634 innodb_zip tests failing on s390x

Some GNU/Linux distributions ship a zlib that is modified to use
the s390x DFLTCC instruction. That modification would essentially
redefine compressBound(sourceLen) as (sourceLen * 16 + 2308) / 8 + 6.

Let us relax the tests for InnoDB ROW_FORMAT=COMPRESSED to cope with
such a weaker compression guarantee.

create_table_info_t::row_size_is_acceptable(): Remove a bogus debug-only
assertion that would fail to hold for the test innodb_zip.bug36169.
The function page_zip_empty_size() may indeed return 0.

cdf19cd... by Brandon Nesterenko

MDEV-16091: Seconds_Behind_Master spikes to millions of seconds

The rpl.rpl_seconds_behind_master_spike test would sometimes
timeout or take a very long time to complete. This happened
because an MTR DEBUG_SYNC signal would be lost due to a
subsequent call to RESET. I.e., the slave SQL thread would
be paused due to the WAIT_FOR signal being lost, resulting in
either a failed test if the `select master_pos_wait` timeout
occurs first, or a very long run-time if the DBUG_SYNC timeout
occurs first.

The fix ensures that the MTR signal is processed by the slave
SQL thread before issuing the call to RESET

Reviewed By:
============
Andrei Elkin <email address hidden>