1. 04 Apr, 2022 1 commit
    • Dmitry Shulga's avatar
      MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*) · cd56b40f
      Dmitry Shulga authored
      This bug report is not about ASAN Use After Free issue. This bug is
      about missed calling of the method LEX::cleanup_lex_after_parse_error
      that should happen on parse error.
      
      Aforementioned method calls sphead::restore_thd_mem_root to clean up
      resources acquired on processing a stored routine. Particularly,
      the method sp_head::restore_tht_mem_root is called to restore
      an original mem root and reset LEX::sphead into nullptr.
      
      The method LEX::cleanup_lex_after_parse_error is invoked by the macros
      MYSQL_YYABORT. Unfortunately, some rules of grammar for handling
      user variables in SQL use YYABORT instead of MYSQL_YYABORT to handle
      parser errors. As a consequence, in case a statement with setting of
      a user variable is called inside a stored routine, it results in
      assert failure in sp_head destructor.
      
      To fix the issue the macros YYABORT should be replaced by MYSQL_YYABORT
      in those grammar rules that handle assignment of user variables.
      cd56b40f
  2. 02 Apr, 2022 1 commit
  3. 01 Apr, 2022 2 commits
  4. 31 Mar, 2022 1 commit
    • Nayuta Yanagisawa's avatar
      MDEV-28005 Deprecate Spider plugin variables regarding UDFs · f78fdf08
      Nayuta Yanagisawa authored
      Configuring UDFs via plugin variables looks not a good idea.
      The more variables Spider has, the more complex it becomes.
      Further, I expect that only a few users use Spider UDFs.
      
      Deprecate the following plugin variables regarding Spider UDFs:
      
      * spider_udf_ds_bulk_insert_rows
      * spider_udf_ds_table_loop_mode
      * spider_udf_ds_use_real_table
      * spider_udf_ct_bulk_insert_interval
      * spider_udf_ct_bulk_insert_rows
      
      spider_udf_table_lock_mutex_count and spider_udf_table_mon_mutex_count
      are also for tweaking UDFs but they are already read-only. So,
      there is no need to deprecate them.
      f78fdf08
  5. 30 Mar, 2022 1 commit
  6. 29 Mar, 2022 12 commits
  7. 28 Mar, 2022 10 commits
    • mkaruza's avatar
      MDEV-25912 wsrep does not identify checksummed events correctly · 97f237e6
      mkaruza authored
      For GTID consistenty, GTID events was artificialy added before
      replication happned. This event should not contain CHECKSUM calculated.
      Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
      97f237e6
    • Vladislav Vaintroub's avatar
      MDEV-28178 Windows : sporadic ER_ERROR_ON_RENAME .. (errno: 13 "Permission denied") · 739002ee
      Vladislav Vaintroub authored
      On affected machine, the error happens sporadically in
      innodb.instant_alter_limit.
      
      Procmon shows SetRenameInformationFile failing with ERROR_ACCESS_DENIED.
      In this case, the destination file was previously opened rsp oplocked by
      Windows defender antivirus.
      
      The fix is to retry MoveFileEx on ERROR_ACCESS_DENIED.
      739002ee
    • Marko Mäkelä's avatar
      MDEV-27931: buf_page_is_corrupted() wrongly claims corruption · 303448bc
      Marko Mäkelä authored
      In commit 437da7bc (MDEV-19534),
      the default value of the global variable srv_checksum_algorithm
      in innochecksum was changed from SRV_CHECKSUM_ALGORITHM_INNODB
      to implied 0 (innodb_checksum_algorithm=crc32). As a result,
      the function buf_page_is_corrupted() would by default invoke
      buf_calc_page_crc32() in innochecksum, and crc32_inited would hold.
      
      This would cause "innochecksum" to fail on a particular page.
      
      The actual problem is older, introduced in 2011 in
      mysql/mysql-server@17e497bdb793bc6b8360aa1c626dcd8bb5cfad1b
      (MySQL 5.6.3). It should affect the validation of pages of old
      data files that were written with innodb_checksum_algorithm=innodb.
      When using innodb_checksum_algorithm=crc32 (the default setting
      since MariaDB Server 10.2), some valid pages would be rejected
      only because exactly one of the two checksum fields accidentally
      matches the innodb_checksum_algorithm=crc32 value.
      
      buf_page_is_corrupted(): Simplify the logic of non-strict
      checksum validation, by always invoking buf_calc_page_crc32().
      Remove a bogus condition that if only one of the checksum fields
      contains the value returned by buf_calc_page_crc32(), the page
      is corrupted.
      303448bc
    • Marko Mäkelä's avatar
      MDEV-28181 The innochecksum -w option was inadvertently removed · b2fa874e
      Marko Mäkelä authored
      In commit 7a4fbb55 (MDEV-25105)
      the innochecksum option --write (-w) was removed altogether.
      It should have been made a Boolean option, so that old data files
      may be converted to a format that is compatible with
      innodb_checksum_algorithm=strict_crc32 by executing the following:
      
      innochecksum -n -w ibdata* */*.ibd
      
      It would be better to use an older-version innochecksum
      for such a conversion, so that page checksums will be validated
      before updating the checksum.
      
      It never was possible for innochecksum to convert files to the
      innodb_checksum_algorithm=full_crc32 format that is the default
      for new InnoDB data files.
      b2fa874e
    • Marko Mäkelä's avatar
      MDEV-27234: Data dictionary recovery was not READ COMMITTED · 8f8ba758
      Marko Mäkelä authored
      This also fixes MDEV-20198: Instant ALTER TABLE is not crash safe
      
      InnoDB dictionary recovery wrongly used the READ UNCOMMITTED isolation
      level, causing some mismatch. For example, if a table was renamed or
      replaced in a transaction, according to READ UNCOMMITTED the table might
      not exist at all.
      
      We implement READ COMMITTED isolation level for accessing the dictionary
      tables SYS_TABLES, SYS_COLUMNS, SYS_INDEXES, SYS_FIELDS, SYS_VIRTUAL,
      SYS_FOREIGN, SYS_FOREIGN_COLS. For most of these tables, no secondary
      index exists. For the secondary indexes (on SYS_TABLES.ID,
      SYS_FOREIGN.FOR_NAME, SYS_FOREIGN.REF_NAME), we will always look up
      the primary key in the clustered index and check if the record actually
      is a committed version.
      
      dict_check_sys_tables(): Recover tablespaces also from delete-marked
      committed records, so that if a matching .ibd file exists, it will
      be removed by fil_delete_tablespace() when the committed delete-marked
      SYS_INDEXES record of the clustered index is purged
      in row_purge_remove_clust_if_poss_low().
      
      fil_ibd_open(): Change the Boolean parameter "validate" to a ternary
      one, to suppress error messages when the file might not exist.
      It is possible that a .ibd file was deleted and the server shut down
      before the SYS_INDEXES and SYS_TABLES records were purged. Hence, if
      dict_check_sys_tables() finds a committed delete-marked record,
      we must not complain if the tablespace file is not found.
      On Windows, we msut treat ERROR_PATH_NOT_FOUND (directory not found)
      in the same way as ERROR_FILE_NOT_FOUND. This fixes a few failures where
      a previous test successfully executed DROP DATABASE (and deleted all
      files and the directory), but a committed delete-marked SYS_TABLES
      record had not been purged before server restart.
      
      dict_getnext_system_low(): Do not filter out delete-marked records.
      
      dict_startscan_system(), dict_getnext_system(): Do filter out
      delete-marked records, for accessing the INFORMATION_SCHEMA tables.
      
      dict_sys_tables_rec_read(): Return the DB_TRX_ID of the committed
      version of the record. This is needed in dict_load_table_low().
      
      dict_load_foreign_cols(), dict_load_foreign(): Add a parameter for
      the current transaction identifier. In some DDL operations, the
      FOREIGN KEY constraints are being loaded from the data dictionary
      before the DDL transaction has been committed. For SYS_FOREIGN
      and SYS_FOREIGN_COLS, we must implement the special case of
      READ COMMITTED that the changes of the uncommitted current transaction
      are visible.
      
      dict_load_foreign(): Validate the table name. We could find a
      SYS_FOREIGN.ID via a committed delete-marked secondary index record
      that does not match the REF_NAME or FOR_NAME of the secondary index record.
      
      dict_load_index_low(): Optionally take the table as a parameter,
      so that table->def_trx_id can be updated in case of a
      committed delete-marked SYS_INDEXES record corresponding
      to DROP INDEX, but not corresponding to an index stub of ADD INDEX.
      
      dict_load_indexes(): Do not update table->def_trx_id
      in case of delete-marked records.
      
      rec_is_metadata(), rec_offs_make_valid(), rec_get_offsets_func(),
      row_build_low(): Relax some assertions. We may now have
      !index->is_instant() even if a metadata record is present in the index.
      Previously, the recovery of instant ADD/DROP COLUMN assumed
      that READ UNCOMMITTED of the data dictionary will be performed.
      Now, we will have a READ COMMITTED copy of the data dictionary
      cache, and a READ UNCOMMITTED copy of the metadata record.
      
      btr_page_reorganize_low(): Correctly update the FIL_PAGE_TYPE
      when rolling back an instant ADD/DROP COLUMN operation.
      
      row_rec_to_index_entry_impl(): Relax some assertions,
      and disallow accessing "extra" fields. This fixes the recovery
      of a crash during an instant ADD COLUMN after a successful
      instant DROP COLUMN, in the test innodb.instant_alter_crash.
      
      Tested by: Matthias Leich
      8f8ba758
    • Marko Mäkelä's avatar
      2ab94108
    • Marko Mäkelä's avatar
      Fix main.create_or_replace better · a6dbb6b2
      Marko Mäkelä authored
      InnoDB background statistics recalculation may acquire
      a metadata also on the table itself, not only on the tables
      that store the statistics.
      
      Hence, it is better to disable InnoDB persistent statistics altogether.
      This fixes up commit 9b8d9a1d.
      a6dbb6b2
    • Daniel Black's avatar
      deb: merge fix - remove debian/mariadb-plugin-columnstore.* · 2885fb0e
      Daniel Black authored
      Was accidently included in ec62f46a.
      
      The autobake-deb.sh populates these files when needed.
      2885fb0e
    • hongdongjian's avatar
      MDEV-28177: server_audit; Update the offset of dbName on the aarch64 platform. · 7af133cc
      hongdongjian authored
      On the aarch64 platform, MySQL 5.7.33 cannot install this version of the audit
      plugin, but X86_64 can run well。
      7af133cc
    • Otto Kekäläinen's avatar
      Deb: Fix Salsa-CI autopkgtest failure · 9d6d1221
      Otto Kekäläinen authored
      The autopkgtest was failing due to missing *.changes file. This is part
      of source build, so revert autobake-deb.sh back to NOT using -b for
      Gitlab-CI/Salsa-CI runs.
      9d6d1221
  8. 25 Mar, 2022 12 commits
    • Igor Babaev's avatar
      MDEV-27937 Assertion failure when executing prepared statement with ? in IN list · e048289e
      Igor Babaev authored
      This bug affected queries with IN predicates that contain parameter markers
      in the value list. Such queries are executed via prepared statements.
      The problem appeared only if the number of elements in the value list
      was greater than the set value of the system variable
      in_predicate_conversion_threshold.
      
      The patch unconditionally prohibits conversion of an IN predicate to the
      equivalent IN predicand if the value list of the IN predicate contains
      parameters markers.
      
      Approved by Oleksandr Byelkin <sanja@mariadb.com>
      e048289e
    • Sergei Golubchik's avatar
      MDEV-27900 fixes · f92388fa
      Sergei Golubchik authored
      * prevent infinite recursion in beyond-EOF reads (when pread returns 0)
      * reduce code duplication
      
      followup for d7817382 and f4fb6cb3
      f92388fa
    • Rucha Deodhar's avatar
      MDEV-21873: 10.2 to 10.3 upgrade doesn't remove semi-sync reference · 549a71e7
      Rucha Deodhar authored
      from mysql.plugin table
      Fix: Since mysql_upgrade runs commands from mysql_system_tables.fix,
      added sql commands to check for semisync plugins in
      INFORMATION_SCHEMA.PLUGINS and if they aren't there then delete them
      from mysql.plugin.
      549a71e7
    • Alexander Barkov's avatar
      MDEV-19804 sql_mode=ORACLE: call procedure in packages · fbcf0225
      Alexander Barkov authored
      Adding support for the fully qualified package procedure calls:
      
      BEGIN
        CALL db.pkg.proc(args); -- SQL/PSM call style
        db.pkg.proc(args);      -- PL/SQL call style
      END;
      fbcf0225
    • Sachin Kumar's avatar
      MDEV-24667 LOAD DATA INFILE on temporary table not written to slave binlog · 9f4ba624
      Sachin Kumar authored
      Problem: In regular replication, when master binlogged using statement format
      slave might not have written an event to its binary log when the Query
      event aimed at a temporary table.
      Specifically this was observed with LOAD DATA INFILE.
      
      This effect was possible because unlike master slave holds temporary
      tables in its pool and the master side check of existence of a
      temporary table at the format bin-logging decision did not apply.
      
      Solution: replace THD::has_thd_temporary_tables() with
      THD::has_temporary_tables which allows to identify temporary table
      presence on either side.
      
      --
      Reviewed by Andrei Elkin.
      9f4ba624
    • sjaakola's avatar
      MDEV-24845 Oddities around innodb_fatal_semaphore_wait_threshold and global.innodb_disallow_writes · 9b2fa2ae
      sjaakola authored
      This commit adds a mtr test for reproducing a test scenario where despite of
      innodb_disallow_writes blocking, writes to file system can still happen.
      
      The test launches a garbd node, which triggers one of the cluster node to switch to
      SST donor state. In this state, all disk activity should be halted, and e.g.
      innodb_disallow_writes has been set. The test records md5sum aggregate over mariadb
      data directory when the node enters the donor state, and records another md5sum
      when the node leaves the donor state. If there is no IO activity in data directory, these
      hashes should be equal.
      
      For this test, the Donor state processing, has beeen instrumented so that, SST donor thread can be
      stopped when entering the donor state. The test uses this new dbug sync point,
      to control when to record the md5sums.
      
      New SST script was added: wsrep_sst_backup, and garbd uses backup method to lauch the donor
      node to call this script, and to enter in donor state.
      
      The backup script could be later extended as general purpose backup method for the cluster.
      
      This commit fixes also one race condition happening in wsrep_sst_rsync, like this:
      * wsrep_rsync_sst script requests for flush tables,
        and then waits in a loop until mariadbd has created file tables_flushed,
        as confirmation that FLUSH TABLES has completed
      * mariadbd's SST donor thread, wakes for the flush table request and then performs FTWRL,
        and after this it creates the tables_flushed file
      * note that SST script will now continue to startup rsync sending
      * mariadbd's SST donor thread now calls for sst_disallow_writes(),
        so that innodb would setup disk IO blockage, however rsyncing may already be ongoing at this point
      
      This race condition is fixed in this commit, by performing all disk IO blocking before
      creating the tables_flushed file.
      Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
      9b2fa2ae
    • Marko Mäkelä's avatar
      Fix g++-12 -O2 -Wstringop-overflow · e9e6db93
      Marko Mäkelä authored
      buf_pool_t::watch_unset(): Reorder some code so that
      no warning will be emitted in CMAKE_BUILD_TYPE=RelWithDebInfo.
      It is unclear why invoking watch_is_sentinel() before accessing
      the block descriptor state would make the warning disappear.
      e9e6db93
    • Alexander Barkov's avatar
      MDEV-28166 sql_mode=ORACLE: fully qualified package function calls do not work: db.pkg.func() · 6437b304
      Alexander Barkov authored
      Also fixes MDEV-19328 sql_mode=ORACLE: Package function in VIEW
      6437b304
    • Vlad Lesin's avatar
      MDEV-27557 InnoDB unnecessarily commits mtr during secondary index search to... · dcb2968f
      Vlad Lesin authored
      MDEV-27557 InnoDB unnecessarily commits mtr during secondary index search to preserve clustered index latching order
      
      New function to release latches till savepoint was added in mtr_t. As
      there is no longer need to limit MDEV-20605 fix usage for locking reads
      only, the limitation is removed.
      dcb2968f
    • Tuukka Pasanen's avatar
      MDEV-27965: MariaDB needs at least libfmt version 7.0 · 13b97880
      Tuukka Pasanen authored
      Add requirement in Debian control file for libfmt 7.0
      which is needed for building MariaDB.
      
      This supports the SFORMAT function added in MDEV-25015.
      
      + autobake-deb.sh so old Debian/Ubuntu still
      bundle the libfmt pulled in from upstream.
      
      Closes #2062
      13b97880
    • Daniel Black's avatar
      Merge 10.6 into 10.7 · 8b92e346
      Daniel Black authored
      8b92e346
    • Daniel Black's avatar
      Deb: enable pmem on riscv64 · 63f76d3b
      Daniel Black authored
      63f76d3b