1. 13 Mar, 2017 5 commits
    • Marko Mäkelä's avatar
      Fix some compilation warnings. · 056ec4ab
      Marko Mäkelä authored
      056ec4ab
    • Marko Mäkelä's avatar
      MDEV-12091 Shutdown fails to wait for rollback of recovered transactions to finish · e5b155a4
      Marko Mäkelä authored
      In the 10.1 InnoDB Plugin, a call os_event_free(buf_flush_event) was
      misplaced. The event could be triggered by rollback of resurrected
      transactions while shutdown was in progress. This bug was caught
      by cmake -DWITH_ASAN testing. This call was only present in the
      10.1 InnoDB Plugin, not in other versions, or in XtraDB.
      
      That said, the bug affects all InnoDB versions. Shutdown assumes the
      cessation of any page-dirtying activity, including the activity of
      the background rollback thread. InnoDB only waited for the background
      rollback to finish as part of a slow shutdown (innodb_fast_shutdown=0).
      The default is a clean shutdown (innodb_fast_shutdown=1). In a scenario
      where InnoDB is killed, restarted, and shut down soon enough, the data
      files could become corrupted.
      
      logs_empty_and_mark_files_at_shutdown(): Wait for the
      rollback to finish, except if innodb_fast_shutdown=2
      (crash-like shutdown) was requested.
      
      trx_rollback_or_clean_recovered(): Before choosing the next
      recovered transaction to roll back, terminate early if non-slow
      shutdown was initiated. Roll back everything on slow shutdown
      (innodb_fast_shutdown=0).
      
      srv_innodb_monitor_mutex: Declare as static, because the mutex
      is only used within one module.
      
      In 10.2, os_event_destroy() sets the event to a NULL pointer,
      while os_event_free() in earlier versions did not do that.
      e5b155a4
    • Marko Mäkelä's avatar
      Define a mtr_t::start() wrapper inline. · ff8bf6e9
      Marko Mäkelä authored
      ff8bf6e9
    • Marko Mäkelä's avatar
      Adjust an outdated comment. · c32dcae6
      Marko Mäkelä authored
      os_sync_free(), which hid resource leaks, was removed in MySQL 5.7.
      c32dcae6
    • Oleksandr Byelkin's avatar
      MDEV-10555: Server crashes in mysql_admin_table upon killing ANALYZE · c0fb7b45
      Oleksandr Byelkin authored
      Take into acount result of open table operation in mysql_admin_table.
      c0fb7b45
  2. 11 Mar, 2017 1 commit
  3. 10 Mar, 2017 6 commits
    • Oleksandr Byelkin's avatar
      fix test for windows 64 · eb574697
      Oleksandr Byelkin authored
      eb574697
    • Vladislav Vaintroub's avatar
      f2fe5cb2
    • Vladislav Vaintroub's avatar
      Revert MySQL commit that disables writing on Windows while flush is in progress · 7c512138
      Vladislav Vaintroub authored
      Reason : after running sysbench tests (rw,update_no_index), in all cases
      the throughout was considerably (approx 15%) better with the patch removed.
      
      Reverted commit info
      commit 8dc03bee3ade2edcc53a3a257346f4a0a9f0b44c
      Author: Yasufumi Kinoshita <yasufumi.kinoshita@oracle.com>
      Date:   Wed Nov 20 17:02:24 2013 +0900
      
      Bug #17824101 : WL#7050 CAUSES RW PERFORMANCE REGRESSION AT SOME WINDOWS ENVIRONMENT
      7c512138
    • Marko Mäkelä's avatar
      Hard-code innodb_page_size as the undo log page size. · a20340cf
      Marko Mäkelä authored
      InnoDB undo logs currently always use the innodb_page_size,
      whether they are stored in the system tablespace, in a
      dedicated undo tablespace, or in the temporary tablespace.
      Remove redundant page_size parameters.
      
      TrxUndoRsegsIterator::set_next(): return bool instead of page_size.
      a20340cf
    • Marko Mäkelä's avatar
      Simplify InnoDB transaction system initialization. · 0ef91c89
      Marko Mäkelä authored
      trx_rseg_mem_create(): Remove the parameter rseg_array.
      Update trx_sys->rseg_array directly.
      0ef91c89
    • Marko Mäkelä's avatar
      InnoDB purge_sys cleanup. · 14178398
      Marko Mäkelä authored
      TrxUndoRsegsIterator::m_purge_sys: Remove. There is only one purge_sys.
      
      purge_sys_t: Renamed from trx_purge_t. Define a constructor and
      destructor. Allocate rseg_iter, purge_queue inline.
      
      purge_sys->trx: Remove. Use purge_sys->sess->trx instead.
      
      purge_sys->view_active: Remove. Access to purge_sys->view is always
      protected by purge_sys->latch.
      
      trx_purge_sys_create(): Replaced by purge_sys_t::purge_sys_t().
      
      trx_purge_sys_close(): Replaced by purge_sys_t::~purge_sys_t().
      14178398
  4. 09 Mar, 2017 8 commits
    • Vladislav Vaintroub's avatar
      Add SRV_ALL_O_DIRECT_FSYNC to switch(srv_flush_method) in log0log.c. · 9928dbe5
      Vladislav Vaintroub authored
      Also in log_checkpoint(), where fil_flush_file_spaces() was
      not done on Windows, it is not done.
      9928dbe5
    • Vladislav Vaintroub's avatar
      MDEV-12201 innodb_flush_method are not available on Windows · a98009ab
      Vladislav Vaintroub authored
       Remove srv_win_file_flush_method
      
      - Rename srv_unix_file_flush_method to srv_file_flush_method, and
        rename constants to remove UNIX from them, i.e SRV_UNIX_FSYNC=>SRV_FSYNC
      
      - Add SRV_ALL_O_DIRECT_FSYNC corresponding to current Windows default
      (no buffering for either log or data, flush on both log and data)
      
      - change os_file_open on Windows to behave identically to Unix wrt
      O_DIRECT and O_DSYNC settings. map O_DIRECT to FILE_FLAG_NO_BUFFERING and
      O_DSYNC to FILE_FLAG_WRITE_THROUGH
      
      - remove various #ifdef _WIN32
      a98009ab
    • Oleksandr Byelkin's avatar
      MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() ||... · 8e05953d
      Oleksandr Byelkin authored
      MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() || derived->first_select()->first_inner_unit()->first_select()-> exclude_from_table_unique_test' failed in TABLE_LIST::set_check_materialized()
      
      Do not try to materialize derived table which already merged (irreversebly).
      8e05953d
    • Marko Mäkelä's avatar
      70a0500d
    • Marko Mäkelä's avatar
      Simplify InnoDB startup. · 7a30d86e
      Marko Mäkelä authored
      InnoDB needs to collect transactions from the persistent data files
      in trx_rseg_array_init() before trx_lists_init_at_db_start() is
      executed. But there is no need to create purge_sys->purge_queue
      separately from purge_sys.
      
      trx_sys_init_at_db_start(): Change the return type to void.
      Remove the direct call to trx_rseg_array_init(). It will be called
      by trx_lists_init_at_db_start(), which we are calling.
      Initialize the purge system read view.
      
      trx_lists_init_at_db_start(): Call trx_purge_sys_create(), which will
      invoke trx_rseg_array_init() to read the undo log segments.
      
      trx_purge_sys_create(): Remove the parameters. Do not initialize
      the purge system read view, because trx_sys->rw_trx_list has not
      been recovered yet. The purge_sys->view will be initialized at
      the end of trx_sys_init_at_db_start().
      
      trx_rseg_array_init(): Remove the parameter. Use purge_sys->purge_queue
      directly.
      
      innobase_start_or_create_for_mysql(): Remove the local variable
      purge_queue. Do not call trx_purge_sys_create(), because it will be
      called by trx_sys_init_at_db_start().
      7a30d86e
    • Marko Mäkelä's avatar
      Remove trx_sys_t::pending_purge_rseg_array. · 15bdfeeb
      Marko Mäkelä authored
      In MySQL 5.7, there is some redundant code for supposedly handling
      an upgrade from an earlier version of InnoDB.
      
      An upgrade of InnoDB between major versions should include a
      slow shutdown (innodb_fast_shutdown=0) of the previous version.
      
      A comment in trx_lists_init_at_db_start() confused clean shutdown
      and slow shutdown. A clean shutdown does not necessarily guarantee
      that there are no active transactions. A slow shutdown guarantees
      that.
      
      Because there was no code to handle rollback of recovered transactions
      that happened to use the rollback segment slots that MySQL 5.7.2
      repurposed for temporary undo logs, the upgrade is not working in all
      cases, and we may as well remove the code to handle purging.
      
      trx_sys_t::pending_purge_rseg_array: Remove.
      
      trx_undo_get_undo_rec_low(): Define as static. Remove the parameter
      is_redo_rseg.
      
      trx_undo_get_undo_rec(), trx_rseg_get_on_id(): Remove the parameter
      is_redo_rseg.
      
      trx_rseg_mem_free(): Remove the second parameter.
      
      trx_sys_get_nth_rseg(): Replace with trx_rseg_get_on_id().
      
      trx_rseg_schedule_pending_purge(): Remove.
      15bdfeeb
    • Oleksandr Byelkin's avatar
      MDEV-11966: Impossible to execute prepared ANALYZE SELECT · 24cbc8da
      Oleksandr Byelkin authored
      Prepare os ANALYZE now respond as EXPLAIN.
      24cbc8da
    • Marko Mäkelä's avatar
      enum btr_latch_mode: Incorporate some flags. · 5ff6694d
      Marko Mäkelä authored
      This fixes some GCC 6.3.0 warnings and makes the code a little
      more debugging-friendly.
      5ff6694d
  5. 08 Mar, 2017 6 commits
    • Vladislav Vaintroub's avatar
    • Marko Mäkelä's avatar
      MDEV-11688 follow-up: More robust shutdown after aborted startup. · 29a980cf
      Marko Mäkelä authored
      After starting MariaDB 10.2 with an invalid value of
      --innodb-flush-method= (the empty string), shutdown would
      attempt to dereference some NULL pointers. This was probably broken
      in commit 81b7fe9d which implemented
      shutdown after aborted startup.
      
      logs_empty_and_mark_files_at_shutdown(): Allow shutdown even if
      lock_sys, log_sys, or fil_system is NULL.
      
      os_aio_free(): Tolerate os_aio_segment_wait_events==NULL.
      
      innobase_start_or_create_for_mysql(): Do not invoke
      srv_init_abort() before initializing all mutexes for the temporary files.
      
      innodb_shutdown(): Tolerate buf_pool_ptr==NULL.
      29a980cf
    • Marko Mäkelä's avatar
      MDEV-11027 InnoDB log recovery is too noisy · 5da6bd7b
      Marko Mäkelä authored
      Provide more useful progress reporting of crash recovery.
      
      recv_sys_t::progress_time: The time of the last report.
      
      recv_sys_t::report(ib_time_t): Determine whether progress should
      be reported.
      
      recv_scan_print_counter: Remove.
      
      log_group_read_log_seg(): After after each I/O request, invoke
      recv_sys_t::report() and report progress if needed.
      
      recv_apply_hashed_log_recs(): Change the return type back to void
      (DB_SUCCESS was always returned), and rename the parameter to last_batch.
      At the start of each batch, if there are pages to be recovered,
      issue a message.
      5da6bd7b
    • Oleksandr Byelkin's avatar
      MDEV-10704: Assertion `field->field->table == table_arg' failed in... · 0b1abc2f
      Oleksandr Byelkin authored
      MDEV-10704: Assertion `field->field->table == table_arg' failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&, bool, bool)
      
      the bug test suite
      0b1abc2f
    • Daniel Black's avatar
      Whitespace correction to avoid compile warning · 8c3b98fe
      Daniel Black authored
      Introduced 2f63e2e2
      
      Compiler error was:
      
      sql/log_event.cc: In function ‘size_t log_event_print_value(IO_CACHE*, const uchar*, uint, uint, char*, size_t)’:
      sql/log_event.cc:2897:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
             if (!ptr)
             ^~
      sql/log_event.cc:2900:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
               int32 i32= uint2korr(ptr);
               ^~~~~
      
      Added in 950abd52
      
      Error was:
      
      sql/item_sum.cc:3478:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
           if ((!args[i]->fixed &&
           ^~
      /sql/item_sum.cc:3482:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
             with_subselect|= args[i]->with_subselect;
             ^~~~~~~~~~~~~~
      Signed-off-by: default avatarDaniel Black <daniel.black@au.ibm.com>
      8c3b98fe
    • Igor Babaev's avatar
      Fixed bug mdev-12185. · 2d948ebd
      Igor Babaev authored
      The bug was caused by a wrong order of statements in With_clause::print().
      As a result any view definition containing WITH clause with several
      CTE specifications was put the frm file in a syntactically incorrect
      form.
      2d948ebd
  6. 07 Mar, 2017 7 commits
  7. 06 Mar, 2017 2 commits
    • Marko Mäkelä's avatar
      Remove an unused declaration. · 5b07334b
      Marko Mäkelä authored
      The function thd_supports_xa() was removed in MySQL 5.7 in WL#8843.
      5b07334b
    • Marko Mäkelä's avatar
      MDEV-9282 follow-up: Remove an unused variable. · 7331b83e
      Marko Mäkelä authored
      Remove the unused variable innodb_calling_exit which was added
      in MySQL 5.7 in an attempt to avoid failures in other threads when
      an I/O thread calls exit().
      
      Since MDEV-9282, InnoDB or XtraDB MariaDB Server is not calling
      exit() at all, and the variable innodb_calling_exit was never set.
      7331b83e
  8. 03 Mar, 2017 5 commits
    • Marko Mäkelä's avatar
      MDEV-12121: Revert test adjustments for -DWITH_INNODB_AHI=OFF · ff0530ef
      Marko Mäkelä authored
      Because the default build configuration of the server will remain
      at -DWITH_INNODB_AHI=ON, we want to test the instrumentation.
      
      We make and revert the test adjustments in separate commits on purpose,
      so that this commit can be easily reverted later if the default
      build configuration is changed to -DWITH_INNODB_AHI=OFF.
      ff0530ef
    • Marko Mäkelä's avatar
      MDEV-12121 Introduce build option WITH_INNODB_AHI to disable innodb_adaptive_hash_index · 27b9989d
      Marko Mäkelä authored
      The InnoDB adaptive hash index is sometimes degrading the performance of
      InnoDB, and it is sometimes disabled to get more consistent performance.
      We should have a compile-time option to disable the adaptive hash index.
      
      Let us introduce two options:
      
      OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON)
      OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON)
      
      where WITH_INNODB_AHI always implies WITH_INNODB_ROOT_GUESS.
      
      As part of this change, the misleadingly named function
      trx_search_latch_release_if_reserved(trx) will be replaced with the macro
      trx_assert_no_search_latch(trx) that will be empty unless
      BTR_CUR_HASH_ADAPT is defined (cmake -DWITH_INNODB_AHI=ON).
      
      We will also remove the unused column
      INFORMATION_SCHEMA.INNODB_TRX.TRX_ADAPTIVE_HASH_TIMEOUT.
      In MariaDB Server 10.1, it used to reflect the value of
      trx_t::search_latch_timeout which could be adjusted during
      row_search_for_mysql(). In 10.2, there is no such field.
      
      Other than the removal of the unused column TRX_ADAPTIVE_HASH_TIMEOUT,
      this is an almost non-functional change to the server when using the
      default build options.
      
      Some tests are adjusted so that they will work with both
      -DWITH_INNODB_AHI=ON and -DWITH_INNODB_AHI=OFF. The test
      innodb.innodb_monitor has been renamed to innodb.monitor
      in order to track MySQL 5.7, and the duplicate tests
      sys_vars.innodb_monitor_* are removed.
      27b9989d
    • Marko Mäkelä's avatar
      MDEV-12103: Move a misplaced assertion. · 545f49da
      Marko Mäkelä authored
      545f49da
    • Marko Mäkelä's avatar
      MDEV-12103 Reduce the time of looking for MLOG_CHECKPOINT during crash recovery · ab8199f3
      Marko Mäkelä authored
      This fixes MySQL Bug#80788 in MariaDB 10.2.5.
      
      When I made the InnoDB crash recovery more robust by implementing
      WL#7142, I also introduced an extra redo log scan pass that can be
      shortened.
      
      This fix will slightly extend the InnoDB redo log format that I
      introduced in MySQL 5.7.9 by writing the start LSN of the MLOG_CHECKPOINT
      mini-transaction to the end of the log checkpoint page, so that recovery
      can jump straight to it without scanning all the preceding redo log.
      
      LOG_CHECKPOINT_END_LSN: At the end of the checkpoint page, the start LSN
      of the MLOG_CHECKPOINT mini-transaction. Previously, these bytes were
      written as 0.
      
      log_write_checkpoint_info(), log_group_checkpoint(): Add the parameter
      end_lsn for writing LOG_CHECKPOINT_END_LSN.
      
      log_checkpoint(): Remember the LSN at which the MLOG_CHECKPOINT
      mini-transaction is starting (or at which the redo log ends on
      shutdown).
      
      recv_init_crash_recovery(): Remove.
      
      recv_group_scan_log_recs(): Add the parameter checkpoint_lsn.
      
      recv_recovery_from_checkpoint_start(): Read LOG_CHECKPOINT_END_LSN
      and if it is set, start the first scan from it instead of the
      checkpoint LSN. Improve some messages and remove bogus assertions.
      
      recv_parse_log_recs(): Do not skip DBUG_PRINT("ib_log") for some
      file-level redo log records.
      
      recv_parse_or_apply_log_rec_body(): If we have not parsed all redo
      log between the checkpoint and the corresponding MLOG_CHECKPOINT
      record, defer the check for MLOG_FILE_DELETE or MLOG_FILE_NAME records
      to recv_init_crash_recovery_spaces().
      
      recv_init_crash_recovery_spaces(): Refuse recovery if
      MLOG_FILE_NAME or MLOG_FILE_DELETE records are missing.
      ab8199f3
    • Sachin Setiya's avatar