1. 14 Oct, 2019 3 commits
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 4f9f3f19
      Marko Mäkelä authored
      Do not merge the InnoDB changes for MDEV-20813.
      4f9f3f19
    • Marko Mäkelä's avatar
      MDEV-20813: Remove the buf_flush_init_for_writing() assertion · ae702d76
      Marko Mäkelä authored
      Old InnoDB/XtraDB versions only initialized FIL_PAGE_TYPE for
      B-tree pages (to FIL_PAGE_INDEX), and left it uninitialized
      (possibly containing FIL_PAGE_INDEX) for others. In MySQL
      or MariaDB 5.5, the field is initialized on almost all pages,
      but still not all of them.
      
      In MariaDB 10.2 and later, buf_flush_init_for_writing() would
      initialize the FIL_PAGE_TYPE on such old pages, but only after
      passing the debug assertion that we are now removing from 10.1.
      There, we will be able to modify fil_crypt_rotate_page() so
      that it will skip the key rotation for pages that contain 0
      in FIL_PAGE_TYPE.
      
      In MariaDB 10.1, there is no logic that would initialize
      FIL_PAGE_TYPE on data pages in old data files after an update.
      So, encryption key rotation may routinely cause page flushes
      on pages that contain 0 in FIL_PAGE_TYPE.
      ae702d76
    • Marko Mäkelä's avatar
      MDEV-19740: Fix C++11 violations caught by GCC 9.2.1 · 2920377a
      Marko Mäkelä authored
      This is a backport of commit ec28f953
      to MariaDB Server 10.1.
      2920377a
  2. 12 Oct, 2019 2 commits
    • Marko Mäkelä's avatar
      MDEV-20813 Assertion failure in buf_flush_init_for_writing() for... · 361e8284
      Marko Mäkelä authored
      MDEV-20813 Assertion failure in buf_flush_init_for_writing() for innodb_immediate_scrub_data_uncompressed=ON
      
      The assertion that was added in
      commit c0c003be
      to augment the fix of MDEV-20805 turns out to be invalid when
      innodb_immediate_scrub_data_uncompressed is enabled.
      In this mode, fsp_init_file_page() will be invoked on data pages
      that have been freed, causing writes of almost-all-zero pages.
      
      btr_page_free(): Adjust the comment.
      
      buf_flush_init_for_writing(): Disable the assertion with a note
      that it should be re-enabled in MDEV-15528.
      361e8284
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 2227dec4
      Marko Mäkelä authored
      2227dec4
  3. 11 Oct, 2019 13 commits
    • Julius Goryavsky's avatar
      MDEV-20728: /usr/sbin/mysqld: unknown variable 'defaults-group-suffix=mysqld1 · 2ae02c29
      Julius Goryavsky authored
      When the mysqld_multi script passes the --defaults-group-suffix
      option to mysqld, it must remove the initial substring with the
      group name ("mysqld") from option value, because otherwise substring
      "mysqld" will be added to the group name and then the group name
      will contain the word "mysqld" twice, which is wrong, because
      mysqld itself adds the suffix received to the group name.
      2ae02c29
    • Julius Goryavsky's avatar
      MDEV-20728: /usr/sbin/mysqld: unknown variable 'defaults-group-suffix=mysqld1 · 4ca0abe9
      Julius Goryavsky authored
      When the mysqld_multi script passes the --defaults-group-suffix
      option to mysqld, it must remove the initial substring with the
      group name ("mysqld") from option value, because otherwise substring
      "mysqld" will be added to the group name and then the group name
      will contain the word "mysqld" twice, which is wrong, because
      mysqld itself adds the suffix received to the group name.
      4ca0abe9
    • Marko Mäkelä's avatar
      Fix -std=c++98 -Wzero-length-array · 38736928
      Marko Mäkelä authored
      This is another follow-up fix to
      commit b393e2cb
      which turned out to be still broken.
      
      Replace the C++11 keyword 'constexpr' with #define.
      
      debug_sync_t::str: Remove the zero-length array.
      Replace sync->str with reinterpret_cast<char*>(&sync[1]).
      38736928
    • Marko Mäkelä's avatar
      After-merge fix: Correct an assertion · 1e1b53cc
      Marko Mäkelä authored
      During IMPORT TABLESPACE, we do invoke
      buf_flush_init_for_writing() with block==NULL and newest_lsn!=0.
      1e1b53cc
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 966d97b5
      Marko Mäkelä authored
      966d97b5
    • Marko Mäkelä's avatar
      Fix CMAKE_BUILD_TYPE=Debug · 1fd1ef25
      Marko Mäkelä authored
      Remove unused variables and type mismatch that was introduced
      in commit b393e2cb
      
      Also, fix a typo in the documentation of the parameter, and
      update the test.
      1fd1ef25
    • Marko Mäkelä's avatar
      MDEV-20805 follow-up: Catch writes of bogus pages · c0c003be
      Marko Mäkelä authored
      buf_flush_init_for_writing(): Assert that FIL_PAGE_TYPE is set
      except when creating a new data file with a dummy first page.
      
      buf_dblwr_create(): Ensure that FIL_PAGE_TYPE on all pages
      will be initialized. Reset buf_dblwr_being_created at the end.
      c0c003be
    • Marko Mäkelä's avatar
      Merge 5.5 into 10.1 · cbfd6882
      Marko Mäkelä authored
      cbfd6882
    • Marko Mäkelä's avatar
      MDEV-20805 ibuf_add_free_page() is not initializing FIL_PAGE_TYPE first · ea61b796
      Marko Mäkelä authored
      In the function recv_parse_or_apply_log_rec_body() there are debug checks
      for validating the state of the page when redo log records are being
      applied. Most notably, FIL_PAGE_TYPE should be set before anything else
      is being written to the page.
      
      ibuf_add_free_page(): Set FIL_PAGE_TYPE before performing any other changes.
      ea61b796
    • Marko Mäkelä's avatar
      MDEV-19455: Avoid SET DEBUG_DBUG='-d,...' construct · 4ebaf813
      Marko Mäkelä authored
      Apply the correct pattern for debug instrumentation:
      
      SET @save_dbug=@@debug_dbug;
      SET debug_dbug='+d,...';
      ...
      SET debug_dbug=@save_dbug;
      
      Numerous tests use statements of the form
      
      SET debug_dbug='-d,...';
      
      which will inadvertently enable all DBUG tracing output,
      causing unnecessary waste of resources.
      4ebaf813
    • Marko Mäkelä's avatar
      MDEV-20804 Speed up main.index_merge_innodb · 5ef12244
      Marko Mäkelä authored
      The test main.index_merge_innodb is taking very much time,
      especially on later versions (10.2 and 10.3).
      
      Some of this could be attributed to the use of INSERT...SELECT,
      which is time-consumingly creating explicit record locks in InnoDB
      for the locking read in the SELECT part.
      
      In 10.3 and later, some slowness can be attributed to MDEV-12288,
      which makes the InnoDB purge thread spend time to reset transaction
      identifiers in the inserted records. If we prevent purge from
      running before all tables are dropped, the test seems to be
      10% faster on an unoptimized debug build on 10.5. (A proper fix
      would be to implement MDEV-515 and stop writing row-level undo log
      records for inserts into an empty table or partition.)
      
      At the same time, it should not hurt to make main.index_merge_myisam
      to use the sequence engine. Not only could it be a little faster,
      but the test would be slightly more readable.
      5ef12244
    • Nikita Malyavin's avatar
      MDEV-18546 ASAN heap-use-after-free in innobase_get_computed_value / row_purge · 350e46a8
      Nikita Malyavin authored
      the bug was already fixed in MDEV-17005, so now only test is added
      350e46a8
    • Nikita Malyavin's avatar
  4. 10 Oct, 2019 2 commits
    • Marko Mäkelä's avatar
      MDEV-20788: Bogus assertion failure for PAGE_FREE list · 6d7a8269
      Marko Mäkelä authored
      In MDEV-11369 (instant ADD COLUMN) in MariaDB Server 10.3,
      we introduced the hidden metadata record that must be the
      first record in the clustered index if and only if
      index->is_instant() holds.
      
      To catch MDEV-19783, in
      commit ed0793e0 and
      commit 99dc40d6
      we added some assertions to find cases where
      the metadata record is missing while it should not be, or a
      record exists when it should not. Those assertions were invalid
      when traversing the PAGE_FREE list. That list can contain anything;
      we must only be able to determine the successor and the size of
      each garbage record in it.
      
      page_validate(), page_simple_validate_old(), page_simple_validate_new():
      Do not invoke page_rec_get_next_const() for traversing the PAGE_FREE
      list, but instead use a lower-level accessor that does not attempt to
      validate the REC_INFO_MIN_REC_FLAG.
      
      page_copy_rec_list_end_no_locks(),
      page_copy_rec_list_start(), page_delete_rec_list_start():
      Add assertions.
      
      btr_page_get_split_rec_to_left(): Remove a redundant return value,
      and make the output parameter the return value.
      
      btr_page_get_split_rec_to_right(), btr_page_split_and_insert(): Clean up.
      6d7a8269
    • Michael Widenius's avatar
  5. 09 Oct, 2019 6 commits
  6. 08 Oct, 2019 2 commits
    • Marko Mäkelä's avatar
      Merge 5.5 into 10.1 · d95f96ad
      Marko Mäkelä authored
      d95f96ad
    • Sachin Setiya's avatar
      MDEV-20574 Position of events reported by mysqlbinlog is wrong with encrypted... · 27664ef2
      Sachin Setiya authored
      MDEV-20574 Position of events reported by mysqlbinlog is wrong with encrypted binlogs, SHOW BINLOG EVENTS reports the correct one.
      
      Analysis
      
      Mysqlbinlog output for encrypted binary log
      #Q> insert into tab1 values (3,'row 003')
      #190912 17:36:35 server id 10221  end_log_pos 980 CRC32 0x53bcb3d3  Table_map: `test`.`tab1` mapped to number 19
      # at 940
      #190912 17:36:35 server id 10221  end_log_pos 1026 CRC32 0xf2ae5136     Write_rows: table id 19 flags: STMT_END_F
      
      Here we can see Table_map_log_event ends at 980 but Next event starts at 940.
      And the reason for that is we do not send START_ENCRYPTION_EVENT to the slave
      
      Solution:-
      Send Start_encryption_log_event as Ignorable_log_event to slave(mysqlbinlog),
      So that mysqlbinlog can update its log_pos.
      Since Slave can request multiple FORMAT_DESCRIPTION_EVENT while master does not
      have so We only update slave master pos when master actually have the
      FORMAT_DESCRIPTION_EVENT. Similar logic should be applied for START_ENCRYPTION_EVENT.
      
      Also added the test case when new server reads the data from old server which
      does not send START_ENCRYPTION_EVENT to slave.
      
      Master Slave Upgrade Scenario.
      When Slave is updated first, Slave will have extra logic of handling
      START_ENCRYPTION_EVENT But master willnot be sending START_ENCRYPTION_EVENT.
      So there will be no issue.
      When Master is updated first, It will send  START_ENCRYPTION_EVENT to
      slave , But slave will ignore this event in queue_event.
      27664ef2
  7. 07 Oct, 2019 2 commits
  8. 04 Oct, 2019 1 commit
  9. 03 Oct, 2019 1 commit
  10. 02 Oct, 2019 1 commit
    • Sergey Vojtovich's avatar
      Cleanup EITS · e43791d4
      Sergey Vojtovich authored
      Moved EITS allocation inside read_statistics_for_tables_if_needed().
      Removed redundant is_safe argument.
      e43791d4
  11. 01 Oct, 2019 4 commits
  12. 30 Sep, 2019 3 commits
    • Robert Bindar's avatar
      MDEV-20647 Fix and enable SphinxSE tests · 576a5f09
      Robert Bindar authored
      576a5f09
    • Marko Mäkelä's avatar
      Fix -Wunused for CMAKE_BUILD_TYPE=RelWithDebInfo · 46b78526
      Marko Mäkelä authored
      For release builds, do not declare unused variables.
      
      unpack_row(): Omit a debug-only variable from WSREP diagnostic message.
      
      create_wsrep_THD(): Fix -Wmaybe-uninitialized for the PSI_thread_key.
      46b78526
    • Sujatha's avatar
      MDEV-20645: Replication consistency is broken as workers miss the error... · 9b80f930
      Sujatha authored
      MDEV-20645: Replication consistency is broken as workers miss the error notification from an earlier failed group.
      
      Analysis:
      ========
      In general if there are three groups.
      1 - Inserts 32 which fails due to local entry '32' on slave.
      2 - Inserts 33
      3 - Inserts 34
      
      Each group considers itself as a waiter and it waits for prior group 'waitee'.
      This is done in 'register_wait_for_prior_event_group_commit'. If there is no
      other parallel group being scheduled then no waitee will be there.
      
      Let us assume 3 groups are being scheduled in parallel.
      
      3-> waits for 2-> waits for->1
      
      '1' upon completion it checks is there any registered subsequent waiter. If
      so it wakes up the subsequent waiter with its execution status. This execution
      status is stored in wakeup_error.
      
      If '1' failed then it sends corresponding wakeup_error to 2. Then '2' aborts
      and it propagates error to '3'.  So all further commits are aborted.  This
      mechanism works only when all transactions reach a stage where they are
      waiting for their prior commit to complete.
      
      In case of optimistic following scenario occurs.
      
      1,2,3 are scheduled in parallel.
      
      3 - Reaches group_commit_code waits for 2 to complete.
      1 - errors out sets stop_on_error_sub_id=1.
      
      When a group execution results in error its corresponding sub_id is set to
      'stop_on_error_sub_id'. Any new groups queued for execution will check if
      their sub_id is > stop_on_error_sub_id.  If it is true their execution will be
      skipped as prior group execution failed.  'skip_event_group=1' will be set.
      Since the execution of SQL thread is about to stop we just skip execution of
      all the following event groups.  We still do all the normal waiting and wakeup
      processing between the event groups as a simple way to ensure that everything
      is stopped and cleaned up correctly.
      
      Upon error '1' transaction checks for registered waiters. Since no one is
      there it simply goes away.
      
      2 - Starts the execution. It checks do I have a waitee.
      
      Since wait_commit_sub_id == entry->last_committed_sub_id no waitee is set.
      
      Secondly: 'entry->stop_on_error_sub_id' is set by '1'st execution.  Now
      'handle_parallel_thread' code checks if the current group 'sub_id' is greater
      than the 'sub_id' set within 'stop_on_error_sub_id'.
      
      Since the above is true 'skip_event_group=true' is set.  Simply call
      'wait_for_prior_commit' to wakeup all waiters.  Group '2' didn't had any
      waitee and its execution is skipped.  Hence its wakeup_error=0.It sends a
      positive wakeup signal to '3'. Which commits. This results in a missed
      transaction. i.e 33 is missed and 34 is committed.
      
      Fix:
      ===
      When a worker learns that an earlier transaction execution has failed, and it
      should not proceed for further execution, it should mark its own execution
      status as failed so that it alerts its followers to abort as well.
      9b80f930