1. 14 Jun, 2022 6 commits
  2. 13 Jun, 2022 5 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
    • Monty's avatar
      Fixed maria.maria-recover and maria.encrypt-no-key test files · 1bcd87cd
      Monty authored
      These had been damaged during some merge which caused --embedded
      test to fail
      1bcd87cd
    • 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
  3. 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
  4. 09 Jun, 2022 7 commits
  5. 08 Jun, 2022 8 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
    • chansuke's avatar
      MDEV-25273: fix typo (s/strucures/structures/) · 960f0344
      chansuke authored
      960f0344
  6. 07 Jun, 2022 12 commits
    • Monty's avatar
      Improve error reporting in Aria · 3d241eb9
      Monty authored
      This patch fixes the following issues in Aria error reporting in case
      of read errors & crashed tables:
      - Added the table name to the most error messages, including in case of
        read errors or when encrypting/decrypting a table. The format for
        error messages was changed sligtly to accomodate logging of errors
        from lower level routines.
      - If we got an read error from storage (hard disk, ssd, S3 etc) we only
        reported 'table is crashed'. Now the error number from the storage
        is reported.
      - Added checking of read failure from records_in_range()
      - Calls to ma_set_fatal_error() did not inform the SQL level of
        errors (to not spam the user with multiple error messages).
        Now the first error message and any fatal error messages are reported
        to the user.
      3d241eb9
    • Monty's avatar
      Updated aria_dump_log · 1de18a83
      Monty authored
      - Print correct server version for header
      - Updated version number
      - One can now specify file name last (without -f)
      1de18a83
    • Michael Widenius's avatar
      Make join->key_dependent up to date for derived tables · 31811cf8
      Michael Widenius authored
      Main-author: Sergei Petrunia
      31811cf8
    • Michael Widenius's avatar
      Improve table pruning in optimizer with up to date key_dependent map · 432a4ebe
      Michael Widenius authored
      Part of:
      MDEV-28073 Slow query performance in MariaDB when using many tables
      
      s->key_dependent has a list of tables that are compared with key fields
      in the current table.  However it does not take into account if a key
      field could be resolved by another table.
      This is because MariaDB expands 'join_tab->keyuse' to include all generated
      comparisons.
      For example:
      SELECT * from t1,t2,t3 where t1.key=t2.key and t2.key=t3.key
      In this case keyuse for t1 includes t2.key and t3.key and key_dependent
      contains 't2.map | t3.map'
      If we in best_extension_by_limited_search() consider t2,t1 then t1's
      key is fully defined, but we cannot do any prune of plans as
      s->key_dependent indicates that t3 is still needed.
      
      Fixed by calculating in best_access_patch the current key_dependent map
      of tables that is needed to satisfy all keys. This allows us to prune
      more bad plans earlier as soon as all keys can be used.
      
      We also set key_dependent to 0 if we found an EQ_REF key, as this an
      optimal key for the table and there is no reason to check more keys.
      432a4ebe
    • Michael Widenius's avatar
      greedy_search() and best_extension_by_limited_search() scrambled table order · 64f24b77
      Michael Widenius authored
      best_extension_by_limited_search() assumes that tables should be sorted
      according to size to be able to quickly disregard bad plans. However the
      current usage of swap_variables() will change the table order to a not
      sorted one for the next recursive call. This breaks the assumtion and
      causes performance issues when using many tables (we have to examine
      many more plans).
      
      This patch fixes this by ensuring that the original table order is kept
      for the not yet used tables when best_extension_by_limited_search() is
      called.
      
      This was done by always calling swap_variables() for each table and
      restoring the original table order at exit.
      
      Some test changed:
      - In a majority of the test the change was that two "identical tables"
        where swapped and the optimzer is now using the first/smaller table
      - In few test the table order was changed. The new plan looks identical
        or slighly better than the original.
      64f24b77
    • Sergei Petrunia's avatar
      MDEV-28749: restore_prev_nj_state() doesn't update cur_sj_inner_tables correctly · f0ea7f7f
      Sergei Petrunia authored
      (Try 2)
      
      The code that updates semi-join optimization state for a join order prefix
      had several bugs. The visible effect was bad optimization for FirstMatch or
      LooseScan strategies: they either weren't considered when they should have
      been, or considered when they shouldn't have been.
      
      In order to hit the bug, the optimizer needs to consider several different
      join prefixes in a certain order. Queries with "obvious" query plans which
      prune all join orders except one are not affected.
      
      Internally, the bugs in updates of semi-join state were:
      1. restore_prev_sj_state() assumed that
        "we assume remaining_tables doesnt contain @tab"
        which wasn't true.
      2. Another bug in this function: it did remove bits from
         join->cur_sj_inner_tables but never added them.
      3. greedy_search() adds tables into the join prefix but neglects to update
         the semi-join optimization state. (It does update nested outer join
         state, see this call:
           check_interleaving_with_nj(best_table)
         but there's no matching call to update the semi-join state.
         (This wasn't visible because most of the state is in the POSITION
          structure which is updated. But there is also state in JOIN, too)
      
      The patch:
      - Fixes all of the above
      - Adds JOIN::dbug_verify_sj_inner_tables() which is used to verify the
        state is correct at every step.
      - Renames advance_sj_state() to optimize_semi_joins().
        = Introduces update_sj_state() which ideally should have been called
          "advance_sj_state" but I didn't reuse the name to not create confusion.
      f0ea7f7f
    • Monty's avatar
      Fixed cost calculation for SELECT STRAIGHT_JOIN · 46c4fd45
      Monty authored
      Main fix was replacing read_time+= with read_time
      
      I also did updated the 'identical' code in optimize_straight_join) and
      best_extension_by_limited_search() to make them eaiser to compare.
      
      Reviewer: Sergei Petrunia <sergey@mariadb.com>
      46c4fd45
    • Monty's avatar
      removed some compiler warnings · e240e8d0
      Monty authored
      e240e8d0
    • Sergei Golubchik's avatar
      main.help: flush help tables after modifying them · 37ea0778
      Sergei Golubchik authored
      otherwise following tests that crash the server will see them
      corrupted
      37ea0778
    • Sergei Golubchik's avatar
      typo fixed: [[space]] -> [[:space:]] · 7c4efab9
      Sergei Golubchik authored
      7c4efab9
    • Sergei Petrunia's avatar
      MDEV-28749: restore_prev_nj_state() doesn't update cur_sj_inner_tables correctly · 19c72163
      Sergei Petrunia authored
      (Try 2) (Cherry-pick back into 10.3)
      
      The code that updates semi-join optimization state for a join order prefix
      had several bugs. The visible effect was bad optimization for FirstMatch or
      LooseScan strategies: they either weren't considered when they should have
      been, or considered when they shouldn't have been.
      
      In order to hit the bug, the optimizer needs to consider several different
      join prefixes in a certain order. Queries with "obvious" query plans which
      prune all join orders except one are not affected.
      
      Internally, the bugs in updates of semi-join state were:
      1. restore_prev_sj_state() assumed that
        "we assume remaining_tables doesnt contain @tab"
        which wasn't true.
      2. Another bug in this function: it did remove bits from
         join->cur_sj_inner_tables but never added them.
      3. greedy_search() adds tables into the join prefix but neglects to update
         the semi-join optimization state. (It does update nested outer join
         state, see this call:
           check_interleaving_with_nj(best_table)
         but there's no matching call to update the semi-join state.
         (This wasn't visible because most of the state is in the POSITION
          structure which is updated. But there is also state in JOIN, too)
      
      The patch:
      - Fixes all of the above
      - Adds JOIN::dbug_verify_sj_inner_tables() which is used to verify the
        state is correct at every step.
      - Renames advance_sj_state() to optimize_semi_joins().
        = Introduces update_sj_state() which ideally should have been called
          "advance_sj_state" but I didn't reuse the name to not create confusion.
      19c72163
    • Marko Mäkelä's avatar
      MDEV-25257 follow-up: full_crc32 format is garbage-free · 09177ead
      Marko Mäkelä authored
      In any files that were created in the
      innodb_checksum_algorithm=full_crc32 format
      (commit c0f47a4a)
      any unused data fields will have been zero-initialized
      (commit 3926673c).
      09177ead