1. 11 Jan, 2023 5 commits
    • Julius Goryavsky's avatar
      MDEV-30220: rsync SST completely ignores aria-log-dir-path · 53c4be7b
      Julius Goryavsky authored
      This commit adds support for the --aria-log-dir-path
      option on the command line and for the aria-log-dir-path
      option in the configuration file to the SST scripts, since
      before this change these parameters were completely ignored
      during SST - SST scripts assumed that aria logs files are
      always located in the same directory as logs for innodb.
      
      Tests for this change will be added as a separate commit,
      along with tests for MDEV-30157 and MDEV-28669.
      53c4be7b
    • Julius Goryavsky's avatar
      MDEV-30157: Galera SST doesn't properly handle undo* files from innodb · b84f3fa7
      Julius Goryavsky authored
      This fix adds separate handling for "undo*" files that contain undo
      logs as part of innodb files and adds a filter for undo* to the main
      filter used when initially transferring files with rsync.
      b84f3fa7
    • Julius Goryavsky's avatar
      pre-MDEV-30157 & pre-MDEV-28669: fixes before the main corrections · e4a4aad7
      Julius Goryavsky authored
      This commit adds even more correct handling of parameters
      with paths when they contain leading or trailing spaces and/or
      slashes. Also it fixes problems that occur when the user specified
      explicit paths to additional directories, but these paths match
      the specified path of the data directory - in this case, additional
      subdirectories should be treated (in relation to the data directory)
      in the same way as if these paths were not specified or as if they
      are implicitly specified as "." or "./". But prior to this fix,
      existing code treated any values as if they were completely
      separate directories, whether or not they actually point to the
      same location to which datadir points to - and this sometimes
      resulted in incorrect file transfers.
      
      This fix does not contain separate tests, as tests will be
      part of the main commit(s). This fix has been made as a separate
      commit to facilitate review for major substantive fixes related
      to MDEV-30157 and MDEV-28669.
      e4a4aad7
    • Sergei Petrunia's avatar
      MDEV-28602 Wrong result with outer join, merged derived table and view · b928c849
      Sergei Petrunia authored
      (Variant 3, initial variant was by Rex Jonston)
      
      A LEFT JOIN with a constant as a column of the inner table produced wrong
      query result if the optimizer had to write the inner table column into a
      temp table. Query pattern:
      
        SELECT ...
        FROM (SELECT /*non-mergeable select*/
              FROM t1 LEFT JOIN (SELECT 'Y' as Val) t2 ON ...) as tbl
      
      Fixed this by adding Item_direct_view_ref::save_in_field() which follows
      the pattern of Item_direct_view_ref's save_org_in_field(),
      save_in_result_field() and val_XXX() functions:
      * call check_null_ref() and handle NULL value
      * if we didn't get a NULL-complemented row, call Item_direct_ref's function.
      b928c849
    • Marko Mäkelä's avatar
      Remove an unused parameter · b218dfea
      Marko Mäkelä authored
      lock_rec_has_to_wait(): Remove the unused parameter for_locking
      that had been originally added
      in commit df4dd593
      b218dfea
  2. 10 Jan, 2023 1 commit
    • Daniel Black's avatar
      clang15 warnings - unused vars and old prototypes · 56948ee5
      Daniel Black authored
      clang15 finally errors on old prototype definations.
      
      Its also a lot fussier about variables that aren't used
      as is the case a number of time with loop counters that
      aren't examined.
      
      RocksDB was complaining that its get_range function was
      declared without the array length in ha_rocksdb.h. While
      a constant is used rather than trying to import the
      Rdb_key_def::INDEX_NUMBER_SIZE header (was causing a lot of
      errors on the defination of other orders). If the constant
      does change can be assured that the same compile warnings will
      tell us of the error.
      
      The ha_rocksdb::index_read_map_impl DBUG_EXECUTE_IF was similar
      to the existing endless functions used in replication tests.
      Its rather moot point as the rocksdb.force_shutdown test that
      uses myrocks_busy_loop_on_row_read is currently disabled.
      56948ee5
  3. 09 Jan, 2023 1 commit
  4. 07 Jan, 2023 1 commit
  5. 06 Jan, 2023 2 commits
    • Igor Babaev's avatar
      MDEV-27624 Wrong result for nested left join using not_exists optimization · b21832ef
      Igor Babaev authored
      This bug affected queries with nested left joins having the same last inner
      table such that not_exists optimization could be applied to the most inner
      outer join when optimizer chose to use join buffers. The bug could lead to
      producing wrong a result set.
      If the WHERE condition a query contains a conjunctive IS NULL predicate
      over a non-nullable column of an inner table of a not nested outer join
      then not_exists optimization can be applied to tho the outer join. With
      this optimization when looking for matches for a certain record from the
      outer table of the join the records of the inner table can be ignored
      right after the first match satisfying the ON condition is found.
      In the case of nested outer joins having the same last inner table this
      optimization still can be applied but only if all ON conditions of the
      embedding outer joins are satisfied. Such check was missing in the code
      that tried to apply not_exists optimization when join buffers were used
      for outer join operations.
      This problem has been already fixed in the patch for bug MDEV-7992. Yet
      there it was resolved only for the cases when join buffers were not used
      for outer joins.
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      b21832ef
    • Haidong Ji's avatar
      MDEV-17093: SOURCE_REVISION in log and handle_fatal_signal · af0ff8b4
      Haidong Ji authored
      MariaDB MDEV-12583 added `SOURCE_REVISION` variable that exposes the
      SHA1 of source code commit that the current running engine was built
      from. This info is useful for troubleshooting and debugging.
      
      This commit does the following:
      - addes the `SOURCE_REVISION` value into engine error log.
      - when a crash triggers handle_fatal_signal, the `SOURCE_REVISION` will
        be included in crash report.
      - resolves MDEV-20344: startup messages belong in stderr/error-log not
        stdout
      
      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.
      af0ff8b4
  6. 04 Jan, 2023 1 commit
  7. 03 Jan, 2023 1 commit
    • Andrew Hutchings's avatar
      MDEV-30329: mariadb-service-convert resets systemd service to default User=root · e51a1d6f
      Andrew Hutchings authored
      If mariadb-service-convert is run and the user variable is unset then
      this sets `User=` in `[Service]`, which then tries to run mariadb as
      root, which in-turn fails. This only happens when mysqld_safe is missing
      which is all the time now. So don't set `User=` if there is no user variable.
      
      Reviewer: Sergei Golubchik <serg@mariadb.org> (in PR #2382)
      e51a1d6f
  8. 01 Jan, 2023 10 commits
  9. 27 Dec, 2022 1 commit
  10. 26 Dec, 2022 4 commits
    • Marko Mäkelä's avatar
      MDEV-25004 Refactorings · 72e2d1d2
      Marko Mäkelä authored
        * Avoid some pessimization
        * Slightly smaller upgrade dataset
        * Simplify vers_row_same_trx() and its caller
      72e2d1d2
    • Aleksey Midenkov's avatar
      MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORY · e056efdd
      Aleksey Midenkov authored
      1. In case of system-versioned table add row_end into FTS_DOC_ID index
         in fts_create_common_tables() and innobase_create_key_defs().
         fts_n_uniq() returns 1 or 2 depending on whether the table is
         system-versioned.
      
         After this patch recreate of FTS_DOC_ID index is required for
         existing system-versioned tables. If you see this message in error
         log or server warnings: "InnoDB: Table db/t1 contains 2 indexes
         inside InnoDB, which is different from the number of indexes 1
         defined in the MariaDB" use this command to fix the table:
      
            ALTER TABLE db.t1 FORCE;
      
      2. Fix duplicate history for secondary unique index like it was done
         in MDEV-23644 for clustered index (932ec586). In case of
         existing history row which conflicts with currently inseted row we
         check in row_ins_scan_sec_index_for_duplicate() whether that row
         was inserted as part of current transaction. In that case we
         indicate with DB_FOREIGN_DUPLICATE_KEY that new history row is not
         needed and should be silently skipped.
      
      3. Some parts of MDEV-21138 (7410ff43) reverted. Skipping of
         FTS_DOC_ID index for history rows made problems with purge
         system. Now this is fixed differently by p.2.
      
      4. wait_all_purged.inc checks that we didn't affect non-history rows
         so they are deleted and purged correctly.
      
      Additional FTS fixes
      
        fts_init_get_doc_id(): exclude history rows from max_doc_id
        calculation. fts_init_get_doc_id() callback is used only for crash
        recovery.
      
        fts_add_doc_by_id(): set max value for row_end field.
      
        fts_read_stopword(): stopwords table can be system-versioned too. We
        now read stopwords only for current data.
      
        row_insert_for_mysql(): exclude history rows from doc_id validation.
      
        row_merge_read_clustered_index(): exclude history_rows from doc_id
        processing.
      
        fts_load_user_stopword(): for versioned table retrieve row_end field
        and skip history rows. For non-versioned table we retrieve 'value'
        field twice (just for uniformity).
      
      FTS tests for System Versioning now include maybe_versioning.inc which
      adds 3 combinations:
      
      'vers'     for debug build sets sysvers_force and
      	   sysvers_hide. sysvers_force makes every created table
      	   system-versioned, sysvers_hide hides WITH SYSTEM VERSIONING
      	   for SHOW CREATE.
      
      	   Note: basic.test, stopword.test and versioning.test do not
      	   require debug for 'vers' combination. This is controlled by
      	   $modify_create_table in maybe_versioning.inc and these
      	   tests run WITH SYSTEM VERSIONING explicitly which allows to
      	   test 'vers' combination on non-debug builds.
      
      'vers_trx' like 'vers' sets sysvers_force_trx and sysvers_hide. That
      	   tests FTS with trx_id-based System Versioning.
      
      'orig' 	   works like before: no System Versioning is added, no debug is
      	   required.
      
      Upgrade/downgrade test for System Versioning is done by
      innodb_fts.versioning. It has 2 combinations:
      
      'prepare' makes binaries in std_data (requires old server and OLD_BINDIR).
      	  It tests upgrade/downgrade against old server as well.
      
      'upgrade' tests upgrade against binaries in std_data.
      
      Cleanups:
      
      Removed innodb-fts-stopword.test as it duplicates stopword.test
      e056efdd
    • Aleksey Midenkov's avatar
      MDEV-25004 restart_bindir option to restart server from different location · 68c437ba
      Aleksey Midenkov authored
      Adds new parameter $restart_bindir for restart_mysqld.inc.
      
      Example:
      
      let $restart_bindir= /home/midenok/src/mariadb/10.3b/build;
      --source include/restart_mysqld.inc
      
      It is good to return back original server before check_mysqld will be
      run at the test end:
      
      let $restart_bindir=;
      --source include/restart_mysqld.inc
      68c437ba
    • Aleksey Midenkov's avatar
      MDEV-25004 vers_force_trx option to force transactional System Versioning · 5d506ac2
      Aleksey Midenkov authored
      Works like vers_force but forces trx_id-based system-versioned tables
      if the storage supports it (currently InnoDB-only). Otherwise creates
      timestamp-based system-versioned table.
      5d506ac2
  11. 21 Dec, 2022 1 commit
  12. 20 Dec, 2022 2 commits
    • Vlad Lesin's avatar
      MDEV-30225 RR isolation violation with locking unique search · 3ddc00dc
      Vlad Lesin authored
      Before the fix next-key lock was requested only if a record was
      delete-marked for locking unique search in RR isolation level.
      There can be several delete-marked records for the same unique key,
      that's why InnoDB scans the records until eighter non-delete-marked record
      is reached or all delete-marked records with the same unique key are
      scanned.
      
      For range scan next-key locks are used for RR to protect scanned range from
      inserting new records by other transactions. And this is the reason of why
      next-key locks are used for delete-marked records for unique searches.
      
      If a record is not delete-marked, the requested lock type was "not-gap".
      When a record is not delete-marked during lock request by trx 1, and
      some other transaction holds conflicting lock, trx 1 creates waiting
      not-gap lock on the record and suspends. During trx 1 suspending the
      record can be delete-marked. And when the lock is granted on conflicting
      transaction commit or rollback, its type is still "not-gap". So we have
      "not-gap" lock on delete-marked record for RR. And this let some other
      transaction to insert some record with the same unique key when trx 1 is
      not committed, what can cause isolation level violation.
      
      The fix is to set next-key locks for both delete-marked and
      non-delete-marked records for unique search in RR.
      3ddc00dc
    • Yuchen Pei's avatar
      MDEV-29562 Spider table charset error should happen correctly. · 3f63aa18
      Yuchen Pei authored
      When trying to create a spider table with banned charsets including
      utf32, utf16, ucs2 and utf16le[1], spider should emit an error
      immediately, rather than wait until a separate statement that
      establishes a connection (e.g. SELECT). This also applies to ALTER
      TABLE statement that changes charsets.
      
      [1] https://mariadb.com/kb/en/server-system-variables/#character_set_clientSigned-off-by: default avatarYuchen Pei <yuchen.pei@mariadb.com>
      Reviewed-by: default avatarNayuta Yanagisawa <nayuta.yanagisawa@mariadb.com>
      3f63aa18
  13. 19 Dec, 2022 1 commit
  14. 16 Dec, 2022 2 commits
    • Lena Startseva's avatar
      MDEV-27691: make working view-protocol · 0ca3aaa7
      Lena Startseva authored
      Excluded one case from view-protocol in gis.test
      0ca3aaa7
    • Marko Mäkelä's avatar
      MDEV-30242 MTR fails to report stack traces of all threads by default · 9f8fc983
      Marko Mäkelä authored
      An unfortunate change to the default behavior of the handling of
      core dumps was implemented in
      commit e9be5428
      by making MTR_PRINT_CORE=small the default value, that is, to
      only display the stack trace of one thread in crash reports.
      Many if not most failures that occur in regression tests are
      sporadic and involve race conditions or deadlocks. To be able to
      analyze such failures, having the stack traces of all active threads
      is a must, because CI environments typically do not save any core dumps.
      
      While the environment variable MTR_PRINT_CORE could be set in CI
      environments to compensate for the unfortunate change, it is better
      to revert to the old default (dumping all threads) so that
      no explicit action will be required from maintainers of independent
      CI systems. In that case, if something fails once in a blue moon,
      we can have some hope of diagnosing it based on the output.
      
      We fix this regression by defaulting the unset environment variable
      MTR_PRINT_CORE to "medium".
      9f8fc983
  15. 15 Dec, 2022 2 commits
    • musvaage's avatar
      debian typos · d0f6d467
      musvaage authored
      d0f6d467
    • Marko Mäkelä's avatar
      MDEV-30233 DROP DATABASE test fails: Directory not empty · c562ccf7
      Marko Mäkelä authored
      Some tests drop the default mtr database "test". This may fail due
      to the directory not being empty. InnoDB may not delete all tables
      immediately, due to the "background drop table queue" or its
      replacement in commit 1bd681c8
      (the purge of history would clean up after a DDL operation during
      which the server was killed).
      
      Let us try to avoid "drop database test" whenever it is easily possible.
      Where it is not, SET GLOBAL innodb_max_purge_lag_wait=0 will ensure
      that the replacement of the "background drop table queue" will have
      completed its job.
      c562ccf7
  16. 13 Dec, 2022 2 commits
    • Daniel Black's avatar
      MDEV-21187: log_slow_filter="" logs queries not using indexes · 697dbd15
      Daniel Black authored
      Consistent with MDEV-4206 and empty log_slow_filter still means
      no explict filtering. Since 21518ab2 however the
      log_queries_not_using_indexes became stored in the same variable.
      
      As we need to test for the absense of log_queries_not_using_indexes
      the SERVER_QUERY_NO_INDEX USED part of log_slow_statement, the empty
      criteria resulted in an always true to log queries not using indexes if
      log_slow_filter was set to empty.
      
      Adjusted the log_slow.test for MDEV-4206 as slow_log_query has been
      global and session for a while and it was relying on the MDEV-21187
      buggy behavior to detect a slow query.
      
      Reviewer: Monty
      697dbd15
    • Daniel Black's avatar
      MDEV-18591: mysql_install_db - pass --log-error to mysqld in install (#2363) · acfaa045
      Daniel Black authored
      Previously we parsed it out in mysql_install_db for use in the error
      message, but failed to pass it to mysqld in the bootstrap.
      
      Also match log_error as it might appear in the .cnf files.
      
      Thanks Michal Schorm for the test case.
      
      Reviewed by: Faustin Lammler
      acfaa045
  17. 09 Dec, 2022 2 commits
    • Julius Goryavsky's avatar
      MDEV-29814: galera_var_notify_ssl_ipv6 causes testing system to hang · 8f309732
      Julius Goryavsky authored
      This commit fixes the test system hanging due to
      the galera_var_notify_ssl_ipv6 test and also brings
      the wsrep_notify[_ssl].sh files in line with each other
      between the user template and the mtr suite.
      
      Quotes are also added here to avoid problems if the
      user specifies the value of one of the variables at the
      beginning of the file containing shell-specific characters,
      for example, if the password or username specified in the
      PSWD and USER variables will contain the "$" character.
      
      Also fixed an issue with automatic --ssl-verify-server-cert
      option substitution when the corresponding value is set
      by the user to "1" or "on".
      
      Also fixed some tests here to avoid joining one of the nodes
      to another cluster when the nodes are restarted from the mtr
      side, which can lead to random failures when testing with
      buildbot.
      8f309732
    • Marko Mäkelä's avatar
      MDEV-29144 ER_TABLE_SCHEMA_MISMATCH or crash on DISCARD/IMPORT · 782b2a75
      Marko Mäkelä authored
      mysql_discard_or_import_tablespace(): On successful
      ALTER TABLE...DISCARD TABLESPACE, evict the table handle from the
      table definition cache, so that ha_innobase::close() will be invoked,
      like InnoDB expects to be the case. This will avoid an assertion failure
      ut_a(table->get_ref_count() == 0) during IMPORT TABLESPACE.
      
      ha_innobase::open(): Do not issue any ER_TABLESPACE_DISCARDED warning.
      Member functions for DML will do that.
      
      ha_innobase::truncate(), ha_innobase::check_if_supported_inplace_alter():
      Issue ER_TABLESPACE_DISCARDED warnings, to compensate for the removal of
      the warning in ha_innobase::open().
      
      row_quiesce_write_indexes(): Only write information about committed
      indexes. The ALTER TABLE t NOWAIT ADD INDEX(c) in the nondeterministic
      test case will most of the time fail due to a metadata lock (MDL) timeout
      and leave behind an uncommitted index.
      
      Reviewed by: Sergei Golubchik
      782b2a75
  18. 08 Dec, 2022 1 commit
    • Daniel Black's avatar
      MDEV-30150 ST_GeomFromGeoJSON, 'geometry' before 'type: feature' error · 8f3631d0
      Daniel Black authored
      The geometry type requires Type:"Feature" but the feature need
      not be first in the JSON structure.
      
      Adjust code to return an error if geometry isn't a JSON object,
      but continue parsing searching for Type: "Feature" to trigger
      the geometry parsing.
      
      Thanks Derick Magnusen for the bug report.
      8f3631d0