1. 15 May, 2018 8 commits
    • Sergei Golubchik's avatar
      MDEV-16110 ALTER with ALGORITHM=INPLACE breaks temporary table with virtual columns · 77cd7542
      Sergei Golubchik authored
      Part one, non-temporary tables.
      
      Rrenaming a column can make destructive changes
      to the TABLE. This TABLE cannot be used anymore
      and needs to be reopened even if ALTER TABLE
      was aborted with an error.
      77cd7542
    • Sergei Golubchik's avatar
      MDEV-14750 Valgrind Invalid read, ASAN heap-use-after-free in... · c2931242
      Sergei Golubchik authored
      MDEV-14750 Valgrind Invalid read, ASAN heap-use-after-free in Item_ident::print upon SHOW CREATE on partitioned table
      
      items in the partitioning function were taking
      the table name from the table's field
      (in set_field(from_field) in Item_field::fix_fields)
      and field's table_name is TABLE::alias.
      
      But alias is changed for every statement, and
      can be realloced if next statement uses a longer
      alias. But partitioning items are fixed once
      and live as long as the TABLE does. So if
      an alias is realloced, pointers to the old
      alias string will become invalid.
      
      Fix partitioning item table_name to point to
      the actual table name instead.
      c2931242
    • Sergei Golubchik's avatar
      cleanup: vcol_in_partition_func_processor · c14c958c
      Sergei Golubchik authored
      rename to post_fix_fields_part_expr_processor()
      because it's only used after fix_fields in
      fix_fields_part_func() and can be used for
      various post-fix_fields fixups
      c14c958c
    • Sergei Golubchik's avatar
      MDEV-15755 Query crashing MariaDB in cleanup_after_query · 445ac662
      Sergei Golubchik authored
      set the pointer to NULL to avoid double-free
      when the item is cleaned up many times
      
      (once in JOIN_TAB::cleanup(): tmp->jtbm_subselect->cleanup()
      and once at the end of the query, with all other items)
      445ac662
    • Sergei Golubchik's avatar
      fix failing main.mysql_client_test test on 32bit · 93efa48a
      Sergei Golubchik authored
      in `ulonglong=ulong*uint` multiplication
      is done in ulong, wrapping around on 32bit.
      
      This became visible after C/C changed the
      default charset to utf8, thus changing
      mbmaxlem from 1 to 3.
      93efa48a
    • Sergei Golubchik's avatar
      update C/C · 9d6ec6d1
      Sergei Golubchik authored
      9d6ec6d1
    • Sergei Petrunia's avatar
      MDEV-16155: UPDATE on RocksDB table with unique constraint does not work · 21bcfeb9
      Sergei Petrunia authored
      RocksDB now supports "iterator bounds" which are min and max keys
      that an iterator is interested in.
      
      Iterator initialization function doesn't copy the keys, though, it keeps
      pointers to them.
      So if the buffer space for the keys is used for another iterator (the one
      for checking for UNIUQE constraint violation in ha_rocksdb::ha_update_row)
      then one can get incorrect query result.
      
      Fixed by using a separate buffer for iterator bounds in the unique constraint
      violation check.
      21bcfeb9
    • Marko Mäkelä's avatar
      681e8ca3
  2. 14 May, 2018 9 commits
  3. 12 May, 2018 4 commits
    • Galina Shalygina's avatar
      MDEV-16090: Server crash in in Item_func_in::val_int or assertion `in_item' · 6c0f3dd3
      Galina Shalygina authored
                  failure upon SELECT with impossible condition
      
      The problem appears because of a wrong implementation of the
      Item_func_in::build_clone() method. It didn't clone 'array' and 'cmp_fields'
      fields for the cloned IN predicate and this could cause crashes.
      The Item_func_in::fix_length_and_dec() method was refactored and a new method
      named Item_func_in::create_array() was created. It allowed to create 'array'
      for cloned IN predicates in a proper way.
      6c0f3dd3
    • Galina Shalygina's avatar
      MDEV-16088: Pushdown into materialized views/derived tables doesn't · 8b26fea8
      Galina Shalygina authored
                  work in the IN subqueries
      
      The pushdown into the materialized derived table/view wasn't done because
      optimize() for the derived was called before any conditions that can
      be pushed down were extracted. So optimize() in
      convert_join_subqueries_to_semijoins() method is called too early and is
      unnecessary. The second optimize() call in mysql_handle_single_derived()
      is enough.
      8b26fea8
    • Marko Mäkelä's avatar
      dict_create_index_tree_in_mem(): Remove dead code · 77867c14
      Marko Mäkelä authored
      In InnoDB, CREATE TEMPORARY TABLE does not allow FULLTEXT INDEX.
      Replace a condition with a debug assertion, and add a test.
      77867c14
    • Marko Mäkelä's avatar
      After-merge fix · 8c4f3b31
      Marko Mäkelä authored
      8c4f3b31
  4. 11 May, 2018 19 commits
    • Marko Mäkelä's avatar
    • Sachin Agarwal's avatar
      Bug #23593654 CRASH IN BUF_BLOCK_FROM_AHI WHEN LARGE PAGES AND AHI ARE ENABLED · 0da98472
      Sachin Agarwal authored
      Problem:
      
      Fix for Bug #21348684 (#Rb9581) introduced a conditional debug execute
      'buf_pool_resize_chunk_null', which causes new chunks memory for 2nd
      buffer pool instance is freed.
      
      Buffer pool resize function removes all old chunks entry from
      'buf_chunk_map_reg' and add new chunks entry into it. But when
      'buf_pool_resize_chunk_null' is set true, 2nd buffer pool
      instance's chunk entries are not added into 'buf_chunk_map_reg'.
      When purge thread tries to access that buffer chunk, it leads to
      debug assertion.
      
      Fix:
      
      Added old chunk entries into 'buf_chunk_map_reg' for 2nd buffer pool
      instance when 'buf_pool_resize_chunk_null' debug condition is set to true.
      
      Reviewed by: Jimmy <Jimmy.Yang@oracle.com>
      RB: 18664
      0da98472
    • Aakanksha Verma's avatar
      FOLLOW-UP FIX FOR BUG#27141613 · 4c7ea34e
      Aakanksha Verma authored
      PROBLEM
      
      Issue found during ntest run is a regression of  Bug #27141613. The
      issue is basically when index is being freed due to an error during its
      creation,when the index isn't added to dictionary cache its field
      columns are not set, the derefrencing of null col pointer during the
      clean of index from the virtual column's leads to a crash.
      
      NOTE: Also test i_innodb.virtual_debug was failing on 32k page size and
      above for the newly added scenario. Fixed that.
      
      FIX
      
      Added a check that if only the index is cached , the virtual index
      freeing from the virtual cols index list is performed.
      
      Reviewed by: Satya Bodapati<satya.bodapati@oracle.com>
      RB: 18670
      4c7ea34e
    • Aakanksha Verma's avatar
      Bug #27141613 ASSERTION: TRX0REC.CC:319:COL->IS_VIRTUAL() / CRASH IN TRX_UNDO_READ_V_COLS · 279f992b
      Aakanksha Verma authored
      PROBLEM
      =======
      When add of virtual index fails with DB_TOO_BIG_RECORD , the virtual
      index being freed isn't removed from the list of indexes a virtual
      column(which is part of the index). This while the undo log is read
      could fetch a wrong value during rollback and cause the assertion
      reported in the bug particularly.
      
      FIX
      ===
      Added a function that is called when the virtual index being freed would
      allow the index be removed from the index list of virtual column which
      was a field of that index.
      
      Reviwed By: Jimmy Yang<Jimmy.Yang@oracle.com>
      RB: 18528
      279f992b
    • Marko Mäkelä's avatar
      Adjust the test case for MariaDB · c88ac735
      Marko Mäkelä authored
      c88ac735
    • Aditya A's avatar
      Bug #27304661 MYSQL CRASH DOING SYNC INDEX ] [FATAL] INNODB: SEMAPHORE WAIT HAS LASTED > 600 · 280879eb
      Aditya A authored
      PROBLEM
      -------
      
      Whenever an fts table is created it registers itself in a queue which
      is operated by a background thread whose job is to optimize the
      fts tables in background. Additionally we place these fts tables in
      non-LRU list so that they cannot be evicted from cache. But in the
      scenario when a node is brought up which is already having fts
      tables ,we first try to load the fts tables in dictionary ,but we skip
      the part where it is added in background queue and in non-LRU list because
      the background thread is not yet created,so these tables are loaded
      but they can be evicted from the cache. Now coming to the deadlock scenario
      
      1. A Server background thread is trying to evict a table from the cache
          because the cache is full,so it scans the LRU list for the tables it can
          evict.It finds the fts table (because of the reason explained above)
          can be evicted and it takes the dict_sys->mutex (this is a system wide mutex)
          submits a request to  the background thread to remove this table from queue
          and waits it to be completed.
      
      2.  In the mean time fts_optimize_thread() is processing another job
          in the queue and needs dict_sys->mutex for a small amount of time,
          but it cannot get it because it is blocked by the first background thread.
      
      So Thread 1 is waiting for its job to be completed by Thread 2,whereas Thread 2
      is waiting for dict_sys->mutex held by thread 1 ,causing the deadlock.
      
      FIX
      280879eb
    • Sachin Agarwal's avatar
      Bug #26805833 INNODB COMPLAINS OF SYNTAX ERROR, BUT DOES NOT SAY WHICH OPTION · b7e333f9
      Sachin Agarwal authored
      Problem:
      
      when incorrect value is assigned to innodb_data_file_path or
      innodb_temp_data_file_path parameter, Innodb returns error and logs error
      message in mysqlds.err file but there is no information in error message about
      the parameter which causes Innodb initialization is failed.
      
      Fix:
      
      Added error message with parameter name and value, which causes Innodb
      initialization is failed.
      
      Reviewed by: Jimmy <Jimmy.Yang@oracle.com>
      RB: 18206
      b7e333f9
    • Marko Mäkelä's avatar
      Adjust the test case for MariaDB · 671a37f6
      Marko Mäkelä authored
      Note: it does not appear to cover the bug fix! The test
      will pass even if the Oracle Bug #26731689 fix is reverted.
      671a37f6
    • Sachin Agarwal's avatar
      Bug #26731689 FK ON TABLE WITH GENERATED COLS: ASSERTION POS < N_DEF · 3d10966b
      Sachin Agarwal authored
      Problem:
      
      During ALTER, when filling stored column info, wrong column number is used.
      This is because we ignored virtual column when iterating over columns in
      table and lead to debug assertion.
      
      Fix:
      
      In InnoDB table cache object, vcols are on stored on one list, stored and
      normal columns are stored in another list.
      When looking for stored column, ignore the virtual columns to get the right
      column number of stored column.
      
      Reviewed by: Thiru <thirunarayanan.balathandayuth@oracle.com>,
                   Satya <satya.bodapati@oracle.com>
      RB: 17939
      3d10966b
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 82f0dc35
      Marko Mäkelä authored
      82f0dc35
    • Marko Mäkelä's avatar
      MDEV-16145 Crash in ALTER TABLE…AUTO_INCREMENT=1 after DISCARD TABLESPACE · c407ee09
      Marko Mäkelä authored
      This is the MariaDB equivalent of fixing the MySQL 5.7 regression
      Bug #26935001 ALTER TABLE AUTO_INCREMENT TRIES TO READ
      INDEX FROM DISCARDED TABLESPACE
      
      Oracle did not publish a test case, but it is easy to guess
      based on the commit message. The MariaDB code is different
      due to MDEV-6076 implementing persistent AUTO_INCREMENT.
      
      commit_set_autoinc(): Report ER_TABLESPACE_DISCARDED if the
      tablespace is missing.
      
      prepare_inplace_alter_table_dict(): Avoid accessing a discarded
      tablespace. (This avoids generating warnings in fil_space_acquire().)
      c407ee09
    • Marko Mäkelä's avatar
      64f4576b
    • Marko Mäkelä's avatar
      Merge 10.0 into 10.1 · 3b99a274
      Marko Mäkelä authored
      3b99a274
    • Sachin Agarwal's avatar
      Bug #26334149 - MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE ORPHANED DUE TO RENAME TABLE · 197bf0fe
      Sachin Agarwal authored
      Problem:
      When FTS index is added into a table which doesn't have 'FTS_DOC_ID'
      column, Innodb rebuilds table to add column 'FTS_DOC_ID'. when this FTS
      index is dropped from this table. Innodb doesn't not rebuild table to
      remove 'FTS_DOC_ID' column and deletes FTS index auxiliary tables.
      But it doesn't delete FTS common auxiliary tables.
      Later when the database having this table is renamed, FTS auxiliary
      tables are not renamed because table's flags2 (dict_table_t.flags2)
      has been resetted for DICT_TF2_FTS flag during FTS index drop operation.
      Now when we drop old database, it leads to an assert.
      
      Fix:
      During renaming of FTS auxiliary tables, ORed a condition to check if
      table has DICT_TF2_FTS_HAS_DOC_ID flag set.
      
      RB: 18769
      Reviewed by : Jimmy.Yang@oracle.com
      197bf0fe
    • Thirunarayanan Balathandayuthapani's avatar
      Bug #27041445 SERVER ABORTS IF FTS_DOC_ID EXCEEDS FTS_DOC_ID_MAX_STEP · 9c03ba8f
      Thirunarayanan Balathandayuthapani authored
      Problem:
      =======
      Multiple insert statement in table contains FULLTEXT KEY and a
      FTS_DOC_ID column aborts the server if the FTS_DOC_ID exceeds
      FTS_DOC_ID_MAX_STEP.
      
      Solution:
      ========
      Remove the exception for first committed insert statement.
      
      Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com>
      RB: 18023
      9c03ba8f
    • Marko Mäkelä's avatar
      Merge 5.5 into 10.0 (no changes) · c70fc6b1
      Marko Mäkelä authored
      c70fc6b1
    • Marko Mäkelä's avatar
      Remove a redundant condition added by the 5.6.40 merge · 580a8061
      Marko Mäkelä authored
      When Oracle fixed MDEV-13899 in their own way, they moved the
      condition to the only caller of PageConverter::update_records().
      Thus, the merge of 5.6.40 into MariaDB added a redundant condition.
      
      PageConverter::update_records(): Move the page_is_leaf() condition
      to the only caller, PageConverter::update_index_page().
      580a8061
    • Sergei Petrunia's avatar
      MDEV-12427: rocksdb.write_sync fails · c6864832
      Sergei Petrunia authored
      Enable the test as the cause of the failure has been fixed
      c6864832