1. 25 Oct, 2018 2 commits
    • Marko Mäkelä's avatar
      MDEV-17545 Predicate lock for SPATIAL INDEX should lock non-matching record · 7e9728a9
      Marko Mäkelä authored
      rtr_pcur_getnext_from_path(): Remove a bogus condition.
      The predicate lock should be acquired also on no match,
      to ensure that the locking read will be repeatable.
      
      This is based on the following fix in MySQL 5.7.24:
      
      commit 365111c590082984dbae42e1d1da28ac3f7fb5bd
      Author: Jimmy Yang <jimmy.yang@oracle.com>
      Date:   Wed Jun 6 16:23:00 2018 -0700
      
          Fix Bug 27577612 - CONCURRENT SERIALIZABLE TRANSACTIONS CAN INSERT INTO
          AN AREA SELECTED FOR UPDATE
          Backport fix to mysql-5.7
      Reviewed-by: default avatarAllen Lai <allen.lai@oracle.com>
      
      No test case is added, because the MySQL 5.7 test case would pass
      even when the fix is not present. We would need a test case that
      only causes a locking conflict on the spatial index.
      7e9728a9
    • Marko Mäkelä's avatar
      MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check causes hang · a21e01a5
      Marko Mäkelä authored
      row_ins_check_foreign_constraint(): Do not overwrite hard errors
      with the soft error DB_LOCK_WAIT. This prevents an infinite
      wait loop when DB_INTERRUPTED was returned. For DB_LOCK_WAIT,
      row_insert_for_mysql() would keep invoking row_ins_step() and the
      transaction would remain active until the server shutdown is initiated.
      a21e01a5
  2. 19 Oct, 2018 2 commits
    • Marko Mäkelä's avatar
      MDEV-17466: Remove the debug assertion · ab1ce220
      Marko Mäkelä authored
      This reverts commit 2d4075e1
      where the debug assertion was added. There seems to be a potential
      problem in the purge of indexes that depend on virtual columns.
      
      Ultimately, we should change the InnoDB undo log format so that
      all actual secondary index keys are stored there, also for
      virtual or spatial indexes. In that way, purge and rollback would
      be more straightforward.
      ab1ce220
    • Marko Mäkelä's avatar
      Remove unused TIMETPF · abbf169f
      Marko Mäkelä authored
      abbf169f
  3. 18 Oct, 2018 2 commits
  4. 17 Oct, 2018 2 commits
    • Marko Mäkelä's avatar
      MDEV-13564: Set innodb_safe_truncate=ON by default · 853a0a43
      Marko Mäkelä authored
      The setting innodb_safe_truncate=ON reduces compatibility with older
      versions of MariaDB and backup tools in two ways.
      
      First, we will be writing TRX_UNDO_RENAME_TABLE records, which older
      versions do not know about. These records could be misinterpreted if
      a DDL transaction was recovered and would be rolled back.
      Such rollback is only possible if the server was killed while
      an incomplete DDL transaction was persisted. On transaction completion,
      the insert_undo log pages would only be repurposed for new undo log
      allocations, and their contents would not matter. So, older versions
      will not have a problem with innodb_safe_truncate=ON if the server was
      shut down cleanly.
      
      Second, to prevent such recovery failure, innodb_safe_truncate=ON will
      cause a modification of the redo log format identifier, which will
      prevent older versions from starting up after a crash. MariaDB Server
      versions older than 10.2.13 will refuse to start up altogether, even
      after clean shutdown.
      
      A server restart with innodb_safe_truncate=OFF will restore compatibility
      with older server and backup versions.
      853a0a43
    • Igor Babaev's avatar
      MDEV-17107 Assertion `table_list->table' failed in find_field_in_table_ref · dc3f5594
      Igor Babaev authored
      Added only test case because the bug was fixed by the patch for mdev-16992.
      dc3f5594
  5. 16 Oct, 2018 2 commits
  6. 14 Oct, 2018 1 commit
  7. 13 Oct, 2018 1 commit
  8. 12 Oct, 2018 1 commit
    • Igor Babaev's avatar
      MDEV-17354 Server crashes in add_key_field / .. / Item_func_null_predicate::add_key_fields · 6d29c852
      Igor Babaev authored
                 upon INSERT .. SELECT
      
      The function Item *Item_direct_view_ref::derived_field_transformer_for_where()
      erroneously did not strip off ref wrappers from references to materialized
      derived tables / views. As a result the expressions that contained some
      references of the type Item_direct_view_ref to columns of a materialized
      derived table / view V were pushed into V incorrectly. This could cause
      crashes for some INSERT ... SELECT statements.
      6d29c852
  9. 11 Oct, 2018 6 commits
    • Marko Mäkelä's avatar
      MDEV-17433 Allow InnoDB start up with empty ib_logfile0 from mariabackup --prepare · 81a5b6cc
      Marko Mäkelä authored
      A prepared backup from Mariabackup does not really need to contain any
      redo log file, because all log will have been applied to the data files.
      
      When the user copies a prepared backup to a data directory (overwriting
      existing files), it could happen that the data directory already contained
      redo log files from the past. mariabackup --copy-back) would delete the
      old redo log files, but a user’s own copying script might not do that.
      To prevent corruption caused by mixing an old redo log file with data
      files from a backup, starting with MDEV-13311, Mariabackup would create
      a zero-length ib_logfile0 that would prevent startup.
      
      Actually, there is no need to prevent InnoDB from starting up when a
      single zero-length file ib_logfile0 is present. Only if there exist
      multiple data files of different lengths, then we should refuse to
      start up due to inconsistency. A single zero-length ib_logfile0 should
      be treated as if the log files were missing: create new log files
      according to the configuration.
      
      open_log_file(): Remove. There is no need to open the log files
      at this point, because os_file_get_status() already determined
      the size of the file.
      
      innobase_start_or_create_for_mysql(): Move the creation of new
      log files a little later, not when finding out that the first log
      file does not exist, but after finding out that it does not exist
      or it exists as a zero-length file.
      81a5b6cc
    • Marko Mäkelä's avatar
      Fix a sign mismatch · b8944e89
      Marko Mäkelä authored
      b8944e89
    • Marko Mäkelä's avatar
      MDEV-13564: Replace innodb_unsafe_truncate with innodb_safe_truncate · 6319c0b5
      Marko Mäkelä authored
      Rename the 10.2-specific configuration option innodb_unsafe_truncate
      to innodb_safe_truncate, and invert its value.
      
      The default (for now) is innodb_safe_truncate=OFF, to avoid
      disrupting users with an undo and redo log format change within
      a Generally Available (GA) release series.
      6319c0b5
    • Marko Mäkelä's avatar
      MDEV-13564: Implement innodb_unsafe_truncate=ON for compatibility · 3448ceb0
      Marko Mäkelä authored
      While MariaDB Server 10.2 is not really guaranteed to be compatible
      with Percona XtraBackup 2.4 (for example, the MySQL 5.7 undo log format
      change that could be present in XtraBackup, but was reverted from
      MariaDB in MDEV-12289), we do not want to disrupt users who have
      deployed xtrabackup and MariaDB Server 10.2 in their environments.
      
      With this change, MariaDB 10.2 will continue to use the backup-unsafe
      TRUNCATE TABLE code, so that neither the undo log nor the redo log
      formats will change in an incompatible way.
      
      Undo tablespace truncation will keep using the redo log only. Recovery
      or backup with old code will fail to shrink the undo tablespace files,
      but the contents will be recovered just fine.
      
      In the MariaDB Server 10.2 series only, we introduce the configuration
      parameter innodb_unsafe_truncate and make it ON by default. To allow
      MariaDB Backup (mariabackup) to work properly with TRUNCATE TABLE
      operations, use loose_innodb_unsafe_truncate=OFF.
      
      MariaDB Server 10.3.10 and later releases will always use the
      backup-safe TRUNCATE TABLE, and this parameter will not be
      added there.
      
      recv_recovery_rollback_active(): Skip row_mysql_drop_garbage_tables()
      unless innodb_unsafe_truncate=OFF. It is too unsafe to drop orphan
      tables if RENAME operations are not transactional within InnoDB.
      
      LOG_HEADER_FORMAT_10_3: Replaces LOG_HEADER_FORMAT_CURRENT.
      
      log_init(), log_group_file_header_flush(),
      srv_prepare_to_delete_redo_log_files(),
      innobase_start_or_create_for_mysql(): Choose the redo log format
      and subformat based on the value of innodb_unsafe_truncate.
      3448ceb0
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 07815d95
      Marko Mäkelä authored
      07815d95
    • Marko Mäkelä's avatar
      940f0c78
  10. 10 Oct, 2018 3 commits
  11. 09 Oct, 2018 2 commits
  12. 08 Oct, 2018 3 commits
    • Andrei Elkin's avatar
      MDEV-17346 parallel slave start and stop races to workers disappeared · f517d8c7
      Andrei Elkin authored
      The bug appears as a slave SQL thread hanging in
      rpl_parallel_thread_pool::get_thread() while there are no slave worker
      threads to awake it.
      
      The reason of the hang is that at the parallel slave worker pool
      activation the being stared SQL thread could read the worker pool size
      concurrently with pool deactivation. At reading the SQL thread did not
      employ necessary protection from a race.
      
      Fixed with making the SQL thread at the pool activation first
      to grab the same lock as potential deactivator also does prior
      to access the pool size.
      f517d8c7
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-16980 Wrongly set tablename len while opening the · e9d9ca8c
      Thirunarayanan Balathandayuthapani authored
      			table for purge thread
      
      Problem:
      =======
      	Purge tries to fetch mdl lock for the whole table even though it tries
      to open one of the partition. But table name length was wrongly set to indicate
      the partition name too.
      
      Solution:
      ========
      - Table name length should identify the table name only not the partition name.
      e9d9ca8c
    • Igor Babaev's avatar
      MDEV-17382 Hash join algorithm should not be used to join materialized · 1ebe841f
      Igor Babaev authored
                 derived table / view by equality
      
      Now rows of a materialized derived table are always put into a
      temporary table before join operation. If BNLH is used to join this
      table with the result of a partial join then both operands of the
      join are actually put into main memory. In most cases this is not
      efficient.
      We could avoid this by sending the rows of the derived table directly
      to the join operation. However this kind of data flow is not supported
      yet.
      Fixed by not allowing usage of hash join algorithm to join a materialized
      derived table if it's joined by an equality predicate of the form
      f=e where f is a field of the derived table.
      1ebe841f
  13. 07 Oct, 2018 1 commit
    • Igor Babaev's avatar
      MDEV-17382 Hash join algorithm should not be used to join materialized · 1eca4957
      Igor Babaev authored
                 derived table / view by equality
      
      Now rows of a materialized derived table are always put into a
      temporary table before join operation. If BNLH is used to join this
      table with the result of a partial join then both operands of the
      join are actually put into main memory. In most cases this is not
      efficient.
      We could avoid this by sending the rows of the derived table directly
      to the join operation. However this kind of data flow is not supported
      yet.
      Fixed by not allowing usage of hash join algorithm to join a materialized
      derived table if it's joined by an equality predicate of the form
      f=e where f is a field of the derived table.
      1eca4957
  14. 06 Oct, 2018 1 commit
  15. 05 Oct, 2018 11 commits