1. 29 Apr, 2022 3 commits
    • Marko Mäkelä's avatar
      MDEV-28445 Secondary index locking invokes costly trx_sys.get_min_trx_id() · b6e41e38
      Marko Mäkelä authored
      lock_sec_rec_read_check_and_lock(): Remove a redundant check
      for trx_sys.get_min_trx_id(). This would be checked in
      lock_sec_rec_some_has_impl() anyway. Also, test the
      cheapest conditions first.
      
      lock_sec_rec_some_has_impl(): Replace trx_sys.get_min_trx_id()
      with trx_sys.find_same_or_older() that is much easier to evaluate.
      
      Inspired by mysql/mysql-server@0a0c0db97e9c9705f4dffc629a770fb87a60cb22
      b6e41e38
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-28443: MDEV-15250 causes latch order violation · 0f717d03
      Thirunarayanan Balathandayuthapani authored
      Problem:
      =======
      Index page latches must be acquired before undo page latches.
      In trx_t::apply_log(), InnoDB acquired undo log page latch
      before an index page latch.
      
      Solution:
      ========
      In trx_t::apply_log(), InnoDB should copy the undo log
      record and release the undo log block before applying
      it on online indexes.
      0f717d03
    • Marko Mäkelä's avatar
      MDEV-27274: DROP TABLE does not delete detached InnoDB files · 8c1c6130
      Marko Mäkelä authored
      In commit 1bd681c8 (MDEV-25506 part 3)
      the way how DDL transactions delete files was rewritten.
      Only files that are actually attached to InnoDB tablespaces would be
      deleted, and only after the DDL transaction was durably committed.
      
      After a failed ALTER TABLE...IMPORT TABLESPACE, any data files that
      the user might have moved to the data directory will not be attached
      to the InnoDB data dictionary. Therefore, DROP TABLE would not
      attempt to delete those files, and a subsequent CREATE TABLE would
      fail. The logic was that the user who created the files outside the
      DBMS is still the owner of those files, and InnoDB should not delete
      those files because an "ownership transfer" (IMPORT TABLESPACE) was
      not successfully completed.
      
      However, not deleting those detached files could surprise users.
      
      ha_innobase::delete_table(): Even if no tablespace exists, try to
      delete any files that might match the table name.
      
      Reviewed by: Thirunarayanan Balathandayuthapani
      8c1c6130
  2. 27 Apr, 2022 1 commit
  3. 26 Apr, 2022 11 commits
  4. 25 Apr, 2022 7 commits
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-15250 UPSERT during ALTER TABLE results in 'Duplicate entry' error for alter · 4b80c11f
      Thirunarayanan Balathandayuthapani authored
      - InnoDB DDL results in `Duplicate entry' if concurrent DML throws
      duplicate key error. The following scenario explains the problem
      
      connection con1:
        ALTER TABLE t1 FORCE;
      
      connection con2:
        INSERT INTO t1(pk, uk) VALUES (2, 2), (3, 2);
      
      In connection con2, InnoDB throws the 'DUPLICATE KEY' error because
      of unique index. Alter operation will throw the error when applying
      the concurrent DML log.
      
      - Inserting the duplicate key for unique index logs the insert
      operation for online ALTER TABLE. When insertion fails,
      transaction does rollback and it leads to logging of
      delete operation for online ALTER TABLE.
      While applying the insert log entries, alter operation
      encounters 'DUPLICATE KEY' error.
      
      - To avoid the above fake duplicate scenario, InnoDB should
      not write any log for online ALTER TABLE before DML transaction
      commit.
      
      - User thread which does DML can apply the online log if
      InnoDB ran out of online log and index is marked as completed.
      Set online log error if apply phase encountered any error.
      It can also clear all other indexes log, marks the newly
      added indexes as corrupted.
      
      - Removed the old online code which was a part of DML operations
      
      commit_inplace_alter_table() : Does apply the online log
      for the last batch of secondary index log and does frees
      the log for the completed index.
      
      trx_t::apply_online_log: Set to true while writing the undo
      log if the modified table has active DDL
      
      trx_t::apply_log(): Apply the DML changes to online DDL tables
      
      dict_table_t::is_active_ddl(): Returns true if the table
      has an active DDL
      
      dict_index_t::online_log_make_dummy(): Assign dummy value
      for clustered index online log to indicate the secondary
      indexes are being rebuild.
      
      dict_index_t::online_log_is_dummy(): Check whether the online
      log has dummy value
      
      ha_innobase_inplace_ctx::log_failure(): Handle the apply log
      failure for online DDL transaction
      
      row_log_mark_other_online_index_abort(): Clear out all other
      online index log after encountering the error during
      row_log_apply()
      
      row_log_get_error(): Get the error happened during row_log_apply()
      
      row_log_online_op(): Does apply the online log if index is
      completed and ran out of memory. Returns false if apply log fails
      
      UndorecApplier: Introduced a class to maintain the undo log
      record, latched undo buffer page, parse the undo log record,
      maintain the undo record type, info bits and update vector
      
      UndorecApplier::get_old_rec(): Get the correct version of the
      clustered index record that was modified by the current undo
      log record
      
      UndorecApplier::clear_undo_rec(): Clear the undo log related
      information after applying the undo log record
      
      UndorecApplier::log_update(): Handle the update, delete undo
      log and apply it on online indexes
      
      UndorecApplier::log_insert(): Handle the insert undo log
      and apply it on online indexes
      
      UndorecApplier::is_same(): Check whether the given roll pointer
      is generated by the current undo log record information
      
      trx_t::rollback_low(): Set apply_online_log for the transaction
      after partially rollbacked transaction has any active DDL
      
      prepare_inplace_alter_table_dict(): After allocating the online
      log, InnoDB does create fulltext common tables. Fulltext index
      doesn't allow the index to be online. So removed the dead
      code of online log removal
      
      Thanks to Marko Mäkelä for providing the initial prototype and
      Matthias Leich for testing the issue patiently.
      4b80c11f
    • Marko Mäkelä's avatar
      1a66e3f8
    • Marko Mäkelä's avatar
      Remove redundant innodb-page_compression_ tests · cba13079
      Marko Mäkelä authored
      These were replaced with innodb.innodb_page_compressed
      in commit 35095c45
      cba13079
    • Marko Mäkelä's avatar
      Clean up the page_compressed tests · 35095c45
      Marko Mäkelä authored
      It suffices to test compression with one record. Restarting the
      server is not really needed; we are exercising the log based recovery
      in other tests, such as mariabackup.page_compression_level.
      35095c45
    • Marko Mäkelä's avatar
      Cleanup: Remove IF_VALGRIND · 4faef6e2
      Marko Mäkelä authored
      The purpose of the compress() wrapper my_compress_buffer() was twofold:
      silence Valgrind warnings about uninitialized memory access before
      zlib 1.2.4, and have PERFORMANCE_SCHEMA instrumentation of some zlib
      related memory allocation. Because of PERFORMANCE_SCHEMA, we cannot
      trivially replace my_compress_buffer() with compress().
      
      az_open(): Remove a crc32() call. Any CRC of the empty string is 0.
      4faef6e2
    • Marko Mäkelä's avatar
      Do not disable --symbolic-links on Valgrind (or MSAN) · 232af0c7
      Marko Mäkelä authored
      The option --symbolic-links was originally disabled by default under
      Purify (and later Valgrind) in 51156c5a
      without any explanation.
      232af0c7
    • Alexander Barkov's avatar
      MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition · 4ed30b2a
      Alexander Barkov authored
      Adding a 10.6 specific test from the MDEV
      4ed30b2a
  5. 22 Apr, 2022 1 commit
    • Marko Mäkelä's avatar
      MDEV-27094 Debug builds include useless InnoDB "disabled" options · c009ce7d
      Marko Mäkelä authored
      This is a backport of commit 4489a89c
      in order to remove the test innodb.redo_log_during_checkpoint
      that would cause trouble in the DBUG subsystem invoked by
      safe_mutex_lock() via log_checkpoint(). Before
      commit 7cffb5f6
      these mutexes were of different type.
      
      The following options were introduced in
      commit 2e814d47 (mariadb-10.2.2)
      and have little use:
      
      innodb_disable_resize_buffer_pool_debug had no effect even in
      MariaDB 10.2.2 or MySQL 5.7.9. It was introduced in
      mysql/mysql-server@5c4094cf4971eebab89da4ee4ae92c71f69cd524
      to work around a problem that was fixed in
      mysql/mysql-server@2957ae4f990bf3aed25822b0ce15d3ccad0b54b6
      (but the parameter was not removed).
      
      innodb_page_cleaner_disabled_debug and innodb_master_thread_disabled_debug
      are only used by the test innodb.redo_log_during_checkpoint
      that will be removed as part of this commit.
      
      innodb_dict_stats_disabled_debug is only used by that test,
      and it is redundant because one could simply use
      innodb_stats_persistent=OFF or the STATS_PERSISTENT=0 attribute
      of the table in the test to achieve the same effect.
      c009ce7d
  6. 21 Apr, 2022 14 commits
    • Marko Mäkelä's avatar
      Merge 10.5 into 10.6 · fae0ccad
      Marko Mäkelä authored
      fae0ccad
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · 620c55e7
      Marko Mäkelä authored
      620c55e7
    • Vlad Lesin's avatar
      MDEV-27919 mariabackup --log-copy-interval is measured in millisecondss in... · 1b558dd4
      Vlad Lesin authored
      MDEV-27919 mariabackup --log-copy-interval is measured in millisecondss in 10.5 and in microseconds in 10.6
      
      Multiply polling interval by 1000.
      1b558dd4
    • Marko Mäkelä's avatar
      MDEV-28371 Assertion fold == id.fold() failed in buf_flush_check_neighbor() · fdec842f
      Marko Mäkelä authored
      Due to 32-bit arithmetics, SRV_TMP_SPACE_ID page number 0x200002 would be
      folded to 0, which is incompatible with the assumption that was made in
      commit 7cffb5f6 (MDEV-23399).
      
      page_id_t::fold(): Compute in the native word width instead of uint32_t.
      On 64-bit platforms, an alternative would be to return the 64-bit m_id
      directly, but that was measured to cause a performance regression.
      
      fil_space_t::open(): Invoke fil_node_t::find_metadata() when the
      tablespace is being created. In this way, we will actually detect
      that the temporary tablespace resides on SSD. (During database
      creation, also the system tablespace will correctly be detected as
      residing on SSD.)
      fdec842f
    • Daniel Black's avatar
      MDEV-28263: mariadb-tzinfo-to-sql (postfix) · f0c52bfe
      Daniel Black authored
      I missed include/no_protocol.inc already existed.
      f0c52bfe
    • Daniel Black's avatar
      MDEV-28313 InnoDB transactions are not aligned at cache lines (postfix) · c47069ea
      Daniel Black authored
      aarch64 RHEL7 and Centos7 internal compiler error here, so we carry
      another pragma enchantment like buf0lru.cc and row0ins.cc.
      c47069ea
    • Marko Mäkelä's avatar
      WolfSSL v5.2.0-stable · aec85607
      Marko Mäkelä authored
      aec85607
    • Marko Mäkelä's avatar
      Fix clang -Wunused-but-set-variable · f84b5d78
      Marko Mäkelä authored
      f84b5d78
    • Marko Mäkelä's avatar
      Merge 10.3 into 10.4 · 39478409
      Marko Mäkelä authored
      39478409
    • Marko Mäkelä's avatar
      MDEV-28369 ibuf_bitmap_mutex is an unnecessary contention point · 4730314a
      Marko Mäkelä authored
      The only purpose of ibuf_bitmap_mutex is to prevent a deadlock between
      two concurrent invocations of ibuf_update_free_bits_for_two_pages_low()
      on the same pair of bitmap pages, but in opposite order.
      The mutex is unnecessarily serializing the execution of the function
      even when it is being invoked on totally different tablespaces.
      To avoid deadlocks, it suffices to ensure that the two page latches
      are being acquired in a deterministic (sorted) order.
      4730314a
    • Daniel Black's avatar
      Merge branch 10.4 into 10.5 · 580cbd18
      Daniel Black authored
      A few of constaint -> constraint
      580cbd18
    • Daniel Black's avatar
      MDEV-21208: mysql_tzinfo_to_sql does not work in strict mode · b8398ee1
      Daniel Black authored
      Remove Warning that occured by doing an ALTER TABLE ... ORDER
      BY on an InnoDB table.
      
      Reviewed by Brandon Nesterenko
      b8398ee1
    • Daniel Black's avatar
      MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases · 13e77930
      Daniel Black authored
      The --skip-write-binlog message was confusing that it only had
      an effect if the galera was enabled. There are uses beyond galera
      so we apply SET SESSION SQL_LOG_BIN=0 as implied by the option
      without being conditional on the wsrep status.
      
      We also with --skip-write-binlog actually check the session @@WSREP_ON
      variable rather than the global server variable.
      
      Since 10.6, the wsrep_mode could replicate Aria and MyISAM, in which
      case no change to innodb and back is needed.
      
      By removing the conditions, we can use LOCK TABLES in a general case
      improving the load speed of Aria (MDEV-23326), regardless of the
      skip-write-binlog flag. The only case where we don't use LOCK TABLES is
      when we are replicating via Innodb, because wsrep_on=1 and wsrep_mode
      doesn't contain REPLICATE_ARIA{,MYISAM}. This uses an Innodb transaction
      instead. When replicating via InnoDB we change the table engine type
      back to what it was originally.
      
      By removing the \d and other syntax that requires parsing by
      the mariadb client, we can use the generated SQL more generally, like
      in the embedded server.
      
      We also save and restore the SQL_LOG_BIN and WSREP_ON session server
      variables so this can be included in the same session as other data
      without taking into changes in state.
      
      Remove wsrep.mysql_tzinfo_to_sql_symlink{,_skip} tests as they offered
      no additional coverage beyond main.mysql_tzinfo_to_sql_symlink (no
      server testing was done).
      
      Add galera.mariadb_tzinfo_to_sql to actually test the replication
      of tzinfo data through galera.
      
      The conditional executable comment around /*M!100602 ...
      START TRANSACTION .. LOCK TABLES.. */ is so that we can provide tzinfo
      files (MDEV-27113, MDBF-389) and in the case that a user uses it on a
      pre-10.6 server version it will still work. Both START TRANSACTION and
      LOCK TABLES are not supported in prepared statements in MariaDB versions
      earlier than 10.6.2.
      
      Reviewed by Brandon Nesterenko
      13e77930
    • Haidong Ji's avatar
      MDEV-28227 Error message Chinese translation · d7189fbc
      Haidong Ji authored
      - Simplified Chinese translation added
      - Character encoding is gdk
      -- gdk covers more characters
      -- gdk includes both Simplified and Traditional
      -- best option I think, may need to work along with other locale
      settings
      - Other cleanup
      -- Within each error, messages are sorted according to language code
      -- More consistent formatting (8 spaces proceeding each translation)
      -- jps removed as duplicate of jpn translation
      
      This should be a good starting point. More refinement is appreciated,
      and needed down the road.
      
      English "containt" (sic) spelling fixes on ER_FK_NO_INDEX_{CHILD,PARENT}
      resulting in mtr test case adjustments.
      
      Edited/reviewed by Daniel Black
      d7189fbc
  7. 20 Apr, 2022 3 commits