1. 04 Nov, 2020 2 commits
    • Marko Mäkelä's avatar
      MDEV-24109 InnoDB hangs with innodb_flush_sync=OFF · 4cbfdeca
      Marko Mäkelä authored
      MDEV-23855 broke the handling of innodb_flush_sync=OFF.
      That parameter is supposed to limit the page write rate
      in case the log capacity is being exceeded and log checkpoints
      are needed.
      
      With this fix, the following should pass:
      ./mtr --mysqld=--loose-innodb-flush-sync=0
      
      One of our best regression tests for page flushing is
      encryption.innochecksum. With innodb_page_size=16k and
      innodb_flush_sync=OFF it would likely hang without this fix.
      
      log_sys.last_checkpoint_lsn: Declare as Atomic_relaxed<lsn_t>
      so that we are allowed to read the value while not holding
      log_sys.mutex.
      
      buf_flush_wait_flushed(): Let the page cleaner perform the flushing
      also if innodb_flush_sync=OFF. After the page cleaner has
      completed, perform a checkpoint if it is needed, because
      buf_flush_sync_for_checkpoint() will not be run if
      innodb_flush_sync=OFF.
      
      buf_flush_ahead(): Simplify the condition. We do not really care
      whether buf_flush_page_cleaner() is running.
      
      buf_flush_page_cleaner(): Evaluate innodb_flush_sync at the low
      level. If innodb_flush_sync=OFF, rate-limit the batches to
      innodb_io_capacity_max pages per second.
      
      Reviewed by: Vladislav Vaintroub
      4cbfdeca
    • Dmitry Shulga's avatar
      7b20aa57
  2. 03 Nov, 2020 9 commits
  3. 02 Nov, 2020 17 commits
    • Marko Mäkelä's avatar
      MDEV-24072 Assertion 'ib_table.n_v_cols' failed in instant_alter_column_possible() · 9e14a2df
      Marko Mäkelä authored
      instant_alter_column_possible(): Relax a too strict debug assertion.
      The existence of an index stub or a corrupted index on virtual columns
      does not imply that virtual columns exist.
      9e14a2df
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · e6290a82
      Marko Mäkelä authored
      e6290a82
    • Marko Mäkelä's avatar
      fixup a593e03d: nullptr · 3fe306c8
      Marko Mäkelä authored
      C++11 is allowed only starting with MariaDB Server 10.4.
      3fe306c8
    • Marko Mäkelä's avatar
      Merge 10.2 into 10.3 · c7f322c9
      Marko Mäkelä authored
      c7f322c9
    • Marko Mäkelä's avatar
      MDEV-22387: Do not violate __attribute__((nonnull)) · 8036d0a3
      Marko Mäkelä authored
      This follows up commit
      commit 94a520dd and
      commit 7c5519c1.
      
      After these changes, the default test suites on a
      cmake -DWITH_UBSAN=ON build no longer fail due to passing
      null pointers as parameters that are declared to never be null,
      but plenty of other runtime errors remain.
      8036d0a3
    • Marko Mäkelä's avatar
      Merge bb-10.2-release into 10.2 · d2fab686
      Marko Mäkelä authored
      d2fab686
    • Marko Mäkelä's avatar
      MDEV-23630 fixup: main.mysqldump result · ff0b6122
      Marko Mäkelä authored
      This was missed in commit d6ea03fa.
      ff0b6122
    • Marko Mäkelä's avatar
      Fix clang -Winconsistent-missing-override · 440d4b28
      Marko Mäkelä authored
      440d4b28
    • Vladislav Vaintroub's avatar
      Windows : require at least VS2019 for MSVC. · 504d4c1f
      Vladislav Vaintroub authored
      This will  avoid some errors on appveyor, due to outdated SDKs.
      504d4c1f
    • Nikita Malyavin's avatar
    • Nikita Malyavin's avatar
      MDEV-22506 Malformed error message for ER_KEY_CONTAINS_PERIOD_FIELDS · e618f7e9
      Nikita Malyavin authored
      Though this is an error message task, the problem was deep in the
      `mysql_prepare_create_table` implementation. The problem is described as
      follows:
      
      1. `append_system_key_parts` was called before
      `mysql_prepare_create_table`, though key name generation was done close to
      the latest stage of the latter.
      2. We can't move `append_system_key_parts` in the end, because system keys
      should be appended before some checks done.
      3. If the checks from `append_system_key_parts` are moved to the end of
      `mysql_prepare_create_table`, then some other inappropriate errors are
      issued. like `ER_DUP_FIELDNAME`.
      
      To have key name specified in error message, name generation should be done
      before the checks, which consequenced in more changes.
      
      The final design for key initialization in `mysql_prepare_create_table`
      follows. The initialization is done in three phases:
      1. Calculate a total number of keys created with respect to keys ignored.
       Allocate KEY* buffer.
      2. Generate unique names; calculate a total number of key parts.
       Make early checks. Allocate KEY_PART_INFO* buffer.
      3. Initialize key parts, make the rest of the checks.
      e618f7e9
    • Nikita Malyavin's avatar
      MDEV-22677 UPDATE crashes on partitioned HEAP table WITHOUT OVERLAPS · a79c6e36
      Nikita Malyavin authored
      `ha_heap::clone` was creating a handler by share's handlerton, which is
      partition handlerton.
      
      handler's handlerton should be used instead.
      
      Here in particular, HEAP handlerton will be used and it will create ha_heap
      handler.
      a79c6e36
    • Nikita Malyavin's avatar
      MDEV-22608 ASAN use-after-poison in TABLE::check_period_overlaps · d9e00770
      Nikita Malyavin authored
      The bug was fixed by MDEV-22599 bugfix, which changed `Field::cmp` call
      to `Field::cmp_prefix` in `TABLE::check_period_overlaps`.
      
      The trick is that `Field_bit::cmp` apparently calls `Field_bit::cmp_key`,
      which condiders an argument an actual pointer to data, which isn't correct
      for `Field_bit`, since it stores data by `bit_ptr`. which is in the
      beginning of the record, and using `ptr` is incorrect (we use it through
      `ptr_in_record` call)
      d9e00770
    • Nikita Malyavin's avatar
      MDEV-22639 Assertion failed in ha_check_overlaps upon multi-table update · afca9768
      Nikita Malyavin authored
      After Sergei's cleanup this assertion is not actual anymore -- we can't
      predict if the handler was used for lookup, especially in multi-update
      scenario.
      
      `position(old_data)` is made earlier in `ha_check_overlaps`, therefore it
      is guaranteed that we compare right refs.
      afca9768
    • Nikita Malyavin's avatar
      MDEV-22714 Assertion failed upon multi-update on table WITHOUT OVERLAPS · d543363f
      Nikita Malyavin authored
      The problem here was that ha_check_overlaps internally uses ha_index_read,
      which in case of fail overwrites table->status. Even though the handlers
      are different, they share a common table, so the value is anyway spoiled.
      This is bad, and table->status is badly designed and overweighted by
      functionality, but nothing can be done with it, since the code related to
      this logic is ancient and it's impossible to extract it with normal effort.
      
      So let's just save and restore the value in ha_update_row before and after
      the checks.
      
      Other operations like INSERT and simple UPDATE are not in risk, since they
      don't use this table->status approach.
      DELETE does not do any unique checks, so it's also safe.
      d543363f
    • Nikita Malyavin's avatar
      Add DBUG_ASSERT in Field::ptr_in_record · 30894fe9
      Nikita Malyavin authored
      1. Subtracting table->record[0] from record is UB (non-contiguous buffers)
      2. It is very popular to use move_field_offset, which changes Field::ptr,
      but leaves table->record[0] unchanged. This makes a ptr_in_record result
      incorrect, since it relies on table->record[0] value.
      The check ensures the result is within the queried record boundaries.
      30894fe9
    • Elena Stepanova's avatar
      95fcd567
  4. 01 Nov, 2020 3 commits
  5. 31 Oct, 2020 3 commits
    • Daniel Black's avatar
      MDEV-23630: mysqldump logically dump system table information · d6ea03fa
      Daniel Black authored
      Add --system={all, users, plugins, udfs, servers, stats, timezones}
      
      This will dump system information from the server in
      a logical form like:
      * CREATE USER
      * GRANT
      * SET DEFAULT ROLE
      * CREATE ROLE
      * CREATE SERVER
      * INSTALL PLUGIN
      * CREATE FUNCTION
      
      "stats" is the innodb statistics tables or EITS and
      these are dumped as INSERT/REPLACE INTO statements
      without recreating the table.
      
      "timezones" is the collection of timezone tables
      which are important to transfer to generate identical
      results on restoration.
      
      Two other options have an effect on the SQL generated by
      --system=all. These are mutually exclusive of each other.
      * --replace
      * --insert-ignore
      
      --replace will include "OR REPLACE" into the logical form
      like:
      * CREATE OR REPLACE USER ...
      * DROP ROLE IF EXISTS (MySQL-8.0+)
      * CREATE OR REPLACE ROLE ...
      * UNINSTALL PLUGIN IF EXISTS (10.4+) ... (before INSTALL PLUGIN)
      * DROP FUNCTION IF EXISTS (MySQL-5.7+)
      * CREATE OR REPLACE [AGGREGATE] FUNCTION
      * CREATE OR REPLACE SERVER
      
      --insert-ignore uses the construct " IF NOT EXISTS" where
      supported in the logical syntax.
      
      'CREATE OR REPLACE USER' includes protection against
      being run as the same user that is importing the mysqldump.
      
      Includes experimental support for dumping mysql-5.7/8.0
      system tables and exporting logical SQL compatible with MySQL.
      
      Updates mysqldump man page, including this information and
      (removing obsolute bug reference)
      
      Reviewed-by: anel@mariadb.org
      d6ea03fa
    • Oleksandr Byelkin's avatar
      Merge branch '10.3' into 10.4 · 80c951ce
      Oleksandr Byelkin authored
      80c951ce
    • Elena Stepanova's avatar
      6d3792a9
  6. 30 Oct, 2020 6 commits
    • Daniel Black's avatar
      MDEV-22974: mysql_native_password make "invalid" valid · 5b779c22
      Daniel Black authored
      Per b9f3f068, mysql_system_tables_data.sql creates
      a mysql_native_password with a salted hash of "invalid" so that `set password`
      will detect a native password can be applied:.
      
      SHOW CREATE USER; diligently uses this value in its output
      generating the SQL:
      
         MariaDB [(none)]> show create user;
      
         +---------------------------------------------------------------------------------------------------+
         | CREATE USER for dan@localhost                                                                     |
         +---------------------------------------------------------------------------------------------------+
         | CREATE USER `dan`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket |
         +---------------------------------------------------------------------------------------------------+
      
      Attempting to execute this before this patch results in:
      
        MariaDB [(none)]>  CREATE USER `dan2`@`localhost` IDENTIFIED VIA mysql_native_password USING 'invalid' OR unix_socket;
        ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
      
      As such, deep the implementation of mysql_native_password we make "invalid" valid (pun intended)
      such that the above create user will succeed. We do this by storing
      "*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE" (credit: Oracle MySQL), that is of an INCORRECT
      length for a scramble.
      
      In native_password_authenticate we check the length of this cached value
      and immediately fail if it is anything other than the scramble length.
      
      native_password_get_salt is only called in the context of set_user_salt, so all setting of native
      passwords to hashed content of 'invalid', quite literally create an invalid password.
      
      So other forms of "invalid" are valid SQL in creating invalid passwords:
      
         MariaDB [(none)]> set password = 'invalid';
         Query OK, 0 rows affected (0.001 sec)
      
         MariaDB [(none)]> alter user dan@localhost IDENTIFIED BY PASSWORD 'invalid';
         Query OK, 0 rows affected (0.000 sec)
      
      closes #1628
      
      Reviewer: serg@mariadb.com
      5b779c22
    • Marko Mäkelä's avatar
      MDEV-24054 Assertion in_LRU_list failed in buf_flush_try_neighbors() · b0ff7916
      Marko Mäkelä authored
      buf_flush_try_neighbors(): Before invoking buf_page_t::ready_for_flush(),
      check that the freshly looked up buf_pool.page_hash entry actually is
      a buffer page and not a buf_pool.watch[] sentinel for purge buffering.
      
      This race condition was introduced in MDEV-15053
      (commit b1ab211d).
      It is rather hard to hit this bug, because
      buf_flush_check_neighbors() already checked the condition.
      The problem exists if buf_pool.watch_set() was invoked for
      a page in the range after the check in buf_flush_check_neighbor()
      had been finished.
      b0ff7916
    • Oleksandr Byelkin's avatar
      Merge branch '10.2' into 10.3 · 794f6651
      Oleksandr Byelkin authored
      794f6651
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · 03357ded
      Marko Mäkelä authored
      03357ded
    • Marko Mäkelä's avatar
      Update Connector/C · 1fddccf6
      Marko Mäkelä authored
      1fddccf6
    • Marko Mäkelä's avatar
      Try to stabilize main.innodb_ext_key,off · 5b3be9e1
      Marko Mäkelä authored
      Thanks to Varun Gupta for suggesting this. This seems to
      make main.innodb_ext_key,off more stable.
      5b3be9e1