1. 27 May, 2024 19 commits
    • Monty's avatar
      MDEV-32188 make TIMESTAMP use whole 32-bit unsigned range · dfdedd46
      Monty authored
      This patch extends the timestamp from
      2038-01-19 03:14:07.999999 to 2106-02-07 06:28:15.999999
      for 64 bit hardware and OS where 'long' is 64 bits.
      This is true for 64 bit Linux but not for Windows.
      
      This is done by treating the 32 bit stored int as unsigned instead of
      signed.  This is safe as MariaDB has never accepted dates before the epoch
      (1970).
      The benefit of this approach that for normal timestamp the storage is
      compatible with earlier version.
      
      However for tables using system versioning we before stored a
      timestamp with the year 2038 as the 'max timestamp', which is used to
      detect current values.  This patch stores the new 2106 year max value
      as the max timestamp. This means that old tables using system
      versioning needs to be updated with mariadb-upgrade when moving them
      to 11.4. That will be done in a separate commit.
      dfdedd46
    • Monty's avatar
      MDEV-33620 Improve times and states in show processlist for replication · ce6cce85
      Monty authored
      - Slave_IO thread time is now reset between reading events. Before
        this commit Slave_IO always showed "Waiting for master to send
        event" and the time was from SLAVE START. Now it shows time since
        reading last event.
      ce6cce85
    • Monty's avatar
      Generate a warning(note) and write to error log if master_pos_wait() fails. · d2e6fe02
      Monty authored
      This is to make it easier to understand why master_pos_wait() fails in mtr.
      d2e6fe02
    • Monty's avatar
    • Sergei Golubchik's avatar
      cleanup: redundant condition · 201e28fa
      Sergei Golubchik authored
      201e28fa
    • Sergei Golubchik's avatar
    • Monty's avatar
      MDEV-33881 Userstat skips system tables inconsistently · 0f414f63
      Monty authored
      Fixed that no tables from 'mysql' schema are included in userstat.
      A beneif of this is that the server is not reading statistics tables
      if mysql.proc or other tables in mysql is accessed.
      0f414f63
    • Monty's avatar
      Optimize checking if a table is a statistics table · ab513b00
      Monty authored
      ab513b00
    • Monty's avatar
      MDEV-33152 Add QUERIES to INDEX_STATISTICS · a00e99ac
      Monty authored
      Other changes:
      - Do not collect index statistics for system tables like index_stats
        table_stats, performance_schema, information_schema etc as the user
        has no control of these and the generate noise in the statistics.
      a00e99ac
    • Sergei Golubchik's avatar
      cleanup: remove thd->stmt_changes_data · 869e67c9
      Sergei Golubchik authored
      what is done in the plugin - stays in the plugin
      869e67c9
    • Sergei Golubchik's avatar
      mark the deprecated sysvar deprecated · 3781848b
      Sergei Golubchik authored
      and adjust the copyright year
      3781848b
    • Elena Stepanova's avatar
    • Monty's avatar
      MDEV-33501 Extend query_response_time plugin to be compatible with Percona server · 243b9f3c
      Monty authored
      This is to update the plugin to be compatible with Percona's
      query_response_time plugin, with some additions.
      Some of the tests are taken from Percona server.
      
      - Added plugins QUERY_RESPONSE_TIME_READ, QUERY_RESPONSE_TIME_WRITE and
        QUERY_RESPONSE_TIME_READ_WRITE.
      - Added option query_response_time_session_stats, with possible values
        GLOBAL, ON or OFF, to the query_response_time plugin.
      
      Notes:
      - All modules are dependent on QUERY_RESPONSE_READ_TIME. This must always
        be enabled if any of the other modules are used.
        This will be auto-enabled in the near future.
      - Accounting are done per statement. Stored functions are regarded
        as part of the original statement.
      - For stored procedures the accounting are done per statement executed
        in the stored procedure. CALL will not be accounted because of this.
      - FLUSH commands will not be accounted for. This is to ensure that
        FLUSH QUERY_RESPONSE_TIME is not part of the statistics.
        (This helps when testing with mtr and otherwise).
      - FLUSH QUERY_RESPONSE_TIME_READ and FLUSH QUERY_RESPONSE_TIME_READ
        only resets the corresponding status.
      - FLUSH QUERY_RESPONSE_TIME and FLUSH QUERY_RESPONSE_TIME_READ_WRITE or
        changing the value of query_response_time_range_base followed by
        any FLUSH of QUERY_RESPOSNSE_TIME resets all status.
      243b9f3c
    • Sergei Golubchik's avatar
      MDEV-28671 post-testing fixes · 5296f908
      Sergei Golubchik authored
      Various help message improvements:
      * MySQL->MariaDB, mysqld->mariadbd, "mysqld daemon" -> "mariadbd process"
      * typos
      * don't specify defaults directly in the help message
      * don't say that an option is deprecated, mark is as such
      * missing spaces in the middle of the text
      etc
      5296f908
    • Sergei Golubchik's avatar
      cleanup: remove convert_dash_to_underscore · 53582238
      Sergei Golubchik authored
      it was a no-op, plugin variables don't have dashes
      53582238
    • Sergei Golubchik's avatar
      MDEV-28671 post-merge fixes · df10a945
      Sergei Golubchik authored
      * use new deprecated printer for all deprecated server options
      * restore alphabetic option sorting order
      * move deprecated printer from mysqld.cc to my_getopt.c
      * in --help print deprecation message at the end of the option help
      * move 'ALL' help text where it belongs - to other SET options, and
        with a correct indentation.
      * consistently end all or none command-line option help strings
        with a dot - my_print_help() needs that.
        It's about 50/50 now, so let's do none, less line wraps in --help
      * remove trailing spaces from command-line option help strings
      df10a945
    • Christian Gonzalez's avatar
      MDEV-28671 Enable var deprecation for mysqld help output · 4186fa72
      Christian Gonzalez authored
      Currently there are mechanism to mark a system variable as
      deprecated, but they are only used to print warning messages
      when a deprecated variable is set.
      
      Leverage the existing mechanisms in order to make the
      deprecation information available at the --help output of mysqld by:
      
      * Moving the deprecation information (i.e `deprecation_substitute`
        attribute) from the `sys_var` class into the `my_option` struct.
        As every `sys_var` contains its own `my_option` struct, the access
        to the deprecation information remains available to `sys_var`
        objects. `my_getotp` functions, which works directly with
        `my_option` structs, gain access to this information while building
        the --help output.
      
      * For plugin variables, leverages the `PLUGIN_VAR_DEPRECATED` flag
        and set the `deprecation_substitute` attribute  accordingly when
        building the `my_option` objects.
      
      * Change the `option_cmp` function to use the `deprecation_substitute`
        attribute instead of the name when sorting the options. This way
        deprecated options and the substitutes will be grouped together.
      
      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.
      4186fa72
    • Sergei Golubchik's avatar
      after merge fix · 25094f33
      Sergei Golubchik authored
      25094f33
    • Alexander Barkov's avatar
      MDEV-33696 main.dyncol and ctype_unicode_casefold_bmp.inc in --view · 78325a25
      Alexander Barkov authored
      The problem seems to be fixed earlier in the MDEV-25829 stage branch.
      Removing the --disable_view_protocol command.
      78325a25
  2. 26 May, 2024 2 commits
  3. 25 May, 2024 1 commit
  4. 24 May, 2024 7 commits
    • Alexander Barkov's avatar
      MDEV-33701 upgrades from 11.4 to 11.5 don't work · 283b9285
      Alexander Barkov authored
      A user variable and a literal with different collation
      produce an illegal mix of collation error.
      Rewriting the script to avoid such arguments.
      283b9285
    • Alexander Barkov's avatar
      MDEV-33698 tests in the jp suite fail · a0cde364
      Alexander Barkov authored
      a0cde364
    • Alexander Barkov's avatar
      MDEV-25829 Change default Unicode collation to uca1400_ai_ci · 903b5d6a
      Alexander Barkov authored
      Step#3 The main patch
      903b5d6a
    • Alexander Barkov's avatar
      MDEV-25829 Change default Unicode collation to uca1400_ai_ci · a3117c79
      Alexander Barkov authored
      Step#2 - Adding a new collation derivation level for CAST and CONVERT.
      
      Now character string cast functions:
        - CAST(string_expr AS CHAR)
        - CONVERT(expr USING charset_name)
      
      have a new collation derivation level between:
      
        - string literals
        - utf8 metadata functions, e.g. user() and database()
      
      Before the change these cast functions had collation derivation equal
      to table columns, which caused more illegal mix of collation conflicts.
      
      Note, binary string cast functions:
        - BINARY(expr)
        - CAST(string_expr AS BINARY)
        - CONVERT(expr USING binary)
      did not change their collation derivation, to preserve the behaviour of
      queries like these:
      SELECT database()=BINARY'test';
      SELECT user()=CAST('root' AS BINARY);
      SELECT current_role()=CONVERT('role' USING binary);
      
      Derivation levels after the change look as follows:
      
        DERIVATION_IGNORABLE= 7, // Explicit NULL
      
        DERIVATION_NUMERIC= 6,   // Numbers in string context,
                                 // Numeric user variables
                                 // CAST(numeric_expr AS CHAR)
      
        DERIVATION_COERCIBLE= 5, // Literals, string user variables
      
        DERIVATION_CAST= 4,      // CAST(string_expr AS CHAR),
                                 // CONVERT(string_expr USING cs)
      
        DERIVATION_SYSCONST= 3,  // utf8 metadata functions, e.g. user(), database()
        DERIVATION_IMPLICIT= 2,  // Table columns, SP variables, BINARY(expr)
        DERIVATION_NONE= 1,      // A mix (e.g. CONCAT) of two differrent collations
        DERIVATION_EXPLICIT= 0   // An explicit COLLATE clause
      a3117c79
    • Alexander Barkov's avatar
      MDEV-25829 Change default Unicode collation to uca1400_ai_ci · 1b65cc9d
      Alexander Barkov authored
      Step#1 - Changing collation derivation for string user variables
      from IMPLICIT to COERCIBLE.
      
      Retionale:
      
      Without this preparatory change, switching the default collation for
      Unicode character sets from xxx_general_ci to uca1400_ai_ci would cause
      "Illegal mix of collations" errors in scenarios comparing a column with
      a non-default collation to a string user variable
      
      This is especially important for queries to INFORMATION_SCHEMA tables,
      whose columns use utf8mb3_general_ci.
      
      See the description of MDEV-25829 for more details and SQL script examples.
      1b65cc9d
    • Oleksandr Byelkin's avatar
      Fix duplicated on merge tests · 44974a07
      Oleksandr Byelkin authored
      44974a07
    • Oleksandr Byelkin's avatar
      Merge branch '11.4' into 11.4.2 · e9a5b25d
      Oleksandr Byelkin authored
      e9a5b25d
  5. 23 May, 2024 6 commits
    • Oleksandr Byelkin's avatar
      Fix version · 6c323c7a
      Oleksandr Byelkin authored
      6c323c7a
    • Brandon Nesterenko's avatar
      11.5 Fix Merge Conflict Between MDEV-7850 and MDEV-33672 · aee03ea5
      Brandon Nesterenko authored
      MDEV-33672 (10.6) added checks/tests for malformed events which end
      before the flags describe (which would lead to reading of un-owned
      memory). MDEV-7850 (11.5) extended all GTID events with a thread id
      at the end of the event. This GTID event extension invalidates the
      tests added in MDEV-33672 because the thread id is appended after the
      event (and thereby the event isn't cut short).
      
      This patch fixes these MDEV-33672 tests by not writing the GTID
      thread id when writing the Gtid events just for these tests. This
      preserves tests for backwards compatibility, rather than getting rid
      of the tests altogether.
      aee03ea5
    • Oleksandr Byelkin's avatar
      Merge branch '11.4' into 11.5 · dd7d9d7f
      Oleksandr Byelkin authored
      dd7d9d7f
    • Marko Mäkelä's avatar
      MDEV-34212 InnoDB transaction recovery is incorrect · 727b5493
      Marko Mäkelä authored
      trx_undo_mem_create_at_db_start(): Invoke recv_sys_t::recover()
      instead of buf_page_get_gen(), so that all undo log pages will be
      recovered correctly. Failure to do this could prevent InnoDB from
      starting up due to "Data structure corruption", or it could
      potentially lead to a situation where InnoDB starts up but some
      transactions were recovered incorrectly.
      
      recv_sys_t::recover(): Only acquire a buffer-fix on the pages,
      not a shared latch. This is adequate protection, because this function
      is only being invoked during early startup when no "users" are modifying
      buffer pool pages. The only writes are due to server bootstrap
      (the data files being created) or crash recovery (changes from
      ib_logfile0 being applied).
      
      buf_page_get_gen(): Assert that the function is not invoked while crash
      recovery is in progress, and that the special mode BUF_GET_RECOVER is
      only invoked during crash recovery or server bootstrap.
      
      All this should really have been part of
      commit 850d6173 (MDEV-32042).
      727b5493
    • Alexander Barkov's avatar
      MDEV-33729 UBSAN negation of -X cannot be represented in type 'long long int';... · 2dfc6c44
      Alexander Barkov authored
      MDEV-33729 UBSAN negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoll_mb2_or_mb4
      
      The problem was introduced by MDEV-30879.
      The function my_strntoll_8bit() was correctly changed by MDEV-30879.
      The function my_strntoll_mb2_or_mb4() was not.
      
      Applying the missing change to my_strntoll_mb2_or_mb4().
      2dfc6c44
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-34200 InnoDB tries to write to read-only system tablespace · 6c0eb29d
      Thirunarayanan Balathandayuthapani authored
      		in buf_dblwr_t::init_or_load_pages()
      
      - InnoDB fails to set the TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED
      flag in transaction system header page while recreating
      the undo log tablespaces
      
      buf_dblwr_t::init_or_load_pages(): Tries to reset the
      space id and try to write into doublewrite buffer even
      when read_only mode is enabled.
      
      In srv_all_undo_tablespaces_open(), InnoDB should try to
      open the extra unused undo tablespaces instead of trying to
      creating it.
      6c0eb29d
  6. 22 May, 2024 5 commits
    • Marko Mäkelä's avatar
      Merge 11.2 into 11.4 · d2c9d86e
      Marko Mäkelä authored
      d2c9d86e
    • Marko Mäkelä's avatar
      MDEV-34216 Possible corruption when shrinking the system tablespace on innodb_fast_shutdown=0 · b793feb1
      Marko Mäkelä authored
      This bug was found related to MDEV-34212.
      
      Some InnoDB tests, most notably innodb.table_flags,64k would occasionally
      fail. I am able to reproduce this locally on a MemorySanitizer build,
      sporadically.
      
      The following is a minimal .test file for reproducing this:
        --source include/have_innodb.inc
        SELECT @@innodb_page_size;
      and the .opt file:
        --innodb-undo-tablespaces=0 --innodb-page-size=64k
        --innodb-buffer-pool-size=20m
      
      This bug was revealed due to the recent
      commit 466ae1cf
      which set innodb_fast_shutdown=0 during server bootstrap
      in our regression test driver.
      
      Due to the bug, a write of undo page 50 in the system tablespace
      was discarded in buf_page_t::flush(). A subsequent InnoDB startup
      failed because an old version of that page would point to a
      freed undo log page 300.
      
      mtr_t::commit_shrink(): Only invoke fil_space_t::set_create_lsn()
      on undo tablespaces, which will be fully reinitialized or created
      from the scratch. On the system tablespace, we must only adjust
      the file size, to avoid writing pages that are beyond the end
      of the tablespace. Thanks to Thirunarayanan Balathandayuthapani
      for providing this fix.
      b793feb1
    • Oleksandr Byelkin's avatar
      new CC 3.4 · eede2221
      Oleksandr Byelkin authored
      eede2221
    • Marko Mäkelä's avatar
      Merge 11.2 into 11.4 · cb273d53
      Marko Mäkelä authored
      cb273d53
    • Marko Mäkelä's avatar
      MDEV-34209 InnoDB is disregarding read-only mode on slow shutdown · ff377d3b
      Marko Mäkelä authored
      innobase_end(): Do not attempt to shrink the system tablespace if
      innodb_read_only=ON or innodb_force_recovery>4. This fixes a regression
      due to commit 2d6c2f22 (MDEV-32452).
      
      This bug was caught when testing a fix of MDEV-34200, which adds
      SET GLOBAL innodb_fast_shutdown=0 to the test innodb.undo_upgrade.
      ff377d3b