1. 07 Feb, 2020 2 commits
    • 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
  2. 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
  3. 05 Feb, 2020 3 commits
  4. 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
  5. 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
  6. 02 Feb, 2020 2 commits
  7. 01 Feb, 2020 3 commits
  8. 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
  9. 30 Jan, 2020 1 commit
  10. 29 Jan, 2020 6 commits
    • Monty's avatar
      Fixed compiler warnings from gcc 7.4.1 · 4d61f124
      Monty authored
      - Fixed possible error in rocksdb/rdb_datadic.cc
      4d61f124
    • Monty's avatar
      Added error output wsrep_print_version · cd2c0e01
      Monty authored
      This helps to determinate why galera library doesn't load
      cd2c0e01
    • mkaruza's avatar
      Galera GTID support · 41bc7368
      mkaruza authored
      Support for galera GTID consistency thru cluster. All nodes in cluster
      should have same GTID for replicated events which are originating from cluster.
      Cluster originating commands need to contain sequential WSREP GTID seqno
      Ignore manual setting of gtid_seq_no=X.
      
      In master-slave scenario where master is non galera node replicated GTID is
      replicated and is preserved in all nodes.
      
      To have this - domain_id, server_id and seqnos should be same on all nodes.
      Node which bootstraps the cluster, to achieve this, sends domain_id and
      server_id to other nodes and this combination is used to write GTID for events
      that are replicated inside cluster.
      
      Cluster nodes that are executing non replicated events are going to have different
      GTID than replicated ones, difference will be visible in domain part of gtid.
      
      With wsrep_gtid_domain_id you can set domain_id for WSREP cluster.
      
      Functions WSREP_LAST_WRITTEN_GTID, WSREP_LAST_SEEN_GTID and
      WSREP_SYNC_WAIT_UPTO_GTID now works with "native" GTID format.
      
      Fixed galera tests to reflect this chances.
      
      Add variable to manually update WSREP GTID seqno in cluster
      
      Add variable to manipulate and change WSREP GTID seqno. Next command
      originating from cluster and on same thread will have set seqno and
      cluster should change their internal counter to it's value.
      Behavior is same as using @@gtid_seq_no for non WSREP transaction.
      41bc7368
    • Marko Mäkelä's avatar
      Cleanup: Remove mtr_state_t and mtr_t::m_state · 5defdc38
      Marko Mäkelä authored
      mtr_t::is_active(), mtr_t::is_committed(): Make debug-only.
      5defdc38
    • Marko Mäkelä's avatar
      MDEV-21362: Do not call memcmp on null pointers · c69a8629
      Marko Mäkelä authored
      Starting with commit 37344390
      we would invoke memcmp() unconditionally, even if the length is zero.
      But, a call to memcmp() is undefined if any parameter is a null pointer,
      even if the length is zero.
      
      In the following tests, a null pointer is being passed to the comparison:
      vcol.vcol_keys_innodb gcol.gcol_keys_innodb main.func_group_innodb
      innodb.innodb_bug53592
      
      cmp_data(): Keep WITH_UBSAN happy and avoid potential future bugs
      in optimized builds, like the one addressed by
      commit fc168c3a (MDEV-15587).
      c69a8629
    • Marko Mäkelä's avatar
      MDEV-21351 Replace recv_sys.heap with list of buf_block_t · 50324ce6
      Marko Mäkelä authored
      InnoDB crash recovery used a special type of mem_heap_t that
      allocates backing store from the buffer pool. That incurred
      a significant overhead, leading to underutilization of memory,
      and limiting the maximum contiguous allocated size of a log record.
      
      recv_sys_t::blocks: A linked list of buf_block_t that are allocated
      by buf_block_alloc() for redo log records. Replaces recv_sys_t::heap.
      We repurpose buf_block_t::unzip_LRU for linking the elements.
      
      recv_sys_t::max_log_blocks: Renamed from recv_n_pool_free_frames.
      
      recv_sys_t::max_blocks(): Accessor for max_log_blocks.
      
      recv_sys_t::alloc(): Allocate memory from the current recv_sys_t::blocks
      element, or allocate another block.  In debug builds, various free()
      member functions must be invoked, because we repurpose
      buf_page_t::buf_fix_count for tracking allocations.
      
      recv_sys_t::free_corrupted_page(): Renamed from recv_recover_corrupt_page()
      
      recv_sys_t::is_memory_exhausted(): Renamed from recv_sys_heap_check()
      
      recv_sys_t::pages and its elements are allocated directly by the
      system memory allocator.
      
      recv_parse_log_recs(): Remove the parameter available_memory.
      
      We rename some variables 'store_to_hash' to 'store', because
      recv_sys.pages is not actually a hash table.
      
      This is joint work with Thirunarayanan Balathandayuthapani.
      50324ce6
  11. 28 Jan, 2020 4 commits
  12. 27 Jan, 2020 2 commits
  13. 26 Jan, 2020 2 commits
  14. 25 Jan, 2020 1 commit
  15. 24 Jan, 2020 1 commit
    • Sergei Petrunia's avatar
      MDEV-21383: Possible range plan is not used under certain conditions · 7e8a5802
      Sergei Petrunia authored
      [Variant 2 of the fix: collect the attached conditions]
      
      Problem:
      make_join_select() has a section of code which starts with
       "We plan to scan all rows. Check again if we should use an index."
      
      the code in that section will [unnecessarily] re-run the range
      optimizer using this condition:
      
        condition_attached_to_current_table AND current_table's_ON_expr
      
      Note that the original invocation of range optimizer in
      make_join_statistics was done using the whole select's WHERE condition.
      Taking the whole select's WHERE condition and using multiple-equalities
      allowed the range optimizer to infer more range restrictions.
      
      The fix:
      - Do range optimization using a condition that is an AND of this table's
      condition and all of the previous tables' conditions.
      - Also, fix the range optimizer to prefer SEL_ARGs with type=KEY_RANGE
      over SEL_ARGS with type=MAYBE_KEY, regardless of the key part.
      Computing
      key_and(
        SEL_ARG(type=MAYBE_KEY key_part=1),
        SEL_ARG(type=KEY_RANGE, key_part=2)
      )
      will now produce the SEL_ARG with type=KEY_RANGE.
      7e8a5802