1. 17 Apr, 2023 1 commit
  2. 14 Apr, 2023 2 commits
    • Vlad Lesin's avatar
      MDEV-31049 fil_delete_tablespace() returns wrong file handle if tablespace was... · 71f16c83
      Vlad Lesin authored
      MDEV-31049 fil_delete_tablespace() returns wrong file handle if tablespace was closed by parallel thread
      
      fil_delete_tablespace() stores file handle in local variable and calls
      mtr_t::commit_file()=>fil_system_t::detach(..., detach_handle=true), which
      sets space->chain.start->handle = OS_FILE_CLOSED. fil_system_t::detach()
      is invoked under fil_system.mutex.
      
      But before the mutex is acquired some parallel thread can change
      space->chain.start->handle. fil_delete_tablespace() returns value, stored
      in local variable, i.e. wrong value.
      
      File handle can be closed, for example, from buf_flush_space() when the
      limit of innodb_open_files exceded and fil_space_t::get() causes
      fil_space_t::try_to_close() call.
      
      fil_space_t::try_to_close() is executed under fil_system.mutex. And
      mtr_t::commit_file() locks it for fil_system_t::detach() call.
      fil_system_t::detach() returns detached file handle if its argument
      detach_handle is true. The fix is to let mtr_t::commit_file() to pass
      that detached file handle to fil_delete_tablespace().
      71f16c83
    • Vlad Lesin's avatar
      MDEV-30775 Performance regression in fil_space_t::try_to_close() introduced in MDEV-23855 · 0cca8166
      Vlad Lesin authored
      Post-push fix.
      
      10.5 MDEV-30775 fix inserts just opened tablespace just after the element
      which fil_system.space_list_last_opened points to.
      
      In MDEV-25223 fil_system_t::space_list was changed from UT_LIST to
      ilist. ilist<...>::insert(iterator pos, reference value) inserts element
      to list before pos.
      
      But it was not taken into account during 10.5->10.6 merge in
      85cbfaef, and the fix
      does not work properly, i.e. it inserted just opened tablespace to the
      position preceding fil_system.space_list_last_opened.
      0cca8166
  3. 13 Apr, 2023 4 commits
    • Tuukka Pasanen's avatar
      MDEV-30687: Make small facelifting to autobake-debs.sh · f2fde3f6
      Tuukka Pasanen authored
      Currently autobake-debs.sh does not pass shellcheck
      it fails making errors:
      
       * SC1091 when using shellcheck -x it needs to know where to
         find ./VERSION. As this is not needed we just specify it
         as /dev/null as mentioned in shellcheck documentation:
         https://www.shellcheck.net/wiki/SC1091
      
       * SC2086 make sure that there is no globbing or word splitting
         in dpkg-buidpackage string. This not big problem or about to happen
         but now extra parameter parsing is more Bash compliant with
         using array.
         Change BUILDPACKAGE_PREPEND to BUILDPACKAGE_DPKGCMD which holds
         'eatmydata' if it's available and needed 'dpkg-buildpackage'
         https://www.shellcheck.net/wiki/SC2086
      
      Fix small script indentation problem.
      f2fde3f6
    • Tuukka Pasanen's avatar
      MDEV-31045: Fix regression building on Ubuntu 18.04 · 1e4eef5c
      Tuukka Pasanen authored
      Github PR #2424 regressed Ubuntu 18.04 building
      other than x86_64 machines. Architecture that are
      impacted are PPC64 and ARM64.
      This was because of changes in debian/rules file
      which caused removing dependency to package 'libpmem-dev'
      and CMake which '-DWITH_PMEM' removing not working
      correctly. Package libpmem-dev was removed but
      it still required to have PMEM with CMake which.
      Commit make change that -DWITH_PMEM is correctly removed
      if it's not wanted.
      1e4eef5c
    • Marko Mäkelä's avatar
      MDEV-31048 PERFORMANCE_SCHEMA lakcs InnoDB read_slots and write_slots · f50abab1
      Marko Mäkelä authored
      tpool::cache::m_mtx: Add PERFORMANCE_SCHEMA instrumentation
      (wait/synch/mutex/innodb/tpool_cache_mutex). This covers the
      InnoDB read_slots and write_slots for asynchronous data page I/O.
      f50abab1
    • Marko Mäkelä's avatar
      MDEV-28974 fixup: Fix error and warning messages · c0eeb725
      Marko Mäkelä authored
      fil_name_process(): Starting with
      commit 212994f7
      the name is not guaranteed to be NUL terminated.
      c0eeb725
  4. 12 Apr, 2023 2 commits
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-29273 Race condition between drop table and closing of table · 2ddfb838
      Thirunarayanan Balathandayuthapani authored
      - This issue caused by race condition between drop thread
      and fil_encrypt_thread. fil_encrypt_thread closes
      the tablespace if the number of opened files
      exceeds innodb_open_files. fil_node_open_file()
      closes the tablespace which are open and it doesn't
      have pending operations. At that time, InnoDB drop tries
      to write the redo log for the file delete operation.
      It throws the bad file descriptor error.
      
      - When trying to close the file, InnoDB should check
      whether the table is going to be dropped.
      2ddfb838
    • Marko Mäkelä's avatar
      MDEV-26827 fixup: Do not duplicate io_slots::pending_io_count() · a091d6ac
      Marko Mäkelä authored
      os_aio_pending_reads_approx(), os_aio_pending_reads(): Replaces
      buf_pool.n_pend_reads.
      
      os_aio_pending_writes(): Replaces buf_dblwr.pending_writes().
      
      buf_dblwr_t::write_cond, buf_dblwr_t::writes_pending: Remove.
      a091d6ac
  5. 11 Apr, 2023 2 commits
  6. 06 Apr, 2023 1 commit
  7. 05 Apr, 2023 1 commit
  8. 04 Apr, 2023 6 commits
    • Jan Lindström's avatar
      MDEV-29602 : Galera debug build crashes when the spider plugin is enabled · 06393cd8
      Jan Lindström authored
      Spider system tables should be created so that wsrep_on=OFF.
      Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
      06393cd8
    • Alexander Barkov's avatar
    • Jan Lindström's avatar
      MDEV-28641 : Query cache entries not invalidated on slave of a Galera cluster · afdf19cf
      Jan Lindström authored
      Query cache should be invalidated if we are not in applier. For some
      reason this condition was incorrect starting from 10.5 but it is
      correct in 10.4.
      Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
      afdf19cf
    • Sergei Petrunia's avatar
      MDEV-30972: ANALYZE FORMAT=JSON: some time is unaccounted-for in BNL-H join · 31536b24
      Sergei Petrunia authored
      After MDEV-30830 has added block-nl-join.r_unpack_time_ms, it became
      apparent that there is some unaccounted-for time in BNL join operation,
      namely the time that is spent after unpacking the join buffer record.
      
      Fix this by adding a Gap_time_tracker to track the time that is spent
      after unpacking the join buffer record and before any next time tracking.
      The collected time is printed in block-nl-join.r_other_time_ms.
      
      Reviewed by: Monty <monty@mariadb.org>
      31536b24
    • Sergei Petrunia's avatar
      ANALYZE FORMAT=JSON: Backport block-nl-join.r_unpack_time_ms from 11.0 +fix MDEV-30830. · 0269d82d
      Sergei Petrunia authored
      Also fix it to work with hashed join (MDEV-30830).
      
      Reviewed by: Monty <monty@mariadb.org>
      0269d82d
    • Alexander Barkov's avatar
      MDEV-30034 UNIQUE USING HASH accepts duplicate entries for tricky collations · 8020b1bd
      Alexander Barkov authored
      - Adding a new argument "flag" to MY_COLLATION_HANDLER::strnncollsp_nchars()
        and a flag MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES.
        The flag defines if strnncollsp_nchars() should emulate trailing spaces
        which were possibly trimmed earlier (e.g. in InnoDB CHAR compression).
        This is important for NOPAD collations.
      
        For example, with this input:
         - str1= 'a '    (Latin letter a followed by one space)
         - str2= 'a  '   (Latin letter a followed by two spaces)
         - nchars= 3
        if the flag is given, strnncollsp_nchars() will virtually restore
        one trailing space to str1 up to nchars (3) characters and compare two
        strings as equal:
        - str1= 'a  '  (one extra trailing space emulated)
        - str2= 'a  '  (as is)
      
        If the flag is not given, strnncollsp_nchars() does not add trailing
        virtual spaces, so in case of a NOPAD collation, str1 will be compared
        as less than str2 because it is shorter.
      
      - Field_string::cmp_prefix() now passes the new flag.
        Field_varstring::cmp_prefix() and Field_blob::cmp_prefix() do
        not pass the new flag.
      
      - The branch in cmp_whole_field() in storage/innobase/rem/rem0cmp.cc
        (which handles the CHAR data type) now also passed the new flag.
      
      - Fixing UCA collations to respect the new flag.
        Other collations are possibly also affected, however
        I had no success in making an SQL script demonstrating the problem.
        Other collations will be extended to respect this flags in a separate
        patch later.
      
      - Changing the meaning of the last parameter of Field::cmp_prefix()
        from "number of bytes" (internal length)
        to "number of characters" (user visible length).
      
        The code calling cmp_prefix() from handler.cc was wrong.
        After this change, the call in handler.cc became correct.
      
        The code calling cmp_prefix() from key_rec_cmp() in key.cc
        was adjusted according to this change.
      
      - Old strnncollsp_nchar() related tests in unittest/strings/strings-t.c
        now pass the new flag.
        A few new tests also were added, without the flag.
      8020b1bd
  9. 03 Apr, 2023 3 commits
    • Lorna Luo's avatar
      Make 'move_file' command more reliable in 3 innodb tests · 0cc1694e
      Lorna Luo authored
      The tests innodb.import_tablespace_race, innodn.restart, and innodb.innodb-wl5522 move
      the tablespace file between the data directory and the tmp directory specified by
      global environment variables. However this is risky because it's not unusual that the
      set tmp directory (often under /tmp) is mounted on another disk partition or device,
      and 'move_file' command may fail with "Errcode: 18 'Invalid cross-device link.'"
      
      For innodb.import_tablespace_race and innodb.innodb-wl5522, moving files
      across directories is not necessary. Modify the tests so they rename
      files under the same directory. For innodb.restart, instead of moving
      between datadir and MYSQL_TMPDIR, move the files under MYSQLTEST_VARDIR.
      
      All new code of the whole pull request, including one or several files that
      are either new files or modified ones, are contributed under the BSD-new license.
      I am contributing on behalf of my employer Amazon Web Services, Inc.
      0cc1694e
    • Lorna Luo's avatar
      Make 'move_file' command more reliable in mysqltest · da73db23
      Lorna Luo authored
      The tests innodb.import_tablespace_race, innodn.restart, and innodb.innodb-wl5522 move
      the tablespace file between the data directory and the tmp directory specified by
      global environment variables. However this is risky because it's not unusual that the
      set tmp directory (often under /tmp) is mounted on another disk partition or device,
      and 'move_file' command may fail with "Errcode: 18 'Invalid cross-device link.'"
      
      To stabilize mysqltest in the described scenario, and prevent such
      behavior in the future, let make_file() check both from file path and to
      file path and make sure they are either both under MYSQLTEST_VARDIR or
      MYSQL_TMP_DIR.
      
      All new code of the whole pull request, including one or several files that
      are either new files or modified ones, are contributed under the BSD-new license.
      I am contributing on behalf of my employer Amazon Web Services, Inc.
      da73db23
    • Oleksandr Byelkin's avatar
      Merge branch '10.4' into 10.5 · 3261a78e
      Oleksandr Byelkin authored
      3261a78e
  10. 02 Apr, 2023 3 commits
  11. 01 Apr, 2023 4 commits
    • Sergei Golubchik's avatar
      ensure that STRING_WITH_LEN is only used with string literals · 0a634390
      Sergei Golubchik authored
      This is allowed:
      
        STRING_WITH_LEN("string literal")
      
      This is not:
      
        char *str = "pointer to string";
        ... STRING_WITH_LEN(str) ..
      
      In C++ this is also allowed:
      
        const char str[] = "string literal";
        ... STRING_WITH_LEN(str) ...
      0a634390
    • Sergei Golubchik's avatar
      MDEV-13255 main.status failed in buildbot · 6a10468e
      Sergei Golubchik authored
      Test fails sporadically and very rarely on this:
      ```
      let $org_queries= `SHOW STATUS LIKE 'Queries'`;
      SELECT f1();
      CALL p1();
      let $new_queries= `SHOW STATUS LIKE 'Queries'`;
      let $diff= `SELECT SUBSTRING('$new_queries',9)-SUBSTRING('$org_queries',9)`;
      ```
      if COM_QUIT from one of the earlier (in the test) disconnect's
      happens between the two SHOW STATUS commands.
      Because COM_QUIT increments "Queries".
      
      The directly previous test uses wait_condition to wait for
      its disconnects to complete. But there are more disconnects earlier
      in the test file and nothing waits for them.
      
      Let's change wait_condition to wait for *all* disconnect to complete.
      6a10468e
    • Oleksandr Byelkin's avatar
    • Hugo Wen's avatar
      Handle meaningless addr2line results and increase timeout · 3b642440
      Hugo Wen authored
      MariaDB server prints the stack information if a crash happens.
      
      It traverses the stack frames in function `print_with_addr_resolve`.
      For *EACH* frame, it tries to parse the file name and line number of the
      frame using `addr2line`, or prints `backtrace_symbols_fd` if `addr2line`
      fails.
      
      1. Logic in `addr_resolve` function uses addr2line to get the file name
         and line numbers. It has a timeout of 500ms to wait for the response
         from addr2line. However, that's not enough on small instances
         especially if the debug information is in a separate file or
         compressed.
      
         Increase the timeout to 5 seconds to support some edge cases, as
         experiments showed addr2line may take 2-3 seconds on some frames.
      
      2. While parsing a frame inside of a shared library using `addr2line`,
         the file name and line numbers could be `??`, empty or `0` if the
         debug info is not loaded.
         It's easy to reproduce when glibc-debuginfo is not installed.
      
         Instead of printing a meaningless frame like:
      
             :0(__GI___poll)[0x1505e9197639]
             ...
             ??:0(__libc_start_main)[0x7ffff6c8913a]
      
         We want to print the frame information using `backtrace_symbols_fd`,
         with the shared library name and a hexadecimal offset.
         Stacktrace example on a real instance with this commit:
      
             /lib64/libc.so.6(__poll+0x49)[0x145cbf71a639]
             ...
             /lib64/libc.so.6(__libc_start_main+0xea)[0x7f4d0034d13a]
      
         `addr_resolve` has considered the case of meaningless combination of
         file name and line number returned by `addr2line`. e.g. `??:?`
         However, conditions like `:0` and `??:0` are not handled. So now the
         function will rollback to `backtrace_symbols_fd` in above cases.
      
      All new code of the whole pull request, including one or several files
      that are either new files or modified ones, are contributed under the
      BSD-new license. I am contributing on behalf of my employer Amazon Web
      Services, Inc.
      3b642440
  12. 31 Mar, 2023 5 commits
  13. 30 Mar, 2023 1 commit
    • Jan Lindström's avatar
      MDEV-30413 : run sequence nextval got [Note] WSREP: MDL BF-BF conflict and [ERROR] Aborting · 169def14
      Jan Lindström authored
      Sequence objects are implemented using special tables.
      These tables do not have primary key and only one row.
      NEXTVAL is basically update from existing value to new
      value. In Galera this could mean that two write-sets
      from different nodes do not conflict and this could
      lead situation where write-sets are executed
      concurrently and possibly in wrong seqno order.
      
      This is fixed by using table-level exclusive key for
      SEQUENCE updates. Note that this naturally works
      correctly only if InnoDB storage engine is used for
      sequence.
      
      This fix does not contain a test case because while
      it is possible to syncronize appliers using dbug_sync
      it was too hard to syncronize MDL-lock requests to
      exact objects. Testing done for this fix is documented
      on MDEV.
      Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
      169def14
  14. 29 Mar, 2023 3 commits
    • Marko Mäkelä's avatar
      MDEV-30453 Setting innodb_buffer_pool_filename to an empty string attempts to... · a6780df4
      Marko Mäkelä authored
      MDEV-30453 Setting innodb_buffer_pool_filename to an empty string attempts to delete the data directory on shutdown
      
      Let us make innodb_buffer_pool_filename a read-only variable
      so that a malicious user cannot cause an important file to be
      deleted on InnoDB shutdown. An attempt to delete a directory
      will fail because it is not a regular file, but what if the
      variable pointed to (say) ibdata1, ib_logfile0 or some *.ibd file?
      
      It does not seem to make much sense for this parameter to be
      configurable in the first place, but we will not change that in order
      to avoid breaking compatibility.
      a6780df4
    • Alexander Barkov's avatar
      MDEV-26765 UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!? · 03b4a2d6
      Alexander Barkov authored
      Problem:
      
      UNIX_TIMESTAMP() called for a expression of the TIME data type
      returned NULL.
      
      Inside Type_handler_timestamp_common::Item_val_native_with_conversion
      the call for item->get_date() did not convert TIME to DATETIME
      automatically (because it does not have to, by design).
      As a result, Type_handler_timestamp_common::TIME_to_native() received
      a MYSQL_TIME value with zero date 0000-00-00 and therefore returned "true"
      (indicating SQL NULL value).
      
      Fix:
      
      Removing the call for item->get_date().
      Instantiating Datetime(item) instead.
      This forces automatic TIME to DATETIME conversion
      (unless @@old_mode is zero_date_time_cast).
      03b4a2d6
    • Daniel Black's avatar
      MDEV-30276 - wsrep_sst_mariabackup to use mariadb-backup · e093e5ab
      Daniel Black authored
      rather than mariabackup internally, and change and messages accordingly.
      e093e5ab
  15. 28 Mar, 2023 2 commits