An error occurred fetching the project authors.
  1. 27 Aug, 2019 1 commit
    • Marko Mäkelä's avatar
      MDEV-15326/MDEV-16136 dead code removal · 25af2a18
      Marko Mäkelä authored
      Revert part of fa2a74e0.
      
      trx_reference(): Remove, and merge the relevant part to the only caller
      trx_rw_is_active(). If the statements trx = NULL; were ever executed,
      the function would have dereferenced a NULL pointer and crashed in
      trx_mutex_exit(trx). Hence, those statements must have been unreachable,
      and they can be replaced with debug assertions.
      
      trx_rw_is_active(): Avoid unnecessary acquisition and release of trx->mutex
      when do_ref_count=false.
      
      lock_trx_release_locks(): Do not reset trx->id=0. Had the statement been
      necessary, we would have experienced crashes in trx_reference().
      25af2a18
  2. 24 Jul, 2019 2 commits
  3. 11 May, 2019 1 commit
  4. 03 May, 2019 1 commit
    • Marko Mäkelä's avatar
      MDEV-19346: Remove dummy InnoDB log checkpoints · 3db94d24
      Marko Mäkelä authored
      log_checkpoint(), log_make_checkpoint_at(): Remove the parameter
      write_always. It seems that the primary purpose of this parameter
      was to ensure in the function recv_reset_logs() that both checkpoint
      header pages will be overwritten, when the function is called from
      the never-enabled function recv_recovery_from_archive_start().
      
      create_log_files(): Merge recv_reset_logs() to its only caller.
      
      Debug instrumentation: Prefer to flush the redo log, instead of
      triggering a redo log checkpoint.
      
      page_header_set_field(): Disable a debug assertion that will
      always fail due to MDEV-19344, now that we no longer initiate
      a redo log checkpoint before an injected crash.
      
      In recv_reset_logs() there used to be two calls to
      log_make_checkpoint_at(). The apparent purpose of this was
      to ensure that both InnoDB redo log checkpoint header pages
      will be initialized or overwritten.
      The second call was removed (without any explanation) in MySQL 5.6.3:
      mysql/mysql-server@4ca37968da54ddc6b3b6628f41428ddba1c79bb8
      
      In MySQL 5.6.8 WL#6494, starting with
      mysql/mysql-server@00a0ba8ad92569fcf08212b3b8cf046dc8a0ce10
      the function recv_reset_logs() was not only invoked during
      InnoDB data file initialization, but also during a regular
      startup when the redo log is being resized.
      
      mysql/mysql-server@45e91679832219e2593c77185342f11f85232b58
      in MySQL 5.7.2 removed the UNIV_LOG_ARCHIVE code, but still
      did not remove the parameter write_always.
      3db94d24
  5. 28 Mar, 2019 3 commits
    • Marko Mäkelä's avatar
      Revert MDEV-18464 and MDEV-12009 · d0116e10
      Marko Mäkelä authored
      This reverts commit 21b2fada
      and commit 81d71ee6.
      
      The MDEV-18464 change introduces a few data race issues. Contrary to
      the documentation, the field trx_t::victim is not always being protected
      by lock_sys_t::mutex and trx_t::mutex. Most importantly, it seems
      that KILL QUERY could wrongly avoid acquiring both mutexes when
      invoking lock_trx_handle_wait_low(), in case another thread had
      already set trx->victim=true.
      
      We also revert MDEV-12009, because it should depend on the MDEV-18464
      fix being present.
      d0116e10
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-19051 Avoid unnecessary writing MLOG_INDEX_LOAD · 0623cc7c
      Thirunarayanan Balathandayuthapani authored
      1) Avoid writing of MLOG_INDEX_LOAD redo log record during inplace
      alter table when the table is empty and also for spatial index.
      
      2) Avoid creation of temporary merge file for spatial index during
      index creation process.
      0623cc7c
    • Jan Lindström's avatar
      MDEV-18464: Port kill_one_trx fixes from 10.4 to 10.1 · 21b2fada
      Jan Lindström authored
      Pushed the decision for innodb transaction and system
      locking down to lock0lock.cc level. With this,
      we can avoid releasing these mutexes for executions
      where these mutexes were acquired upfront.
      
      This patch will also fix BF aborting of native threads, e.g.
      threads which have declared wsrep_on=OFF. Earlier, we have
      used, for innodb trx locks, was_chosen_as_deadlock_victim
      flag, for marking inodb transactions, which are victims for
      wsrep BF abort. With native threads (wsrep_on==OFF), re-using
      was_chosen_as_deadlock_victim flag may lead to inteference
      with real deadlock, and to deal with this, the patch has added new
      flag for marking wsrep BF aborts only: victim=true
      
      Similar way if replication decides to abort one of the threads
      we mark victim by: victim=true
      
      innobase_kill_query
      	Remove lock sys and trx mutex handling.
      
      wsrep_innobase_kill_one_trx
      	Mark victim trx with victim=true
      
      trx0trx.h
      	Remove trx_abort_t type and abort type variable from
      	trx struct. Add victim variable to trx.
      
      wsrep_kill_victim
      	Remove abort_type
      
      lock_report_waiters_to_mysql
      	Take also trx mutex and mark trx as a victim for
      	replication abort.
      
      lock_trx_handle_wait_low
      	New low level function to check whether the transaction
      	has already been rolled back because it was selected as
      	a deadlock victim, or if it has to wait then cancel
      	the wait lock.
      
      lock_trx_handle_wait
      	If transaction is not marked as victim take lock sys
      	and trx mutex before calling lock_trx_handle_wait_low
      	and release them after that.
      
      row_search_for_mysql
      	Remove lock sys and trx mutex taking and releasing.
      
      trx_rollback_to_savepoint_for_mysql_low
      trx_commit_in_memory
      	Clean up victim variable.
      21b2fada
  6. 07 Jan, 2019 1 commit
    • Jan Lindström's avatar
      MDEV-15740: InnoDB does not flush redo log when it shoul · 1d56d875
      Jan Lindström authored
      During database recovery, a transaction with wsrep XID is
      recovered from InnoDB in prepared state. However, when the
      transaction is looked up with trx_get_trx_by_xid() in
      innobase_commit_by_xid(), trx->xid gets cleared in
      trx_get_trx_by_xid_low() and commit time serialization history
      write does not update the wsrep XID in trx sys header for
      that recovered trx. As a result the transaction gets
      committed during recovery but the wsrep position does not
      get updated appropriately.
      
      As a fix, we preserve trx->xid for Galera over transaction
      commit in recovery phase.
      
      Fix authored by: Teemu Ollakka (GaleraCluster) and Marko Mäkelä.
      
      	modified:   mysql-test/suite/galera/disabled.def
      	modified:   mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
      	modified:   mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
      	modified:   mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
      	modified:   mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
      	modified:   storage/innobase/trx/trx0trx.cc
      	modified:   storage/xtradb/trx/trx0trx.cc
      1d56d875
  7. 27 Nov, 2018 1 commit
  8. 19 Nov, 2018 1 commit
  9. 01 Nov, 2018 1 commit
  10. 10 Sep, 2018 1 commit
    • Marko Mäkelä's avatar
      MDEV-17158 TRUNCATE is not atomic after MDEV-13564 · 75f8e86f
      Marko Mäkelä authored
      It turned out that ha_innobase::truncate() would prematurely
      commit the transaction already before the completion of the
      ha_innobase::create(). All of this must be atomic.
      
      innodb.truncate_crash: Use the correct DEBUG_SYNC point, and
      tolerate non-truncation of the table, because the redo log
      for the TRUNCATE transaction commit might be flushed due to
      some InnoDB background activity.
      
      dict_build_tablespace_for_table(): Merge to the function
      dict_build_table_def_step().
      
      dict_build_table_def_step(): If a table is being created during
      an already started data dictionary transaction (such as TRUNCATE),
      persistently write the table_id to the undo log header before
      creating any file. In this way, the recovery of TRUNCATE will be
      able to delete the new file before rolling back the rename of
      the original table.
      
      dict_table_rename_in_cache(): Add the parameter replace_new_file,
      used as part of rolling back a TRUNCATE operation.
      
      fil_rename_tablespace_check(): Add the parameter replace_new.
      If the parameter is set and a file identified by new_path exists,
      remove a possible tablespace and also the file.
      
      create_table_info_t::create_table_def(): Remove some debug assertions
      that no longer hold. During TRUNCATE, the transaction will already
      have been started (and performed a rename operation) before the
      table is created. Also, remove a call to dict_build_tablespace_for_table().
      
      create_table_info_t::create_table(): Add the parameter create_fk=true.
      During TRUNCATE TABLE, do not add FOREIGN KEY constraints to the
      InnoDB data dictionary, because they will also not be removed.
      
      row_table_add_foreign_constraints(): If trx=NULL, do not modify
      the InnoDB data dictionary, but only load the FOREIGN KEY constraints
      from the data dictionary.
      
      ha_innobase::create(): Lock the InnoDB data dictionary cache only
      if no transaction was passed by the caller. Unlock it in any case.
      
      innobase_rename_table(): Add the parameter commit = true.
      If !commit, do not lock or unlock the data dictionary cache.
      
      ha_innobase::truncate(): Lock the data dictionary before invoking
      rename or create, and let ha_innobase::create() unlock it and
      also commit or roll back the transaction.
      
      trx_undo_mark_as_dict(): Renamed from trx_undo_mark_as_dict_operation()
      and declared global instead of static.
      
      row_undo_ins_parse_undo_rec(): If table_id is set, this must
      be rolling back the rename operation in TRUNCATE TABLE, and
      therefore replace_new_file=true.
      75f8e86f
  11. 16 Aug, 2018 3 commits
    • Marko Mäkelä's avatar
      MDEV-16136: Prevent wrong reuse in trx_reference() · fa2a74e0
      Marko Mäkelä authored
      If trx_free() and trx_create_low() were called while a call to
      trx_reference() was pending, we could get a reference to a wrong
      transaction object.
      
      trx_reference(): Return NULL if the trx->id no longer matches.
      
      lock_trx_release_locks(): Assign trx->id = 0, so that trx_reference()
      will not return a reference to this object.
      
      trx_cleanup_at_db_startup(): Assign trx->id = 0.
      
      assert_trx_is_free(): Assert !trx->n_ref. Assert trx->id == 0,
      now that it will be cleared as part of a transaction commit.
      fa2a74e0
    • Marko Mäkelä's avatar
      Rename lock_pool_t to lock_list · 65835065
      Marko Mäkelä authored
      Also, replace reverse iteration with forward iteration.
      
      lock_table_has(): Remove a redundant condition.
      65835065
    • Marko Mäkelä's avatar
      MDEV-16136: Simplify trx_lock_t memory management · 3ce8a0fc
      Marko Mäkelä authored
      Allocate trx->lock.rec_pool and trx->lock.table_pool directly from trx_t.
      Remove unnecessary use of std::vector.
      
      In order to do this, move some definitions from lock0priv.h to
      lock0types.h, so that ib_lock_t will not be an opaque type.
      3ce8a0fc
  12. 03 Aug, 2018 3 commits
  13. 30 Jul, 2018 1 commit
  14. 24 Apr, 2018 1 commit
    • Marko Mäkelä's avatar
      MDEV-15030 Add ASAN instrumentation to trx_t Pool · 7b5543b2
      Marko Mäkelä authored
      Pool::mem_free(): Poison the freed memory. Assert that it was
      fully initialized, because the reuse of trx_t objects will
      assume that the objects were previously initialized.
      
      Pool::~Pool(), Pool::get(): Unpoison the allocated memory,
      and mark it initialized.
      
      trx_free(): After invoking Pool::mem_free(), unpoison
      trx_t::mutex and trx_t::undo_mutex, because MutexMonitor
      will access these even for freed trx_t objects.
      7b5543b2
  15. 16 Mar, 2018 1 commit
    • Marko Mäkelä's avatar
      MDEV-13935 INSERT stuck at state Unlocking tables · bd7ed1b9
      Marko Mäkelä authored
      Revert the dead code for MySQL 5.7 multi-master replication (GCS),
      also known as
      WL#6835: InnoDB: GCS Replication: Deterministic Deadlock Handling
      (High Prio Transactions in InnoDB).
      
      Also, make innodb_lock_schedule_algorithm=vats skip SPATIAL INDEX,
      because the code does not seem to be compatible with them.
      
      Add FIXME comments to some SPATIAL INDEX locking code. It looks
      like Galera write-set replication might not work with SPATIAL INDEX.
      bd7ed1b9
  16. 15 Feb, 2018 2 commits
    • Marko Mäkelä's avatar
      Dead code removal: sess_t · 03400d97
      Marko Mäkelä authored
      The session object is not really needed for anything.
      We can directly create and free the dummy purge_sys->query->trx.
      03400d97
    • Marko Mäkelä's avatar
      Dead code removal: sess_t · 27ea2963
      Marko Mäkelä authored
      The session object is not really needed for anything.
      We can directly create and free the dummy purge_sys->query->trx.
      27ea2963
  17. 13 Feb, 2018 1 commit
  18. 22 Jan, 2018 1 commit
    • Marko Mäkelä's avatar
      MDEV-14941 Timeouts on persistent statistics tables caused by MDEV-14511 · 4f8555f1
      Marko Mäkelä authored
      MDEV-14511 tried to avoid some consistency problems related to InnoDB
      persistent statistics. The persistent statistics are being written by
      an InnoDB internal SQL interpreter that requires the InnoDB data dictionary
      cache to be locked.
      
      Before MDEV-14511, the statistics were written during DDL in separate
      transactions, which could unnecessarily reduce performance (each commit
      would require a redo log flush) and break atomicity, because the statistics
      would be updated separately from the dictionary transaction.
      
      However, because it is unacceptable to hold the InnoDB data dictionary
      cache locked while suspending the execution for waiting for a
      transactional lock (in the mysql.innodb_index_stats or
      mysql.innodb_table_stats tables) to be released, any lock conflict
      was immediately be reported as "lock wait timeout".
      
      To fix MDEV-14941, an attempt to reduce these lock conflicts by acquiring
      transactional locks on the user tables in both the statistics and DDL
      operations was made, but it would still not entirely prevent lock conflicts
      on the mysql.innodb_index_stats and mysql.innodb_table_stats tables.
      
      Fixing the remaining problems would require a change that is too intrusive
      for a GA release series, such as MariaDB 10.2.
      
      Thefefore, we revert the change MDEV-14511. To silence the
      MDEV-13201 assertion, we use the pre-existing flag trx_t::internal.
      4f8555f1
  19. 18 Jan, 2018 1 commit
    • Marko Mäkelä's avatar
      MDEV-14985 innodb_undo_log_truncate may be blocked if transactions were recovered at startup · 6c09a654
      Marko Mäkelä authored
      The field trx_rseg_t::trx_ref_count that was added in WL#6965 in
      MySQL 5.7.5 is being incremented twice if a recovered transaction
      includes both undo log partitions insert_undo and update_undo.
      
      This reference count is being used in trx_purge(), which invokes
      trx_purge_initiate_truncate() to try to truncate an undo tablespace
      file. Because of the double-increment, the trx_ref_count would never
      reach 0.
      
      It is possible that after the failed truncation attempt, the undo
      tablespace would be disabled for logging any new transactions until
      the server is restarted (hopefully after committing or rolling back
      all transactions, so that no transactions would be recovered
      on the next startup).
      
      trx_resurrect_insert(), trx_resurrect_update(): Do not increment
      trx_ref_count. Instead, let the caller do that.
      
      trx_lists_init_at_db_start(): Increment rseg->trx_ref_count only
      once for each recovered transaction. Adjust comments.
      Finally, if innodb_force_recovery prevents the undo log scan,
      do not bother iterating the empty lists.
      6c09a654
  20. 06 Dec, 2017 1 commit
    • Marko Mäkelä's avatar
      Follow-up fix to MDEV-13201 Assertion `srv_undo_sources || ...` failed on... · 77fb7ccb
      Marko Mäkelä authored
      Follow-up fix to MDEV-13201 Assertion `srv_undo_sources || ...` failed on shutdown during DDL operation
      
      Introduce the debug flag trx_t::persistent_stats to suppress the
      assertion for the updates of persistent statistics during fast
      shutdown.
      
      dict_stats_exec_sql(): Do execute the statement even though shutdown
      has been initiated.
      77fb7ccb
  21. 30 Oct, 2017 1 commit
    • Marko Mäkelä's avatar
      Backport MDEV-13890 from 10.2 (InnoDB/XtraDB shutdown failure) · d11001d1
      Marko Mäkelä authored
      If InnoDB or XtraDB recovered committed transactions at server
      startup, but the processing of recovered transactions was
      prevented by innodb_read_only or by innodb_force_recovery,
      an assertion would fail at shutdown.
      
      This bug was originally reproduced when Mariabackup executed
      InnoDB shutdown after preparing (applying redo log into) a backup.
      
      trx_free_prepared(): Allow TRX_STATE_COMMITTED_IN_MEMORY.
      
      trx_undo_free_prepared(): Allow any undo log state. For transactions
      that were resurrected in TRX_STATE_COMMITTED_IN_MEMORY
      the undo log state would have been reset by trx_undo_set_state_at_finish().
      d11001d1
  22. 27 Oct, 2017 1 commit
    • Marko Mäkelä's avatar
      Relax a too strict assertion at shutdown · 02ba15a9
      Marko Mäkelä authored
      trx_free_prepared(): The function trx_resurrect_insert()
      can resurrect a committed transaction when the TRX_UNDO_STATE
      field is not TRX_UNDO_ACTIVE or TRX_UNDO_PREPARED.
      (In the examined failure of mariabackup.xb_compressed_encrypted,
      assertion failure in --apply-log shutdown at line 25,
      the TRX_UNDO_STATE strangely contained the value 0xffff.)
      
      In any case, the assertion must allow the state
      TRX_STATE_COMMITTED_IN_MEMORY for resurrected transactions.
      02ba15a9
  23. 10 Oct, 2017 1 commit
    • Marko Mäkelä's avatar
      MDEV-13311 Presence of old logs in 10.2.7 will corrupt restored instance (change in behavior) · 1b478a7a
      Marko Mäkelä authored
      Mariabackup 10.2.7 would delete the redo log files after a successful
      --prepare operation. If the user is manually copying the prepared files
      instead of using the --copy-back option, it could happen that some old
      redo log file would be preserved in the restored location. These old
      redo log files could cause corruption of the restored data files when
      the server is started up.
      
      We prevent this scenario by creating a "poisoned" redo log file
      ib_logfile0 at the end of the --prepare step. The poisoning consists
      of simply truncating the file to an empty file. InnoDB will refuse
      to start up on an empty redo log file.
      
      copy_back(): Delete all redo log files in the target if the source
      file ib_logfile0 is empty. (Previously we did this if the source
      file is missing.)
      
      SRV_OPERATION_RESTORE_EXPORT: A new variant of SRV_OPERATION_RESTORE
      when the --export option is specified. In this mode, we will keep
      deleting all redo log files, instead of truncating the first one.
      
      delete_log_files(): Add a parameter for the first file to delete,
      to be passed as 0 or 1.
      
      innobase_start_or_create_for_mysql(): In mariabackup --prepare,
      tolerate an empty ib_logfile0 file. Otherwise, require the first
      redo log file to be longer than 4 blocks (2048 bytes). Unless
      --export was specified, truncate the first log file at the
      end of --prepare.
      1b478a7a
  24. 12 Sep, 2017 1 commit
  25. 23 Aug, 2017 1 commit
    • Marko Mäkelä's avatar
      MDEV-13606 XA PREPARE transactions should survive innodb_force_recovery=1 or 2 · b8b3ba63
      Marko Mäkelä authored
      When MySQL 5.0.3 introduced InnoDB support for two-phase commit,
      it also introduced the questionable logic to roll back XA PREPARE
      transactions on startup when innodb_force_recovery is 1 or 2.
      
      Remove this logic in order to avoid unwanted side effects when
      innodb_force_recovery is being set for other reasons. That is,
      XA PREPARE transactions will always remain in that state until
      InnoDB receives an explicit XA ROLLBACK or XA COMMIT request
      from the upper layer.
      
      At the time the logic was introduced in MySQL 5.0.3, there already
      was a startup parameter that is the preferred way of achieving
      the behaviour: --tc-heuristic-recover=ROLLBACK.
      b8b3ba63
  26. 15 Aug, 2017 1 commit
    • Marko Mäkelä's avatar
      MDEV-13520 InnoDB attempts UPDATE with DB_TRX_ID=0 if innodb_force_recovery=3 · b4f6b678
      Marko Mäkelä authored
      trx_set_rw_mode(): Check the flag high_level_read_only instead
      of testing srv_force_recovery (innodb_force_recovery) directly.
      There is no need to prevent the creation of read-write transactions
      if innodb_force_recovery=3 is used. Yes, in that mode any recovered
      incomplete transactions will not be rolled back, but these transactions
      will continue to hold locks on the records that they have modified.
      If the new read-write transactions hit conflicts with already existing
      (possibly recovered) transactions, the lock wait timeout mechanism
      will work just fine.
      b4f6b678
  27. 08 Aug, 2017 1 commit
  28. 07 Aug, 2017 1 commit
    • Kristian Nielsen's avatar
      MDEV-11937: InnoDB flushes redo log too often · 36e81a23
      Kristian Nielsen authored
      Problem was introduced with the InnoDB 5.7 merge, the code related to
      avoiding extra fsync at the end of commit when binlog is enabled. The
      MariaDB method for this was removed, but the replacement MySQL method
      based on thd_get_durability_property() is not functional in MariaDB.
      
      This commit reverts the offending parts of the merge and adds a test
      case, to fix the problem for InnoDB. But other storage engines are
      likely to have a similar problem.
      36e81a23
  29. 05 Jul, 2017 1 commit
    • Marko Mäkelä's avatar
      InnoDB: Remove a redundant condition and an outdated comment · 0ff62ad8
      Marko Mäkelä authored
      Since MariaDB 10.2.2, temporary table metadata is not written
      to the InnoDB data dictionary tables. Therefore,
      the DICT_TF2_TEMPORARY flag cannot be set in SYS_TABLES,
      except if there exist orphan temporary tables that were created
      before MariaDB 10.2.2.
      
      trx_resurrect_table_locks(): Do not skip temporary tables.
      If a resurrect transaction modified a temporary table that was
      created before MariaDB 10.2.2, that table would be treated
      internally as a persistent table. It is safer to resurrect
      locks than to skip the table, because the table would be modified
      on transaction rollback.
      0ff62ad8
  30. 29 Jun, 2017 2 commits
  31. 16 Jun, 2017 1 commit
    • Marko Mäkelä's avatar
      Remove trx_t::has_search_latch and simplify debug code · 50faeda4
      Marko Mäkelä authored
      When the btr_search_latch was split into an array of latches
      in MySQL 5.7.8 as part of the Oracle Bug#20985298 fix, the "caching"
      of the latch across storage engine API calls was removed, and
      the field trx->has_search_latch would only be set during a short
      time frame in the execution of row_search_mvcc(), which was
      formerly called row_search_for_mysql().
      
      This means that the column
      INFORMATION_SCHEMA.INNODB_TRX.TRX_ADAPTIVE_HASH_LATCHED will always
      report 0. That column cannot be removed in MariaDB 10.2, but it
      can be removed in future releases.
      
      trx_t::has_search_latch: Remove.
      
      trx_assert_no_search_latch(): Remove.
      
      row_sel_try_search_shortcut_for_mysql(): Remove a redundant condition
      on trx->has_search_latch (it was always true).
      
      sync_check_iterate(): Make the parameter const.
      
      sync_check_functor_t: Make the operator() const, and remove result()
      and the virtual destructor. There is no need to have mutable state
      in the functors.
      
      sync_checker<bool>: Replaces dict_sync_check and btrsea_sync_check.
      
      sync_check: Replaces btrsea_sync_check.
      
      dict_sync_check: Instantiated from sync_checker.
      
      sync_allowed_latches: Use std::find() directly on the array.
      Remove the std::vector.
      
      TrxInInnoDB::enter(), TrxInInnoDB::exit(): Remove obviously redundant
      debug assertions on trx->in_depth, and use equality comparison against 0
      because it could be more efficient on some architectures.
      50faeda4