1. 24 Mar, 2020 1 commit
    • seppo's avatar
      MDEV-21473 conflicts with async slave BF aborting (#1475) · 5918b170
      seppo authored
      If async slave thread (slave SQL handler), becomes a BF victim, it may occasionally happen that rollbacker thread is used to carry out the rollback instead of the async slave thread.
      This can happen, if async slave thread has flagged "idle" state when BF thread tries to figure out how to kill the victim.
      The issue was possible to test by using a galera cluster as slave for external master, and issuing high load of conflicting writes through async replication and directly against galera cluster nodes.
      However, a deterministic mtr test for the "conflict window" has not yet been worked on.
      
      The fix, in this patch makes sure that async slave thread state is never set to IDLE. This prevents the rollbacker thread to intervene.
      The wsrep_query_state change was refactored to happen by dedicated function to make controlling the idle state change in one place.
      5918b170
  2. 23 Mar, 2020 6 commits
  3. 21 Mar, 2020 4 commits
  4. 20 Mar, 2020 10 commits
    • Eugene Kosov's avatar
      InnoDB: reduce size of dtuple_t · 45973ec6
      Eugene Kosov authored
      Making a linked list of dtuple_t is needed only for inserting
      records. It's better to store tuples in a non-intrusive
      container to not affect all other use cases of dtuple_t
      
      dtuple_t::tuple_list: removed, it was 2 * sizeof(void*) bytes
      
      ins_node_t::entry_list: now it's std::vector<dtuple_t*>
      
      ins_node_t::entry: now it's std::vector<dtuple_t*>::iterator
      
      DBUG_EXECUTE_IF("row_ins_skip_sec": this dead code removed
      45973ec6
    • Eugene Kosov's avatar
      correct comment in buf_page_is_corrupted() · 54b2da95
      Eugene Kosov authored
      54b2da95
    • Eugene Kosov's avatar
      st_::span fixes · 1f53335d
      Eugene Kosov authored
      move span.h to a proper place to make it available for the whole server
      
      Reformat it.
      
      Constuctors from a contigous container are fixed
      to use cont.data() instead of cont.begin()
      
      span<>::index_type is replaced with span<>::size_type
      1f53335d
    • Eugene Kosov's avatar
      remove fishy reinterpret_cast from buf_page_is_zeroes() · 884d22f2
      Eugene Kosov authored
      In my micro-benchmarks memcmp(4196) 3 times faster than old
      implementation. Also, it's generally better to use as less
      reinterpret_casts<> as possible.
      
      buf_is_zeroes(): renamed from buf_page_is_zeroes() and
      argument changed to span<> for convenience.
      
      st_::span<T>::const_iterator: fixed
      
      page_zip-verify_checksum(): make argument byte* instead of void*
      884d22f2
    • Igor Babaev's avatar
      MDEV-17177 Crash in Item_func_in::cleanup() for SELECT executed via · 2bde0655
      Igor Babaev authored
                 prepared statement
      
      The method Item_func_in::build_clone() that builds a clone item for an
      Item_func_in item first calls a generic method Item_func::build_item()
      that builds the the clones for the arguments of the Item_func_in item
      to be cloned, creates a copy of the Item_func_in object and attaches the
      clones for the arguments to this copy. Then the method Item_func_in::build_clone()
      makes the copy fully independent on the copied object in order to
      guarantee a proper destruction of the clone. The fact is the copy of the
      Item_func_in object is registered as any other item object and should be
      destructed as any other item object.
      If the method Item_func::build_item fails to build a clone of an argument
      then it returns 0. In this case no copy of the Item_func_in object should
      be created. Otherwise the finalizing actions for this copy would not be
      performed and the copy would remain in a state that would prevent its
      proper destruction.
      
      The code of Item_func_in::build_clone() before this patch created the copy
      of the Item_func_in object before cloning the argument items. If this
      cloning failed the server crashed when trying to destruct the copy item.
      
      The code of Item_row::build_clone() was changed similarly to the code of
      Item_func::build_clone though this code could not cause any problems.
      2bde0655
    • Marko Mäkelä's avatar
      9f7b8625
    • Marko Mäkelä's avatar
      MDEV-21549: Clean up the import/export tests · b034d708
      Marko Mäkelä authored
      Remove CREATE/DROP database.
      
      Remove some unnecessary suppressions, replacements, and
      SQL statements.
      
      Populate tables via have_sequence.inc to avoid the creation of
      explicit InnoDB record locks in INSERT...SELECT. This will remove
      some gaps in AUTO_INCREMENT values.
      b034d708
    • Marko Mäkelä's avatar
      MDEV-21549 IMPORT TABLESPACE fails to adjust all tablespace ID in root pages · b8b3edff
      Marko Mäkelä authored
      After MDEV-12353, the consistency check that I originally added for
      commit 1b9fe0bb
      (InnoDB Plugin for MySQL 5.1) started randomly failing.
      
      It turns out that the IMPORT TABLESPACE code was always incorrect:
      it did not update the (redundantly stored) tablespace ID
      in index tree root pages. It only does that for page headers
      and BLOB pointers.
      
      PageConverter::update_index_page(): Update the tablespace ID
      in the BTR_SEG_TOP and BTR_SEG_LEAF of index root pages.
      b8b3edff
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · c9ec1cc7
      Marko Mäkelä authored
      c9ec1cc7
    • Alexander Barkov's avatar
      MDEV-21977 main.func_math fails due to undefined behaviour · 328edf85
      Alexander Barkov authored
      The problem happened in these line:
      
      uval0= (ulonglong) (val0_negative ? -val0 : val0);
      uval1= (ulonglong) (val1_negative ? -val1 : val1);
      
      return check_integer_overflow(val0_negative ? -(longlong) res : res,
                                    !val0_negative);
      
      when unary minus was performed on -9223372036854775808.
      This behavior is undefined in C/C++.
      328edf85
  5. 19 Mar, 2020 5 commits
    • Marko Mäkelä's avatar
      MDEV-21981 Replace arithmetic + with bitwise OR when possible · a66eebf5
      Marko Mäkelä authored
      Several macros such as sint2korr() and uint4korr() are using the
      arithmetic + operator while a bitwise or operator would suffice.
      
      GCC 5 and clang 5 and later can detect patterns consisting of
      bitwise or and shifts by multiples of 8 bits, such as those used
      in the InnoDB function mach_read_from_4(). They actually translate
      that verbose low-level code into high-level machine language
      (i486 bswap instruction or fused into the Haswell movbe instruction).
      
      We should do the same for MariaDB Server code that is outside InnoDB.
      
      Note: The Microsoft C compiler is lacking this optimization.
      There, we might consider using _byteswap_ushort(), _byteswap_ulong(),
      _byteswap_uint64(). But, those would lead to unaligned reads, which are
      bad for reasons stated in MDEV-20277. Besides, outside InnoDB,
      most data is already being stored in the native little-endian format
      of that compiler.
      a66eebf5
    • Marko Mäkelä's avatar
      MDEV-21983: Crash on DROP/RENAME TABLE after DISCARD TABLESPACE · 6960e9ed
      Marko Mäkelä authored
      fil_delete_tablespace(): Remove the unused parameter drop_ahi,
      and add the parameter if_exists=false. We want to suppress
      error messages if we know that the tablespace has been discarded.
      
      dict_table_rename_in_cache(): Pass the new parameter to
      fil_delete_tablespace(), that is, do not complain about
      missing tablespace if the tablespace has been discarded.
      
      row_make_new_pathname(): Declare as static.
      
      row_drop_table_for_mysql(): Tolerate !table->data_dir_path
      when the tablespace has been discarded.
      
      row_rename_table_for_mysql(): Skip part of the RENAME TABLE
      when fil_space_get_first_path() returns NULL.
      6960e9ed
    • Marko Mäkelä's avatar
      MDEV-13626: Clean up the buffer pool resizing tests from MySQL 5.7 · 9fd692ae
      Marko Mäkelä authored
      buf_pool_resize(): Simplify the fault injection
      for innodb.buf_pool_resize_oom.
      
      innodb.buf_pool_resize_oom: Use a small buffer pool.
      
      innodb.innodb_buffer_pool_load_now: Make use of the sequence engine,
      to avoid creating explicit InnoDB record locks. Clean up the
      accesses to information_schema.innodb_buffer_page_lru.
      9fd692ae
    • Marko Mäkelä's avatar
    • Marko Mäkelä's avatar
      MDEV-14057: Fix some tests · e28b4b68
      Marko Mäkelä authored
      e28b4b68
  6. 18 Mar, 2020 3 commits
  7. 17 Mar, 2020 4 commits
  8. 16 Mar, 2020 1 commit
  9. 14 Mar, 2020 2 commits
  10. 13 Mar, 2020 4 commits
    • Marko Mäkelä's avatar
      Fix GCC 10.0 -Wstringop-overflow · ed21202a
      Marko Mäkelä authored
      myrg_open(): Reduce the scope of the variable 'end' and
      simplify the code.
      
      For some reason, I got no warning for this code in the 10.2
      branch, only 10.3 or later.
      
      The ENGINE=MERGE is covered by the tests main.merge, main.merge_debug,
      and main.merge-big.
      ed21202a
    • Sujatha's avatar
      MDEV-10047: table-based master info repository · d9d3c222
      Sujatha authored
      Problem:
      =======
      When we upgrade from "mysql" to "mariadb" if slave is using repositories as
      tables their data is completely ignored and no warning is issued in error log.
      
      Fix:
      ===
      "mysql_upgrade" test should check for the presence of data in
      "mysql.slave_master_info" and "mysql.slave_relay_log_info" tables. When tables
      have some data the upgrade script should report a warning which hints users
      that the data in repository tables will be ignored.
      d9d3c222
    • Marko Mäkelä's avatar
      Fix clang 10 warnings · 9f858f38
      Marko Mäkelä authored
      _ma_fetch_keypage(): Correct an assertion that used to always hold.
      Thanks to clang -Wint-in-bool-context for flagging this.
      
      double_to_datetime_with_warn(): Suppress -Wimplicit-int-float-conversion
      by adding a cast. LONGLONG_MAX converted to double will actually be
      LONGLONG_MAX+1.
      9f858f38
    • Marko Mäkelä's avatar
      MDEV-21933 INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES accesses SYS_DATAFILES · 2e8b0c56
      Marko Mäkelä authored
      All tablespace metadata is buffered in fil_system. There is a LRU
      mechanism, but that only controls the opening and closing of
      fil_node_t::handle.
      
      It is much more efficient and less error-prone to access data file names
      by looking up the fil_space_t object rather than by essentially joining
      each row with an access to SYS_DATAFILES via the InnoDB internal SQL parser.
      
      dict_get_first_path(): Declare static. The function may only be needed
      when loading or updating the data dictionary. Also, change a condition
      in order to avoid a bogus GCC 10 -Wstringop-overflow warning for
      mem_strdupl() about len==ULINT_UNDEFINED.
      
      i_s_sys_tablespaces_fill_table(): Do not access other InnoDB internal
      dictionary tables than SYS_TABLESPACES.
      2e8b0c56