1. 22 Feb, 2018 2 commits
    • Marko Mäkelä's avatar
      Allocate purge_sys statically · fb335b48
      Marko Mäkelä authored
      There is only one purge_sys. Allocate it statically in order to avoid
      dereferencing a pointer whenever accessing it. Also, align some
      members to their own cache line in order to avoid false sharing.
      
      purge_sys_t::create(): The deferred constructor.
      
      purge_sys_t::close(): The early destructor.
      
      undo::Truncate::create(): The deferred constructor.
      Because purge_sys.undo_trunc is constructed before the start-up
      parameters are parsed, the normal constructor would copy a
      wrong value of srv_purge_rseg_truncate_frequency.
      
      TrxUndoRsegsIterator: Do not forward-declare an inline constructor,
      because the static construction of purge_sys.rseg_iter would not have
      access to it.
      fb335b48
    • Marko Mäkelä's avatar
      Cleanup: Do not pass globals as parameters · a3a2b898
      Marko Mäkelä authored
      trx_purge(): Remove the parameter limit or batch_size, which is
      always passed as srv_purge_batch_size.
      
      trx_purge_attach_undo_recs(): Remove the parameters purge_sys, batch_size.
      Refer to srv_purge_batch_size.
      
      trx_purge_wait_for_workers_to_complete(): Remove the parameter purge_sys.
      a3a2b898
  2. 21 Feb, 2018 9 commits
    • Marko Mäkelä's avatar
      MDEV-15370 Upgrade fails when both insert_undo and update_undo exist · fe0e263e
      Marko Mäkelä authored
      Before MDEV-12288 in MariaDB 10.3.1, InnoDB used to partition
      the persistent transaction undo log into insert_undo and update_undo.
      
      MDEV-12288 repurposes the update_undo as the single undo log.
      In order to support an upgrade from earlier MariaDB versions,
      the insert_undo is recovered in data structures, called old_insert.
      
      An assertion failure occurred in TrxUndoRsegsIterator::set_next()
      when an incomplete transaction was recovered with both insert_undo
      and update_undo log. This could be easily demonstrated by starting
      ./mysql-test-run --manual-gdb innodb.read_only_recovery
      in MariaDB 10.2, and after the first kill, start up the MariaDB 10.3
      server with the same parameters.
      
      The problem is that MariaDB 10.3 would roll back the recovered
      transaction, and finally "commit" it twice (with all changes to
      data rolled back), both insert_undo and update_undo with the same
      commit end identifier (trx->no).
      
      Our fix is to introduce a "commit number" that comprises two components:
      (trx->no << 1 | !old_insert). In this way, the assertion in the purge
      subsystem can be relaxed so that only the trx->no component must match.
      fe0e263e
    • Marko Mäkelä's avatar
      Refactor TrxUndoRsegsIterator for further simplification · 6a370e43
      Marko Mäkelä authored
      TrxUndoRsegs::append(): Remove.
      
      TrxUndoRsegsIterator::set_next(): Add a debug assertion that
      demonstrates that the merging of rollback segments never occurs.
      Since MDEV-12289 or earlier, MariaDB 10.2 will not make any
      temporary undo log accessible to the purge subsystem.
      (Also MySQL 5.7 would skip the purge of any undo log for
      temporary tables, but not before parsing and buffering those
      temporary undo log records.)
      6a370e43
    • Marko Mäkelä's avatar
      Simplify TrxUndoRsegs · 6ae7fa68
      Marko Mäkelä authored
      Construct directly from trx_rseg_t&.
      push_back(), size(): Remove.
      6ae7fa68
    • Marko Mäkelä's avatar
      Replace purge_iter_t with purge_sys_t::iterator · d4187bdc
      Marko Mäkelä authored
      Also, remove the field undo_rseg_space.
      Apparently its purpose was to avoid problems with
      temporary undo logs, which MySQL 5.7 unnecessarily adds to
      the purge system. (Temporary undo log records are not purged.)
      MariaDB 10.2 fixed this in MDEV-12289 or earlier.
      d4187bdc
    • Marko Mäkelä's avatar
      Rename the purge_sys_t iterators · 28d844fd
      Marko Mäkelä authored
      purge_iter_t::operator<=(): Ordering comparison.
      This replaces trx_purge_check_limit() with the difference that
      we are not comparing undo_rseg_space. (In MariaDB, temporary
      undo logs do not enter the purge subsystem at all.)
      
      purge_sys_t::done: Remove. This was not used for anything.
      
      purge_sys_t::tail: Renamed from purge_sys_t::iter.
      
      purge_sys_t::head: Renamed from purge_sys_t::limit.
      28d844fd
    • Marko Mäkelä's avatar
      MDEV-10814 innodb large allocations - Don't dump · 7bfe33ee
      Marko Mäkelä authored
      Merge pull request #364
      7bfe33ee
    • Daniel Black's avatar
      MDEV-15356: tp_timeout_handler needs to call set_killed_no_mutex as it has the mutex · 8f50a26e
      Daniel Black authored
      Regression introducted in c2118a08 where LOCK_thd_data was moveed
      to LOCK_thd_kill
      8f50a26e
    • Vladislav Vaintroub's avatar
      e2ac8d3f
    • Marko Mäkelä's avatar
      Avoid some dead code · 094cf730
      Marko Mäkelä authored
      094cf730
  3. 20 Feb, 2018 9 commits
    • Vladislav Vaintroub's avatar
      Make possible to use clang on Windows (clang-cl) · 56e7b7ea
      Vladislav Vaintroub authored
      -DWITH_ASAN can be used as well now, on x64
      
      Fix many clang-cl warnings.
      56e7b7ea
    • Galina Shalygina's avatar
      MDEV-14835 Server crashes in Field_iterator_table::create_item when number of · 9d97e601
      Galina Shalygina authored
      elements of BIGINT or YEAR type in the IN list reaches in_predicate_conversion_threshold
      
      The bug appears at the prepare stage when IN-predicate with the long list
      of values is converted into IN-subquery. It happens because values in the
      right operand of the IN-predicate that have BIGINT or YEAR types are converted
      into the Item_int_with_ref.
      To fix it in the procedure Item_func_in::create_value_list_for_tvc
      real_item() is taken for each value in the right operand of the IN-predicate.
      9d97e601
    • Marko Mäkelä's avatar
      MDEV-15158 On commit, do not write to the TRX_SYS page · 947efe17
      Marko Mäkelä authored
      This is based on a prototype by
      Thirunarayanan Balathandayuthapani <thiru@mariadb.com>.
      
      Binlog and Galera write-set replication information was written into
      TRX_SYS page on each commit. Instead of writing to the TRX_SYS during
      normal operation, InnoDB can make use of rollback segment header pages,
      which are already being written to during a commit.
      
      The following list of fields in rollback segment header page are added:
          TRX_RSEG_BINLOG_OFFSET
          TRX_RSEG_BINLOG_NAME (NUL-terminated; empty name = not present)
          TRX_RSEG_WSREP_XID_FORMAT (0=not present; 1=present)
          TRX_RSEG_WSREP_XID_GTRID
          TRX_RSEG_WSREP_XID_BQUAL
          TRX_RSEG_WSREP_XID_DATA
      
      trx_sys_t: Introduce the fields
      recovered_binlog_filename, recovered_binlog_offset, recovered_wsrep_xid.
      
      To facilitate upgrade from older mysql or mariaDB versions, we will read
      the information in TRX_SYS page. It will be overridden by the
      information that we find in rollback segment header pages.
      
      Mariabackup --prepare will read the metadata from the rollback
      segment header pages via trx_rseg_array_init(). It will still
      not read any undo log pages or recover any transactions.
      947efe17
    • Marko Mäkelä's avatar
    • Eugene Kosov's avatar
      remove uint · d4822bef
      Eugene Kosov authored
      d4822bef
    • Marko Mäkelä's avatar
      Fix the Windows build · cd63f43c
      Marko Mäkelä authored
      my_atomic_load32() expects a pointer to non-const on Windows.
      cd63f43c
    • Eugene Kosov's avatar
      ASAN unpoison system versioning related buffer · 8ed9ef54
      Eugene Kosov authored
      Fixes this report:
      ==3165==ERROR: AddressSanitizer: use-after-poison on address 0x61e0000270a0 at pc 0x00000114b78c bp 0x7f15d65fe120 sp 0x7f15d65fd8d0
      WRITE of size 1366 at 0x61e0000270a0 thread T28
          #0 0x114b78b in __asan_memcpy fun/cpp_projects/llvm_toolchain/llvm/projects/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cc:23
          #1 0x208208d in TABLE::init(THD*, TABLE_LIST*) work/mariadb/sql/table.cc:4662:3
          #2 0x19df85b in open_table(THD*, TABLE_LIST*, Open_table_context*) work/mariadb/sql/sql_base.cc:1993:10
          #3 0x19eb968 in open_and_process_table(THD*, LEX*, TABLE_LIST*, unsigned int*, unsigned int, Prelocking_strategy*, bool, Open_table_context*) work/mariadb/sql/sql_base.cc:3483:14
          #4 0x19e7c05 in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) work/mariadb/sql/sql_base.cc:4001:14
          #5 0x19f4dac in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) work/mariadb/sql/sql_base.cc:4879:7
          #6 0x1627263 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) work/mariadb/sql/sql_base.h:487:10
          #7 0x1c3839c in mysql_execute_command(THD*) work/mariadb/sql/sql_parse.cc:5113:13
          #8 0x1c1b72c in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) work/mariadb/sql/sql_parse.cc:7980:18
          #9 0x1c13464 in handle_bootstrap_impl(THD*) work/mariadb/sql/sql_parse.cc:1044:5
          #10 0x1c11ff7 in do_handle_bootstrap(THD*) work/mariadb/sql/sql_parse.cc:1096:3
          #11 0x1c11d14 in handle_bootstrap work/mariadb/sql/sql_parse.cc:1079:3
          #12 0x115a6ae in __asan::AsanThread::ThreadStart(unsigned long, __sanitizer::atomic_uintptr_t*) fun/cpp_projects/llvm_toolchain/llvm/projects/compiler-rt/lib/asan/asan_thread.cc:259
          #13 0x7f15fe1407fb in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x77fb)
          #14 0x7f15fbb64b5e in clone /build/glibc-itYbWN/glibc-2.26/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      8ed9ef54
    • Marko Mäkelä's avatar
      1fa14a7c
    • Marko Mäkelä's avatar
      Clarify the access to trx_sys.rseg_history_len · 60a68fdf
      Marko Mäkelä authored
      trx_sys_t::rseg_history_len: Make private, and clarify the
      documentation.
      
      trx_sys_t::history_size(): Read rseg_history_len.
      
      trx_sys_t::history_insert(), trx_sys_t::history_remove(),
      trx_sys_t::history_add(): Update rseg_history_len.
      60a68fdf
  4. 19 Feb, 2018 8 commits
  5. 18 Feb, 2018 2 commits
  6. 17 Feb, 2018 5 commits
    • Alexander Barkov's avatar
    • Marko Mäkelä's avatar
      Merge 10.1 into 10.2 · 970ce270
      Marko Mäkelä authored
      Disable the test encryption.innodb_encryption-page-compression
      because the wait_condition would seem to time out deterministically.
      MDEV-14814 has to be addressed in 10.2 separately.
      
      Datafile::validate_first_page(): Do not invoke
      page_size_t::page_size_t(flags) before validating the tablespace flags.
      This avoids a crash in MDEV-15333 innodb.restart test case.
      FIXME: Reduce the number of error messages. The first one is enough.
      970ce270
    • Marko Mäkelä's avatar
      MDEV-15333 MariaDB (still) slow start · 9a46d971
      Marko Mäkelä authored
      This performance regression was introduced in the MariaDB 10.1
      file format incompatibility bug fix MDEV-11623 (MariaDB 10.1.21
      and MariaDB 10.2.4) and partially fixed in MariaDB 10.1.25 in
      MDEV-12610 without adding a regression test case.
      
      On a normal startup (without crash recovery), InnoDB should not read
      every .ibd data file, because this is slow. Like in MySQL, for now,
      InnoDB will still open every data file (without reading), and it
      will read every .ibd file for which an .isl file exists, or the
      DATA DIRECTORY attribute has been specified for the table.
      
      The test case shuts down InnoDB, moves data files, replaces them
      with garbage, and then restarts InnoDB, expecting no messages to
      be issued for the garbage files. (Some messages will for now be
      issued for the table that uses the DATA DIRECTORY attribute.)
      Finally, the test shuts down the server, restores the old data files,
      and restarts again to drop the tables.
      
      fil_open_single_table_tablespace(): Remove the condition on flags,
      and only call fsp_flags_try_adjust() if validate==true
      (reading the first page has been requested). The only caller with
      validate==false is at server startup when we are processing all
      records from SYS_TABLES. The flags passed to this function are
      actually derived from SYS_TABLES.TYPE and SYS_TABLES.N_COLS,
      and there never was any problem with SYS_TABLES in MariaDB 10.1.
      The problem that MDEV-11623 was that incorrect tablespace flags
      were computed and written to FSP_SPACE_FLAGS.
      9a46d971
    • Daniel Black's avatar
      MDEV-10814: Innodb large allocations - madvise - Don't dump · b600f307
      Daniel Black authored
      Note: Linux only
      
      Core dumps of large buffer pool pages take time and space
      and pose potential data expose in scenarios where data-at-rest
      encryption is deployed.
      
      Here we use madvise(MADV_DONT_DUMP) on large memory allocations
      used by the innodb buffer pool, log_sys and recv_sys. The effect
      of this system call is that these memory areas will not appear in
      a core dump. Data from these buffers is rarely useful in fault
      diagnosis.
      
      log_sys and recv_sys structures now use large memory allocations
      for their large buffer.
      
      Debug builds don't include the madvise syscall and as such will
      include full core dumps.
      
      A function, buf_madvise_do_dump, is added but never called. It
      is there to be called from a debugger to re-enable the core
      dumping of all of these pages if for some reason the entire
      contents of these buffers are needed.
      
      Idea thanks to Hartmut Holzgraefe
      b600f307
    • Alexander Kuleshov's avatar
      merge two the same consistently 'if' clauses into one · afc56a50
      Alexander Kuleshov authored
      we have two the same 'if' clauses that check opt_bin_log argument
      in mysqld.cc and both clauses go successively one after another.
      Let's merge them into one
      afc56a50
  7. 16 Feb, 2018 5 commits