1. 29 Aug, 2019 5 commits
    • Marko Mäkelä's avatar
      MDEV-20149 innodb.innodb-system-table-view fails with wrong result · d58437d1
      Marko Mäkelä authored
      The test occasionally fails with different table reference count
      due to purge activity after INSERT operations (MDEV-12288).
      Wait for purge before accessing dict_table_t::n_ref_count.
      d58437d1
    • Marko Mäkelä's avatar
      After-merge fix · d4246e25
      Marko Mäkelä authored
      Merge a part of commit 25af2a18.
      This was forgotten in the
      merge commit e41eb044.
      d4246e25
    • Marko Mäkelä's avatar
      MDEV-20425 Implement Boolean debug build option debug_assert · e50b2bdb
      Marko Mäkelä authored
      Commit 536215e3 in MariaDB Server 10.3.1
      introduced the compiler flag (not cmake option) DBUG_ASSERT_AS_PRINTF
      that converts DBUG_ASSERT in non-debug builds into printouts.
      
      For debug builds, it could be useful to be able to convert DBUG_ASSERT
      into a warning or error printout, to allow execution to continue.
      This would allow debug builds to be used for reproducing hard failures
      that occur with release builds.
      
      my_assert: A Boolean flag (set by default), tied to the new option
      debug_assert that is available on debug builds only.
      When set, DBUG_ASSERT() will invoke assert(), like it did until now.
      When unset, DBUG_ASSERT() will invoke fprintf(stderr, ...)
      with the file name, line number and assertion expression.
      e50b2bdb
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 1a3c3659
      Marko Mäkelä authored
      1a3c3659
    • Marko Mäkelä's avatar
      Clean up innodb.innodb-read-view · 5e9b3419
      Marko Mäkelä authored
      5e9b3419
  2. 28 Aug, 2019 7 commits
    • Marko Mäkelä's avatar
      Remove a bogus comment · 2842ae03
      Marko Mäkelä authored
      Changes of PAGE_MAX_TRX_ID must be redo-logged for correctness.
      That was fixed in the InnoDB Plugin for MySQL 5.1 already.
      2842ae03
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 5f35e103
      Marko Mäkelä authored
      5f35e103
    • Julius Goryavsky's avatar
      Improved handling of subdirectories in the xtrabackup-v2 SST scripts (similar... · 4ba20e0a
      Julius Goryavsky authored
      Improved handling of subdirectories in the xtrabackup-v2 SST scripts (similar to MDEV-18863) for more predictable test results (related to xtrabackup-v2 SST)
      4ba20e0a
    • Oleksandr Byelkin's avatar
      MDEV-16932: ASAN heap-use-after-free in my_charlen_utf8 /... · 9cd6e7ad
      Oleksandr Byelkin authored
      MDEV-16932: ASAN heap-use-after-free in my_charlen_utf8 / my_well_formed_char_length_utf8 on 2nd execution of SP with ALTER trying to add bad CHECK
      
      Make automatic name generation during execution (not prepare).
      
      Check result of memory allocation operation.
      9cd6e7ad
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · e41eb044
      Marko Mäkelä authored
      e41eb044
    • Eugene Kosov's avatar
      fix clang warnings · d4866c7d
      Eugene Kosov authored
      d4866c7d
    • Marko Mäkelä's avatar
      Implement innodb_evict_tables_on_commit_debug · 947b0b57
      Marko Mäkelä authored
      Some bugs are detected only after a table definition has been evicted
      and then reloaded to the InnoDB data dictionary cache.
      
      For debug builds, introduce the settable Boolean configuration parameter
      innodb_evict_tables_on_commit_debug that can be set to request InnoDB
      to attempt to evict table definitions from the data dictionary cache
      whenever a transaction is committed.
      
      This has been tested on 10.3 and 10.4 with the following:
      
      ./mysql-test-run.pl --mysqld=--loose-innodb-evict-tables-on-commit-debug
      
      You can also use the following:
      
      SET GLOBAL innodb_evict_tables_on_commit_debug=ON;
      SET GLOBAL innodb_evict_tables_on_commit_debug=OFF;
      
      The parameter affects the commit (or rollback or abort) of
      transactions that have modified persistent InnoDB tables.
      947b0b57
  3. 27 Aug, 2019 5 commits
    • Marko Mäkelä's avatar
      MDEV-13626: Add innodb.innodb-read-view · 7aac8358
      Marko Mäkelä authored
      7aac8358
    • Marko Mäkelä's avatar
      MDEV-15326/MDEV-16136 dead code removal · 25af2a18
      Marko Mäkelä authored
      Revert part of fa2a74e0.
      
      trx_reference(): Remove, and merge the relevant part to the only caller
      trx_rw_is_active(). If the statements trx = NULL; were ever executed,
      the function would have dereferenced a NULL pointer and crashed in
      trx_mutex_exit(trx). Hence, those statements must have been unreachable,
      and they can be replaced with debug assertions.
      
      trx_rw_is_active(): Avoid unnecessary acquisition and release of trx->mutex
      when do_ref_count=false.
      
      lock_trx_release_locks(): Do not reset trx->id=0. Had the statement been
      necessary, we would have experienced crashes in trx_reference().
      25af2a18
    • Sujatha's avatar
      MDEV-19925: Column ... cannot be converted from type 'varchar(20)' to type 'varchar(20)' · e7b71e0d
      Sujatha authored
      Cherry picking:
      Bug#25135304: RBR: WRONG FIELD LENGTH IN ERROR MESSAGE
      commit 47bd3f7cf3c8518f62b1580ec65af2ba7ac13b95
      
      Description:
      ============
      In row based replication, when replicating from a table with a field with
      character set set to UTF8mb3 to the same table with the same field set to
      character set UTF8mb4 I get a confusing error message:
      
      For VARCHAR: VARCHAR(1) 'utf8mb3' to VARCHAR(1) 'utf8mb4'
      "Column 0 of table 'test.t1' cannot be converted from type 'varchar(3)' to
      type 'varchar(1)'"
      
      Similar issue with CHAR type as well.
      
      Issue with respect to BLOB types:
      
      For BLOB: LONGBLOB to TINYBLOB - Error message displays incorrect blob type.
      "Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type
      'tinyblob'"
      
      For BINARY to BINARY - Error message displays incorrect type for master side
      field.
      "Column 0 of table 'test.t' cannot be converted from type 'char(1)' to type
      'binary(10)'"
      Similar issue exists for VARBINARY type. It is displayed as 'VARCHAR'.
      
      Analysis:
      =========
      In Row based replication charset information is not sent as part of metadata
      from master to slave.
      
      For VARCHAR field its character length is converted into equivalent
      octets/bytes and stored internally. At the time of displaying the data to user
      it is converted back to original character length.
      
      For example:
      VARCHAR(2)- utf8mb3 is stored as:2*3 = VARCHAR(6)
      At the time of displaying it to user
      VARCHAR(6)- charset utf8mb3:6/3= VARCHAR(2).
      
      At present the internally converted octect length is sent from master to slave
      with out providing the charset information. On slave side if the type
      conversion fails 'show_sql_type' function is used to get the type specific
      information from metadata. Since there is no charset information is available
      the filed type is displayed as VARCHAR(6).
      
      This results in confused error message.
      
      For CHAR fields
      CHAR(1)- utf8mb3 - CHAR(3)
      CHAR(1)- utf8mb4 - CHAR(4)
      
      'show_sql_type' function which retrieves type information from metadata uses
      (bytes/local charset length) to get actual character length. If slave's chaset
      is 'utf8mb4' then
      
      CHAR(3/4)-->CHAR(0)
      CHAR(4/4)-->CHAR(1).
      
      This results in confused error message.
      
      Analysis for BLOB type issue:
      
      BLOB's length is represented in two forms.
      1. Actual length
      i.e
        (length < 256) type= MYSQL_TYPE_TINY_BLOB;
        (length < 65536) type= MYSQL_TYPE_BLOB; ...
      
      2. packlength - The number of bytes used to represent the length of the blob
        1- tinyblob
        2- blob ...
      
      In row based replication only the packlength is written in the binary log. On
      the slave side this packlength is interpreted as actual length of the blob.
      Hence the length is always < 256 and the type is displayed as tiny blob.
      
      Analysis for BINARY to BINARY type issue:
      The character set information is needed to identify a filed's type as char or
      binary. Since master side character set information is not available on the
      slave side both binary and char fields are displayed as char.
      
      Fix:
      ===
      For CHAR and VARCHAR fields display their length in octets for both source and
      target fields. For target field display the charset information if it is
      relevant.
      
      For blob type changed the code to use the packlength and display appropriate
      blob type in error message.
      
      For binary and varbinary fields use the slave side character set as reference
      to map them to binary or varbinary fields.
      e7b71e0d
    • Jan Lindström's avatar
      f6087137
    • Alexander Barkov's avatar
      MDEV-19699 Server crashes in Item_null_result::field_type upon SELECT with ROLLUP on constant table · 29bbf474
      Alexander Barkov authored
      Also fixes:
      
      MDEV-20431 GREATEST(int_col,date_col) returns wrong results in a view
      29bbf474
  4. 26 Aug, 2019 4 commits
    • Julius Goryavsky's avatar
      MDEV-20420: SST failed after MDEV-18863 in some test configurations · de0f93fb
      Julius Goryavsky authored
      After applying MDEV-18863, in some test configurations, SST
      may fails due to duplication of some parameters (in particular
      "--port") in the main part of the command line and after
      "--mysqld-args", as well as due to incorrect interpretation
      of the parameter "--port" passed after "--mysqld-args" when
      the SST script is invoked without explicitly specifying a port
      for SST. In addition, it is necessary to correctly handle spaces,
      quotation marks and special characters when copying original
      arguments from the argv[] array to a new command line (after
      "--mysqld-args"). This patch resolves these shortcomings.
      de0f93fb
    • Vladislav Vaintroub's avatar
      9bf424bc
    • Vladislav Vaintroub's avatar
      MTR : improve detection of handles.exe on Windows. · 202243d5
      Vladislav Vaintroub authored
      Depending on version, "handle.exe -?" can output either "Handle v4.0"
      or "Nthandle v4.1"
      202243d5
    • Sujatha's avatar
      MDEV-20188: binlog.binlog_stm_drop_tmp_tbl fails in buildbot with Unknown table on exec · 4a9fb905
      Sujatha authored
      Analysis:
      ========
      As part of BUG#28642318 fix, two new test cases were added. The first test
      case tests a scenario where two sessions are present, in which the first
      session has a regular table named 't1' and another session has a temporary
      table named 't1'. Test executes a DELETE statement on regular table. These
      statements are captured from binary log and replayed back on new client
      connection to prove that DELETE statement is applied successfully. Note that
      the binlog contains only CREATE TEMPORARY TABLE part hence a temporary table
      gets created in new connection. This replaying logic is implemented by using
      '--exec $MYSQL' command. If the new connection gets disconnected within the
      scope of first test case the test passes, i.e the temporary table gets dropped
      as part thread cleanup. But on slow platforms the connection gets closed at
      the time of execution of test case 2. When the temporary table is dropped as
      part thread cleanup a "DROP TEMPORARY TABLE t1" is written into the binary
      log. In test case two the same sessions continue to exist and and table names
      are reused to test a new bug scenario. The additional "DROP TEMPORARY TABLE"
      command drops second test specific tables which results in "Unknown table"
      error.
      
      Fix:
      ====
      Rename the second case specific table to 't2'. Even if the close connection
      from test case one happens later the drop command with has
      'DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`' will not result in an error.
      4a9fb905
  5. 22 Aug, 2019 2 commits
  6. 21 Aug, 2019 9 commits
    • Aleksey Midenkov's avatar
      MDEV-17613 MIN/MAX Optimization (Select tables optimized away) does not work · b96e4424
      Aleksey Midenkov authored
      Current easy fix is not possible, because SELECT clones ha_partition
      and then closes the clone which leads to unclosed transaction in
      partitions we forcely prune out. We cound solve this by closing these
      partitions (and release from transaction) in
      change_partitions_to_open() at versioning conditions stage, but this
      is problematic because table lock is acquired for each partition at
      open stage and therefore must be released when we close partition
      handler in change_partitions_to_open(). More details in MDEV-20376.
      
      This should change after MDEV-20250 where mechanism of opening
      partitions will be improved.
      
      This reverts commit cdbac54d.
      b96e4424
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · 32ec5fb9
      Marko Mäkelä authored
      32ec5fb9
    • Julius Goryavsky's avatar
      94e6a4fa
    • Aleksey Midenkov's avatar
      MDEV-19740 Debug build of 10.3.15 FTBFS · e8de75db
      Aleksey Midenkov authored
      Fix debug build failing with error:
      
      extended initializer lists only available with -std=c++11 or -std=gnu++11
      e8de75db
    • Marko Mäkelä's avatar
      MDEV-17187 table doesn't exist in engine after ALTER of FOREIGN KEY · 9de2e60d
      Marko Mäkelä authored
      ha_innobase::open(): Always ignore problems with FOREIGN KEY constraints
      (pass DICT_ERR_IGNORE_FK_NOKEY), no matter whether foreign_key_checks
      is enabled. Instead, we must report errors when enforcing the FOREIGN KEY
      constraints. As a result of ignoring these errors, the tables will be
      loaded with dict_foreign_t objects whose foreign_index or referenced_index
      will be NULL.
      
      Also, pass DICT_ERR_IGNORE_FK_NOKEY instead of DICT_ERR_IGNORE_NONE
      to dict_table_open_on_id_low() in many other cases. Notably, on
      CREATE TABLE and ALTER TABLE, we will keep validating the FOREIGN KEY
      constraints as before.
      
      dict_table_open_on_name(): If no other flags than
      DICT_ERR_IGNORE_FK_NOKEY are set, refuse access to unreadable tables.
      Some encryption tests rely on this code path.
      
      For the DML code path, we used to have the problem that when
      one of the indexes was missing in dict_foreign_t, we would ignore
      the FOREIGN KEY constraint altogether. The following changes
      address that.
      
      row_ins_check_foreign_constraints(): Add the parameter pk.
      For the primary key, consider also foreign key constraints for which
      foreign->foreign_index=NULL (no underlying index is available).
      
      row_ins_check_foreign_constraint(): Report errors also for !check_ref.
      Remove a redundant check for srv_read_only_mode.
      
      row_ins_foreign_report_add_err(): Tolerate foreign->foreign_index=NULL.
      9de2e60d
    • Marko Mäkelä's avatar
      MDEV-17187: Code cleanup · e279c007
      Marko Mäkelä authored
      fkerr_t: Errors for the foreign key checks. Replaces ulint,
      which used #define that looked like dberr_t literals.
      
      wsrep_dict_foreign_find_index(): Remove. Use
      dict_foreign_find_index() instead, with default parameters.
      
      dict_foreign_push_index_error(): Do not add redundant quotes
      around quoted table names.
      e279c007
    • Marko Mäkelä's avatar
    • Anel Husakovic's avatar
    • Jan Lindström's avatar
      MDEV-19968: Galera test failure on galera_load_data · 1a3c77e5
      Jan Lindström authored
      Add wait conditions and compare cardinality etc information
      between nodes and print something only if they differ.
      1a3c77e5
  7. 20 Aug, 2019 8 commits