1. 04 Aug, 2023 2 commits
  2. 02 Aug, 2023 2 commits
    • Sergei Golubchik's avatar
      MDEV-31822 ALTER TABLE ENGINE=x started failing instead of producing warning... · 61acb436
      Sergei Golubchik authored
      MDEV-31822 ALTER TABLE ENGINE=x started failing instead of producing warning on unsupported TRANSACTIONAL=1
      
      make TRANSACTIONAL table option behave similar to other engine-defined
      table options. If the engine doesn't suport it:
      * if specified expicitly in CREATE or ALTER - it's ER_UNKNOWN_OPTION
      * an error or a warning depending on sql_mode IGNORE_BAD_TABLE_OPTIONS
      * in ALTER TABLE from the engine that suppors it to the engine that
        doesn't - silently preserved (no warning)
      * it is commented out in SHOW CREATE unless IGNORE_BAD_TABLE_OPTIONS
      61acb436
    • Sergei Golubchik's avatar
      MDEV-18114 Foreign Key Constraint actions don't affect Virtual Column · da09ae05
      Sergei Golubchik authored
      * invoke check_expression() for all vcol_info's in
        mysql_prepare_create_table() to check for FK CASCADE
      * also check for SET NULL and SET DEFAULT
      * to check against existing FKs when a vcol is added in ALTER TABLE,
        old FKs must be added to the new_key_list just like other indexes are
      * check columns recursively, if vcol1 references vcol2,
        flags of vcol2 must be taken into account
      * remove check_table_name_processor(), put that logic under
        check_vcol_func_processor() to avoid walking the tree twice
      da09ae05
  3. 01 Aug, 2023 15 commits
    • Sergei Golubchik's avatar
      cleanup: key->key_create_info.check_for_duplicate_indexes -> key->old · ab1191c0
      Sergei Golubchik authored
      mark old keys in the ALTER TABLE with the `old` flag, not with
      the `key_create_info.check_for_duplicate_indexes`.
      
      This allows to mark old foreign keys too.
      ab1191c0
    • Sergei Golubchik's avatar
      cleanup: Item_field::check_vcol_func_processor() · 0c9794d0
      Sergei Golubchik authored
      to declutter Item_field::check_vcol_func_processor(), move alter_info
      specific part of it into Alter_info::check_vcol_field()
      0c9794d0
    • Sergei Golubchik's avatar
      cleanup: put db/table_name into Alter_info · b8233b38
      Sergei Golubchik authored
      also, prefer Lex_table_name and Lex_ident over LEX_CSTRING
      b8233b38
    • Sergei Golubchik's avatar
      cleanup: reorder enum_fk_option · 2f6d464f
      Sergei Golubchik authored
      2f6d464f
    • Sergei Golubchik's avatar
      cleanup: remove unused keyinfo flag · f7a9f446
      Sergei Golubchik authored
      HA_UNIQUE_CHECK was
      * only used internally by MyISAM/Aria
      * only used for internal temporary tables (for DISTINCT)
      * never saved in frm
      * saved in MYI/MAD but only for temporary tables
      * only set, never checked
      
      it's safe to remove it and free the bit (there are only 16 of them)
      f7a9f446
    • Sergei Golubchik's avatar
      cleanup: invert return code · 383baa81
      Sergei Golubchik authored
      383baa81
    • Sergei Golubchik's avatar
      cleanup: remove redundant arguments · 010f535b
      Sergei Golubchik authored
      010f535b
    • Sergei Golubchik's avatar
      cleanup: cosmetic changes · bf5cc31d
      Sergei Golubchik authored
      bf5cc31d
    • Sergei Petrunia's avatar
      MDEV-31764: ASAN use-after-poison in trace_engine_stats in ANALYZE JSON · 691e964d
      Sergei Petrunia authored
      Do not attempt to produce "r_engine_stats" on the temporary (=work) tables.
      These tables may be
      - re-created during the query execution
      - freed during the query execution (This is done e.g. in JOIN::cleanup(),
        before we produce ANALYZE FORMAT=JSON output).
      
      - (Also, make save_explain_data() functions not set handler_for_stats
        to point to handler objects that do not have handler->handler_stats set.
        If the storage engine is not collecting handler_stats, it will not have
        them when we're producing ANALYZE FORMAT=JSON output, either).
      691e964d
    • Oleksandr Byelkin's avatar
      New CC 3.3 · 138717b1
      Oleksandr Byelkin authored
      138717b1
    • Oleksandr Byelkin's avatar
      Merge branch '10.5' into 10.6 · 6bf8483c
      Oleksandr Byelkin authored
      6bf8483c
    • Marko Mäkelä's avatar
      MDEV-27593: Crashing on I/O error is unhelpful · 72928e64
      Marko Mäkelä authored
      buf_page_t::write_complete(), buf_page_write_complete(),
      IORequest::write_complete(): Add a parameter for passing
      an error code. If an error occurred, we will release the
      io-fix, buffer-fix and page latch but not reset the
      oldest_modification field. The block would remain in
      buf_pool.LRU and possibly buf_pool.flush_list, to be written
      again later, by buf_flush_page_cleaner(). If all page writes
      start consistently failing, all write threads should eventually
      hang in log_free_check() because the log checkpoint cannot
      be advanced to make room in the circular write-ahead-log ib_logfile0.
      
      IORequest::read_complete(): Add a parameter for passing
      an error code. If a read operation fails, we report the error
      and discard the page, just like we would do if the page checksum
      was not validated or the page could not be decrypted.
      This only affects asynchronous reads, due to linear or random read-ahead
      or crash recovery. When buf_page_get_low() invokes buf_read_page(),
      that will be a synchronous read, not involving this code.
      
      This was tested by randomly injecting errors in
      write_io_callback() and read_io_callback(), like this:
      
        if (!ut_rnd_interval(100))
          cb->m_err= 42;
      72928e64
    • Marko Mäkelä's avatar
      MDEV-31816 fixup: Relax a debug assertion · 96cfdb87
      Marko Mäkelä authored
      buf_LRU_free_page(): The block may also be in the IBUF_EXIST state
      when executing the test innodb.innodb_bulk_create_index_debug.
      96cfdb87
    • Oleksandr Byelkin's avatar
      Merge branch '10.4' into 10.5 · 65405308
      Oleksandr Byelkin authored
      65405308
    • Marko Mäkelä's avatar
      MDEV-31816 buf_LRU_free_page() does not preserve ROW_FORMAT=COMPRESSED block state · d794d348
      Marko Mäkelä authored
      buf_LRU_free_page(): When we are discarding the uncompressed copy of a
      ROW_FORMAT=COMPRESSED page, buf_page_t::can_relocate() must have ensured
      that the block descriptor state is one of FREED, UNFIXED, REINIT.
      Do not overwrite the state with UNFIXED. We do not want to write back
      pages that were actually freed, and we want to avoid doublewrite for
      pages that were (re)initialized by log records written since the latest
      checkpoint. Last but not least, we do not want crashes like those that
      commit dc1bd180 (MDEV-31386)
      was supposed to fix.
      
      The test innodb_zip.wl5522_zip should typically cover all 3 states.
      
      This bug is a regression due to
      commit aaef2e1d (MDEV-27058).
      d794d348
  4. 31 Jul, 2023 6 commits
  5. 30 Jul, 2023 3 commits
  6. 29 Jul, 2023 1 commit
  7. 28 Jul, 2023 2 commits
    • Marko Mäkelä's avatar
      MDEV-31354 SIGSEGV in log_sort_flush_list() in InnoDB crash recovery · 0d175968
      Marko Mäkelä authored
      log_sort_flush_list(): Wait for any pending page writes to cease
      before sorting the buf_pool.flush_list. Starting with
      commit 22b62eda (MDEV-25113),
      it is possible that some buf_page_t::oldest_modification_
      that we will be comparing in std::sort() will be updated from
      some value >2 to 1 while we are holding buf_pool.flush_list_mutex.
      
      To catch this type of trouble better in the future, we will clean
      garbage (pages that have been written out) from buf_pool.flush_list
      while constructing the array for sorting, and check with debug
      assertions that all blocks that we are copying from the array to the
      list will be dirty (requiring a writeback) while we sort and copy
      the array back to buf_pool.flush_list.
      
      This failure was observed by chance exactly once when running the test
      innodb.recovery_memory. It was never reproduced in the same form
      afterwards. Unrelated to this change, the test does occasionally
      reproduce a failure to start up InnoDB due to a corrupted page
      being read in recovery. The ticket MDEV-31791 was filed for that.
      
      Tested by: Matthias Leich
      0d175968
    • Marko Mäkelä's avatar
      MDEV-31790 work-around: Add not_msan.inc · f3bbf866
      Marko Mäkelä authored
      f3bbf866
  8. 27 Jul, 2023 2 commits
  9. 26 Jul, 2023 4 commits
  10. 25 Jul, 2023 3 commits
    • Oleksandr Byelkin's avatar
      new WolfSSL v5.6.3-stable · 2a46b358
      Oleksandr Byelkin authored
      2a46b358
    • Brandon Nesterenko's avatar
      MDEV-30619: Parallel Slave SQL Thread Can Update Seconds_Behind_Master with Active Workers · 063f4ac2
      Brandon Nesterenko authored
      MDEV-31749 sporadic assert in MDEV-30619 new test
      
      If the workers of a parallel replica are busy (potentially with long
      queues), but the SQL thread has no events left to distribute (so it
      goes idle), then the next event that comes from the primary will
      update mi->last_master_timestamp with its timestamp, even if the
      workers have not yet finished.
      
      This patch changes the parallel replica logic which updates
      last_master_timestamp after idling from using solely sql_thread_caught_up
      (added in MDEV-29639) to using the latter with rli queued/dequeued
      event counters.
      That is, if  the queued count is equal to the dequeued count, it
      means all events have been processed and the replica is considered
      idle when the driver thread has also distributed all events.
      
      Low level details of the commit include
      - to make a more generalized test for Seconds_Behind_Master on
        the parallel replica, rpl_delayed_parallel_slave_sbm.test
        is renamed to rpl_parallel_sbm.test for this purpose.
      - pause_sql_thread_on_next_event usage was removed
        with the MDEV-30619 fixes. Rather than remove it, we adapt it
        to the needs of this test case
      - added test case to cover SBM spike of relay log read and LMT
        update that was fixed by MDEV-29639
      - rpl_seconds_behind_master_spike.test is made to use
        the negate_clock_diff_with_master debug eval.
      
      Reviewed By:
      ============
      Andrei Elkin <andrei.elkin@mariadb.com>
      063f4ac2
    • Marko Mäkelä's avatar
      MDEV-31767 InnoDB tables are being flagged as corrupted on an I/O bound server · b102872a
      Marko Mäkelä authored
      The main problem is that at ever since
      commit aaef2e1d removed the
      function buf_wait_for_read(), it is not safe to invoke
      buf_page_get_low() with RW_NO_LATCH, that is, only buffer-fixing
      the page. If a page read (or decryption or decompression) is in
      progress, there would be a race condition when executing consistency
      checks, and a page would wrongly be flagged as corrupted.
      
      Furthermore, if the page is actually corrupted and the initial
      access to it was with RW_NO_LATCH (only buffer-fixing), the
      page read handler would likely end up in an infinite loop in
      buf_pool_t::corrupted_evict(). It is not safe to invoke
      mtr_t::upgrade_buffer_fix() on a block on which a page latch
      was not initially acquired in buf_page_get_low().
      
      btr_block_reget(): Remove the constant parameter rw_latch=RW_X_LATCH.
      
      btr_block_get(): Assert that RW_NO_LATCH is not being used,
      and change the parameter type of rw_latch.
      
      btr_pcur_move_to_next_page(), innobase_table_is_empty(): Adjust for the
      parameter type change of btr_block_get().
      
      btr_root_block_get(): If mode==RW_NO_LATCH, do not check the integrity of
      the page, because it is not safe to do so.
      
      btr_page_alloc_low(), btr_page_free(): If the root page latch is not
      previously held by the mini-transaction, invoke btr_root_block_get()
      again with the proper latching mode.
      
      btr_latch_prev(): Helper function to safely acquire a latch on a
      preceding sibling page while holding a latch on a B-tree page.
      To avoid deadlocks, we must not wait for the latch while holding
      a latch on the current page, because another thread may be waiting
      for our page latch when moving to the next page from our preceding
      sibling page. If s_lock_try() or x_lock_try() on the preceding page fails,
      we must release the current page latch, and wait for the latch on the
      preceding page as well as the current page, in that order.
      Page splits or merges will be prevented by the parent page latch
      that we are holding.
      
      btr_cur_t::search_leaf(): Make use of btr_latch_prev().
      
      btr_cur_t::open_leaf(): Make use of btr_latch_prev(). Do not invoke
      mtr_t::upgrade_buffer_fix() (when latch_mode == BTR_MODIFY_TREE),
      because we will already have acquired all page latches upfront.
      
      btr_cur_t::pessimistic_search_leaf(): Do acquire an exclusive index latch
      before accessing the page. Make use of btr_latch_prev().
      b102872a