1. 28 Jun, 2023 3 commits
  2. 27 Jun, 2023 6 commits
  3. 26 Jun, 2023 3 commits
  4. 25 Jun, 2023 9 commits
  5. 21 Jun, 2023 3 commits
    • Brandon Nesterenko's avatar
      MDEV-29894: Calling a function from a different database in a slave side trigger crashes · c2d44ecb
      Brandon Nesterenko authored
      When opening and locking tables, if triggers will be invoked in a
      separate database, thd->set_db() is invoked, thus freeeing the memory
      and headers which thd->db had previously pointed to. In row based
      replication, the event execution logic initializes thd->db to point
      to the database which the event targets, which is owned by the
      corresponding table share (introduced in d9898c9a for MDEV-7409).
      The problem then, is that during the table opening and locking
      process for a row event, memory which belongs to the table share
      would be freed, which is not valid.
      
      This patch replaces the thd->reset_db() calls to thd->set_db(),
      which copies-by-value, rather than by reference. Then when the
      memory is freed, our copy of memory is freed, rather than memory
      which belongs to a table share.
      
      Notes:
        1. The call to change thd->db now happens on a higher-level, in
      Rows_log_event::do_apply_event() rather than ::do_exec_row(), in the
      call stack. This is because do_exec_row() is called within a loop,
      and each invocation would redundantly set and unset the db to the
      same value.
        2. thd->set_db() is only used if triggers are to be invoked, as
      there is no vulnerability in the non-trigger case, and copying
      memory would be an unnecessary inefficiency.
      
      Reviewed By:
      ============
      Andrei Elkin <andrei.elkin@mariadb.com>
      c2d44ecb
    • Monty's avatar
      MDEV-31375 Assertion `dbl_records <= s->records' failed with optimizer_use_condition_selectivity=1 · 3d617fdc
      Monty authored
      The reason for the crash wad that 'best splitting' optimization
      predicted less rows to be found than what opt_range did.
      This code in apply_selectivity_for_table(), when using use_cond_selectivity=1,
      was not prepared for this case which caused an assert in debug builds.
      Production builds is not affected.
      
      The fix is to choose the smaller of the two row counts. It will have a
      minimum on costs when using use_cond_selectivity=1 and should not cause
      any problems in production.
      3d617fdc
    • Monty's avatar
      MDEV-31494 Server crashes in ha_partition::index_blocks / get_key_scans_params · d3c81804
      Monty authored
      MDEV-31445 Server crashes in ha_partition::index_blocks / cost_for_index_read
      
      The crash happened in the case where partition pruning finds 0
      partitions.
      d3c81804
  6. 20 Jun, 2023 1 commit
  7. 19 Jun, 2023 1 commit
  8. 18 Jun, 2023 14 commits
    • Sergei Golubchik's avatar
      10.5 fixes for --view and --embedded · 7c7de020
      Sergei Golubchik authored
      7c7de020
    • Sergei Golubchik's avatar
      10.11 fix - view protocols · 92502ad7
      Sergei Golubchik authored
      92502ad7
    • Sergei Golubchik's avatar
      compilation errors on 32bit · ef885322
      Sergei Golubchik authored
      storage/innobase/fsp/fsp0fsp.cc:3108:58: error: conversion to ‘uint16_t {aka short unsigned int}’ from ‘unsigned int’ may alter its value [-Werror=conversion]
      storage/innobase/handler/handler0alter.cc:10202:25: error: conversion to ‘unsigned char:7’ from ‘ulint {aka unsigned int}’ may alter its value [-Werror=conversion]
      ef885322
    • Sergei Golubchik's avatar
      MDEV-9069 extend AES_ENCRYPT() and AES_DECRYPT() to support IV and the algorithm · 028d7512
      Sergei Golubchik authored
      AES_ENCRYPT(str, key, [, iv [, mode ]])
      AES_DECRYPT(str, key, [, iv [, mode ]])
      
      mode is aes-{128,192,256}-{ecb,cbc,ctr} e.g. "aes-128-cbc".
      
      and a @@block_encryption_mode variable for the default value of mode
      
      change in behavior: AES_ENCRYPT(str, key) can no longer
      be used in persistent virtual columns (and alike)
      028d7512
    • Sergei Golubchik's avatar
      enable AES-CTR with wolfssl · 1ec5562f
      Sergei Golubchik authored
      apparently it works now just fine, tests don't fail anymore
      1ec5562f
    • Sergei Golubchik's avatar
      09aeb5c2
    • Sergei Golubchik's avatar
      59413714
    • Sergei Golubchik's avatar
      MDEV-26182 fixes for --ps · 6c2c9ddb
      Sergei Golubchik authored
      * invoke parent's cleanup()
      * don't reinit memroot, if already inited (causes memory leak)
      
      also move free_root() from destructor to cleanup() to not accumulate
      allocations from prepare and multiple executes
      6c2c9ddb
    • tanruixiang's avatar
      MDEV-26182 Implement JSON_INTERSECT() · 877a75e2
      tanruixiang authored
      The idea is to have simple functions that the user can combine to produce
      the exact result one wants, whether the user wants JSON object that has
      common keys with another JSON object, or same key/value pair etc. So
      making simpler function helps here.
      
      We accomplish this by making three separate functions.
      1) JSON_OBJECT_FILTER_KEYS(Obj, Arr_keys):
      Put keys ( which are basically strings ) in hash, go over the object and
      get key one by one. If the key is present in the hash,
      add the key-value pair to result.
      
      2) JSON_OBJECT_TO_ARRAY(Obj) : Create a string variable, Go over the json
      object, and add each key value pair as an array into the result.
      
      3) JSON_ARRAY_INTERSECT(arr1, arr2) :
      Go over one of the json and add each item of the array
      in hash (after normalizing each item). Go over the second array,
      search the normalized item one by one in the hash. If item is found,
      add it to the result.
      
      Implementation Idea: Holyfoot ( Alexey Botchkov)
      Author: tanruixiang and Rucha Deodhar
      877a75e2
    • Rucha Deodhar's avatar
      MDEV-30145: JSON_TABLE: allow to retrieve the key when iterating on JSON · bed88213
      Rucha Deodhar authored
      objects
      
      Idea behind implementation:
      We get the json object specified by the json path. Then, transform it into
      key-value pairs by going over the json. Get each key-value pair
      one-by-one and return the result.
      bed88213
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-14795 InnoDB system tablespace cannot be shrunk · b596a772
      Thirunarayanan Balathandayuthapani authored
      - Patch does shrinking the system tablespace during startup
      process. Steps for shrinking the system tablespace:
      
      1) Find the last used extent in the system tablespace
      by iterating through the BITMAP in extent descriptor page
      
      2) Check whether tablespace is being used within fixed size
      and If the last used extent is lesser than fixed size then
      set the desired target size to fixed size
      
      3) Flush all the pages belong to system tablespace in flush list
      
      4) Truncate the truncated pages from FSP_FREE and FSP_FREE_FRAG list
      
      5) Reset the bitmap in descriptor pages for the truncated pages
      
      6) Update the FSP_SIZE and FSP_FREE_LIMIT in header page
      
      7) In case of multiple files, calculate the truncated last
      file size and do the truncation in last file
      
      - recv_sys_t::apply(): Handle the truncation of the system
      tablespace only if we have recv_size of tablespace exists
      b596a772
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-31442 page_cleaner thread aborts while releasing the tablespace · 02875ad4
      Thirunarayanan Balathandayuthapani authored
      After further I/O on a tablespace has been stopped
      (for example due to DROP TABLE or an operation that
      rebuilds a table), page cleaner thread tries to
      flush the pending writes for the tablespace and
      releases the tablespace reference even though it was not
      acquired.
      
      fil_space_t::flush(): Don't release the tablespace when it is
      being stopped and closed
      
      Thanks to Marko Mäkelä for suggesting this patch.
      02875ad4
    • Sergei Golubchik's avatar
      MDEV-5816: fixes for --view · e9eb2557
      Sergei Golubchik authored
      view creation (that mysqltest automatically does in --view protocol)
      can cause sp cache invalidation, and that will cause the test to fail
      (because the test checks that invalidation did not happen).
      
      disable view protocol in the parts of the test where this is the case
      e9eb2557
    • Dmitry Shulga's avatar
      MDEV-5816: Stored programs: validation of stored program statements · 998745d7
      Dmitry Shulga authored
      The follow-up patch to check in mtr tests that recompilation of
      a SP's instruction doesn't lead to eviction of SP from sp_cache.
      
      This patch adds the debug keyword 'check_sp_cache_not_invalidated'
      checked in sp_cache_flush_obsolete. In case this debug keyword
      is set the macros DBUG_SUICIDE() called to cause test failure.
      
      The function sp_cache_flush_obsolete() is called on opening
      a stored routine. So setting this keyword before second execution
      of some stored routine that supposed to cause recompilation of
      SP's statement will guarantee that this stored routing not evicted
      from sp_cache.
      
      Suggested approach has one limitation - the statement
       CREATE/ALTER/DROP VIEW
      forces invalidation of the whole sp_cache (by invoking the function
       sp_cache_invalidate()).
      So, for those tests (actually, there are very small number of such tests)
      that create/alter/drop a view before the second execution of some stored
      routine, the debug keyword 'check_sp_cache_not_invalidated' isn't set.
      
      The proposal to add some way a check that a stored routine is not force out
      from sp_cache on re-parsing a failing statement of a stored routine was
      done during reiew, that is the reason the proposed change has been formatted
      as a separate patch.
      998745d7