1. 20 Oct, 2020 4 commits
    • Marko Mäkelä's avatar
      MDEV-23996 Race conditions in SHOW ENGINE INNODB MUTEX · 832a6acb
      Marko Mäkelä authored
      The function innodb_show_mutex_status() is the only ultimate caller of
      LatchCounter::iterate() via MutexMonitor::iterate(). Because the call
      is not protected by LatchCounter::m_mutex, any mutex_create() or
      mutex_free() that is invoked concurrently during the execution, bad
      things such as a crash could happen.
      
      The most likely way for this to happen is buffer pool resizing,
      which could cause buf_block_t::mutex (which existed before MDEV-15053)
      to be created or freed. We could also register InnoDB mutexes in
      TrxFactory::init() if trx_pools needs to grow.
      
      The view INFORMATION_SCHEMA.INNODB_MUTEXES is not affected, because it
      only displays information about rw-locks, not mutexes.
      
      This commit intentionally touches also MutexMonitor::iterate()
      and the only code that interfaces with LatchCounter::iterate()
      to make it clearer for future readers that the scattered code
      that is obfuscated by templates belongs together.
      
      This is based on
      mysql/mysql-server@273a93396f49c7e0a8b07b260128d9a990c2b154
      832a6acb
    • Anel Husakovic's avatar
      Update mtr help · d1af93a5
      Anel Husakovic authored
      - Based on patch: d6a983351c5a454bd0cb113852f
      - Update combination example for 10.2 (commit 2a3fe45d added change
      for 10.3+)
      ```
      ==============================================================================
      
      TEST                                      RESULT   TIME (ms) or COMMENT
      --------------------------------------------------------------------------
      
      worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
      rpl.rpl_invoked_features 'innodb,mix'    [ pass ]   1677
      rpl.rpl_invoked_features 'innodb,row'    [ pass ]   3516
      rpl.rpl_invoked_features 'innodb,stmt'   [ pass ]   1609
      --------------------------------------------------------------------------
      ```
      - `gdb` option will be added during the merge
      d1af93a5
    • Julius Goryavsky's avatar
      MDEV-21951: mariabackup SST fail if data-directory have lost+found directory · 888010d9
      Julius Goryavsky authored
      To fix this, it is necessary to add an option to exclude the
      database with the name "lost+found" from processing (the database
      name will be checked by the check_if_skip_database_by_path() or
      by the check_if_skip_database() function, and as a result
      "lost+found" will be skipped).
      
      In addition, it is necessary to slightly modify the verification
      logic in the check_if_skip_database() function.
      
      Also added a new test galera_sst_mariabackup_lost_found.test
      888010d9
    • Oleksandr Byelkin's avatar
      MDEV-23327: followup · 692a44b3
      Oleksandr Byelkin authored
      fix an error with locked taböes
      692a44b3
  2. 19 Oct, 2020 4 commits
  3. 17 Oct, 2020 2 commits
    • Anel Husakovic's avatar
      MDEV-16676 Using malloc-lib=jemalloc in MariaDB 10.2 causes non-critical error... · 95bb3cb8
      Anel Husakovic authored
      MDEV-16676 Using malloc-lib=jemalloc in MariaDB 10.2 causes non-critical error about missing mysql_config on startup
      
      - This commit is based on patch 84fe9720a4d2483ff67b6a and suggestion of
      Jean Weisbuch to use `ldconfig -p`
      - Format of ldconfig output:
      "libjemalloc.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libjemalloc.so.1"
      
      ```
      $ ./scripts/mysqld_safe
      201013 13:36:50 mysqld_safe Adding '/usr/lib/x86_64-linux-gnu/libjemalloc.so.1' to LD_PRELOAD for mysqld
      201013 13:36:50 mysqld_safe Logging to '/home/anel/builds/data-10.5/mysqld_safe_anel.err'.
      201013 13:36:50 mysqld_safe Starting mysqld daemon with databases from /home/anel/builds/data-10.5
      ```
      Reviewed by: Daniel Black, Faustin Lammler
      95bb3cb8
    • Marko Mäkelä's avatar
      Clean up some encryption tests · db02c458
      Marko Mäkelä authored
      Instead of pointlessly waiting for a page flush to occur, take
      the matter into our own hands and request an explicit flush.
      Also, test with the minimum necessary amount of data (0 or 1 rows)
      so that both page encryption and decryption will be exercised.
      db02c458
  4. 15 Oct, 2020 4 commits
    • Julius Goryavsky's avatar
      MDEV-23659: Update Galera disabled.def file · ebb39bc5
      Julius Goryavsky authored
      This fix removes from the list of disabled tests all
      tests that were fixed by the patch for MDEV-21770.
      ebb39bc5
    • Julius Goryavsky's avatar
      MDEV-21770: `galera_3nodes.galera_ipv6_mariabackup` fails · 31201dcb
      Julius Goryavsky authored
      This patch fixes several flaws in the SST scripts that cause
      failures while running tests that use version 6 IP addresses
      for cluster nodes.
      
      First, if the netcat utility is used for streaming (but not socat),
      then in accordance with its command line syntax, we need to remove
      the square brackets around the IPv6 address. However, for socat,
      the address must contain square brackets, as before.
      
      Secondly, if an IPv6 address is used, then from the joiner side for
      a number of systems (such as Debian) we need to explicitly specify
      the "-6" option, otherwise a listening socket with an IPv6 address
      may not be created.
      
      This patch also contains code improvements in the wsrep_sst_common.
      Changed the code that pars the connection address - fixed the
      shortcomings that sometimes led to incorrect parsing of parameters
      when using shells other than the latest versions of bash.
      
      Also, this patch removes the duplicate code that is intended
      for parsing the connection address and which was located in the
      wsrep_sst_mariabackup file, since all the necessary actions have
      already been done in wsrep_sst_common and there they are done in
      such a way that any shell is supported, not just bash.
      
      The fix does not require separate tests, since all the
      necessary tests are already present in the galera_3nodes suite.
      On the contrary, after this fix, tests using IPv6 addresses can
      be removed from the disabled list (this will be done in a separate
      commit related to MDEV-23659).
      31201dcb
    • Oleksandr Byelkin's avatar
      Fix the constants names · 24c5af67
      Oleksandr Byelkin authored
      24c5af67
    • Daniel Black's avatar
      MDEV-23201: mysql_upgrade order mysql.user for 5.7 cross-upgrade · ff8ffef3
      Daniel Black authored
      As MariaDB tables are expected in a fixed order, the cross upgrade
      previously placed roles, default_role and max_statement_time after
      now unused mysql-5.7 columns.
      
      Test:
      
      $ cp -a /usr/local/mysql-5.7.31/data/ /tmp/m57data
      $ sql/mysqld --no-defaults --skip-networking --datadir=/tmp/m57data  --socket=/tmp/${PWD##*/}.sock   --verbose --lc-messages-dir=$PWD/sql/share
      2020-10-02 11:02:05 140135193212864 [Note] sql/mysqld (mysqld 10.2.34-MariaDB) starting as process 1457667 ...
      2020-10-02 11:02:05 140135193212864 [Note] InnoDB: Mutexes and rw_locks use GCC atomic built
      
      $ client/mysql_upgrade --no-defaults -u root -pbob  -S /tmp/build-mariadb-server-10.2.sock
      MySQL upgrade detected
      Phase 1/7: Checking and upgrading mysql database
      Processing databases
      mysql
      mysql.columns_priv                                 OK
      mysql.db                                           OK
      mysql.engine_cost                                  OK
      mysql.event                                        OK
      mysql.func                                         OK
      mysql.gtid_executed                                OK
      mysql.help_category                                OK
      mysql.help_keyword                                 OK
      mysql.help_relation                                OK
      mysql.help_topic                                   OK
      mysql.innodb_index_stats                           OK
      mysql.innodb_table_stats                           OK
      mysql.ndb_binlog_index                             OK
      mysql.plugin                                       OK
      mysql.proc                                         OK
      mysql.procs_priv                                   OK
      mysql.proxies_priv                                 OK
      mysql.server_cost                                  OK
      mysql.servers                                      OK
      mysql.slave_master_info                            OK
      mysql.slave_relay_log_info                         OK
      mysql.slave_worker_info                            OK
      mysql.tables_priv                                  OK
      mysql.time_zone                                    OK
      mysql.time_zone_leap_second                        OK
      mysql.time_zone_name                               OK
      mysql.time_zone_transition                         OK
      mysql.time_zone_transition_type                    OK
      mysql.user                                         OK
      Upgrading from a version before MariaDB-10.1
      Phase 2/7: Installing used storage engines
      
      Result:
      
      | user  | CREATE TABLE `user` (
        `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
        `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
        `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
        `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
        `ssl_cipher` blob NOT NULL,
        `x509_issuer` blob NOT NULL,
        `x509_subject` blob NOT NULL,
        `max_questions` int(11) unsigned NOT NULL DEFAULT 0,
        `max_updates` int(11) unsigned NOT NULL DEFAULT 0,
        `max_connections` int(11) unsigned NOT NULL DEFAULT 0,
        `max_user_connections` int(11) NOT NULL DEFAULT 0,
        `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '',
        `authentication_string` text COLLATE utf8_bin NOT NULL,
        `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
        `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
        `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000,
        `password_last_changed` timestamp NULL DEFAULT NULL,
        `password_lifetime` smallint(5) unsigned DEFAULT NULL,
        `account_locked` enum('N','Y') COLLATE utf8_bin NOT NULL DEFAULT 'N',
        PRIMARY KEY (`Host`,`User`)
      ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' |
      
      MariaDB [(none)]>  CREATE ROLE `aRole`;
      Query OK, 0 rows affected (0.00 sec)
      
      MariaDB [(none)]> SET ROLE `aRole`;
      Query OK, 0 rows affected (0.00 sec)
      
      MariaDB [(none)]> FLUSH PRIVILEGES;
      Query OK, 0 rows affected (0.00 sec)
      
      MariaDB [(none)]> SET ROLE `aRole`;
      Query OK, 0 rows affected (0.00 sec)
      
      MariaDB [(none)]> SELECT `User`, `is_role` FROM `mysql`.`user`;
      +---------------+---------+
      | User          | is_role |
      +---------------+---------+
      | root          | N       |
      | mysql.session | N       |
      | mysql.sys     | N       |
      | dan           | N       |
      | aRole         | Y       |
      +---------------+---------+
      5 rows in set (0.00 sec)
      
      Reviewer: Anel Husakovic
      ff8ffef3
  5. 14 Oct, 2020 4 commits
  6. 10 Oct, 2020 4 commits
  7. 08 Oct, 2020 1 commit
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-21329 InnoDB: Failing assertion:... · 8984d779
      Thirunarayanan Balathandayuthapani authored
      MDEV-21329 InnoDB: Failing assertion: lock->lock_word.load(std::memory_order_relaxed) == X_LOCK_DECR upon server shutdown
      
      Problem is that dropping of fts table and sync of fts table
      happens concurrently during fts optimize thread shutdown.
      fts_optimize_remove_table() is executed by a user thread that
      performs DDL, and that the fts_optimize_wq may be removed if
      fts_optimize_shutdown() has started executing.
      
      fts_optimize_remove_table() doesn't remove the table from the queue
      and it leads to above scenario. While removing the table from
      fts_optimize_wq, if the table can't be removed then wait till
      fts_optimize_thread shuts down.
      
      Reviewed-by: Marko Mäkelä
      8984d779
  8. 07 Oct, 2020 2 commits
  9. 06 Oct, 2020 8 commits
    • Igor Babaev's avatar
      MDEV-23811: With large number of indexes optimizer chooses an inefficient plan · 291be494
      Igor Babaev authored
      This bug could manifest itself for a query with WHERE condition containing
      top level OR formula such that each conjunct contained a single-range
      condition supported by the same index. One of these range conditions must
      be fully covered by another range condition that is used later in the OR
      formula. Additionally at least one of these condition should be ANDed with
      a sargable range condition supported by a different index.
      
      There were several attempts to fix related problems for OR conditions after
      the backport of range optimizer code from MySQL (commit
      0e19f3e3). Unfortunately the first of these
      fixes contained typo remained unnoticed until recently. This typo bug led
      to rejection of valid range accesses. This patch fixed this typo bug.
      The fix revealed another two bugs: one in a constructor for SEL_ARG,
      the other in the function tree_or(). Both are fixed in this patch.
      291be494
    • Marko Mäkelä's avatar
      MDEV-23897 SIGSEGV on commit with innodb_lock_schedule_algorithm=VATS · 15951892
      Marko Mäkelä authored
      This regression for debug builds was introduced by
      MDEV-23101 (commit 224c9504).
      
      Due to MDEV-16664, the parameter
      innodb_lock_schedule_algorithm=VATS
      is not enabled by default.
      
      The purpose of the added assertions was to enforce the invariant that
      Galera replication cannot be enabled together with VATS due to MDEV-12837.
      However, upon closer inspection, it is obvious that the variable 'lock'
      may be assigned to the null pointer if no match is found in the
      previous->hash list.
      
      lock_grant_and_move_on_page(), lock_grant_and_move_on_rec():
      Assert !lock->trx->is_wsrep() only after ensuring that lock
      is not a null pointer.
      15951892
    • Aleksey Midenkov's avatar
      MDEV-23787 mtr --rr fixes · 2b832151
      Aleksey Midenkov authored
      1. rr record -h randomizes number of processors. Disable THREAD_POOL_SIZE check.
      
      2. check for kernel.perf_event_paranoid for user-friendly error message.
      2b832151
    • Oleksandr Byelkin's avatar
      MDEV-18163 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type !=... · 5933081d
      Oleksandr Byelkin authored
      MDEV-18163 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type != 2' failed in handler::ha_rnd_next(); / Assertion `table_list->table' failed in find_field_in_table_ref / ERROR 1901 (on optimized builds)
      
      Add the same check for altering DEFAULT used as for CREATE TABLE.
      5933081d
    • Daniel Black's avatar
      travis: 10.2 only - make faster · b3a9fbdb
      Daniel Black authored
      Remove from debian build:
      * tokudb
      * mroonga
      * spider
      * ograph
      * embedded server
      
      Add ccache to debian build.
      
      Backport 10.3 changes to autobake-deb
      that make travis faster.
      
      Merge instructions:
      Drop this commit on merge to 10.3
      b3a9fbdb
    • Eugene Kosov's avatar
      MDEV-23894 UBSAN: several call to function show_binlog_vars(THD*,... · 350c9eb7
      Eugene Kosov authored
      MDEV-23894 UBSAN: several call to function show_binlog_vars(THD*, st_mysql_show_var*, char*) through pointer to incorrect function type 'int (*)(THD *, st_mysql_show_var *, void *, system_status_var *, enum_var_type) errors
      350c9eb7
    • Jan Lindström's avatar
      MDEV-18593 : galera.galera_gcache_recover_full_gcache: Test failure:... · 33f19876
      Jan Lindström authored
      MDEV-18593 : galera.galera_gcache_recover_full_gcache: Test failure: galera_gcache_recover_full_gcache.test: assert_grep.inc failed
      
      Grep only the fact that we need to fall back to SST.
      33f19876
    • Marko Mäkelä's avatar
      MDEV-23888: Potential server hang on replication with InnoDB · 577c61e8
      Marko Mäkelä authored
      In MDEV-21452, SAFE_MUTEX flagged an ordering problem that involved
      trx_t::mutex, LOCK_global_system_variables, and LOCK_commit_ordered
      when running
      ./mtr --no-reorder\
       binlog.binlog_checksum,mix binlog.binlog_commit_wait,mix
      
      Because LOCK_commit_ordered is acquired by replication code before
      innobase_commit_ordered() is invoked, and because LOCK_commit_ordered
      should be below LOCK_global_system_variables in the global latching
      order, it turns out that we must avoid acquiring
      LOCK_global_system_variables in any low-level code.
      
      It also turns out that lock_rec_lock() acquires lock_sys_t::mutex
      and then carries on to call lock_rec_enqueue_waiting(), which may
      invoke THDVAR() via thd_lock_wait_timeout(). This call is problematic
      if THDVAR() had never been invoked in that thread earlier.
      
      innobase_trx_init(): Let us invoke THDVAR() at the start of an InnoDB
      transaction so that future invocations of THDVAR() will avoid
      LOCK_global_system_variables acquisition on the same THD. Because
      the first call to intern_sys_var_ptr() will initialize all session
      variables by not passing the offset to sync_dynamic_session_variables(),
      this will indeed make any future THDVAR() invocation mutex-free.
      
      There are some THDVAR() calls in other code (related to indexed virtual
      columns, fulltext indexes, and DDL operations). No SAFE_MUTEX warning
      was known for those, but there does not appear to be any replication
      test coverage for indexed virtual columns or fulltext indexes. DDL should
      be covered, and perhaps DDL code paths were already invoking THDVAR()
      while not holding any InnoDB mutex.
      
      Side note: MySQL should avoid this type of deadlocks since
      mysql/mysql-server@4d275c89954685e2ed1b368812b3b5a29ddf9389.
      MariaDB never defined alloc_and_copy_thd_dynamic_variables(),
      because we prefer to avoid overhead during connection creation.
      
      An important part of the deadlock could be the current handling of
      SET GLOBAL binlog_checksum=NONE; and similar assignments.
      In binlog_checksum_update(), we would hold LOCK_global_system_variables
      while potentially acquiring LOCK_commit_ordered in MYSQL_BIN_LOG::open().
      Even if that code was changed later to release
      LOCK_global_system_variables during the write to mysql_bin_log,
      it could be a good idea for performance to avoid invoking the
      expensive code path of THDVAR() while holding any InnoDB mutexes,
      such as lock_sys.mutex in lock_rec_enqueue_waiting().
      
      Thanks to Andrei Elkin for debugging the SAFE_MUTEX issue, and to
      Sergei Golubchik for the suggestion to invoke THDVAR() early.
      577c61e8
  10. 05 Oct, 2020 7 commits