1. 23 Jun, 2022 3 commits
  2. 22 Jun, 2022 3 commits
    • Marko Mäkelä's avatar
      MDEV-18976 fixup: encryption.innodb-redo-badkey · 0f0a45b2
      Marko Mäkelä authored
      When attempting to recover a database with an incorrect encryption key,
      the unencrypted page contents should be expected to differ from what
      was written before recovery. Let us suppress some more messages.
      This caused intermittent failures, depending on when the latest
      log checkpoint was triggered.
      0f0a45b2
    • Marko Mäkelä's avatar
      MDEV-22388 Corrupted undo log record leads to server crash · 6f4d0659
      Marko Mäkelä authored
      trx_undo_rec_copy(): Return nullptr if the undo record is corrupted.
      
      trx_undo_rec_get_undo_no(): Define inline with the declaration.
      
      trx_purge_dummy_rec: Replaced with a -1 pointer.
      
      row_undo_rec_get(), UndorecApplier::apply_undo_rec(): Check
      if trx_undo_rec_copy() returned nullptr.
      
      trx_purge_get_next_rec(): Return nullptr upon encountering any
      corruption, to signal the end of purge.
      6f4d0659
    • Marko Mäkelä's avatar
      MDEV-28836 fixup · 0fa19fde
      Marko Mäkelä authored
      On GNU/Linux, even though the C11 aligned_alloc() appeared in
      GNU libc early on, some custom memory allocators did not
      implement it until recently. For example, before
      gperftools/gperftools@d406f2285390c402e824dd28e6992f7f890dcdf9
      the free() in tcmalloc would fail to free memory that was
      returned by aligned_alloc(), because the latter would map to the
      built-in allocator of libc. The Linux specific memalign() has a
      similar interface and is safer to use, because it has been
      available for a longer time. For AddressSanitizer, we will use
      aligned_alloc() so that the constraint on size can be enforced.
      
      buf_tmp_reserve_compression_buf(): When HAVE_ALIGNED_ALLOC holds,
      round up the size to be an integer multiple of the alignment.
      
      pfs_malloc(): In the unit test stub, round up the size to be an
      integer multiple of the alignment.
      0fa19fde
  3. 21 Jun, 2022 4 commits
    • Marko Mäkelä's avatar
      MDEV-28836: Memory alignment cleanup · 37946731
      Marko Mäkelä authored
      Table_cache_instance: Define the structure aligned at
      the CPU cache line, and remove a pad[] data member.
      Krunal Bauskar reported this to improve performance on ARMv8.
      
      aligned_malloc(): Wrapper for the Microsoft _aligned_malloc()
      and the ISO/IEC 9899:2011 <stdlib.h> aligned_alloc().
      Note: The parameters are in the Microsoft order (size, alignment),
      opposite of aligned_alloc(alignment, size).
      Note: The standard defines that size must be an integer multiple
      of alignment. It is enforced by AddressSanitizer but not by GNU libc
      on Linux.
      
      aligned_free(): Wrapper for the Microsoft _aligned_free() and
      the standard free().
      
      HAVE_ALIGNED_ALLOC: A new test. Unfortunately, support for
      aligned_alloc() may still be missing on some platforms.
      We will fall back to posix_memalign() for those cases.
      
      HAVE_MEMALIGN: Remove, along with any use of the nonstandard memalign().
      
      PFS_ALIGNEMENT (sic): Removed; we will use CPU_LEVEL1_DCACHE_LINESIZE.
      
      PFS_ALIGNED: Defined using the C++11 keyword alignas.
      
      buf_pool_t::page_hash_table::create(),
      lock_sys_t::hash_table::create():
      lock_sys_t::hash_table::resize(): Pad the allocation size to an
      integer multiple of the alignment.
      
      Reviewed by: Vladislav Vaintroub
      37946731
    • Marko Mäkelä's avatar
      MDEV-28870 InnoDB: Missing FILE_CREATE, FILE_DELETE or FILE_MODIFY before FILE_CHECKPOINT · 2e43af69
      Marko Mäkelä authored
      There was a race condition between log_checkpoint_low() and
      deleting or renaming data files. The scenario is as follows:
      
      1. The buffer pool does not contain dirty pages.
      2. A FILE_DELETE or FILE_RENAME record is written.
      3. The checkpoint LSN will be moved ahead of the write of the record.
      4. The server is killed before the file is actually renamed or deleted.
      
      We will prevent this race condition by ensuring that a log checkpoint
      cannot occur between the durable write and the file system operation:
      
      1. Durably write the FILE_DELETE or FILE_RENAME record.
      2. Perform the file system operation.
      3. Allow any log checkpoint to proceed.
      
      mtr_t::commit_file(): Implement the DELETE or RENAME logic.
      
      fil_delete_tablespace(): Delegate some of the logic to
      mtr_t::commit_file().
      
      fil_space_t::rename(): Delegate some logic to mtr_t::commit_file().
      Remove the debug injection point fil_rename_tablespace_failure_2
      because we do test RENAME failures without any debug injection.
      
      fil_name_write_rename_low(), fil_name_write_rename(): Remove.
      
      Tested by Matthias Leich
      2e43af69
    • Marko Mäkelä's avatar
      MDEV-28845 fixup: Prevent an infinite loop · 55f02c24
      Marko Mäkelä authored
      buf_page_create_low(): Before retrying, release the exclusive page latch
      in order to prevent an infinite loop in buf_pool_t::corrupted_evict().
      55f02c24
    • Marko Mäkelä's avatar
      MDEV-28782 fixup: ./mtr --embedded · 3b662c6e
      Marko Mäkelä authored
      3b662c6e
  4. 17 Jun, 2022 1 commit
  5. 16 Jun, 2022 2 commits
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · 5bb90cb2
      Marko Mäkelä authored
      5bb90cb2
    • Marko Mäkelä's avatar
      MDEV-28864 Assertion `trx_id <= create_id' failed in innodb_check_version() · e99ba4ac
      Marko Mäkelä authored
      ha_innobase::prepare_inplace_alter_table(): If the ALTER TABLE
      operation is no-op for InnoDB, do reset m_prebuilt->trx_id
      so that ha_innobase::table_version() will always report either 0
      or the identifier of the transaction that would commit changes
      to the InnoDB data dictionary.
      
      The failure scenario involved a completed DROP INDEX followed by
      a no-op ALTER TABLE during which the server was killed.
      An effort to create a reproducible test failed.
      e99ba4ac
  6. 15 Jun, 2022 4 commits
    • Monty's avatar
      MDEV-28858 Wrong result with table elimination combined with not_null_range_scan · 674842be
      Monty authored
      The bug was that build_notnull_conds_for_range_scans() did not take into
      account the join_tab is not yet sorted with constant tables first.
      Fixed the bug by testing explicitely if a table is a const table.
      674842be
    • Marko Mäkelä's avatar
      MDEV-28845 InnoDB: Failing assertion: bpage->can_relocate() in buf0lru.cc · 253806df
      Marko Mäkelä authored
      Since commit 0b47c126 (MDEV-13542)
      we treat all-zero pages as corrupted ones.
      
      During a stress test, a read-ahead of an all-zero page was triggered
      and the page read was completed concurrently with buf_page_create_low().
      This caused the assertion to fail, because buf_page_create_low() was
      waiting for the page latch.
      
      buf_page_get_low(): Only invoke buf_pool_t::corrupted_evict()
      if the block was not already marked as corrupted.
      
      buf_page_create_low(): On page identifier mismatch, retry the
      buf_pool.page_hash lookup.
      
      buf_pool_t::corrupted_evict(): Set the state of the block to FREED
      so that a concurrent buf_page_get_low() will refuse to load the page.
      Wait for the page latch to be vacant before proceeding to remove
      the block from buf_pool.page_hash and buf_pool.LRU.
      
      page_id_t::set_corrupted(), page_id_t::is_corrupted(): Accessors
      for indicating a corrupted page identifier.
      
      Tested by Matthias Leich
      253806df
    • Marko Mäkelä's avatar
      MDEV-13542 fixup: Relax an assertion · 0850267d
      Marko Mäkelä authored
      0850267d
    • Vlad Lesin's avatar
      MDEV-28832 infinite loop in mariabackup if log LOG_HEADER_FORMAT field is 0 · 27309fc6
      Vlad Lesin authored
      Avoid the loop with getting rid of back and forth jumping.
      27309fc6
  7. 14 Jun, 2022 4 commits
  8. 13 Jun, 2022 4 commits
    • Nayuta Yanagisawa's avatar
      MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing... · 06e9ce79
      Nayuta Yanagisawa authored
      MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION
      
      During rebuild of partition, the partitioning engine calls
      alter_close_table(), which does not unlock and close some table
      instances of the target table.
      Then, the engine fails to rename partitions because there are table
      instances that are still locked.
      
      Closing all the table instance of the target table fixes the bug.
      06e9ce79
    • Marko Mäkelä's avatar
      MDEV-28802 DROP DATABASE in InnoDB still is case-insensitive · 1f3f4571
      Marko Mäkelä authored
      innodb_drop_database(): Use explicit TO_BINARY casts on
      SYS_TABLES.NAME, which for historical reasons uses the wrong collation
      latin1_swedish_ci instead of BINARY.
      1f3f4571
    • Monty's avatar
      65dd3108
    • Tuukka Pasanen's avatar
      MDEV-28642: Suspend obvious false-positive Lintian warnings · d4760d8c
      Tuukka Pasanen authored
      MariaDB codebase is huge and Lintian has lots of test than
      can fire false-positive warnings which leads to situation
      where real problems can't be spotted.
      
      Suspend obvious false-positive Lintian warnings and
      let Lintian problems that needs some love shine
      out.
      
      Suspends in package mariadb-test-data
      
      Supporting BSD family needs to use '/usr/bin/env perl' and not '/usr/bin/perl'
      Perl script are for testing and not for production in mariadb-test-data
      package:
       * incorrect-path-for-interpreter
      
      There is several files with national-encoding which are test file so they
      can't be in unicode charset
       * national-encoding
      
      Serveral test paths are intentionally repeated:
       * repeated-path-segment
      
      Suspends in package mariadb-test
      
      Supporting BSD family needs to use '/usr/bin/env perl' and not '/usr/bin/perl'
      Perl script are for testing and not for production in mariadb-test-data
      package:
       * incorrect-path-for-interpreter
      
      Suspends in package source package
      
      Remade some 'version-substvar-for-external-package' to use
      regex.
      
      MGroonga is missing source file 'jquery-ui-1.8.18.custom.js' correct
      lintian suspend with regex:
       * source-is-missing
      
      There is several files with very long line lenghts. Add suspends
      for those that can't be corrected in several places. Most
      of them are test result files, SQL test files or intentional
      long lines that can't be splitted.
        * very-long-line-length-in-source-file
      
      There is several autogenerated C++ files which probably should not
      be there but they should not do any harm:
       * source-contains-autogenerated-visual-c++-file
      d4760d8c
  9. 10 Jun, 2022 2 commits
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-25581 Allow user thread to do InnoDB fts cache sync · 1fd7d3a9
      Thirunarayanan Balathandayuthapani authored
      Problem:
      ========
        InnoDB FTS requesting the fts sync of the table once the fts
      cache size reaches 1/10 of innodb_ft_cache_size. But fts_sync()
      releases cache lock when writing the word. By doing this, InnoDB
      insert thread increases the innodb fts cache memory and
      SYNC operation will take more time to complete.
      
      Solution:
      =========
        Remove the fts sync operation(FTS_MSG_SYNC_TABLE) from
      the fts optimize background thread. Instead of that,
      allow user thread to sync the InnoDB fts cache when
      the cache size exceeds 512 kb. User thread holds
      cache lock while doing cache syncing, it make sure that
      other threads doesn't add the docs into the cache.
      
      Removed FTS_MSG_SYNC_TABLE and its related function
      because we do remove the FTS_MSG_SYNC_TABLE message
      itself.
      
      Removed fts_sync_index_check() and all related
      function because other threads doesn't add while
      cache operation going on.
      1fd7d3a9
    • Marko Mäkelä's avatar
      Fix ./mtr --embedded · 51ca5d51
      Marko Mäkelä authored
      This fixes up commit 3d241eb9
      51ca5d51
  10. 09 Jun, 2022 6 commits
  11. 08 Jun, 2022 7 commits
    • Tingyao Nian's avatar
      MDEV-22023 Update man page NAME section to say MariaDB instead of MySQL · 41456181
      Tingyao Nian authored
      Continue the effort of a previous commit (PR#2114) which changed the man
      pages titles from MariaDB to MySQL, to further update the man pages.
      
      Update the man page NAME sections to use mariadb-* instead of mysql* for
      MariaDB binaries that are drop-in replacements for MySQL equivalents,
      indicating that the commands are actually of the MariaDB version.
      
      Before:
          NAME
              mysql_upgrade - check tables for MariaDB upgrade
          ...
      
      After:
          NAME
              mariadb-upgrade - check tables for MariaDB upgrade (mysql_upgrade
              is now a symlink to mariadb-upgrade)
          ...
      
      All new code of the whole pull request, including one or several files
      that are either new files or modified ones, are contributed under the
      BSD-new license. I am contributing on behalf of my employer Amazon Web
      Services, Inc.
      41456181
    • Oleg Smirnov's avatar
      MDEV-28747 Index condition pushdown may be configured incorrectly · 5efadf8d
      Oleg Smirnov authored
      ha_innobase::build_template may initialize m_prebuilt->idx_cond
      even if there is no valid pushed_idx_cond_keyno.
      This potentially problematic piece of code was found while
      working on MDEV-27366
      5efadf8d
    • Marko Mäkelä's avatar
      MDEV-28457 Crash in page_dir_find_owner_slot() · 77b3959b
      Marko Mäkelä authored
      A prominent remaining source of crashes on corrupted index pages
      is page directory corruption.
      
      A frequent caller of page_dir_find_owner_slot() is page_rec_get_prev().
      Some of those calls can be replaced with simpler logic that is less
      prone to fail.
      
      page_dir_find_owner_slot(),
      page_rec_get_prev(), page_rec_get_prev_const(),
      btr_pcur_move_to_prev(), btr_pcur_move_to_prev_on_page(),
      btr_cur_upd_rec_sys(),
      page_delete_rec_list_end(),
      rtr_page_copy_rec_list_end_no_locks(),
      rtr_page_copy_rec_list_start_no_locks(): Return an error code on failure.
      
      fil_space_t::io(), buf_page_get_low(): Use DB_CORRUPTION for
      out-of-bounds page reads.
      
      PageBulk::getSplitRec(), PageBulk::copyOut(): Simplify the code.
      
      btr_validate_level(): Prevent some more CHECK TABLE crashes on
      corrupted pages.
      
      btr_block_get(), btr_pcur_move_to_next_page(): Implement some checks that
      were previously only part of IndexPurge::next().
      
      IndexPurge::next(): Use btr_pcur_move_to_next_page().
      77b3959b
    • Marko Mäkelä's avatar
      Cleanup: Remove unused error code DB_FORCED_ABORT · 44ab6cba
      Marko Mäkelä authored
      MariaDB never supported this form of preemption via high-priority
      transactions. This error code shold not have been added in the
      first place, in commit 2e814d47.
      44ab6cba
    • Daniel Black's avatar
      MDEV-28243: AIX missing my_gethwaddr implementation · e8b0894d
      Daniel Black authored
      and failing spider partition test.
      
      With some small datatype changes to the Linux/Solaris my_gethwaddr implementation
      the hardware address of AIX can be returned. This is an important aspect
      in Spider (and UUID).
      
      Spider test change reviewed by Nayuta Yanagisawa.
      
      my_gethwaddr review by Monty in #2081
      e8b0894d
    • Marko Mäkelä's avatar
      MDEV-13542: Do not crash on decryption failure · 892c4263
      Marko Mäkelä authored
      fil_page_type_validate(): Remove. This debug check was mostly redundant
      and added little value to the code paths that deal with page_compressed
      or encrypted pages.
      
      fil_get_page_type_name(): Remove; unused function.
      
      fil_space_decrypt(): Return an error if the page is not
      supposed to be encrypted. It is possible that an unencrypted page
      contains a nonzero key_version field even though it is not supposed
      to be encrypted. Previously we would crash in such a situation.
      
      buf_page_decrypt_after_read(): Simplify the code. Remove some
      unnecessary error message about temporary tablespace corruption.
      This is where we would usually invoke fil_space_decrypt().
      892c4263
    • Marko Mäkelä's avatar
      MDEV-18519: Assertion failure in btr_page_reorganize_low() · c9498f33
      Marko Mäkelä authored
      Even after commit 0b47c126
      there are a few ib::fatal() calls in non-debug code
      that can be replaced easily.
      
      btr_page_reorganize_low(): On size invariant violation, return
      an error code instead of crashing.
      
      btr_check_blob_fil_page_type(): On an invalid page type, report
      an error but do not crash.
      
      btr_copy_blob_prefix(): Truncate the output if a page type is invalid.
      
      dict_load_foreign_cols(): On an error, return DB_CORRUPTION instead
      of crashing.
      
      fil_space_decrypt_full_crc32(), fil_space_decrypt_for_non_full_checksum():
      On error, return DB_DECRYPTION_FAILED instead of crashing.
      
      fil_set_max_space_id_if_bigger(): Replace ib::fatal() with an
      equivalent ut_a() assertion.
      c9498f33