1. 11 Feb, 2020 6 commits
    • Marko Mäkelä's avatar
      MDEV-19747: Deprecate and ignore innodb_log_optimize_ddl · fc2f2fa8
      Marko Mäkelä authored
      During native table rebuild or index creation, InnoDB used to skip
      redo logging and write MLOG_INDEX_LOAD records to inform crash recovery
      and Mariabackup of the gaps in redo log. This is fragile and prohibits
      some optimizations, such as skipping the doublewrite buffer for
      newly (re)initialized pages (MDEV-19738).
      
      row_merge_write_redo(): Remove. We do not write MLOG_INDEX_LOAD
      records any more. Instead, we write full redo log.
      
      FlushObserver: Remove.
      
      fseg_free_page_func(): Remove the parameter log. Redo logging
      cannot be disabled.
      
      fil_space_t::redo_skipped_count: Remove.
      
      We cannot remove buf_block_t::skip_flush_check, because PageBulk
      will temporarily generate invalid B-tree pages in the buffer pool.
      fc2f2fa8
    • Marko Mäkelä's avatar
      MDEV-17491 micro optimize page_id_t further · 8ccb3caa
      Marko Mäkelä authored
      Let us define page_id_t as a thin wrapper of uint64_t so that
      the comparison operators can be simplified. This is a follow-up
      to the original commit 14be8143.
      
      The comparison operator for recv_sys.pages.emplace() turned out to be
      a busy spot in a recovery benchmark. That data structure was introduced
      in MDEV-19586 in commit 177a571e.
      8ccb3caa
    • Marko Mäkelä's avatar
      MDEV-21351: Fix a performance regression · f3dac591
      Marko Mäkelä authored
      The linear scan of recv_sys_t::blocks() in recv_sys_t::free()
      turns out to dominate the execution time in crash recovery.
      Let us scan the much shorter buf_pool->chunks lists instead.
      f3dac591
    • Jan Lindström's avatar
      MDEV-20051: Add new mode to wsrep_OSU_method in which Galera checks storage... · e6a50e41
      Jan Lindström authored
      MDEV-20051: Add new mode to wsrep_OSU_method in which Galera checks storage engine of the effected table
      
      Introduced a new wsrep_strict_ddl configuration variable in which
      Galera checks storage engine of the effected table. If table is not
      InnoDB (only storage engine currently fully supporting Galera
      replication) DDL-statement will return error code:
      
      ER_GALERA_REPLICATION_NOT_SUPPORTED
             eng "DDL-statement is forbidden as table storage engine does not support Galera replication"
      
      However, when wsrep_replicate_myisam=ON we allow DDL-statements to
      MyISAM tables. If effected table is allowed storage engine Galera
      will run normal TOI.
      
      This new setting should be for now set globally on all
      nodes in a cluster. When this setting is set following DDL-clauses
      accessing tables not supporting Galera replication are refused:
      
      * CREATE TABLE (e.g. CREATE TABLE t1(a int) engine=Aria
      * ALTER TABLE
      * TRUNCATE TABLE
      * CREATE VIEW
      * CREATE TRIGGER
      * CREATE INDEX
      * DROP INDEX
      * RENAME TABLE
      * DROP TABLE
      
      Statements on PROCEDURE, EVENT, FUNCTION are allowed as effected
      tables are known only at execution. Furthermore, USER, ROLE, SERVER,
      DATABASE statements are also allowed as they do not really have
      effected table.
      e6a50e41
    • Igor Babaev's avatar
      MDEV-21683 Server crashes in get_quick_keys with not_null_range_scan · 41541a7c
      Igor Babaev authored
      ANding of the range built from inferred NOT NULL conditions and the range
      built from other conditions used in WHERE/ON clauses may produce an
      IMPOSSIBLE range. The code of MDEV-15777 did not take into account this
      possibility.
      41541a7c
    • Alexander Barkov's avatar
      83e75b39
  2. 10 Feb, 2020 1 commit
  3. 08 Feb, 2020 5 commits
    • Alexander Barkov's avatar
      MDEV-21689 Add Sql_cmd for GRANT/REVOKE statements · 77c63823
      Alexander Barkov authored
      Rewriting GRANT/REVOKE grammar to use more bison stack and use Sql_cmd_ style
      
      1. Removing a few members from LEX:
         - uint grant, grant_to_col, which_columns
         - List<LEX_COLUMN> columns
         - bool all_privileges
      2. Adding classes Grand_object_name, Lex_grant_object_name
      3. Adding classes Grand_privilege, Lex_grand_privilege
      4. Adding struct Lex_column_list_privilege_st, class Lex_column_list_privilege
      5. Rewriting the GRANT/REVOKE grammar to use new classes and pass them through
         bison stack (rather than directly access LEX members)
      6. Adding classes Sql_cmd_grant* and Sql_cmd_revoke*,
         changing GRANT/REVOKE to use LEX::m_sql_cmd.
      7. Adding the "sp_handler" grammar rule and removing some duplicate grammar
         for GRANT/REVOKE for different kinds of SP objects.
      8. Adding a new rule comma_separated_ident_list, reusing it in:
         - with_column_list
         - colum_list_privilege
      77c63823
    • Marko Mäkelä's avatar
      Cleanup: Aligned InnoDB index page header access · 06b0623a
      Marko Mäkelä authored
      ut_align_down(): Preserve the const qualifier. Use C++ casts.
      
      ha_delete_hash_node(): Correct an assertion expression.
      
      fil_page_get_type(): Perform an assumed-aligned read.
      
      page_align(): Preserve the const qualifier. Assume (some) alignment.
      
      page_get_max_trx_id(): Check the index page type.
      
      page_header_get_field(): Perform an assumed-aligned read.
      
      page_get_autoinc(): Perform an assumed-aligned read.
      
      page_dir_get_nth_slot(): Perform an assumed-aligned read.
      Preserve the const qualifier.
      06b0623a
    • Marko Mäkelä's avatar
      MDEV-21351: Allocate aligned memory · c5856b0a
      Marko Mäkelä authored
      recv_sys_t::ALIGNMENT: The recv_sys_t::alloc() alignment
      c5856b0a
    • Marko Mäkelä's avatar
      6eed99f1
    • Martin Liska's avatar
      MDEV-21248: Prevent optimizing out buf argument in check_stack_overrun. · 35c27785
      Martin Liska authored
      When using LTO, one can see optimization of stack variables that
      are passed to check_stack_overrun as argument buf. That prevents
      proper stack overrun detection.
      35c27785
  4. 07 Feb, 2020 6 commits
    • Marko Mäkelä's avatar
      One more fixup for sizeof(mtr_t) reduction · 0d1ca193
      Marko Mäkelä authored
      Add explicit casts when assigning ulint to m_user_space_id.
      0d1ca193
    • Marko Mäkelä's avatar
      mtr_t::get_log_mode(): Remove a redundant assertion · 91e7b443
      Marko Mäkelä authored
      mtr_log_t and mtr_t::m_log_mode have the same range 0 to 3.
      91e7b443
    • Marko Mäkelä's avatar
      Fixup the parent commit · 2b260f2d
      Marko Mäkelä authored
      mtr_t::get_log_mode(): Use equivalent static_assert().
      
      mtr_t::m_n_log_recs: Do not exceed the number of bits in uint16_t.
      2b260f2d
    • Marko Mäkelä's avatar
      Cleanup: Recude sizeof(mtr_t) · 9a999469
      Marko Mäkelä authored
      Use bit-fields for some mtr_t members to improve locality of reference.
      Because mtr_t is never shared between threads, there are no considerations
      regarding concurrent access.
      9a999469
    • Marko Mäkelä's avatar
      Merge 10.4 into 10.5 · 8b6cfda6
      Marko Mäkelä authored
      8b6cfda6
    • Marko Mäkelä's avatar
      MDEV-21674 purge_sys.stop() fails to wait for purge workers to complete · 8b97eba3
      Marko Mäkelä authored
      Since commit 5e62b6a5 (MDEV-16264),
      purge_sys_t::stop() no longer waited for all purge activity to stop.
      
      This caused problems on FLUSH TABLES...FOR EXPORT because of
      purge running concurrently with the buffer pool flush.
      The assertion at the end of buf_flush_dirty_pages() could fail.
      
      The, implemented by Vladislav Vaintroub, aims to eliminate race
      conditions when stopping or resuming purge:
      
      waitable_task::disable(): Wait for the task to complete, then replace
      the task callback function with noop.
      
      waitable_task::enable(): Restore the original task callback function
      after disable().
      
      purge_sys_t::stop(): Invoke purge_coordinator_task.disable().
      
      purge_sys_t::resume(): Invoke purge_coordinator_task.enable().
      
      purge_sys_t::running(): Add const qualifier, and clarify the comment.
      The purge coordinator task will remain active as long as any purge
      worker task is active.
      
      purge_worker_callback(): Assert purge_sys.running().
      
      srv_purge_wakeup(): Merge with the only caller purge_sys_t::resume().
      
      purge_coordinator_task: Use static linkage.
      8b97eba3
  5. 06 Feb, 2020 2 commits
    • Marko Mäkelä's avatar
      MDEV-18582: Fix a race condition · cd3bdc09
      Marko Mäkelä authored
      srv_export_innodb_status(): While gathering
      innodb_mem_adaptive_hash, acquire btr_search_latches[i]
      in order to prevent a race condition with buffer pool resizing.
      cd3bdc09
    • Marko Mäkelä's avatar
      MDEV-21351: Free processed recv_sys_t::blocks · 6d214415
      Marko Mäkelä authored
      Release memory as soon as redo log records are processed.
      
      Because the memory allocation and deallocation of parsed redo log
      records must be protected by recv_sys.mutex, it is better to avoid
      using a std::atomic field for bookkeeping.
      
      buf_page_t::access_time: Keep track of the recv_sys.pages record
      allocations. The most significant 16 bits will count allocated
      blocks (which were previously counted by buf_page_t::buf_fix_count
      in the debug version), and the least significant 16 bits indicate
      the number of allocated bytes in the block (which was previously
      managed in buf_block_t::modify_clock), which must be a positive
      number, up to innodb_page_size. The byte offset 65536 is represented
      as the value 0.
      
      recv_recover_page(): Let the caller erase the log.
      
      recv_validate_tablespace(): Acquire recv_sys_t::mutex.
      6d214415
  6. 05 Feb, 2020 3 commits
  7. 04 Feb, 2020 5 commits
    • Sergey Vojtovich's avatar
      libpmem cmake macros · daaa881c
      Sergey Vojtovich authored
      Also added support for MAP_SYNC. It allows to achieve decent performance
      with DAX devices even when libpmem is unavailable.
      
      Fixed Windows version of my_msync(): according to manual FlushViewOfFile()
      may return before flush is actually completed. It is advised to issue
      FlushFileBuffers() after FlushViewOfFile().
      daaa881c
    • Marko Mäkelä's avatar
      MDEV-21645 SIGSEGV in innobase_get_computed_value · a56f7824
      Marko Mäkelä authored
      ha_innobase::commit_inplace_alter_table(): After
      ALTER_STORED_COLUMN_ORDER, ensure that the virtual column metadata
      will be reloaded also when the table is not being rebuilt.
      a56f7824
    • Sujatha's avatar
      MDEV-20601: Make REPLICA a synonym for SLAVE in SQL statements · 42e825dd
      Sujatha authored
      Fix:
      ===
      Add "REPLICA" as an alias for "SLAVE". All commands which use "SLAVE" keyword
      can be used with new alias "REPLICA".
      
      List of commands:
      
      On Master:
      =========
      SHOW REPLICA HOSTS <--> SHOW SLAVE HOSTS
      Privilege "SLAVE"  <--> "REPLICA"
      
      On Slave:
      =========
      START SLAVE       <--> START REPLICA
      START ALL SLAVES  <--> START ALL REPLICAS
      START SLAVE UNTIL <--> START REPLICA UNTIL
      STOP SLAVE        <--> STOP REPLICA
      STOP ALL SLAVES   <--> STOP ALL REPLICAS
      RESET SLAVE       <--> RESET REPLICA
      RESET SLAVE ALL   <--> RESET REPLICA ALL
      SLAVE_POS         <--> REPLICA_POS
      42e825dd
    • Jan Lindström's avatar
      MDEV-20625 : MariaDB asserting when enabling wsrep_on · 46386661
      Jan Lindström authored
      We need to release global system variables mutex before
      doing wsrep_init to avoid race with next show status and
      we need to save wsrep_on value as it is changed on wsrep_init.
      Added test case.
      46386661
    • Julius Goryavsky's avatar
      93278ee8
  8. 03 Feb, 2020 3 commits
    • Jan Lindström's avatar
      MDEV-20625 : MariaDB asserting when enabling wsrep_on · 574354a6
      Jan Lindström authored
      When wsrep_on is changed to ON we might need to run wsrep_init
      if wsrep-provider is set and wsrep is not inited.
      574354a6
    • Eugene Kosov's avatar
      try to fix Win x86 build · 287c1db7
      Eugene Kosov authored
      287c1db7
    • Sachin's avatar
      MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for... · eed6d215
      Sachin authored
      MDEV-20001 Potential dangerous regression: INSERT INTO >=100 rows fail for myisam table with HASH indexes
      
      Problem:-
      
      So the issue is when we do bulk insert with rows
      > MI_MIN_ROWS_TO_DISABLE_INDEXES(100) , We try to disable the indexes to
      speedup insert. But current logic also disables the long unique indexes.
      
      Solution:- In ha_myisam::start_bulk_insert if we find long hash index
      (HA_KEY_ALG_LONG_HASH) we will not disable the index.
      
      This commit also refactors the mi_disable_indexes_for_rebuild function,
      Since this is function is called at only one place, it is inlined into
      start_bulk_insert
      
      mi_clear_key_active is added into myisamdef.h because now it is also used
      in ha_myisam.cc file.
      
      (Same is done for Aria Storage engine)
      eed6d215
  9. 02 Feb, 2020 2 commits
  10. 01 Feb, 2020 3 commits
  11. 31 Jan, 2020 3 commits
    • Marko Mäkelä's avatar
      MDEV-17844 recs_off_validate() fails in page_zip_write_trx_id_and_roll_ptr() · d87b725e
      Marko Mäkelä authored
      In commit 0e5a4ac2 (MDEV-15562)
      we introduced was a bogus debug check failure that does not affect
      the correctness of the release build.
      
      With a fixed-length PRIMARY KEY, we do not have to recompute
      the rec_get_offsets() after restarting the mini-transaction,
      because the offsets of DB_TRX_ID,DB_ROLL_PTR are not going
      to change.
      
      row_undo_mod_clust(): Invoke rec_offs_make_valid() to keep the
      debug check in page_zip_write_trx_id_and_roll_ptr() happy.
      
      The scenario to reproduce this bug should be rather unlikely:
      In the time frame when row_undo_mod_clust() has committed its
      first mini-transaction and has not yet started the next one,
      another mini-transaction must do something that causes the page
      to be reorganized, split or merged.
      d87b725e
    • Marko Mäkelä's avatar
      Fixup cd2c0e01 · 88bcc7f2
      Marko Mäkelä authored
      The variable 'dlh' was being used uninitialized if WSREP_PROVIDER
      is not set.
      88bcc7f2
    • Sachin's avatar
      Empty commit · a10a94b2
      Sachin authored
      a10a94b2
  12. 30 Jan, 2020 1 commit