maria:bb-10.6-MDEV-29293-galera

Last commit made on 2023-05-19
Get this branch:
git clone -b bb-10.6-MDEV-29293-galera https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.6-MDEV-29293-galera
Repository:
lp:maria

Recent commits

2ee2515... by Teemu Ollakka <email address hidden>

MDEV-29293 MariaDB stuck on starting commit state

This commit contains a merge from 10.5-MDEV-29293-squash
into 10.6.

Although the bug MDEV-29293 was not reproducible with 10.6,
the fix contains several improvements for wsrep KILL query and
BF abort handling, and addresses the following issues:

* MDEV-30307 KILL command issued inside a transaction is
  problematic for galera replication:
  This commit will remove KILL TOI replication, so Galera side
  transaction context is not lost during KILL.
* MDEV-21075 KILL QUERY maintains nodes data consistency but
  breaks GTID sequence: This is fixed as well as KILL does not
  use TOI, and thus does not change GTID state.
* MDEV-30372 Assertion in wsrep-lib state: This was caused by
  BF abort or KILL when local transaction was in the middle
  of group commit. This commit disables THD::killed handling
  during commit, so the problem is avoided.
* MDEV-30963 Assertion failure !lock.was_chosen_as_deadlock_victim
  in trx0trx.h:1065: The assertion happened when the victim was
  BF aborted via MDL while it was committing. This commit changes
  MDL BF aborts so that transactions which are committing cannot
  be BF aborted via MDL. The RQG grammar attached in the issue
  could not reproduce the crash anymore.

Original commit message from 10.5 fix:

    MDEV-29293 MariaDB stuck on starting commit state

    The problem seems to be a deadlock between KILL command execution
    and BF abort issued by an applier, where:
    * KILL has locked victim's LOCK_thd_kill and LOCK_thd_data.
    * Applier has innodb side global lock mutex and victim trx mutex.
    * KILL is calling innobase_kill_query, and is blocked by innodb
      global lock mutex.
    * Applier is in wsrep_innobase_kill_one_trx and is blocked by
      victim's LOCK_thd_kill.

    The fix in this commit removes the TOI replication of KILL command
    and makes KILL execution less intrusive operation. Aborting the
    victim happens now by using awake_no_mutex() and ha_abort_transaction().
    If the KILL happens when the transaction is committing, the
    KILL operation is postponed to happen after the statement
    has completed in order to avoid KILL to interrupt commit
    processing.

    Notable changes in this commit:
    * wsrep client connections's error state may remain sticky after
      client connection is closed. This error message will then pop
      up for the next client session issuing first SQL statement.
      This problem raised with test galera.galera_bf_kill.
      The fix is to reset wsrep client error state, before a THD is
      reused for next connetion.
    * Release THD locks in wsrep_abort_transaction when locking
      innodb mutexes. This guarantees same locking order as with applier
      BF aborting.
    * BF abort from MDL was changed to do BF abort on server/wsrep-lib
      side first, and only then do the BF abort on InnoDB side. This
      removes the need to call back from InnoDB for BF aborts which originate
      from MDL and simplifies the locking.
    * Removed wsrep_thd_set_wsrep_aborter() from service_wsrep.h.
      The manipulation of the wsrep_aborter can be done solely on
      server side. Moreover, it is now debug only variable and
      could be excluded from optimized builds.
    * Remove LOCK_thd_kill from wsrep_thd_LOCK/UNLOCK to allow more
      fine grained locking for SR BF abort which may require locking
      of victim LOCK_thd_kill. Added explicit call for
      wsrep_thd_kill_LOCK/UNLOCK where appropriate.
    * Wsrep-lib was updated to version which allows external
      locking for BF abort calls.

    Changes to MTR tests:
    * Disable galera_bf_abort_group_commit. This test is going to
      be removed (MDEV-30855).
    * Make galera_var_retry_autocommit result more readable by echoing
      cases and expectations into result. Only one expected result for
      reap to verify that server returns expected status for query.
    * Record galera_gcache_recover_manytrx as result file was incomplete.
      Trivial change.
    * Make galera_create_table_as_select more deterministic:
      Wait until CTAS execution has reached MDL wait for multi-master
      conflict case. Expected error from multi-master conflict is
      ER_QUERY_INTERRUPTED. This is because CTAS does not yet have open
      wsrep transaction when it is waiting for MDL, query gets interrupted
      instead of BF aborted. This should be addressed in separate task.
    * A new test galera_bf_abort_registering to check that registering trx gets
      BF aborted through MDL.
    * A new test galera_kill_group_commit to verify correct behavior
      when KILL is executed while the transaction is committing.

    Co-authored-by: Seppo Jaakola <email address hidden>
    Co-authored-by: Jan Lindström <email address hidden>

Signed-off-by: Julius Goryavsky <email address hidden>

a3e5b5c... by Marko Mäkelä

Merge 10.5 into 10.6

f522b0f... by Tuukka Pasanen <email address hidden>

MDEV-30951: Fix small perlcritic and enable modern Perl

Add Modern Perl headers. Perl 5.16 is still fairly
old from 2012.

Enable UTF-8, warnings and make script 'strict'

Small fixes for perlcritic reported problems and some crashes

I/O layer ":utf8" used at line 268, column 16. Use ":encoding(UTF-8)" to get strict validation. (Severity: 5)
"return" statement with explicit "undef" at line 806, column 4. See page 199 of PBP. (Severity: 5)
"return" statement with explicit "undef" at line 6844, column 4. See page 199 of PBP. (Severity: 5)
"return" statement with explicit "undef" at line 7524, column 4. See page 199 of PBP. (Severity: 5)
"return" statement with explicit "undef" at line 7527, column 4. See page 199 of PBP. (Severity: 5)
"return" statement with explicit "undef" at line 7599, column 4. See page 199 of PBP. (Severity: 5)
"return" statement with explicit "undef" at line 7602, column 4. See page 199 of PBP. (Severity: 5)
Expression form of "eval" at line 7784, column 4. See page 161 of PBP. (Severity: 5)
Expression form of "eval" at line 7806, column 4. See page 161 of PBP. (Severity: 5)
Glob written as <...> at line 8016, column 25. See page 167 of PBP. (Severity: 5)
"return" statement followed by "sort" at line 9195, column 60. Behavior is undefined if called in scalar context. (Severity: 5)
Expression form of "eval" at line 9846, column 10. See page 161 of PBP. (Severity: 5)

c9eff1a... by Marko Mäkelä

MDEV-31254 InnoDB: Trying to read doublewrite buffer page

buf_read_page_low(): Remove an error message and a debug assertion
that can be triggered when using innodb_page_size=4k and
innodb_file_per_table=0. In that case, buf_read_ahead_linear()
may be invoked on page 255, which is one less than the first
page of the doublewrite buffer (256).

477285c... by Marko Mäkelä

MDEV-31253 Freed data pages are not always being scrubbed

fil_space_t::flush_freed(): Renamed from buf_flush_freed_pages();
this is a backport of aa45850687409ba857eb3a0eb19e7ccc28dc02f7 from 10.6.
Invoke log_write_up_to() on last_freed_lsn, instead of avoiding
the operation when the log has not yet been written.
A more costly alternative would be that log_checkpoint() would invoke
this function on every affected tablespace.

c271057... by Marko Mäkelä

Merge 10.5 into 10.6

279d012... by Marko Mäkelä

MDEV-29967 innodb_read_ahead_threshold (linear read-ahead) does not work

buf_read_ahead_linear(): Correct some calculations that were broken
in commit b1ab211dee599eabd9a5b886fafa3adea29ae041 (MDEV-15053).

Thanks to Daniel Black for providing a test case and initial debugging.

Tested by: Matthias Leich

d4dd634... by Marko Mäkelä

Merge mariadb-10.5.20 into 10.5

7124911... by Marko Mäkelä

MDEV-31158: Potential hang with ROW_FORMAT=COMPRESSED tables

btr_cur_need_opposite_intention(): Check also page_zip_available()
so that we will escalate to exclusive index latch when a non-leaf
page may have to be split further due to ROW_FORMAT=COMPRESSED page
overflow.

Tested by: Matthias Leich

38ed782... by Marko Mäkelä

MDEV-30812 fixup: GCC 12.2.0 -Wmaybe-uninitialized

best_access_path(): Simplify the logic for computing fanout.
This fixes up commit 4329ec5d3b109cb0bcbee151b5800dc7b19d1945