1. 03 Aug, 2024 1 commit
    • mariadb-DebarunBanerjee's avatar
      MDEV-34689 Redo log corruption at high load · e515e807
      mariadb-DebarunBanerjee authored
      Issue: During mtr_t:commit, if there is not enough space available in
      redo log buffer, we flush the buffer. During flush, the LSN lock is
      released allowing other concurrent mtr to commit. After flush we
      reacquire the lock but use the old LSN obtained before check. It could
      lead to redo log corruption. As the LSN moves backwards with the
      possibility of data loss and unrecoverable server if the server aborts
      for any reason or if server is shutdown with innodb_fast_shutdown=2.
      With normal shutdown, recovery fails to map the checkpoint LSN to
      correct offset.
      
      In debug mode it hits log0log.cc:863: lsn_t log_t::write_buf()
      Assertion `new_buf_free == ((lsn - first_lsn) & write_size_1)' failed.
      
      In release mode, after normal shutdown, restart fails.
      [ERROR] InnoDB: Missing FILE_CHECKPOINT(8416546) at 8416546
      [ERROR] InnoDB: Log scan aborted at LSN 8416546
      
      Backup fails reading the corrupt redo log.
      [00] 2024-07-31 20:59:10 Retrying read of log at LSN=7334851
      [00] FATAL ERROR: 2024-07-31 20:59:11 Was only able to copy log from
      7334851 to 7334851, not 8416446; try increasing innodb_log_file_size
      
      Unless a backup is tried or the server is shutdown or killed
      immediately, the corrupt redo part is eventually truncated and there
      may not be any visible issues seen in release mode.
      
      This issue was introduced by the following commit.
      
      commit a635c406
          MDEV-27774 Reduce scalability bottlenecks in mtr_t::commit()
      
      Fix: If we need to release latch and flush redo before writing mtr
      logs, make sure to get the latest system LSN after reacquiring the
      redo system latch.
      e515e807
  2. 02 Aug, 2024 1 commit
  3. 30 Jul, 2024 2 commits
    • Marko Mäkelä's avatar
      MDEV-34422 Corrupted ib_logfile0 due to uninitialized log_sys.lsn_lock · 1c8af2ae
      Marko Mäkelä authored
      In commit bf0b82d2 (MDEV-33515)
      the function log_t::init_lsn_lock() was removed. This was fine on
      those platforms where InnoDB uses futex-based mutexes (Linux, FreeBSD,
      OpenBSD, NetBSD, DragonflyBSD).
      
      Dave Gosselin debugged this on Apple macOS and submitted a fix where
      pthread_mutex_wrapper::pthread_mutex_wrapper() would invoke init().
      We do not really need that; we only need to invoke lsn_lock.init()
      like we used to do before commit bf0b82d2.
      This should be a no-op for the futex based mutexes, which intentionally
      rely on zero initialization.
      
      The missing pthread_mutex_init() call would cause race conditions
      and corruption of log_sys.buf because multiple threads could
      apparently hold log_sys.lsn_lock concurrently in
      log_t::append_prepare().  The error would be caught by a debug
      assertion in log_t::write_buf(), or in non-debug builds by the
      fact that the server cannot be restarted due to an apparently
      missing FILE_CHECKPOINT record (because it had been written
      to wrong offset in log_sys.buf).
      
      The failure in log_t::append_prepare() was caught on Microsoft Windows
      after enabling SUX_LOCK_GENERIC and therefore forcing the use of
      pthread_mutex_wrapper for the log_sys.lsn_lock.  It appears to be fine
      to omit the pthread_mutex_init() call on GNU/Linux.
      
      log_t::create(): Invoke lsn_lock.init().
      
      log_t::close(): Invoke lsn_lock.destroy().
      
      To better catch this kind of issues in the future by simply defining
      SUX_LOCK_GENERIC on any platform, a separate debug instrumentation patch
      will be applied to the 10.6 branch later.
      
      Reviewed by: Debarun Banerjee
      1c8af2ae
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-33087 ALTER TABLE...ALGORITHM=COPY should build indexes more efficiently · cc8eefb0
      Thirunarayanan Balathandayuthapani authored
      - During copy algorithm, InnoDB should use bulk insert operation
      for row by row insert operation. By doing this, copy algorithm
      can effectively build indexes. This optimization is disabled
      for temporary table, versioning table and table which has
      foreign key relation.
      
      Introduced the variable innodb_alter_copy_bulk to allow
      the bulk insert operation for copy alter operation
      inside InnoDB. This is enabled by default
      
      ha_innobase::extra(): HA_EXTRA_END_ALTER_COPY mode tries to apply
      the buffered bulk insert operation, updates the non-persistent
      table stats.
      
      row_merge_bulk_t::write_to_index(): Update stat_n_rows after
      applying the bulk insert operation
      
      row_ins_clust_index_entry_low(): In case of copy algorithm,
      switch to bulk insert operation.
      
      copy_data_error_ignore(): Handles the error while copying
      the data from source to target file.
      cc8eefb0
  4. 24 Jul, 2024 1 commit
  5. 22 Jul, 2024 2 commits
  6. 20 Jul, 2024 1 commit
  7. 19 Jul, 2024 4 commits
    • Andrei's avatar
      MDEV-15393 gtid_slave_pos duplicate key errors after mysqldump restore · b8f92ade
      Andrei authored
      When mysqldump is run to dump the `mysql` system database, it generates
      INSERT statements into the table `mysql.gtid_slave_pos`.
      After running the backup script
      those inserts did not produce the expected gtid state on slave. In
      particular the maximum of mysql.gtid_slave_pos.sub_id did not make
      into
         rpl_global_gtid_slave_state.last_sub_id
      
      an in-memory object that is supposed to match the current state of the
      table. And that was regardless of whether --gtid option was specified
      or not. Later when the backup recipient server starts as slave
      in *non-gtid* mode this desychronization may lead to a duplicate key
      error.
      
      This effect is corrected for --gtid mode mysqldump/mariadb-dump only
      as the following.  The fixes ensure the insert block of the dump
      script is followed with a "summing-up" SET @global.gtid_slave_pos
      assignment.
      
      For the implemenation part, note a deferred print-out of
      SET-gtid_slave_pos and associated comments is prefered over relocating
      of the entire blocks if (opt_master,slave_data &&
      do_show_master,slave_status) ...  because of compatiblity
      concern. Namely an error inside do_show_*() is handled in the new code
      the same way, as early as, as before.
      
      A regression test can be run in how-to-reproduce mode as well.
      One affected mtr test observed.
      rpl_mysqldump_slave.result "mismatch" shows now the new deferring print
      of SET-gtid_slave_pos policy in action.
      b8f92ade
    • Oleksandr Byelkin's avatar
      new libfmt 11.0.1 · 0f6f1114
      Oleksandr Byelkin authored
      0f6f1114
    • Oleksandr Byelkin's avatar
      New CC 3.3 · a94fd874
      Oleksandr Byelkin authored
      a94fd874
    • Oleksandr Byelkin's avatar
      Fix view protocol · b8b6cab2
      Oleksandr Byelkin authored
      b8b6cab2
  8. 18 Jul, 2024 2 commits
  9. 17 Jul, 2024 26 commits