1. 11 Aug, 2023 3 commits
    • Marko Mäkelä's avatar
      MDEV-25340 Server startup with large innodb_buffer_pool_size takes a long time · 38ee8129
      Marko Mäkelä authored
      buf_pool_t::create(), buf_pool_t::chunk_t::create(): Only initialize
      the first page descriptor of each chunk.
      
      buf_pool_t::lazy_allocate(): Lazily initialize a previously allocated
      page descriptor and advance buf_pool_t::chunk_t::blocks_end until
      the allocated capacity has been reached (blocks_end == blocks + size).
      
      buf_pool_t::lazy_allocate_size(): Return the number of allocation requests
      that buf_pool_t::lazy_allocate() can serve.
      
      buf_pool_t::fully_initialized: Set if lazy_allocate_size() == 0.
      
      Most references to chunk->size have been replaced with
      chunk->blocks_end - chunk->blocks.
      38ee8129
    • Marko Mäkelä's avatar
      squash! 5fea8ffc · b91db971
      Marko Mäkelä authored
      trx_t::commit_in_memory(): Set commit_lsn=0 if the log was written.
      
      trx_commit_complete_for_mysql(): Remove some conditions.
      We will rely on trx->commit_lsn.
      
      innobase_commit_ordered_2(): Simplify some conditions.
      A read-write transaction will always carry nonzero trx_t::id.
      Let us unconditionally reset mysql_log_file_name, flush_log_later
      after trx_t::commit() was invoked.
      b91db971
    • Marko Mäkelä's avatar
      squash! cf108c61 · f4c1784c
      Marko Mäkelä authored
      trx_t::commit_empty(): Ensure that the system-wide transaction identifier
      will be persisted up to this->id, so that there will not be warnings or
      errors due to a PAGE_MAX_TRX_ID being too large. We might have modified
      that on secondary index pages before being rolled back, and those changes
      are never rolled back.
      f4c1784c
  2. 10 Aug, 2023 3 commits
    • Marko Mäkelä's avatar
      MDEV-30100: Assertion purge_sys.tail.trx_no <= purge_sys.rseg->last_trx_no() · cf108c61
      Marko Mäkelä authored
      trx_t::commit_empty(): A special case of transaction "commit" when
      the transaction was actually rolled back or the persistent undo log
      is empty. In this case, we need to change the undo log header state to
      TRX_UNDO_CACHED and move the undo log from rseg->undo_list to
      rseg->undo_cached for fast reuse. Furthermore, unless this is the only
      undo log record in the page, we will remove the record and rewind
      TRX_UNDO_PAGE_START, TRX_UNDO_PAGE_FREE, TRX_UNDO_LAST_LOG.
      
      Even though it is not going to be written persistently anywhere,
      we will invoke trx_sys.assign_new_trx_no(this), so that in the test
      innodb.instant_alter everything will be purged as expected.
      
      trx_t::write_serialisation_history(): Renamed from
      trx_write_serialisation_history(). If there is no undo log,
      invoke commit_empty().
      
      trx_purge_add_undo_to_history(): Simplify an assertion and remove a
      comment. This function will not be invoked on an empty undo log
      anymore.
      
      trx_undo_header_create(): Add a debug assertion.
      
      trx_undo_mem_create_at_db_start(): Remove a duplicated assignment.
      cf108c61
    • Marko Mäkelä's avatar
      MDEV-30100 preparation: Simplify InnoDB transaction commit further · 5fea8ffc
      Marko Mäkelä authored
      trx_commit_complete_for_mysql(): Remove some conditions.
      We will rely on trx_flush_log_if_needed().
      
      trx_t::must_flush_log_later: Remove. trx_commit_complete_for_mysql()
      can simply check for trx_t::flush_log_later.
      
      trx_t::commit_in_memory(): Treat flush_log_later as input and output.
      
      trx_flush_log_if_needed_low(): Renamed to trx_flush_log_if_needed().
      Assert that innodb_flush_log_at_trx_commit!=0 was checked by
      the caller and that the transaction is not in XA PREPARE state.
      
      trx_write_serialisation_history(): Move some code from
      trx_purge_add_undo_to_history().
      
      trx_prepare(): Invoke log_write_up_to() directly if needed.
      
      innobase_commit_ordered_2(): Remove a condition, and do not reset
      trx_t::flush_log_later, because it must be passed from
      trx_t::commit_in_memory() to trx_commit_complete_for_mysql().
      5fea8ffc
    • Marko Mäkelä's avatar
      MDEV-30100 preparation: Simplify InnoDB transaction commit · be983bec
      Marko Mäkelä authored
      trx_commit_cleanup(): Clean up any temporary undo log.
      Replaces trx_undo_commit_cleanup() and trx_undo_seg_free().
      
      trx_write_serialisation_history(): Commit the mini-transaction.
      Do not touch temporary undo logs. Assume that a persistent rollback
      segment has been assigned.
      
      trx_serialise(): Merged into trx_write_serialisation_history().
      
      trx_t::commit_low(): Correct some comments and assertions.
      
      trx_t::commit_persist(): Only invoke commit_low() on a mini-transaction
      if the persistent state needs to change.
      be983bec
  3. 09 Aug, 2023 1 commit
  4. 08 Aug, 2023 3 commits
  5. 07 Aug, 2023 1 commit
  6. 06 Aug, 2023 1 commit
  7. 04 Aug, 2023 6 commits
  8. 03 Aug, 2023 1 commit
    • Oleg Smirnov's avatar
      MDEV-31743 Server crash in store_length, assertion failure in... · 8e8c020f
      Oleg Smirnov authored
      MDEV-31743 Server crash in store_length, assertion failure in Type_handler_string_result::sort_length
      
      After MDEV-21580 the truncation of SORT_FIELD::length
        set_if_smaller(sortorder->length, thd->variables.max_sort_length)
      
      became conditional:
        if (is_variable_sized())
          set_if_smaller(length, thd->variables.max_sort_length)
      
      To provide correct functioning of is_variable_sized() SORT_FIELD::type
      must be set properly. This commit adds the necessary initialization
      of SORT_FIELD::type to JOIN_TAB::remove_duplicates() as it is done
      in filesort's sortlength() function.
      
      DBUG_ASSERT is added to sortlength() just in case to prevent
      a possible uint32 overflow
      8e8c020f
  9. 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
  10. 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
  11. 31 Jul, 2023 4 commits