1. 03 Aug, 2018 13 commits
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 814ae57d
      Marko Mäkelä authored
      814ae57d
    • Oleksandr Byelkin's avatar
      Disable an unstable test · 9d42eb5e
      Oleksandr Byelkin authored
      9d42eb5e
    • Marko Mäkelä's avatar
      769f6d2d
    • Marko Mäkelä's avatar
      Merge 10.0 into 10.1 · 0d3972c6
      Marko Mäkelä authored
      0d3972c6
    • Marko Mäkelä's avatar
      9dfef6e2
    • Marko Mäkelä's avatar
      Follow-up fix to MDEV-16865: InnoDB fts_query() ignores KILL · b963cbaf
      Marko Mäkelä authored
      fts_query(): Remove a redundant condition (result will never be NULL),
      and instead check if *result is NULL, to prevent SIGSEGV in
      fts_query_free_result().
      b963cbaf
    • Marko Mäkelä's avatar
      MDEV-16850 Merge new release of InnoDB 5.7.23 to 10.2 · 976f9205
      Marko Mäkelä authored
      This concludes the merge of all applicable InnoDB changes from
      MySQL 5.7.23, with the exception of a performance fix, which we
      plan to rewrite in MariaDB later in such a way that it does not
      involve changing the storage engine API:
      
      MDEV-16849 Extending indexed VARCHAR column should be instantaneous
      976f9205
    • Marko Mäkelä's avatar
      Fix a race between TRUNCATE and FOREIGN KEY check · 62ee2cd4
      Marko Mäkelä authored
      This is a port of an Oracle fix.
      
      No test case was provided by Oracle. It seems that to exploit this
      bug, one would have to SET foreign_key_checks=0 before TRUNCATE,
      and to concurrently run some DML statement that causes a foreign key
      constraint to be checked.
      
      commit 1f24c5aa2843fa548aa5c4b29c00f955e03e9f5b
      Author: Aditya A <aditya.a@oracle.com>
      Date:   Fri May 18 12:32:37 2018 +0530
      
          Bug #27208858 CONCURRENT DDL/DML ON FOREIGN KEYS CRASH IN
          PAGE_CUR_SEARCH_WITH_MATCH_BYTES
      62ee2cd4
    • Marko Mäkelä's avatar
      MDEV-14637: Fix hang due to persistent statistics · de469a2f
      Marko Mäkelä authored
      Similar to the tables SYS_FOREIGN and SYS_FOREIGN_COLS,
      the tables mysql.innodb_table_stats and mysql.innodb_index_stats
      are updated by the InnoDB internal SQL parser, which fails to
      enforce the size limits of the data. Due to this, it is possible
      for InnoDB to hang when there are persistent statistics defined on
      partitioned tables where the total length of table name,
      partition name and subpartition name exceeds the incorrectly
      defined limit VARCHAR(64). That column should have been defined
      as VARCHAR(199).
      
      btr_node_ptr_max_size(): Interpret the VARCHAR(64) as VARCHAR(199),
      to prevent a hang in the case that the upgrade script has not been
      run.
      
      dict_table_schema_check(): Ignore difference in the length of the
      table_name column.
      
      ha_innobase::max_supported_key_length(): For innodb_page_size=4k,
      return a larger value so that the table mysql.innodb_index_stats
      can be created. This could allow "impossible" tables to be created,
      such that it is not possible to insert anything into a secondary
      index when both the secondary key and the primary key are long,
      but this is the easiest and most consistent way. The Oracle fix
      would only ignore the maximum length violation for the two
      statistics tables.
      
      os_file_get_status_posix(), os_file_get_status_win32(): Handle
      ENAMETOOLONG as well.
      
      This patch is based on the following change in MySQL 5.7.23.
      Not all changes were applied, and our variant allows persistent
      statistics to work without hangs even if the table definitions
      were not upgraded.
      
      From fdbdce701ab8145ae234c9d401109dff4e4106cb Mon Sep 17 00:00:00 2001
      From: Aditya A <aditya.a@oracle.com>
      Date: Thu, 17 May 2018 16:11:43 +0530
      Subject: [PATCH] Bug #26390736 THE FIELD TABLE_NAME (VARCHAR(64)) FROM
                 MYSQL.INNODB_TABLE_STATS CAN OVERFLOW.
      
          In mysql.innodb_index_stats and mysql.innodb_table_stats
          tables the table name column didn't take into consideration
          partition names which can be more than varchar(64).
      de469a2f
    • Marko Mäkelä's avatar
      MDEV-14637: Fix hang due to DDL with FOREIGN KEY · 20460897
      Marko Mäkelä authored
      When MySQL 5.7.1 introduced WL#6326 to reduce contention on the
      non-leaf levels of B-trees, it introduced a new rw-lock mode SX
      (not conflicting with S, but conflicting with SX and X) and
      new rules to go with it.
      
      A thread that is holding an dict_index_t::lock aka index->lock
      in SX mode is permitted to acquire non-leaf buf_block_t::lock
      aka block->lock X or SX mode, in monotonically descending order.
      That is, once the thread has acquired a block->lock, it is not
      allowed to acquire a lock on its parent or grandparent pages.
      Such arbitrary-order access is only allowed when the thread
      acquired the index->lock in X mode upfront.
      
      A customer encountered a repeatable hang when loading a dump into
      InnoDB while using multiple innodb_purge_threads (default: 4).
      The dump makes very heavy use of FOREIGN KEY constraints.
      By luck, it happened so that two purge worker threads (srv_worker_thread)
      deadlocked with each other. Both were operating on the index FOR_REF
      of the InnoDB internal table SYS_FOREIGN. One of them was legitimately
      holding index->lock S-latch and the root block->lock S-latch. The other
      had acquired index->lock SX-latch, root block->lock SX-latch, and a bunch
      of other latches, including the fil_space_t::latch for freeing some blocks
      and some leaf page latches. This other thread was inside 2 nested calls
      to btr_compress() and it was trying to reacquire the root block->lock
      in X mode, violating the WL#6326 protocol.
      
      This violation led to a deadlock, because while S is compatible with SX
      and a thread can upgrade an SX lock to X when there are no conflicting
      requests, in this case there was a conflicting S lock held by the other
      purge worker thread.
      
      During this deadlock, both threads are holding dict_operation_lock S-latch,
      which would block any subsequent DDL statements, such as CREATE TABLE.
      
      The tables SYS_FOREIGN and SYS_FOREIGN_COLS are special in that they
      define key columns of the type VARCHAR(0), created using the InnoDB
      internal SQL parser. Because InnoDB does not internally enforce the
      maximum length of columns, it would happily write more than 0 bytes
      to these columns. This caused a miscalculation of node_ptr_max_size.
      
      btr_cur_will_modify_tree(): Clean up some code. (No functional change.)
      
      btr_node_ptr_max_size(): Renamed from dict_index_node_ptr_max_size().
      Use a more realistic maximum size for SYS_FOREIGN and SYS_FOREIGN_COLS.
      
      btr_cur_pessimistic_delete(): Refrain from merging pages if it is
      not safe.
      
      This work is based on the following MySQL 5.7.23 fix:
      
      commit 58dcf0b4a4165ed59de94a9a1e7d8c954f733726
      Author: Aakanksha Verma <aakanksha.verma@oracle.com>
      Date:   Wed May 9 18:54:03 2018 +0530
      
          BUG#26225783 MYSQL CRASH ON CREATE TABLE (REPRODUCEABLE) -> INNODB: A
          LONG SEMAPHORE WAIT
      20460897
    • Allen Lai's avatar
      Bug#27805553 HARD ERROR SHOULD BE REPORTED WHEN FSYNC() RETURN EIO. · f70a3185
      Allen Lai authored
      fsync() will just return EIO only once when the IO error happens, so, it's
      wrong to keep trying to call it till it return success.
      When fsync() returns EIO it should be treated as a hard error and InnoDB must
      abort immediately.
      f70a3185
    • Sergey Vojtovich's avatar
      Optimized away excessive condition · a1b23361
      Sergey Vojtovich authored
      trx_set_rw_mode() is never called for read-only transactions, this is guarded
      by callers.
      
      Removing this condition from critical section immediately gives 5% scalability
      improvement in OLTP index updates benchmark.
      a1b23361
    • Marko Mäkelä's avatar
      f867a695
  2. 02 Aug, 2018 3 commits
  3. 01 Aug, 2018 5 commits
  4. 31 Jul, 2018 4 commits
  5. 30 Jul, 2018 11 commits
    • Marko Mäkelä's avatar
      MDEV-16855 Fix fts_sync_synchronization in InnoDB · e52315a4
      Marko Mäkelä authored
      This is a backport of the following fix from MySQL 5.7.23.
      Some code refactoring has been omitted, and the test case has
      been adapted to MariaDB.
      
      commit 7a689acaa65e9d602575f7aa53fe36a64a07460f
      Author: Krzysztof Kapuścik <krzysztof.kapuscik@oracle.com>
      Date:   Tue Mar 13 12:34:03 2018 +0100
      
      Bug#27082268 Invalid FTS sync synchronization
      
      The fix closes two issues:
      Bug #27082268 - INNODB: FAILING ASSERTION: SYM_NODE->TABLE != NULL DURING FTS SYNC
      Bug #27095935 - DEADLOCK BETWEEN FTS_DROP_INDEX AND FTS_OPTIMIZE_SYNC_TABLE
      
      Both issues were related to a FTS cache sync being done during
      operations that perfomed DDL actions on internal FTS tables
      (ALTER TABLE, TRUNCATE). In some cases the FTS tables and/or
      internal cache structures could get removed while still being
      used to perform FTS synchronization leading to crashes. In other
      the sync operations could not get finishes as it was waiting for
      dict lock which was taken by thread waiting for the background
      sync to be finished.
      
      The changes done includes:
      - Stopping background operations during ALTER TABLE and TRUNCATE.
      - Removal of unused code in FTS.
      - Cleanup of FTS sync related code to make it more readable and
      easier to maintain.
      
      RB#18262
      e52315a4
    • Marko Mäkelä's avatar
      Apply the 5.6.40 security fixes to XtraDB · 5ed2da95
      Marko Mäkelä authored
      We did not merge Percona XtraDB 5.6.40-84.0 yet.
      The changes in it are mostly cosmetic, except for
      2 bug fixes from Oracle MySQL 5.6.40, which could
      be security bugs.
      
      This was achieved by taking the applicable parts
      of an earlier InnoDB commit to XtraDB:
      
      git diff 15ec8c2f{~,} storage/innobase|
      sed -e s+/innobase/+/xtradb/+|patch -p1
      5ed2da95
    • Marko Mäkelä's avatar
      Merge 5.5 into 10.0 · 7c773abd
      Marko Mäkelä authored
      7c773abd
    • Karthik Kamath's avatar
      No commit message · a49ec980
      Karthik Kamath authored
      No commit message
      a49ec980
    • Marko Mäkelä's avatar
      Merge InnoDB MySQL 5.6.41 to 10.0 · 4c21c367
      Marko Mäkelä authored
      4c21c367
    • Sachin Agarwal's avatar
      Bug #27326796 - MYSQL CRASH WITH INNODB ASSERTION FAILURE IN FILE PARS0PARS.CC · 29ddc6e9
      Sachin Agarwal authored
      Problem:
      As part of bug #24938374 fix, dict_operation_lock was not taken by
      fts_optimize_thread while syncing fts cache.
      Due to this change, alter query is able to update SYS_TABLE rows
      simultaneously. Now when fts_optimizer_thread goes open index table,
      It doesn't open index table if the record corresponding to that table is
      set to REC_INFO_DELETED_FLAG in SYS_TABLES and hits an assert.
      
      Fix:
      If fts sync is already in progress, Alter query would wait for sync to
      complete before renaming table.
      
      RB: #19604
      Reviewed by : Jimmy.Yang@oracle.com
      29ddc6e9
    • Marko Mäkelä's avatar
      Merge 5.5 into 10.0 · 91181b22
      Marko Mäkelä authored
      91181b22
    • mleich1's avatar
      MDEV-16809 Allow full redo logging for ALTER TABLE · fd378fc6
      mleich1 authored
      Add the usual basic test for the variable innodb_log_optimize_ddl.
      Signed-off-by: default avatarmleich1 <Matthias.Leich@mariadb.com>
      fd378fc6
    • Marko Mäkelä's avatar
      Fix InnoDB/XtraDB warnings by GCC 8.2.0 · d17e9a02
      Marko Mäkelä authored
      d17e9a02
    • Marko Mäkelä's avatar
      MDEV-16851 On schema mismatch in IMPORT TABLESPACE, display ROW_FORMAT in clear text · 8bdd1250
      Marko Mäkelä authored
      This is motivated by Oracle MySQL Bug #27542720 SCHEMA MISMATCH
      - TABLE FLAGS DON'T MATCH, BUT FLAGS ARE NUMBERS
      but using a different approach.
      
      row_import::match_schema(): In case of a mismatch, display the
      ROW_FORMAT and optionally KEY_BLOCK_SIZE of the .cfg file.
      8bdd1250
    • Marko Mäkelä's avatar
      Use a more precise argument for memset() · 34096335
      Marko Mäkelä authored
      34096335
  6. 29 Jul, 2018 1 commit
    • Oleksandr Byelkin's avatar
      Merge remote-tracking branch 'mysql/5.5' into 5.5 · fceda2da
      Oleksandr Byelkin authored
      We do not accept:
      1. We did not have this problem (fixed earlier and better)
       d982e717 Bug#27510150: MYSQLDUMP FAILS FOR SPECIFIC --WHERE CLAUSES
      2. We do not have such options (an DBUG_ASSERT put just in case)
       bbc2e37f Bug#27759871: BACKRONYM ISSUE IS STILL IN MYSQL 5.7
      3. Serg fixed it in other way in this release:
       e48d775c Bug#27980823: HEAP OVERFLOW VULNERABILITIES IN MYSQL CLIENT LIBRARY
      fceda2da
  7. 27 Jul, 2018 2 commits
  8. 26 Jul, 2018 1 commit
    • Alexander Barkov's avatar
      MDEV-16614 signal 7 after calling stored procedure, that uses regexp · 5c5a116b
      Alexander Barkov authored
      The problem happened in the derived condition pushdown code:
      - When Item_func_regex::build_clone() was called, it created a copy of
        the original Item_func_regex, and this copy got registered in free_list.
        Class specific additional dynamic members (such as "re") made
        a shallow copy, rather than a deep copy, in the cloned Item_func_regex.
        As a result, the Regexp_processor_pcre::m_pcre of the cloned Item_func_regex
        and of the original Item_func_regex pointed to the same compiled regular
        expression.
      - On cleanup_items(), both original and cloned copies of Item_func_regex
        called re.cleanup(), which called pcre_free(m_pcre). So the same compiled
        regular expression was freed two times, which was noticed by ASAN.
      
      The same problem was repeatable for Item_func_regexp_instr.
      
      A similar problem happened for Item_func_sp, for the sp_result_field member.
      Both original and cloned copies of Item_func_sp pointed the same Field instance
      and both deleted it on cleanup().
      
      A possible solution would be to fix build_clone() to create deep
      (instead of shallow) copies for the dynamic members of the affected classes
      (Item_func_regex, Item_func_regexp_instr, Item_func sp).
      However, this would be too complex.
      
      As agreed with Galina and Igor, this patch disallows using using these
      affected classes in derived condition pushdown by overriding get_clone()
      to return NULL.
      5c5a116b