1. 26 Nov, 2019 2 commits
    • Aleksey Midenkov's avatar
      MDEV-21127 Assertion in key_text::key_text() · a35427f3
      Aleksey Midenkov authored
      Unsigned type while RHS expression could be less than 0.
      a35427f3
    • Marko Mäkelä's avatar
      MDEV-21133 Optimize access to InnoDB page header fields · 25e2a556
      Marko Mäkelä authored
      Introduce memcpy_aligned<N>(), memcmp_aligned<N>(), memset_aligned<N>()
      and use them for accessing InnoDB page header fields that are known
      to be aligned.
      
      MY_ASSUME_ALIGNED(): Wrapper for the GCC/clang __builtin_assume_aligned().
      Nothing similar seems to exist in Microsoft Visual Studio, and the
      C++20 std::assume_aligned is not available to us yet.
      
      Explicitly specified alignment guarantees allow compilers to generate
      faster code on platforms with strict alignment rules, instead of
      emitting calls to potentially unaligned memcpy(), memcmp(), or memset().
      25e2a556
  2. 25 Nov, 2019 11 commits
    • Vladislav Vaintroub's avatar
      MDEV-16264 - Fix assertion `m_queue.empty() && !m_tasks_running' in tpool::task_group destructor · 86407a59
      Vladislav Vaintroub authored
      This particular assertion happened when shutting down Innodb IO.IO shutdown properly waits for all IOs to finish
      
      
      However there is a race condition -
      right after releasing last IO slot and before decrementing task count
      in group, pending_io_count will be 0, but tasks_running will be 1,
      leading to assertion.
      
      The fix is to make task_group destructor to wait for last running task
      to finish.
      86407a59
    • Sergey Vojtovich's avatar
      Removed tc_purge() and purge_tables() argument · 38c2c16c
      Sergey Vojtovich authored
      It was mistakenly used by tdc_start_shutdown() to make sure TABLE_SHARE
      gets evicted from table definition cache when it becomes unused. However
      same effect is achieved by resetting tdc_size and tc_size.
      
      Part of MDEV-17882 - Cleanup refresh version
      38c2c16c
    • Sergey Vojtovich's avatar
      Removed kill_delayed_threads_for_table() · 092834cd
      Sergey Vojtovich authored
      After 7fb9d649 it is used only by ALTER/DROP SERVER, which most probably
      wasn't intentional as Federated never supported delayed inserts anyway.
      
      If delayed inserts will ever become an issue with ALTER/DROP SERVER, we
      should kill them by acquiring X-lock instead.
      
      Part of MDEV-17882 - Cleanup refresh version
      092834cd
    • Sergey Vojtovich's avatar
      Removed tdc_increment_refresh_version() · 0aa807d1
      Sergey Vojtovich authored
      It is never called after 7fb9d649, which makes the whole refresh version
      infrastructure useless.
      
      Removed:
      - tdc_version_t
      - TDC_VERSION_MAX
      - tdc_version
      - TDC_element::version
      - tdc_increment_refresh_version()
      - tdc_refresh_version()
      - refresh_version argument of tdc_wait_for_old_version()
      - Flush_commands status variable
      - refresh version from COM_STATISTICS
      - refresh version from dbug printouts
      
      Part of MDEV-17882 - Cleanup refresh version
      0aa807d1
    • Aleksey Midenkov's avatar
      Merge 10.4 into 10.5 · 0c05a2ed
      Aleksey Midenkov authored
      0c05a2ed
    • Vladislav Vaintroub's avatar
      Fix shutdown hang in dict_stats , caused by MDEV-16264 · 7c7f9bef
      Vladislav Vaintroub authored
      dict_stats_shutdown() can hang, waiting for timer callback to finish.
      This happens because locks the same mutex, which can also used inside
      timer callback, within dict_stats_schedule() function.
      
      Fix is to make dict_stats_schedule() use mutex.try_lock() instead of
      mutex.lock().
      
      In the unlikely case of simultaneous dict_stats_schedule() setting
      different timer delays, now the first one would win, which is fine.
      Important is that shutdown won't hang.
      7c7f9bef
    • Marko Mäkelä's avatar
      MDEV-20190 Instant operation fails when add column and collation change on non-indexed column · f9ceb0a6
      Marko Mäkelä authored
      We must relax too strict debug assertions. For latin1_swedish_ci,
      mtype=DATA_CHAR or mtype=DATA_VARCHAR will be used instead of
      mtype=DATA_MYSQL or mtype=DATA_VARMYSQL. Likewise, some changes of
      dtype_get_charset_coll() do not affect the data type encoding,
      but only any indexes that are defined on the column.
      
      Charset::same_encoding(): Check whether two charset-collations have
      the same character set encoding.
      
      dict_col_t::same_encoding(): Check whether two character columns
      have the same character set encoding.
      
      dict_col_t::same_type(): Check whether two columns have a compatible
      data type encoding.
      
      dict_col_t::same_format(), dict_table_t::instant_column(): Do not
      compare mtype or the charset-collation of prtype directly.
      Rely on dict_col_t::same_type() instead.
      
      dtype_get_charset_coll(): Narrow the return type to uint16_t.
      
      This is a refined version of a fix that was developed by
      Thirunarayanan Balathandayuthapani.
      f9ceb0a6
    • Aleksey Midenkov's avatar
      Merge 10.3 into 10.4 · a34c34d9
      Aleksey Midenkov authored
      a34c34d9
    • Aleksey Midenkov's avatar
      MDEV-18727 improve DML operation of System Versioning (10.4) · 33f55789
      Aleksey Midenkov authored
      UPDATE, DELETE: replace linear search of current/historical records
      with vers_setup_conds().
      
      Additional DML cases in view.test
      33f55789
    • seppo's avatar
      MDEV-21096 async slave crash with gtid_log_pos table access (#1413) · 4111a530
      seppo authored
      The original crash happened when async replication IO thread was updating mysql.gtid_slave_pos table. Operations on this table should remain node local, but it appears that protection (THD::wsrep_ignore_table flag) to prevent wsrep replication for this table mas missing for innodb write_row() and update_row().
      It was somewhat difficult to reproduce the issue, because mtr seems to create the affected table mysql.gtid_log_pos as of Aria engine type, and Aria engine operations will not be replicated anyhow. It looks, though, that in release installation, mysql.gtid_slave_pos table is of InnoDB engine.
      It was possible to trigger somewhat related problem by running test galera.galera_as_slave_gtid with configuration: gtid_pos_auto_engines=InnoDB. However, this test mode, causes earlier crash when replication background thread creates aditional table: mysql.gtid_slave_pos_InnoDB, and this table create triggered wsrep TOI replication, which also failed for assertion. Actually, async replication IO and background threads should not replicate anything to cluster.
      
      This pull request contains new test galera.galera_as_slave_gtid_auto_engine, which basically just runs galera.galera_as_slave_gtid with configuration of gtid_pos_auto_engines=InnoDB.
      Test galera.galera_as_slave_gtid is also modified for better code reuse.
      Actual fix for MDEV-21096 is in storage/innobase/handler/ha_innodb.cc, where THD::wsrep_ignore_table flag is now honored before wsrep key population.
      There is additional fix in sql/service_wsrep.cc where async replication IO and background threads are marked as non-local. This fences these threads out of wsrep replication altogether. Note that this change, actually makes the use of THD::wsrep_ignore-table redundant. We may want to refactor THD::wsrep_ignore_table out in the future, if there is no other use case for it in sight.
      4111a530
    • Marko Mäkelä's avatar
      MDEV-21132 Remove buf_page_t::newest_modification · 312569e2
      Marko Mäkelä authored
      At each mini-transaction commit, the log sequence number of the
      mini-transaction must be written to each modified page, so that
      it will be available in the FIL_PAGE_LSN field when the page is
      being read in crash recovery.
      
      InnoDB was unnecessarily allocating redundant storage for the
      field, in buf_page_t::newest_modification. Let us access
      FIL_PAGE_LSN directly.
      
      Furthermore, on ALTER TABLE...IMPORT TABLESPACE, let us write
      0 to FIL_PAGE_LSN instead of using log_sys.lsn.
      
      buf_flush_init_for_writing(), buf_flush_update_zip_checksum(),
      fil_encrypt_buf_for_full_crc32(), fil_encrypt_buf(),
      fil_space_encrypt(): Remove the parameter lsn.
      
      buf_page_get_newest_modification(): Merge with the only caller.
      
      buf_tmp_reserve_compression_buf(), buf_tmp_page_encrypt(),
      buf_page_encrypt(): Define static in the same compilation unit
      with the only caller.
      
      PageConverter::m_current_lsn: Remove. Write 0 to FIL_PAGE_LSN
      on ALTER TABLE...IMPORT TABLESPACE.
      312569e2
  3. 23 Nov, 2019 1 commit
    • Igor Babaev's avatar
      MDEV-19919 Assertion `!prebuilt->index->is_primary()' failed · f9528821
      Igor Babaev authored
                 in row_search_idx_cond_check
      
      For a single table query with ORDER BY and several sargable range
      conditions the optimizer may choose an execution plan that employs
      a rowid filter. In this case it is important to build the filter before
      calling the function JOIN_TAB::sort_table() that creates sort index
      for the result set, because when this is index created the filter has
      to be already filled. After the sort index has been created the
      filter must be deactivated. If not to do this the innodb function
      row_search_idx_cond_check() is getting confused when it has to read rows
      from the created sort index by using ha_rnd_pos().
      The order of actions mentioned above is needed also when processing a
      join query if sorting is performed for the first non constant table in
      the chosen execution plan.
      f9528821
  4. 22 Nov, 2019 6 commits
  5. 21 Nov, 2019 2 commits
  6. 20 Nov, 2019 11 commits
  7. 19 Nov, 2019 5 commits
  8. 18 Nov, 2019 2 commits
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 589a1235
      Marko Mäkelä authored
      589a1235
    • Marko Mäkelä's avatar
      MDEV-13564 follow-up: Remove unused code · 39d8652c
      Marko Mäkelä authored
      DropIndex, CreateIndex: Remove. The file row0trunc.cc only exists
      in MariaDB Server 10.3 so that the crash recovery of TRUNCATE TABLE
      operations from older 10.2 and 10.3 servers will work. This dead code
      was being used for implementing the MySQL 5.7 WL#6501 TRUNCATE TABLE
      that was replaced with a backup-safe implementation in MDEV-13564.
      39d8652c