1. 30 Jan, 2024 1 commit
  2. 26 Jan, 2024 1 commit
  3. 24 Jan, 2024 1 commit
    • Alexander Barkov's avatar
      MDEV-32837 long unique does not work like unique key when using replace · 97fcafb9
      Alexander Barkov authored
      write_record() when performing REPLACE has an optimization:
      - if the unique violation happened in the last unique key, then do UPDATE
      - otherwise, do DELETE+INSERT
      
      This patch changes the way of detecting if this optimization
      can be applied if the table has long (hash based) unique
      (i.e. UNIQUE..USING HASH) constraints.
      
      Problem:
      
      The old condition did not take into account that
      TABLE_SHARE and TABLE see long uniques differently:
      - TABLE_SHARE sees as HA_KEY_ALG_LONG_HASH and HA_NOSAME
      - TABLE sees as usual non-unique indexes
      So the old condition could erroneously decide that the UPDATE optimization
      is possible when there are still some unique hash constraints in the table.
      
      Fix:
      
      - If the current key is a long unique, it now works as follows:
      
        UPDATE can be done if the current long unique is the last
        long unique, and there are no in-engine (normal) uniques.
      
      - For in-engine uniques nothing changes, it still works as before:
      
        If the current key is an in-engine (normal) unique:
        UPDATE can be done if it is the last normal unique.
      97fcafb9
  4. 23 Jan, 2024 9 commits
  5. 22 Jan, 2024 2 commits
    • Rex's avatar
      MDEV-33165 Incorrect result interceptor passed to mysql_explain_union() · 11738822
      Rex authored
      Statements affect by this bug are all SQL statements that
      1) prefixed with "EXPLAIN"
      2) have a lower level join structure created for a union subquery.
      
      A bug in select_describe() passed an incorrect "result" object to
      mysql_explain_union(), resulting in unpredictable behaviour and
      out of context calls.
      
      Reviewed by: Oleksandr Byelkin, sanja@mariadb.com
      11738822
    • Brandon Nesterenko's avatar
      MDEV-33283: Binlog Checksum is Zeroed by Zlib if Part of Event Data is Empty · 207c8578
      Brandon Nesterenko authored
      An existing binlog checksum can be overridden to 0 if writing a NULL
      payload when using Zlib for the computation. That is, calling into
      Zlib's crc32 with empty data initializes an incremental CRC
      computation to 0.
      
      This patch changes the Log_event_writer::write_data() to exit
      immediately if there is nothing to write, thereby bypassing the
      checksum computation. This follows the pattern of
      Log_event_writer::encrypt_and_write(), which also exits immediately
      if there is no data to write.
      
      Reviewed By:
      ============
      Andrei Elkin <andrei.elkin@mariadb.com>
      207c8578
  6. 19 Jan, 2024 1 commit
  7. 17 Jan, 2024 1 commit
  8. 16 Jan, 2024 1 commit
  9. 15 Jan, 2024 1 commit
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-32968 InnoDB fails to restore tablespace first page from doublewrite... · caad34df
      Thirunarayanan Balathandayuthapani authored
      MDEV-32968  InnoDB fails to restore tablespace first page from doublewrite buffer when page is empty
      
      - InnoDB fails to find the space id from the page0 of
      the tablespace. In that case, InnoDB can use
      doublewrite buffer to recover the page0 and write
      into the file.
      
      - buf_dblwr_t::init_or_load_pages(): Loads only the pages
      which are valid.(page lsn >= checkpoint). To do that,
      InnoDB has to open the redo log before system
      tablespace, read the latest checkpoint information.
      
      recv_dblwr_t::find_first_page():
      1) Iterate the doublewrite buffer pages and find the 0th page
      2) Read the tablespace flags, space id from the 0th page.
      3) Read the 1st, 2nd and 3rd page from tablespace file and
      compare the space id with the space id which is stored
      in doublewrite buffer.
      4) If it matches then we can write into the file.
      5) Return space which matches the pages from the file.
      
      SysTablespace::read_lsn_and_check_flags(): Remove the
      retry logic for validating the first page. After
      restoring the first page from doublewrite buffer,
      assign tablespace flags by reading the first page.
      
      recv_recovery_read_max_checkpoint(): Reads the maximum
      checkpoint information from log file
      
      recv_recovery_from_checkpoint_start(): Avoid reading
      the checkpoint header information from log file
      
      Datafile::validate_first_page(): Throw error in case
      of first page validation fails.
      caad34df
  10. 14 Jan, 2024 1 commit
  11. 13 Jan, 2024 1 commit
  12. 12 Jan, 2024 3 commits
  13. 11 Jan, 2024 4 commits
  14. 10 Jan, 2024 6 commits
  15. 09 Jan, 2024 2 commits
    • Sergei Golubchik's avatar
      MDEV-33148 A connection can control RAND() in following connection · c6e1ffd1
      Sergei Golubchik authored
      initialize THD::rand in THD::init() not in THD::THD(),
      because the former is also called when a THD is reused -
      in COM_CHANGE_USER and in taking a THD from the cache.
      
      Also use current cycle timer for more unpreditability
      c6e1ffd1
    • Alexander Barkov's avatar
      MDEV-32645 CAST(AS UNSIGNED) fails with --view-protocol · 9322ef03
      Alexander Barkov authored
      Item_float::neg() did not preserve the "presentation" from "this".
      So
        CAST(-1e0 AS UNSIGNED)  -- cast from double to unsigned
      changes its meaning to:
        CAST(-1 AS UNSIGNED)  -- cast signed to undigned
      
      Fixing Item_float::neg() to construct the new value for
      Item_float::presentation as follows:
      - if the old value starts with minus, then the minus is truncated:
        '-2e0' -> '2e0'
      - otherwise, minus sign followed by its old value:
        '1e0'  -> '-1e0'
      9322ef03
  16. 08 Jan, 2024 5 commits