summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lockbb-10.6-MDEV-27025-deadlockVlad Lesin2022-01-187-46/+241
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When lock is checked for conflict, ignore other locks on the record if they wait for the requesting transaction. lock_rec_has_to_wait_in_queue() iterates not all locks for the page, but only the locks located before the waiting lock in the queue. So there is some invariant - any lock in the queue can wait only lock which is located before the waiting lock in the queue. In the case when conflicting lock waits for the transaction of requesting lock, we need to place the requesting lock before the waiting lock in the queue to preserve the invariant. That is why we are looking for the first waiting for requesting transation lock and place the new lock just after the last granted requesting transaction lock before the first waiting for requesting transaction lock. Example: trx1 waiting lock, trx1 granted lock, ..., trx2 lock - waiting for trx1 place new lock here -----------------^ There are also implicit locks which are lazily converted to explicit ones, and we need to place the newly created explicit lock to the correct place in a queue. All explicit locks converted from implicit ones are placed just after the last non-waiting lock of the same transaction before the first waiting for the transaction lock. Code review and cleanup was made by Marko Mäkelä.
* Merge 10.5 into 10.6st-10.6-mergeMarko Mäkelä2022-01-1817-293/+205
|\
| * MDEV-27499 Performance regression in log_checkpoint_margin()Marko Mäkelä2022-01-181-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 4c3ad24413f234599eda27f4958dd3ff21df3203 (MDEV-27416) an unnecessarily strict wait condition was introduced in the function buf_flush_wait(). Most callers actually only care that the pages have been flushed, not that a checkpoint has completed. Only in the buf_flush_sync() call for log resizing, we might care about the log checkpoint. But, in fact, srv_prepare_to_delete_redo_log_file() is explicitly disabling checkpoints. So, we can simply remove the unnecessary wait loop. Thanks to Krunal Bauskar for reporting this performance regression that we failed to repeat in our testing.
| * MDEV-26230 mysql_upgrade fails to load type_mysql_json due to insufficient ↵Sergei Golubchik2022-01-171-1/+1
| | | | | | | | | | | | maturity level bump maturity to beta
| * MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table ↵Sergei Golubchik2022-01-174-2/+26
| | | | | | | | | | | | in MariaDB 10.5.9 when OQGraph SE is loaded to the server don't auto-succeed every DROP TABLE
| * MDEV-27461: Buffer pool resize fails to wake up the page cleanerMarko Mäkelä2022-01-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buf_pool_t::realloc(): Invoke page_cleaner_wakeup() if buf_LRU_get_free_only() returns a null pointer. Ever since commit 7b1252c03d7131754d9503560fe507b33ca1f8b4 (MDEV-24278) the page cleaner would remain in untimed sleep, expecting explicit calls to buf_pool_t::page_cleaner_wakeup() when the ratio of dirty pages could change. Failure to wake up the page cleaner will cause all page writes to be initiated by buf_flush_LRU_list_batch(). That might work too, provided that the buffer pool size is at least BUF_LRU_MIN_LEN (256) pages, but it would not advance the log checkpoint.
| * MDEV-27240 fixup: remove dead codebb-10.5-MDEV-27240Nayuta Yanagisawa2022-01-153-25/+3
| |
| * MDEV-27240 fixup: remove #ifdef in macro callNayuta Yanagisawa2022-01-151-2/+21
| | | | | | | | | | Windows builds failed due to the following error: '#': invalid character: possibly the result of a macro expansion
| * MDEV-27240 SIGSEGV in ha_spider::store_lock on LOCK TABLENayuta Yanagisawa2022-01-158-243/+150
| | | | | | | | | | | | | | | | | | The commit e954d9de gave different lifetime to wide_share and partition_handler_share. This introduced the possibility that partition_handler_share could be accessed even after it was freed. We stop sharing partitoiin_handler_share and make it belong to a single wide_handler to fix the problem.
| * Remove FIXME comments that refer to an early MDEV-14425 planMarko Mäkelä2022-01-142-18/+4
| | | | | | | | | | | | | | | | | | | | | | In MDEV-14425, an early plan was to introduce a separate log file for file-level records and checkpoint information. The reasoning was that fil_system.mutex contention would be reduced by not having to maintain fil_system.named_spaces. The mutex contention was actually fixed in MDEV-23855 by making some data fields in fil_space_t and fil_node_t use std::atomic. Using a single circular log file simplifies recovery and backup.
* | MDEV-27469: Assertion failure in defragment due to tx_read_onlyMarko Mäkelä2022-01-171-3/+7
| | | | | | | | | | | | | | | | | | | | | | In commit c5fd9aa562fb15e8d6ededceccbec0c9792a3243 (MDEV-25919) we prevented the function dict_stats_save_index_stat() from being called in read-only mode in dict_stats_save(), but not elsewhere. dict_stats_save_defrag_summary(), dict_stats_save_defrag_stats(): If the transaction is in read-only mode, return DB_READ_ONLY and do not attempt to lock or modify anything.
* | Merge 10.5 into 10.6Marko Mäkelä2022-01-144-7/+56
|\ \ | |/
| * MDEV-27500 buf_page_free() fails to drop the adaptive hash indexMarko Mäkelä2022-01-141-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function buf_page_free() that was introduced in commit a35b4ae89871d8184f04abb112c385481d557dbb (MDEV-15528) failed to remove any adaptive hash index entries for the page before freeing the page. This caused an assertion failure on shutdown of 10.6 server of in the function buf_pool_t::clear_hash_index() with the expression: (s >= buf_page_t::UNFIXED || s == buf_page_t::REMOVE_HASH). The assertion would fail for a block that is in the freed state. The failing assertion was added in commit aaef2e1d8c843d1e40b1ce0c5199c3abb3c5da28 in the 10.6 branch. Thanks to Matthias Leich for finding the bug and testing the fix.
| * MDEV-26824 Can't add foreign key with empty referenced columns listAleksey Midenkov2022-01-123-7/+52
| | | | | | | | | | | | create_table_info_t::create_foreign_keys() expects equal number of iterations through fk->columns and fk->ref_columns. If fk->ref_columns is empty copy it from fk->columns.
* | MDEV-27058 fixup: Bogus assertion !block->page.is_io_fixed()Marko Mäkelä2022-01-131-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | buf_page_get_gen(): After recv_sys_t::recover_low() returned, the page must not be read-fixed, but it may be write-fixed, because the io-fix state is protected by block->page.lock, which we are not holding yet. Also, let us copy the block descriptor state to a local variable for examination, so that in case an assertion would fail again, we will have the sampled state in the core dump. In a core dump of the assertion failure, we had block->page.fix() == buf_page_t::UNFIXED, that is, the assertion expression was holding again.
* | MDEV-27476 heap-use-after-free in buf_pool_t::is_block_field()Marko Mäkelä2022-01-122-3/+3
| | | | | | | | | | | | | | | | | | This follows up commit 017d1b867b12ff36b3b871c3d57719907a905659. In commit aaef2e1d8c843d1e40b1ce0c5199c3abb3c5da28 (MDEV-27058) some more problematic debug assertions were added. btr_search_update_block_hash_info(), trx_purge_truncate_history(): Use simpler assertions to check that an uncompressed page is present.
* | Merge 10.5 into 10.6Marko Mäkelä2022-01-127-7/+81
|\ \ | |/
| * MDEV-27476 heap-use-after-free in buf_pool_t::is_block_field()Marko Mäkelä2022-01-121-2/+1
| | | | | | | | | | | | | | | | mtr_t::modify(): Remove a debug assertion that had been added in commit 05fa4558e0e82302ece981deabce764491464eb2 (MDEV-22110). The function buf_pool_t::is_uncompressed() is only safe to invoke while holding a buf_pool.page_hash latch so that buf_pool_t::resize() cannot concurrently invoke free() on any chunks.
| * MDEV-27022 Buffer pool is being flushed during recoverybb-10.5-MDEV-27022-sort-flush-listEugene Kosov2022-01-111-3/+35
| | | | | | | | | | | | | | | | | | | | | | The problem was introduced by the removal of buf_pool.flush_rbt in commit 46b1f500983d45e89dc84bb9820023bd51a4cda8 (MDEV-23399) recv_sys_t::apply(): don't write to disc and fsync() the last batch. Insead, sort it by oldest_modification for MariaDB server and some mariabackup operations. log_sort_flush_list(): a thread-safe function which sorts buf_pool::flush_list
| * MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' inRucha Deodhar2022-01-104-2/+44
| | | | | | | | | | | | | | | | | | | | | | | | Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK) Analysis: KILL_QUERY is not ignored when local memory used exceeds maximum session memory. Hence the query proceeds, OK is sent and we end up reopening tables that are marked for reopen. During this, kill status is eventually checked and assertion failure happens during trying to send error message because OK has already been sent. Fix: Ok is already sent so statement has already executed. It is too late to give error. So ignore kill.
| * Silence CMake warning from exteral cmake project (pcre2)st-10.5-wladVladislav Vaintroub2022-01-091-0/+1
| | | | | | | | | | | | | | | | The warning reads: CMake Deprecation Warning at CMakeLists.txt:101 (CMAKE_MINIMUM_REQUIRED): Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.
* | MDEV-27640 trx_has_lock_x() gives wrong result if the table has pending ↵bb-10.6-MDEV-27640Thirunarayanan Balathandayuthapani2022-01-101-2/+2
| | | | | | | | | | | | | | table lock trx_has_lock_x() fails to find whether the trx has X-lock on the table when other transactions are waiting for an X or S lock on the table.
* | Cleanup: Remove unused log_cmdq_keyMarko Mäkelä2022-01-102-3/+1
| | | | | | | | | | | | | | There was an intention to add a CommandQueue in mysql/mysql-server@eca5b0fc17a5bd6d4833d35a0d08c8549dd3b5ec but it never appeared in any release (not even MySQL 5.7.3 where that commit appeared).
* | MDEV-26879: Detach innodb_evict_tables_on_commit_debug from SAFE_MUTEXMarko Mäkelä2022-01-092-7/+3
| | | | | | | | | | | | | | | | | | In commit 18535a402817d8a2b8452df0f75c15dda9199acb (MDEV-24811) the implementation of innodb_evict_tables_on_commit_debug depended on dict_sys.mutex and SAFE_MUTEX. That is no longer the case. SAFE_MUTEX is not available on Microsoft Windows.
* | MDEV-27017 Assertion failure 'table->get_ref_count() == 0' on DDL that ↵bb-10.6-MDEV-27017Thirunarayanan Balathandayuthapani2022-01-055-17/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | involves FULLTEXT INDEX purge_sys.stop_FTS() does not wait for purge operation on FTS tables to finish. InnoDB DDL does purge_sys.stop_FTS() and lock all fts tables. It eventually fails due to n_ref_count value. fts_stop_purge(): Stops the purge thread to process new FTS tables, check n_ref_count of all fts index auxiliary, common tables. This should make sure that consecutive fts_lock_tables() is always successful.
* | MDEV-26879 innodb_evict_tables_on_commit_debug=on makes table creation hangMarko Mäkelä2022-01-053-8/+27
| | | | | | | | | | | | | | | | | | | | In commit c5fd9aa562fb15e8d6ededceccbec0c9792a3243 (MDEV-25919) an incorrect change to lock_release() was applied. The setting innodb_evict_tables_on_commit_debug=on should only be applied to normal transactions, not DDL transactions in the likes of CREATE TABLE, nor transactions that are holding dict_sys.latch, such as dict_stats_save().
* | MDEV-27335 Windows, MSI - Bring the datadir location into the instance ↵Vladislav Vaintroub2022-01-053-60/+93
| | | | | | | | config UI
* | Windows installer - fix UI of the "Uninstall" Dialog.Vladislav Vaintroub2022-01-051-4/+4
| | | | | | | | | | Give RemoveDatadirText field extra 10 pixels in height, to avoid truncated display of directory path
* | Update errmsg-utf8.txt (spa) part 2bb-10.6-danielblack-pr1715-updateJesús Marín2022-01-051-198/+199
| | | | | | | | | | | | | | | | | | Further changes to 3e0304884b45d143e4194b3244d6e77a663680fc New changes in translation: * Converted to LATAM countries treatment: tú for vd. This way it serves good for Spain and all LATAM countries. * Minor changes
* | Work around MDEV-27421 ./mtr --ps-protocol main.opt_traceMarko Mäkelä2022-01-041-0/+3
| |
* | Merge 10.5 into 10.6Marko Mäkelä2022-01-04112-569/+1740
|\ \ | |/
| * MDEV-27416 InnoDB hang in buf_flush_wait_flushed(), on log checkpointbb-10.5-MDEV-27416Marko Mäkelä2022-01-0411-139/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | InnoDB could sometimes hang when triggering a log checkpoint. This is due to commit 7b1252c03d7131754d9503560fe507b33ca1f8b4 (MDEV-24278), which introduced an untimed wait to buf_flush_page_cleaner(). The hang was noticed by occasional failures of IMPORT TABLESPACE tests, such as innodb.innodb-wl5522, which would (unnecessarily) invoke log_make_checkpoint() from row_import_cleanup(). The reason of the hang was that buf_flush_page_cleaner() would enter untimed sleep despite buf_flush_sync_lsn being set. The exact failure scenario is unclear, because buf_flush_sync_lsn should actually be protected by buf_pool.flush_list_mutex. We prevent the hang by invoking buf_pool.page_cleaner_set_idle(false) whenever we are setting buf_flush_sync_lsn and signaling buf_pool.do_flush_list. The bulk of these changes was originally developed as a preparation for MDEV-26827, to invoke buf_flush_list() from fewer threads, and tested on 10.6 by Matthias Leich. This fix was tested by running 100 repetitions of 100 concurrent instances of the test innodb.innodb-wl5522 on a RelWithDebInfo build, using ext4fs and innodb_flush_method=O_DIRECT on a SATA SSD with 4096-byte block size. During the test, the call to log_make_checkpoint() in row_import_cleanup() was present. buf_flush_list(): Make static. buf_flush_wait(): Wait for buf_pool.get_oldest_modification() to reach a target, by work done in the buf_flush_page_cleaner. If buf_flush_sync_lsn is going to be set, we will invoke buf_pool.page_cleaner_set_idle(false). buf_flush_ahead(): If buf_flush_sync_lsn or buf_flush_async_lsn is going to be set and the page cleaner woken up, we will invoke buf_pool.page_cleaner_set_idle(false). buf_flush_wait_flushed(): Invoke buf_flush_wait(). buf_flush_sync(): Invoke recv_sys.apply() at the start in case crash recovery is active. Invoke buf_flush_wait(). buf_flush_sync_batch(): A lower-level variant of buf_flush_sync() that is only called by recv_sys_t::apply(). buf_flush_sync_for_checkpoint(): Do not trigger log apply or checkpoint during recovery. buf_dblwr_t::create(): Only initiate a buffer pool flush, not a checkpoint. row_import_cleanup(): Do not unnecessarily invoke log_make_checkpoint(). Invoking buf_flush_list_space() before starting to generate redo log for the imported tablespace should suffice. srv_prepare_to_delete_redo_log_file(): Set recv_sys.recovery_on in order to prevent buf_flush_sync_for_checkpoint() from initiating a checkpoint while the log is inaccessible. Remove a wait loop that is already part of buf_flush_sync(). Do not invoke fil_names_clear() if the log is being upgraded, because the FILE_MODIFY record is specific to the latest format. create_log_file(): Clear recv_sys.recovery_on only after calling log_make_checkpoint(), to prevent buf_flush_page_cleaner from invoking a checkpoint. innodb_shutdown(): Simplify the logic in mariadb-backup --prepare. os_aio_wait_until_no_pending_writes(): Update the function comment. Apart from row_quiesce_table_start() during FLUSH TABLES...FOR EXPORT, this is being called by buf_flush_list_space(), which is invoked by ALTER TABLE...IMPORT TABLESPACE as well as some encryption operations.
| * Deb: Adapt custom build steps to be compatible with latest Salsa-CIOtto Kekäläinen2022-01-031-44/+5
| | | | | | | | | | | | | | | | | | Upstream Salsa-CI refactored the build process in https://salsa.debian.org/salsa-ci-team/pipeline/-/commit/58880fcef5b742cb9c661121a8c8707bf392b3b5 This broke our custom direct invocation of install-build-deps.sh as the Salsa-CI images no longer contain them. Adapt the .build-script equivalent to follow new Salsa-CI method so builds work again.
| * Merge 10.4 into 10.5bb-10.5-markoMarko Mäkelä2022-01-035-1/+57
| |\
| | * Add --valgrind to VERSION() string for valgrind buildsMonty2021-12-281-0/+2
| | | | | | | | | | | | Fixes main.sp-no-valgrind for valgrind builds not done with BUILD scripts
| | * MDEV-27184 Assertion `(old_top == initial_top (av) && old_size == 0) || ↵Nayuta Yanagisawa2021-12-274-1/+55
| | | | | | | | | | | | | | | | | | | | | ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed, Assertion `str.alloced_length() >= str.length() + data_len' failed Spider crashes on a query that inserts some rows including float. This is because Spider allocates a string of insufficient length.
| * | Correct some copyright messagesMarko Mäkelä2022-01-033-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of the Facebook contribution mysql/mysql-server@72d656acdf082d5ead1cc1be84f2fd68ab6a65a9 was removed in commit 5bea43f5e03225327cd04e0c302f613600f06081 (MDEV-12353). Mainly the configuration parameter innodb_compression_level remains. It had been renamed to page_zip_level in mysql/mysql-server@5b38f2a712a7077c994c00787b891a7d4ee328df.
| * | Cleanup: Remove RECV_READ_AHEAD_AREAMarko Mäkelä2022-01-031-9/+4
| | | | | | | | | | | | Let us directly use the constant 32 in recv_read_in_area().
| * | MDEV-27304 SHOW ... result columns are right-alignedSergei Golubchik2021-12-276-4/+25
| | | | | | | | | | | | | | | --version=value was setting sys_var::CONFIG (meaning, the value came from the config file), but the filename was left as NULL.
| * | Merge branch 10.4 into 10.5st-10.5-juliusJulius Goryavsky2021-12-2689-450/+1618
| |\ \ | | |/
| | * Merge branch 10.3 into 10.4Julius Goryavsky2021-12-2546-341/+733
| | |\
| | | * Merge branch 10.2 into 10.3st-10.3-juliusJulius Goryavsky2021-12-246-214/+214
| | | |\
| | | | * MDEV-24097: galera[_3nodes] suite tests in MTR sporadically failsbb-10.2-MDEV-24097-galeraJulius Goryavsky2021-12-2314-285/+292
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first part of the fixes for MDEV-24097. This commit contains the fixes for instability when testing Galera and when restarting nodes quickly: 1) Protection against a "stuck" old SST process during the execution of the new SST (after restarting the node) is now implemented for mariabackup / xtrabackup, which should help to avoid almost all conflicts due to the use of the same ports - both during testing with mtr, so and when restarting nodes quickly in a production environment. 2) Added more protection to scripts against unexpected return of the rc != 0 (in the commands for deleting temporary files, etc). 3) Added protection against unexpected crashes during binlog transfer (in SST scripts for rsync). 4) Spaces and some special characters in binlog filenames shouldn't be a problem now (at the script level). 5) Daemon process termination tracking has been made more robust against crashes due to unexpected termination of the previous SST process while new scripts are running. 6) Reading ssl encryption parameters has been moved from specific SST scripts to a common wsrep_sst_common.sh script, which allows unified error handling, unified diagnostics and simplifies script revisions in the future. 7) Improved diagnostics of errors related to the use of openssl. 8) Corrections have been made for xtrabackup-v2 (both in tests and in the script code) that restore the work of xtrabackup with updated versions of innodb. 9) Fixed some tests for galera_3nodes, although the complete solution for the problem of starting three nodes at the same time on fast machines will be done in a separate commit. No additional tests are required as this commit fixes problems with existing tests.
| | | * | Merge branch 10.2 into 10.3Julius Goryavsky2021-12-2328-126/+385
| | | |\ \ | | | | |/
| | | | * MDEV-23175: my_timer_milliseconds clock_gettime for multiple platfomrsbb-10.2-MDEV-23175-backportDaniel Black2021-12-221-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Small postfix to MDEV-23175 to ensure faster option on FreeBSD and compatibility to Solaris that isn't high resolution. ftime is left as a backup in case an implementation doesn't contain any of these clocks. FreeBSD $ ./unittest/mysys/my_rdtsc-t 1..11 # ----- Routine --------------- # myt.cycles.routine : 5 # myt.nanoseconds.routine : 11 # myt.microseconds.routine : 13 # myt.milliseconds.routine : 11 # myt.ticks.routine : 17 # ----- Frequency ------------- # myt.cycles.frequency : 3610295566 # myt.nanoseconds.frequency : 1000000000 # myt.microseconds.frequency : 1000000 # myt.milliseconds.frequency : 899 # myt.ticks.frequency : 136 # ----- Resolution ------------ # myt.cycles.resolution : 1 # myt.nanoseconds.resolution : 1 # myt.microseconds.resolution : 1 # myt.milliseconds.resolution : 7 # myt.ticks.resolution : 1 # ----- Overhead -------------- # myt.cycles.overhead : 26 # myt.nanoseconds.overhead : 19140 # myt.microseconds.overhead : 19036 # myt.milliseconds.overhead : 578 # myt.ticks.overhead : 21544 ok 1 - my_timer_init() did not crash ok 2 - The cycle timer is strictly increasing ok 3 - The cycle timer is implemented ok 4 - The nanosecond timer is increasing ok 5 - The nanosecond timer is implemented ok 6 - The microsecond timer is increasing ok 7 - The microsecond timer is implemented ok 8 - The millisecond timer is increasing ok 9 - The millisecond timer is implemented ok 10 - The tick timer is increasing ok 11 - The tick timer is implemented
| | | | * MDEV-27181 fixup: compatibility with Windows + small correctionsbb-10.2-MDEV-27181-fixJulius Goryavsky2021-12-176-95/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Removed symlinks that are not very well supported in tar under Windows. 2) Added comment + changed code formatting in viosslfactories.c 3) Fixed a small bug in the yassl code. 4) Fixed a typo in the script code.
| | | | * MDEV-21866: Assertion `!result' failed in convert_const_to_int upon 2nd ↵bb-10.2-MDEV-21866Dmitry Shulga2021-12-163-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | execution of PS Consider the following use case: MariaDB [test]> CREATE TABLE t1 (field1 BIGINT DEFAULT -1); MariaDB [test]> CREATE VIEW v1 AS SELECT DISTINCT field1 FROM t1; Repeated execution of the following query as a Prepared Statement MariaDB [test]> PREPARE stmt FROM 'SELECT * FROM v1 WHERE field1 <=> NULL'; MariaDB [test]> EXECUTE stmt; results in a crash for a server built with DEBUG. MariaDB [test]> EXECUTE stmt; ERROR 2013 (HY000): Lost connection to MySQL server during query Assertion failed: (!result), function convert_const_to_int, file item_cmpfunc.cc, line 476. Abort trap: 6 (core dumped) The crash inside the function convert_const_to_int() happens by the reason that the value -1 is stored in an instance of the class Field_longlong on restoring its original value in the statement result= field->store(orig_field_val, TRUE); that leads to assigning the value 1 to the variable 'result' with subsequent crash in the DBUG_ASSERT statement following it DBUG_ASSERT(!result); The main matter here is why this assertion failure happens on the second execution of the prepared statement and doens't on the first one. On first handling of the statement 'EXECUTE stmt;' a temporary table is created for serving the query involving the view 'v1'. The table is created by the function create_tmp_table() in the following calls trace: (trace #1) JOIN::prepare (at sql_select.cc:725) st_select_lex::handle_derived LEX::handle_list_of_derived TABLE_LIST::handle_derived mysql_handle_single_derived mysql_derived_prepare select_union::create_result_table create_tmp_table Note, that the data member TABLE::status of a TABLE instance returned by the function create_tmp_table() has the value 0. Later the function setup_table_map() is called on the TABLE instance just created for the sake of the temporary table (calls trace #2 is below): JOIN::prepare (at sql_select.cc:737) setup_tables_and_check_access setup_tables setup_table_map where the data member TABLE::status is set to the value STATUS_NO_RECORD. After that when execution of the method JOIN::prepare reaches calling of the function setup_without_group() the following calls trace is invoked JOIN::prepare setup_without_group setup_conds Item_func::fix_fields Item_func_equal::fix_length_and_dec Item_bool_rowready_func2::fix_length_and_dec Item_func::setup_args_and_comparator Item_func::convert_const_compared_to_int_field convert_const_to_int There is the following code snippet in the function convert_const_to_int() at the line item_cmpfunc.cc:448 bool save_field_value= (field_item->const_item() || !(field->table->status & STATUS_NO_RECORD)); Since field->table->status has bits STATUS_NO_RECORD set the variable save_field_value is false and therefore neither the method Field_longlong::val_int() nor the method Field_longlong::store is called on the Field instance that has the numeric value -1. That is the reason why first execution of the Prepared Statement for the query 'SELECT * FROM v1 WHERE field1 <=> NULL' is successful. On second running of the statement 'EXECUTE stmt' a new temporary tables is also created by running the calls trace #1 but the trace #2 is not executed by the reason that data member SELECT_LEX::first_cond_optimization has been set to false on first execution of the prepared statemet (in the method JOIN::optimize_inner()). As a consequence, the data member TABLE::status for a temporary table just created doesn't have the flags STATUS_NO_RECORD set and therefore on re-execution of the prepared statement the methods Field_longlong::val_int() and Field_longlong::store() are called for the field having the value -1 and the DBUG_ASSERT(!result) is fired. To fix the issue the data member TABLE::status has to be assigned the value STATUS_NO_RECORD in every place where the macros empty_record() is called to emptify a record for just instantiated TABLE object created on behalf the new temporary table.
| | | | * MDEV-27270: Wrong query plan with Range Checked for Each Record and ORDER BY ↵bb-10.2-mdev2720Sergei Petrunia2021-12-153-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... LIMIT Followup to fix for MDEV-25858: When test_if_skip_sort_order() decides to use an index to satisfy ORDER BY ... LIMIT clause, it should disable "Range Checked for Each Record" optimization. Do this in all cases.
| | | | * Disable following tests from galera_3nodes suitebb-10.2-janJan Lindström2021-12-151-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * galera_pc_bootstrap * galera_ipv6_mariabackup * galera_ipv6_mariabackup_section * galera_ipv6_rsync * galera_ipv6_rsync_section * galera_ssl_reload * galera_toi_vote * galera_wsrep_schema_init because MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
| | | | * MDEV-27268 Failed InnoDB initialization leaves garbage files behindMarko Mäkelä2021-12-153-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | create_log_files(): Check log_set_capacity() before modifying or creating any log files. innobase_start_or_create_for_mysql(): If create_log_files() fails and we were initializing a new database, delete the system tablespace files before exiting.