1. 07 Dec, 2023 3 commits
  2. 06 Dec, 2023 2 commits
    • Oleg Smirnov's avatar
      MDEV-15656 Assertion `is_last_prefix <= 0' failed in QUICK_GROUP_MIN_MAX_SELECT::get_next · a8bd6a98
      Oleg Smirnov authored
      When QUICK_GROUP_MIN_MAX_SELECT is initialized or being reset
      it stores the prefix of the last group of the index chosen for
      retrieving data (last_value). Later, when looping through records
      at get_next() method, the server checks whether the retrieved
      group is the last, and if so, it finishes processing.
      
      At the same time, it looks like there is no need for that additional
      check since method next_prefix() returns HA_ERR_KEY_NOT_FOUND
      or HA_ERR_END_OF_FILE when there are no more satisfying records.
      If we do not perform the check, we do not need to retrieve and
      store last_value either.
      
      This commit removes using of last_value from QUICK_GROUP_MIN_MAX_SELECT.
      
      Reviewer: Sergei Petrunia <sergey@mariadb.com>
      a8bd6a98
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-29092 FOREIGN_KEY_CHECKS does not prevent non-copy alter from creating invalid FK structure · d5fc34db
      Thirunarayanan Balathandayuthapani authored
      Problem:
      ========
      - InnoDB should have two keys on the same column for the self
      referencing foreign key relation.
      
      Solution:
      =========
      - Allow self referential foreign key relation to work with one
      key.
      d5fc34db
  3. 05 Dec, 2023 7 commits
  4. 04 Dec, 2023 3 commits
  5. 02 Dec, 2023 3 commits
  6. 30 Nov, 2023 4 commits
    • Rex's avatar
      MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash · c6a9fd79
      Rex authored
      Statements affected by this bug are delete statements that have all
      these conditions
      
      1) single table delete syntax
      2) and in (sub-query) predicate
      3) semi-join optimization enabled
      4) an order by clause.
      
      Semijoin optimization on an innocent looking query, such as
      
      DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
      
      turns it from a single table delete to a multi-table delete.
      
      During multi_delete::initialize_tables for the top level join object, a
      table is initialized missing a keep_current_rowid flag, needed to
      position a handler for removal of the correct row after the filesort
      structure has been built.
      
      Fix provided by Monty (monty@mariadb.com)
      Pushed into 10.5 at Monty's request.
      Applicable to 10.6, 10.11, 11.0.
      OK'd by Monty in slack:#askmonty 2023-12-01
      c6a9fd79
    • Sergei Golubchik's avatar
      MDEV-22230 fix failing test · 5f890452
      Sergei Golubchik authored
      followup for 5bb31bc8
      5f890452
    • Marko Mäkelä's avatar
      MDEV-32269 InnoDB after ALTER TABLE…IMPORT TABLESPACE may not be crash safe · 89a5a8d2
      Marko Mäkelä authored
      mtr_t::commit(): If IMPORT TABLESPACE is first-time-dirtying blocks,
      acquire both log_sys.mutex and log_sys.flush_order_mutex to assign
      a valid m_commit_lsn so that the block will be inserted into the
      correct position of buf_pool.flush_list.
      
      This fixes occasional debug assertion failures when running the
      regression test suite.
      
      Reviewed by: Vladislav Lesin
      89a5a8d2
    • Daniel Black's avatar
      main.subselect* often fails on CI with ER_SUBQUERY_NO_1_ROW · 2fe3e033
      Daniel Black authored
      Using mysql.slow_log was a test table would generate more than
      one row if there was more than one row in the table.
      
      Replace this table with a empty table with PK.
      
      Reviewer: Rex Johnston
      2fe3e033
  7. 29 Nov, 2023 5 commits
    • Marko Mäkelä's avatar
      MDEV-31441 BLOB corruption on UPDATE of PRIMARY KEY with FOREIGN KEY · cd79f102
      Marko Mäkelä authored
      row_upd_clust_rec_by_insert(): If we are resuming from a lock wait,
      reset the 'disowned' flag of the BLOB pointers in 'entry' that we
      copied from 'rec' on which we had invoked btr_cur_disown_inherited_fields()
      before the lock wait started. In this way, the inserted record with
      the updated PRIMARY KEY value will have the BLOB ownership associated
      with itself, like it is supposed to be.
      
      Note: If the lock wait had been aborted, then rollback would have
      invoked btr_cur_unmark_extern_fields() and no corruption would be possible.
      
      Reviewed by: Vladislav Lesin
      Tested by: Matthias Leich
      cd79f102
    • Vlad Lesin's avatar
      MDEV-28682 gcol.gcol_purge contaminates further execution of innodb.gap_locks · 968061fd
      Vlad Lesin authored
      ha_innobase::extra() invokes check_trx_exists() unconditionally even for
      not supported operations. check_trx_exists() creates and registers trx_t
      object if THD does not contain pointer to it. If ha_innobase::extra() does
      not support some operation, it just invokes check_trx_exists() and quites.
      If check_trx_exists() creates and registers new trx_t object for such
      operation, it will never be freed and deregistered.
      
      For example, if ha_innobase::extra() is invoked from purge thread with
      operation = HA_EXTRA_IS_ATTACHED_CHILDREN, like it goes in
      gcol.gcol_purge test, trx_t object will be registered, but not
      deregisreted, and this causes innodb.gap_lock failure, as "SHOW ENGINE
      INNODB STATUS" shows information about unexpected transaction at the end
      of trx_sys.trx_list.
      
      The fix is not to invoke check_trx_exists() for unsupported operations
      in ha_innobase::extra().
      
      Reviewed by: Marko Mäkelä
      968061fd
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-32897 main suite test case prints extra row for metadata_lock_info query · e996f77c
      Thirunarayanan Balathandayuthapani authored
      - Added the parameter stats_persistent=0 for InnoDB engine.
      - Before printing metadata_lock_info query, make sure that
      InnoDB does complete purging.
      
      Reviewed by: Marko Mäkelä
      e996f77c
    • Marko Mäkelä's avatar
      MDEV-32833 InnoDB wrong error message · 47fc64c1
      Marko Mäkelä authored
      trx_t::commit_in_memory(): Empty the detailed_error string, so that
      FOREIGN KEY error messages from an earlier transaction will not be
      wrongly reused in ha_innobase::get_error_message().
      
      Reviewed by: Thirunarayanan Balathandayuthapani
      47fc64c1
    • Daniel Black's avatar
      mallinfo2: include malloc header even if mallinfo undetected · 1fec5012
      Daniel Black authored
      It may be the case that for some reason, -Werror deprecated
      for instance, that mallinfo isn't detected. In this case the
      malloc.h headers won't be included which defined the mallinfo2
      function and its structure.
      
      Re-organise so that either function pulls in the header.
      1fec5012
  8. 28 Nov, 2023 11 commits
    • Kristian Nielsen's avatar
      MDEV-20169: main.partition_innodb fails in buildbot with wrong result · 705f7ab6
      Kristian Nielsen authored
      The problem is that background statistics can race with statistics update
      during INSERT and cause slightly inaccurate `Rows` count in table statistics
      (this is deliberate to avoid excessive locking overhead). This was seen as
      occasional .result difference in the test.
      
      Mask out the unstable `Rows` column from SHOW TABLE STATUS; the value is not
      related to what is being tested in this part of the test case.
      
      Run ANALYZE TABLE before SHOW EXPLAIN to get stable row count in output.
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      705f7ab6
    • Kristian Nielsen's avatar
      MDEV-32168: slave_error_param condition is never checked from the wait_for_slave_param.inc · ea4bcb9d
      Kristian Nielsen authored
      Fix some random test failures following MDEV-32168 push.
      
      Don't blindly set $rpl_only_running_threads in many places. Instead explicit
      stop only the IO or SQL thread, as appropriate. Setting it interfered with
      rpl_end.inc in some cases. Rather than clearing it afterwards, better to
      not set it at all when it is not needed, removing ambiguity in the test
      about the state of the replication threads.
      
      Don't fail the test if include/stop_slave_io.inc finds an error in the IO
      thread after stop. Such errors can be simply because slave stop happened in
      the middle of the IO thread's initial communication with the master.
      Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
      ea4bcb9d
    • Monty's avatar
      Remove deprication from mariadbd --debug · 387b92df
      Monty authored
      --debug is supported by allmost all our other binaries and we should keep
      it also in the server to keep option names similar.
      387b92df
    • Monty's avatar
      Fixed build failure on aarch64-macos · 1ffa8c50
      Monty authored
      debug_sync.h was wrongly combined with replication
      1ffa8c50
    • Monty's avatar
      Fixed crash in Delayed_insert::get_local_table() · acdb8b67
      Monty authored
      This was a bug in my previous commit, found by buildbot
      acdb8b67
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-29913 Assertion `thd->stmt_arena != thd->progress.arena' failed in... · 7081feea
      Thirunarayanan Balathandayuthapani authored
      MDEV-29913 Assertion `thd->stmt_arena != thd->progress.arena' failed in thd_progress_init upon bulk load
      
      - Commit fc31e311(MDEV-8179) doesn't
      report the progress of inplace alter completely. It just does only
      in row_merge_sort(). Removing the progress report function completely
      7081feea
    • Thirunarayanan Balathandayuthapani's avatar
      MDEV-32890 LeakSanitizer errors in mem_heap_create_block_func upon query from... · d9ae5820
      Thirunarayanan Balathandayuthapani authored
      MDEV-32890  LeakSanitizer errors in mem_heap_create_block_func upon query from I_S.INNODB_SYS_TABLES with LIMIT ROWS EXAMINED
      
      - innodb_sys_tables query fails to free the object which contains
      sys_tables information in case of error.
      d9ae5820
    • Faustin Lammler's avatar
      Fix typo · 81aba2c2
      Faustin Lammler authored
      81aba2c2
    • Faustin Lammler's avatar
    • Alexander Barkov's avatar
      MDEV-32879 Server crash in my_decimal::operator= or unexpected ER_DUP_ENTRY... · f436b4a5
      Alexander Barkov authored
      MDEV-32879 Server crash in my_decimal::operator= or unexpected ER_DUP_ENTRY upon comparison with INET6 and similar types
      
      During the 10.5->10.6 merge please use the 10.6 code on conflicts.
      
      This is the 10.5 version of the patch (a backport of the 10.6 version).
      Unlike 10.6 version, it makes changes in plugin/type_inet/sql_type_inet.*
      rather than in sql/sql_type_fixedbin.h
      
      Item_bool_rowready_func2, Item_func_between, Item_func_in
      did not check if a not-NULL argument of an arbitrary data type
      can produce a NULL value on conversion to INET6.
      
      This caused a crash on DBUG_ASSERT() in conversion failures,
      because the function returned SQL NULL for something that
      has Item::maybe_null() equal to false.
      
      Adding setting NULL-ability in such cases.
      
      Details:
      
      - Removing the code in Item_func::setup_args_and_comparator()
        performing character set aggregation with optional narrowing.
        This aggregation is done inside Arg_comparator::set_cmp_func_string().
        So this code was redundant
      
      - Removing Item_func::setup_args_and_comparator() as it git simplified to
        just to two lines:
          convert_const_compared_to_int_field(thd);
          return cmp->set_cmp_func(thd, this, &args[0], &args[1], true);
        Using these lines directly in:
          - Item_bool_rowready_func2::fix_length_and_dec()
          - Item_func_nullif::fix_length_and_dec()
      
      - Adding a new virtual method:
        - Type_handler::Item_bool_rowready_func2_fix_length_and_dec().
      
      - Adding tests detecting if the data type conversion can return SQL NULL into
        the following methods of Type_handler_inet6:
        - Item_bool_rowready_func2_fix_length_and_dec
        - Item_func_between_fix_length_and_dec
        - Item_func_in_fix_comparator_compatible_types
      f436b4a5
    • Yuchen Pei's avatar
      MDEV-32849 Spider: check if any table is actually locked when unlocking · 20578205
      Yuchen Pei authored
      This avoids the scenario in MDEV-32849, when the unlock happens after
      the connection has been freed, say in rollback. This is done in 10.5+
      after the commit a26700cc.
      
      It may or may not prevent potential other scenarios where spider has
      locked something, then for some reason the statement needs to be
      rolled back and spider frees the connection, and then spider proceeds
      to use the freed connection. But at least we fix the regression
      introduced by MDEV-30014 to 10.4 and bring 10.4 closer in parity with
      10.5+.
      20578205
  9. 27 Nov, 2023 2 commits