1. 26 Apr, 2017 7 commits
    • Thirunarayanan Balathandayuthapani's avatar
      Bug #23533396 ASSERTION !M_PREBUILT->TRX->CHECK_FOREIGNS · a6adf567
      Thirunarayanan Balathandayuthapani authored
      Analysis:
      ========
      A foreign key constraint cannot reference a secondary index defined
      on a generated virtual column. While adding new index/drop existing
      column, server internally drops the internal foreign key index and
      it leads to choose the virtual secondary index as foreign key index.
      But innodb doesn't allow foreign key constraint reference to
      secondary virtual index.
      
      Fix:
      ===
      Allow foreign key constraint refer to secondary index defined on
      a generated virutal column.
      
      Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com>
      RB: 13586
      a6adf567
    • Marko Mäkelä's avatar
      Bug#24444831 MY_ERROR(ER_INNODB_ONLINE_LOG_TOO_BIG) CALLED WITH INVALID INDEX NAME · 93078c9c
      Marko Mäkelä authored
      This bug was introduced in MySQL 5.6.8 with WL#6255.
      When an error occurs while rebuilding a table that only has a
      hidden GEN_CLUST_INDEX inside InnoDB, ha_alter_info->key_info_buffer
      would be invalid and should not be dereferenced.
      
      get_error_key_name(): Get the name of an erroneous key.
      Avoid dereferencing ha_alter_info->key_info_buffer when no keys
      exist in the SQL layer.
      
      ha_innobase::inplace_alter_table(),
      ha_innobase::commit_try_rebuild(): Invoke get_error_key_name()
      for reporting ER_INNODB_ONLINE_LOG_TOO_BIG or ER_INDEX_CORRUPT.
      
      RB: 13834
      Reviewed-by: default avatarJimmy Yang <jimmy.yang@oracle.com>
      93078c9c
    • Marko Mäkelä's avatar
      Fix the -DWITH_INNODB_AHI=OFF build · 9a848ee1
      Marko Mäkelä authored
      9a848ee1
    • Marko Mäkelä's avatar
      Adjust a test for WL9513 Bug#23333990 · 8080d79f
      Marko Mäkelä authored
      8080d79f
    • Igor Babaev's avatar
      Fixed the bug mdev-12556. · c7a15345
      Igor Babaev authored
      When the rows produced on the current iteration are sent to the
      temporary table T of the UNION type created for CTE the rows
      that were not there simultaneously are sent to the temporary
      table D that contains rows for the next iteration. The test
      whether a row was in T checks the return code of writing into T.
      If just a HEAP table is used for T then the return code is
      HA_ERR_FOUND_DUPP_KEY, but if an ARIA table is used for T then
      the return code is HA_ERR_FOUND_DUPP_UNIQUE.
      The implementation of select_union_recursive::send_data()
      erroneously checked only for the first return code. So if an Aria
      table was used for T then all rows produced by the current iteration
      went to D and and in most cases D grew with each iteration.
      Whether T has reached stabilization is detected by
      checking whether D is empty. So as a result, the iterations were
      never stopped unless a limit for them was set.
      
      Fixed by checking for both HA_ERR_FOUND_DUPP_KEY and
      HA_ERR_FOUND_DUPP_UNIQUE as return codes returned by
      the function writing a row into the temporary table T.
      c7a15345
    • Sachin Setiya's avatar
      MDEV-12017 Unclear error with flashback: Variable 'binlog_format' can't ... · e180c356
      Sachin Setiya authored
      When WSREP(thd) is not true we will use my_error(...) to print error. This
      will set thd->is_error() to true and we wont be getting generic error.
      Signed-off-by: default avatarSachin Setiya <sachin.setiya@mariadb.com>
      e180c356
    • Igor Babaev's avatar
      Fixed the bug mdev-12558. · a287bfa0
      Igor Babaev authored
      In the current code temporary tables we identified and opened before
      other tables. CTE tables are identified in the same procedure as
      regular tables. When a temporary table and a CTE table have the same
      name T any reference to T that is in the scope of the CTE declaration
      must be associated with this CTE. Yet it was not done properly.
      When a reference to T was found in the scope of the declaration
      of CTE T a pointer to this CTE was set in the reference. No check
      that the reference had been already associated with a temporary table
      was done. As a result, if the temporary table T  had been created then
      the reference to T was considered simultaneously as reference to the CTE
      named T and as a reference to the temporary table named T. This
      confused the code that were executed later and caused a crash of
      the server.
      Now when a table reference is associated with a CTE any previous
      association with a temporary table is dropped.
      
      This problem could be easily avoided if the temporary tables were
      not identified prematurely.
      as reference to CTE named T and
      a287bfa0
  2. 25 Apr, 2017 3 commits
  3. 24 Apr, 2017 13 commits
    • Igor Babaev's avatar
      Fixed the bug mdev-12564. · 0906dc49
      Igor Babaev authored
      Here's  what started happening after the patch that fixed
      the bug mdev-10454 with query reported for the bug
      SELECT * FROM t t1 right JOIN t t2 ON (t2.pk = t1.pk)
        WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 )
              AND t1.c = 'foo';
      The patch added an implementation of propagate_equal_fields() for
      the class Item_row and thus opened the possibility of equal fields
      substitutions.
      At the prepare stage after setup_conds() called for WHERE condition
      had completed the flag of maybe_null of the Item_row object created
      for  (t2.i, t2.pk) was set to false, because the maybe_null flags of
      both elements were set to false. However the flag of maybe_null for
      t1.pk from the ON condition were set to true, because t1 was an inner
      table of an outer join.
      At the optimization stage the outer join was converted to inner join,
      but the maybe_null flags were not corrected and remained the same.
      So after the substitution t2.pk/t1.pk. the maybe_null flag for the
      row remained false while the maybe_flag for the second element of
      the row was true. As a result, when the in-to_exists transformation
      was performed for the NOT IN predicate the guards variables were
      not created for the elements of the row, but a guard object for
      the second element was created. The object were not valid because
      it referred to NULL as a guard variable. This ultimately caused
      a crash when the expression with the guard was evaluated at the
      execution stage.
      
      The patch made sure that the guard objects are not created without
      guard variables.
      
      Yet it does not resolve the problem of inconsistent maybe_null flags.
      and it might be that the problem will pop op in other pieces of code.
      The resolution of this problem is not easy, but the problem should
      be resolved in future versions.
      0906dc49
    • Aditya A's avatar
      WL9513 Bug#23333990 PERSISTENT INDEX STATISTICS UPDATE BEFORE TRANSACTION IS COMMITTED · 44b1fb36
      Aditya A authored
      PROBLEM
      
      By design stats estimation always reading uncommitted data. In this scenario
      an uncommitted transaction has deleted all rows in the table. In Innodb
      uncommitted delete records are marked as delete but not actually removed
      from Btree until the transaction has committed or a read view for the rows
      is present.While calculating persistent stats we were ignoring the delete
      marked records,since all the records are delete marked we were estimating
      the number of rows present in the table as zero which leads to bad plans
      in other transaction operating on the table.
      
      Fix
      
      Introduced a system variable called innodb_stats_include_delete_marked
      which when enabled includes delete marked records for stat
      calculations .
      44b1fb36
    • Marko Mäkelä's avatar
      Bug#22018745 CORRUPTION IN ONLINE TABLE REBUILD (ROW_FORMAT=REDUNDANT, INDEXED VIRTUAL COLUMN) · 6f5f7208
      Marko Mäkelä authored
      Apparently, WL#8149 QA did not cover the code changes made to
      online table rebuild (which was introduced in MySQL 5.6.8 by WL#6255)
      for ROW_FORMAT=REDUNDANT tables.
      
      row_log_table_low_redundant(): Log the new values of indexed virtual
      columns (ventry) only once.
      
      row_log_table_low(): Assert that if o_ventry is specified, the
      logged operation must not be ROW_T_INSERT, and ventry must be specified
      as well.
      
      row_log_table_low(): When computing the size of old_pk, pass v_entry=NULL to
      rec_get_converted_size_temp(), to be consistent with the subsequent call
      to rec_convert_dtuple_to_temp() for logging old_pk. Assert that
      old_pk never contains information on virtual columns, thus proving that this
      change is a no-op.
      
      RB: 13822
      Reviewed-by: default avatarJimmy Yang <jimmy.yang@oracle.com>
      6f5f7208
    • Thirunarayanan Balathandayuthapani's avatar
      Bug #20989615 INNODB AUTO_INCREMENT PRODUCES SAME VALUE TWICE · 223eb5fb
      Thirunarayanan Balathandayuthapani authored
      Problem:
      =======
      Autoincrement value gives duplicate values because of the following reasons.
      
      (1) In InnoDB handler function, current autoincrement value is not changed
      based on newly set auto_increment_increment or auto_increment_offset variable.
      
      (2) Handler function does the rounding logic and changes the current
      autoincrement value and InnoDB doesn't aware of the change in current
      autoincrement value.
      
      Solution:
      ========
      Fix the problem(1), InnoDB always respect the auto_increment_increment
      and auto_increment_offset value in case of current autoincrement value.
      By fixing the problem (2), handler layer won't change any current
      autoincrement value.
      Reviewed-by: default avatarJimmy Yang <jimmy.yang@oracle.com>
      RB: 13748
      223eb5fb
    • Marko Mäkelä's avatar
      Bug#24397406 INNODB: ALGORITHM=INPLACE FAILS TO PROMOTE UNIQUE KEY TO CLUSTERED INDEX · 01389ee8
      Marko Mäkelä authored
      When a table has no PRIMARY KEY, but there is a UNIQUE INDEX
      defined on NOT NULL columns that are not column prefixes,
      that unique index must be treated as the primary key.
      
      This property was being violated by InnoDB when a column was changed
      to NOT NULL, such that a UNIQUE INDEX on that column became eligible
      to being treated as a primary key.
      
      innobase_create_key_defs(): Instead of checking each ADD [UNIQUE] INDEX
      request, check if a GEN_CLUST_INDEX can be replaced with any unique index
      in the altered_table definition. So, we can have new_primary even
      if n_add==0.
      
      prepare_inplace_alter_table_dict(): When the table is not being rebuilt,
      assert that TABLE_SHARE::primary_key is not changing.
      
      RB: 13595
      Reviewed-by: default avatarKevin Lewis <kevin.lewis@oracle.com>
      01389ee8
    • Shaohua Wang's avatar
      BUG#24331265 MEMORY LEAK IN SOME INNODB FTS TESTS · 92f7f81b
      Shaohua Wang authored
      We don't free some memory used by fts optimize thread in release build.
      
      Patch approved by Allen.Lai over IM.
      92f7f81b
    • Thirunarayanan Balathandayuthapani's avatar
      Bug #24347476 HIGH PRIORITY TRX FAILED TO KILL LOW PRIORITY TRX WHEN FOREIGN KEYS ARE INVOLVED · f5759bd8
      Thirunarayanan Balathandayuthapani authored
      Problem:
      =======
      High priority transaction can't able to kill the blocking transaction
      when foreign keys are involved. trx_kill_blocking() missing while checking
      the foreign key constraint.
      
      Fix:
      ===
      Add trx_kill_blocking() while checking for the foreign key constraint.
      Reviewed-by: default avatarDebarun Banerjee <debarun.banerjee@oracle.com>
      RB: 13579
      f5759bd8
    • Shaohua Wang's avatar
      BUG#23760086 INNODB: ASSERTION FAILURE: MACH0DATA.IC:56:(N | 0XFFFFUL) <= 0XFFFFUL · a930c0aa
      Shaohua Wang authored
      Analysis: In row_log_table_delete(), extern size could be greater
      than 2 bytes int if there are enough index on blob columns.
      
      Solution: Use 4 bytes int other than 2 bytes for extern size.
      Reviewed-by: default avatarMarko Mäkelä <marko.makela@oracle.com>
      RB: 13573
      a930c0aa
    • Shaohua Wang's avatar
      BUG#23477773 OPTION TO TURN OFF/ON DEADLOCK CHECKER · d3a2f60e
      Shaohua Wang authored
      Backport WL#9383 INNODB: ADD AN OPTION TO TURN OFF/ON DEADLOCK CHECKER
      (rb#12873) to 5.7.
      d3a2f60e
    • Shaohua Wang's avatar
      Followup: BUG#23479595 SEGMENTATION FAULT WHEN SELECT FTS INDEX TABLES IN INFORMATION SCHEMA · 1a5ca702
      Shaohua Wang authored
      BUG#23742339 FAILING ASSERTION: SYM_NODE->TABLE != NULL
      
      Analysis: When we access fts aux tables in information schema,the
      fts aux tables are dropped by DROP DATABASE in another session.
      
      Solution: Drop parent table if it's a fts aux table, and drop
      table will drop fts aux tables together.
      Reviewed-by: default avatarJimmy Yang <jimmy.yang@oracle.com>
      RB: 13264
      1a5ca702
    • Shaohua Wang's avatar
      BUG#24315031 FAILING ASSERTION: !TABLE->CAN_BE_EVICTED · b862c797
      Shaohua Wang authored
      Analysis:
      the old table is dropped, just after it's added into drop list,
      and new table with the same name is created, then we try to drop
      the new table in background.
      
      Solution:
      Don't drop a table in background if table->to_be_dropped is false.
      Reviewed-by: default avatarJimmy Yang <jimmy.yang@oracle.com>
      RB: 13414
      b862c797
    • Shaohua Wang's avatar
      BUG#24009272 SEGFAULT WITH CREATE+SELECT FROM IS+DROP FTS TABLE CONCURRENTLY · 9ce1ea6f
      Shaohua Wang authored
      Analysis:
      When we access fts_internal_tbl_name in i_s_fts_config_fill (),
      it can be set to NULL by another session.
      
      Solution:
      Define fts_internal_tbl_name2 for global variable innodb_ft_aux_table,
      if it's NULL, set fts_internal_tbl_name to "default".
      Reviewed-by: default avatarJimmy Yang <jimmy.yang@oracle.com>
      RB: 13401
      9ce1ea6f
    • Thirunarayanan Balathandayuthapani's avatar
      Bug #23475211 COMBINING ALTER OPERATIONS TRIGGERS TABLE REBUILD · 4b5a9d8e
      Thirunarayanan Balathandayuthapani authored
      Problem:
      =======
      Inplace alter algorithm determines the table to be rebuild if the table
      undergoes row format change, key block size if handler flag contains only
      change table create option. If alter with inplace ignore flag operations and change table create options then it leads to table rebuild operation.
      
      Solution:
      ========
      During the check for rebuild, ignore the inplace ignore flag and check for
      table create options.
      Reviewed-by: default avatarJimmy Yang <jimmy.yang@oracle.com>
      Reviewed-by: default avatarMarko Makela <marko.makela@oracle.com>
      RB: 13172
      4b5a9d8e
  4. 23 Apr, 2017 1 commit
  5. 21 Apr, 2017 8 commits
    • Igor Babaev's avatar
      Fixed the bug mdev-12519. · 54a995cd
      Igor Babaev authored
      This patch fixed some problems that occurred with subqueries that
      contained directly or indirectly recursive references to recursive CTEs.
      
      1. A [NOT] IN predicate with a constant left operand and a non-correlated
      subquery as the right operand used in the specification of a recursive CTE
      was considered as a constant predicate and was evaluated only once.
      Now such a predicate is re-evaluated after every iteration of the process
      that produces the records of the recursive CTE.
      2. The Exists-To-IN transformation could be applied to [NOT] IN predicates
      with recursive references. This opened a possibility of materialization
      for the subqueries used as right operands. Yet, materialization
      is prohibited for the subqueries if they contain a recursive reference.
      Now the Exists-To-IN transformation cannot be applied for subquery
      predicates with recursive references.
      
      The function st_select_lex::check_subqueries_with_recursive_references()
      is called now only for the first execution of the SELECT.
      54a995cd
    • Marko Mäkelä's avatar
      Fix a crash when page_compression fails during IMPORT TABLESPACE · 14d12488
      Marko Mäkelä authored
      fil_compress_page(): Check for space==NULL.
      14d12488
    • Marko Mäkelä's avatar
      11f772fa
    • Marko Mäkelä's avatar
      MDEV-12545 Reduce the amount of fil_space_t lookups · 0871a00a
      Marko Mäkelä authored
      buf_flush_write_block_low(): Acquire the tablespace reference once,
      and pass it to lower-level functions. This is only a start; further
      calls may be removed.
      
      fil_decompress_page(): Remove unsafe use of fil_space_get_by_id().
      0871a00a
    • Marko Mäkelä's avatar
      MDEV-12467 encryption.create_or_replace hangs during DROP TABLE · b66e15ec
      Marko Mäkelä authored
      fil_crypt_thread(): Do invoke fil_crypt_complete_rotate_space()
      when the tablespace is about to be dropped. Also, remove a redundant
      check whether rotate_thread_t::space is NULL. It can only become
      NULL when fil_crypt_find_space_to_rotate() returns false, and in
      that case we would already have terminated the loop.
      
      fil_crypt_find_page_to_rotate(): Remove a redundant check for
      space->crypt_data == NULL. Once encryption metadata has been
      created for a tablespace, it cannot be removed without dropping
      the entire tablespace.
      b66e15ec
    • Marko Mäkelä's avatar
      Fix some InnoDB type mismatch · 47141c9d
      Marko Mäkelä authored
      On 64-bit Windows, sizeof(ulint)!=sizeof(ulong).
      47141c9d
    • Marko Mäkelä's avatar
      MDEV-12488 Remove type mismatch in InnoDB printf-like calls · 5684aa22
      Marko Mäkelä authored
      Alias the InnoDB ulint and lint data types to size_t and ssize_t,
      which are the standard names for the machine-word-width data types.
      
      Correspondingly, define ULINTPF as "%zu" and introduce ULINTPFx as "%zx".
      In this way, better compiler warnings for type mismatch are possible.
      
      Furthermore, use PRIu64 for that 64-bit format, and define
      the feature macro __STDC_FORMAT_MACROS to enable it on Red Hat systems.
      
      Fix some errors in error messages, and replace some error messages
      with assertions.
      Most notably, an IMPORT TABLESPACE error message in InnoDB was
      displaying the number of columns instead of the mismatching flags.
      5684aa22
    • Marko Mäkelä's avatar
      MDEV-12534 Use atomic operations whenever available · 039a299b
      Marko Mäkelä authored
      Define UNIV_WORD_SIZE as a simple alias to SIZEOF_SIZE_T.
      In MariaDB 10.0 and 10.1, it was incorrectly defined as 4 on
      64-bit Windows.
      
      MONITOR_OS_PENDING_READS, MONITOR_OS_PENDING_WRITES: Enable by default.
      
      os_n_pending_reads, os_n_pending_writes: Remove.
      Use the monitor counters instead.
      039a299b
  6. 20 Apr, 2017 1 commit
  7. 19 Apr, 2017 4 commits
    • Daniel Black's avatar
      MDEV-12453: AWS SDK version failed to build on OSX · 9a91d743
      Daniel Black authored
      Update AWS SDK version from 1.0.8 to 1.0.100
      
      Commit b64910ce (MDEV-12453)
      enabled AWS_SDK to build correctly on buildbot.
      
      Travis still had build faults like below despite many common elements
      between the builds;
      
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cstring:79:9: error: no member named 'strcoll' in the global namespace; did you mean 'strtoll'?
      [ 24%] Building CXX object storage/rocksdb/CMakeFiles/rocksdblib.dir/rocksdb/db/internal_stats.cc.o
      using ::strcoll;
            ~~^
      /usr/include/stdlib.h:169:3: note: 'strtoll' declared here
               strtoll(const char *__str, char **__endptr, int __base);
               ^
      9a91d743
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
      MDEV-12123 Page contains nonzero PAGE_MAX_TRX_ID · d0ef1aaf
      Marko Mäkelä authored
      When MDEV-6076 repurposed the field PAGE_MAX_TRX_ID, it was assumed
      that the field always was 0 in the clustered index of old data files.
      This was not the case in IMPORT TABLESPACE (introduced in MySQL 5.6
      and MariaDB 10.0), which is writing the transaction ID to all index
      pages, including clustered index pages.
      
      This means that on a data file that was at some point of its life
      IMPORTed to an InnoDB instance, MariaDB 10.2.4 or later could interpret
      the transaction ID as a persistent AUTO_INCREMENT value.
      
      This also means that future changes that repurpose PAGE_MAX_TRX_ID
      in the clustered index may cause trouble with files that were imported
      at some point of their life.
      
      There is a separate minor issue that InnoDB is writing PAGE_MAX_TRX_ID
      to every secondary index page, even though it is only needed on leaf
      pages. From now on we will write PAGE_MAX_TRX_ID as 0 to non-leaf pages,
      just to be able to keep stricter debug assertions.
      
      btr_root_raise_and_insert(): Reset the PAGE_MAX_TRX_ID field on non-root
      pages of the clustered index, and on the no-longer-leaf root page of
      secondary indexes.
      
      AbstractCallback::is_root_page(): Remove. Use page_is_root() instead.
      
      PageConverter::update_index_page(): Reset the PAGE_MAX_TRX_ID to 0
      on other pages than the clustered index root page or secondary index
      leaf pages.
      d0ef1aaf
    • Jacob Mathew's avatar
      MDEV-10355 Weird error message upon CREATE TABLE with DEFAULT · 0b52b28b
      Jacob Mathew authored
      Fixed handling of default values with cached temporal functions so that the
      CREATE TABLE statement now succeeds.
      Fixed virtual column session cleanup.
      Fixed the error message.
      Added quoting of date/time values in cases when this was omitted.
      Added a test case in default.test.
      Updated test result files.
      0b52b28b
  8. 17 Apr, 2017 3 commits