Console View
|
Categories: connectors experimental galera main |
|
| connectors | experimental | galera | main | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42236 rpl.rpl_change_master_long_channel_name fails on Windows (too long path) rpl.rpl_change_master_long_channel_name fails on Windows because it expects a 252-character name (base name, excluding the path) to be valid; on Windows the whole path is limited to 260 characters, so a 252-character name makes it too long. The patch disables the test for Windows. Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42238 rpl.rpl_row_mysqlbinlog fails on Windows (charset problem) rpl.rpl_row_mysqlbinlog fails because apparently the client command line on Windows cannot interpret the literal cp932 string which is passed to it. Since the point of the test is not how the original INSERT happens, but how it further works while replaying the binlog, it should be acceptable to insert a hex-encoded value Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Oleg Smirnov
olernov@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-24684 Quadratic time for MIN/MAX/STD/VARIANCE as window functions Rename variables and add comments for better readability |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Oleg Smirnov
olernov@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Remove an unused addition to InnoDB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42228 MTR tests fail with "File already exist" for .expect files on Windows On Windows mtr workers are threads of one process, so a handle opened while reading the .expect file could be inherited by a server spawned at the same time by another worker. That kept the file from being deleted for the lifetime of that server, and the next --write_file of the .expect file failed with "File already exist". Read the .expect file under the spawn lock. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Vladislav Vaintroub |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42200 main.mysqlbinlog_stmt_compressed depends on previous tests The test ran mysqlbinlog on the current binlog file from the start, and if that file still held the previous test's events, it would cause a mismatch. Additionally, thread_id value depended on the chain of tests. The part for thread_id is taken from 11.8, to preserve consistency. Assisted-by: Claude:claude-sonnet-5-5 Reviewed-by: Kristian Nielsen |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Merge remote-tracking branch 'origin/bb-10.11-elenst' into bb-11.4-elenst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42228 MTR tests fail with "File already exist" for .expect files on Windows On Windows mtr workers are threads of one process, so a handle opened while reading the .expect file could be inherited by a server spawned at the same time by another worker. That kept the file from being deleted for the lifetime of that server, and the next --write_file of the .expect file failed with "File already exist". Read the .expect file under the spawn lock. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Vladislav Vaintroub |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Alexey Botchkov
holyfoot@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42390 XMLISVALID: stack overflow in XMLSchema_all::check_type / XMLSchema_sequence::validate_tag_name with deeply nested xs:sequence. The depth of nesting in XML Schema limited to 2048. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42202 perfschema.relaylog fails when run after other replication tests The test checks file I/O instrumentation accumulated since server startup, so it relied on getting freshly started servers. With duplicate options removed, mtr may now reuse servers left by a previous replication test, and the test sees binary/relay log files and statistics from it. Restart both servers at the beginning of the test, removing binary and relay logs while the servers are down. RESET MASTER and RESET SLAVE are not sufficient, as performance schema keeps instances of files deleted by them, and a restart opens a new binary log anyway. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Merge remote-tracking branch 'origin/bb-10.11-elenst' into bb-11.4-elenst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Andrei Elkin
andrei.elkin@pp.inet.fi |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42515: Parallel slave deadlocks with BACKUP STAGE BLOCK_COMMIT This is a poc commit to the described problem. The designed solution to resolve the deadlock is limited to 2pc transactions; find 'Not addressed here' for further details including how to generalize the poc into the full solution. On a parallel slave BACKUP STAGE BLOCK_COMMIT can deadlock with the slave workers. The cause is the same as in MDEV-36025: a worker releases MDL_BACKUP_COMMIT (L) while it waits for a prior commit, after its engine prepare, and re-acquires it later. In MDEV-36025 a backup granted inside that window captures prepared transactions. Here a backup request arriving inside it deadlocks three threads. Let B be the backup session, T1 the group commit leader and T2 one follower, T1 preceding T2 in the binlog order: B --> T2 B requests MDL_BACKUP_WAIT_COMMIT; it conflicts with the granted L of T2 T2 --> T1 T2 waits in wait_for_wakeup_ready() for the leader T1 --> B T1 re-acquires L at the end of queue_for_group_commit(); the request queues behind the pending request of B The middle edge is a condition variable wait, so the MDL deadlock detector does not see the cycle. Replication stalls and STOP SLAVE does not complete until the BACKUP STAGE session is killed. Fix: a parallel slave worker whose transaction is binlogged and commits in two phases no longer holds L while it waits for anything. In ha_commit_trans() it only publishes the request, as thd->backup_commit_lock with no ticket. The binlog group commit leader acquires L for the whole group, after the engine prepare and before it takes LOCK_log, in the new MYSQL_BIN_LOG::trx_group_commit_backup_lock(), called first in trx_group_commit_leader(). The leader's own ha_commit_trans() releases it as it does for any other thread. B waits only for holders of L and no member of a group of workers holds it while parked, so the cycle is gone. The exclusion BLOCK_COMMIT provides is kept for a transaction with at least one two-phase engine branch: L granted for its commit time and the backup lock each other out. The backup image therefore either has the transaction in or has not, which is consistent with the gtid-binlog state of the server and thereby with its binlog state. Only the holder changes: the leader holds L for the whole group, from before the binlogging through the commit. Note non-slave or non-binlogging transactions continue taking L safely where they did before the engine prepare: user threads, a slave without binlog or with --log-slave-updates=0, filtered events. If the leader cannot get L (killed, lock wait timeout), nothing has been binlogged. The leader fails the whole group with its own error and wakes the members, and each rolls back in its own thread. In optimistic mode the group is retried; with no retries left the slave stops with the error. write_transaction_to_binlog_events() reports the leader's error for the default case and does not log "Error writing transaction to binary log" when the worker retries. Consequences: * BLOCK_COMMIT no longer excludes slave transactions that are prepared in the engine and not yet binlogged, so a backup can contain them prepared. Restore has to roll them back (--tc-heuristic-recover=AUTO). * L is held through the leader's commit, not through the commit the other members do in their own threads after they are woken. Not addressed here ================== * One-phase and XA slave transactions keep taking L before their commit, prepare/completion respectively. A one-phase worker holds it across the prior-commit wait in ha_commit_one_phase(). Note some tests may fail 'cos of this. * Generalization into the full solution. Phase 2 drops the two-phase condition in ha_commit_trans(), so one-phase and two-phase transactions can form one slave group. Note a one-phase worker can only lead such a group, as ha_commit_one_phase() makes it wait for all prior commits before it is queued. Phase 3 does the same for XA PREPARE, XA COMMIT and XA ROLLBACK, for whom the BASE takes L in xa.cc, each checked for the property that makes it a binlogged transaction. Later the optional L acquisition may move down to commit_one_phase_2(), before run_binlog_first(), and be done only for transactions involving hton::prepare()-able storage engine. * The release and re-acquire of L in queue_for_group_commit() and wait_for_prior_commit2() is left for a follow-up, as is the THD::backup_commit_lock related cleanup. Tests: rpl.parallel_backup_leader_hold (the deadlock, with a debug hook that holds the leader) and rpl.parallel_backup_leader_kill (the leader killed while it waits for L). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42200 main.mysqlbinlog_stmt_compressed depends on previous tests The test ran mysqlbinlog on the current binlog file from the start, and if that file still held the previous test's events, it would cause a mismatch. Additionally, thread_id value depended on the chain of tests. Assisted-by: Claude:claude-sonnet-5-5 Reviewed-by: Kristian Nielsen |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42237 rpl.rpl_read_old_relay_log_info fails on Windows (Linux-style path) rpl.rpl_read_old_relay_log_info fails because the test overrides relay-log.info with the Linux-style ./slave-relay-bin.000001, while Windows uses the format with backslashes, .\slave-relay-bin.000001. The patch modifies the file contents using a perl block, which keeps the relay log name intact and only replaces the position. Thus the name remains valid for whatever system the test is run on. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Kristian Nielsen
knielsen@knielsen-hq.org |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41658 fix Galera node crash when a parallel slave worker is bf_killed A parallel-replication worker would assert in ha_rollback_trans() because wsrep_after_statement() and ha_commit_trans()'s wsrep error path could roll back its transaction before retry_event_group() unmarks it as committing. Skip mark_start_commit() when using Galera. Galera certification can cause rollback of parallel replication transactions during commit when there is a conflicting transaction outside of replication. This can cause to start the next GCO too early, while the previous GCO still needs to rollback and retry. Do not fail replication with an error when wsrep_after_statement() fails due to a retryable error like brute-force kill. Signed-off-by: Kristian Nielsen <[email protected]> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42198 Options from MTR opt files are added multiple times Options from .opt files of included files were appended every time the file was sourced, so they got repeated once per include path. It caused unnecessary server restarts, and too long server command lines lead to startup failures on Windows. Now each file caches only its own .opt options plus an ordered list of the files (itself and everything it sources) whose options apply, each file listed once. The test's options are assembled from that list. Options of included files still precede those of the including file. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Alice Sherepa |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Andrzej Jarzabek
andrzej.jarzabek@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-31956: Create the extended buffer pool file as a temporary file The extended buffer pool (EBP) file was created with OS_FILE_OPEN_OR_CREATE as ext_buffer_pool in innodb_extended_buffer_pool_path or the data directory, locked, and deleted in fil_system_t::close(). If the server was killed, the file was left behind. It is now created with create_temp_file() and MY_TEMPORARY, so that the operating system removes it when the server closes it or exits, and no stale file is left behind after a crash. innodb_extended_buffer_pool_path is now the directory in which the file is created; the data directory is used if it is not set. For this purpose the body of row_merge_file_create_mode() was generalized into pfs_create_temp_file() in fil0fil.cc, which creates the file and registers it with Performance Schema, so that both the merge sort files and the EBP file are created by the same function. The merge sort files keep being created with O_BINARY | O_SEQUENTIAL, as before. OS_FILE_OPEN_OR_CREATE is removed, because it is no longer used. MTR test innodb.ext_buf_pool no longer lists the EBP file, because the file has no fixed name and is unlinked at creation on POSIX systems. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42202 perfschema.relaylog fails when run after other replication tests The test checks file I/O instrumentation accumulated since server startup, so it relied on getting freshly started servers. With duplicate options removed, mtr may now reuse servers left by a previous replication test, and the test sees binary/relay log files and statistics from it. Restart both servers at the beginning of the test, removing binary and relay logs while the servers are down. RESET MASTER and RESET SLAVE are not sufficient, as performance schema keeps instances of files deleted by them, and a restart opens a new binary log anyway. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42200 main.mysqlbinlog_stmt_compressed depends on previous tests The test ran mysqlbinlog on the current binlog file from the start, and if that file still held the previous test's events, it would cause a mismatch. Additionally, thread_id value depended on the chain of tests. Assisted-by: Claude:claude-sonnet-5-5 Reviewed-by: Kristian Nielsen |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Merge remote-tracking branch 'origin/bb-10.11-elenst' into bb-11.4-elenst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Merge remote-tracking branch 'origin/bb-11.8-elenst' into bb-12.3-elenst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Merge remote-tracking branch 'origin/bb-11.4-elenst' into bb-11.8-elenst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jan Lindström
jan.lindstrom@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41658 follow-up: fix unreachable retry-detection branch rpt_handle_event() read thd->wsrep_trx().state() right after wsrep_after_statement(thd) returned, looking for s_must_abort or s_cert_failed to decide whether to map the wsrep error onto a retryable MariaDB error. wsrep::transaction::after_statement() (wsrep-lib) never returns with the transaction in either of those two states - its own exit assertion only allows s_executing, s_prepared, s_committed, s_aborted or s_must_replay - so the check always took the plain-warning branch and the error mapping never ran. wsrep_after_statement(thd) returning true already means the wsrep side recorded a retryable error (a BF abort or certification failure resolved during the call), and wsrep::transaction::cleanup() has by then cleared the transaction's own bf_aborted()/active()/id_, so there is nothing further to learn from the transaction state afterwards. The mapping is now attempted directly from that signal, falling back to the warning only when there is neither a MariaDB error already set nor a wsrep error left to map. Also notes, where mark_start_commit_unless_wsrep() skips marking a Galera worker's commit as startable early, the throughput trade-off this makes against a non-Galera worker. Assisted-by: Claude:claude-4.6-sonnet |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42237 rpl.rpl_read_old_relay_log_info fails on Windows (Linux-style path) rpl.rpl_read_old_relay_log_info fails because the test overrides relay-log.info with the Linux-style ./slave-relay-bin.000001, while Windows uses the format with backslashes, .\slave-relay-bin.000001. The patch modifies the file contents using a perl block, which keeps the relay log name intact and only replaces the position. Thus the name remains valid for whatever system the test is run on. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
forkfun
alice.sherepa@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-24684 Quadratic time for MIN/MAX/STD/VARIANCE as window functions Frame_scan_cursor cleared and re-scanned the whole frame for every row. For MIN, MAX, STD and VARIANCE keep the result if the frame did not change (whole-partition frames, peers), and add only the new rows if just the bottom moved down. Other functions without remove() (UDF and stored aggregates) are still re-scanned. Argument conversion warnings are no longer repeated when the frame is reused or extended. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Vlad Lesin
vlad_lesin@mail.ru |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-31956 SSD based InnoDB buffer pool extension In one of the practical cloud MariaDB setups, a server node accesses its datadir over the network, but also has a fast local SSD storage for temporary data. The content of such temporary storage is lost when the server container is destroyed. The commit uses this ephemeral fast local storage (SSD) as an extension of the portion of InnoDB buffer pool (DRAM) that caches persistent data pages. This cache is separated from the persistent storage of data files and ib_logfile0 and ignored during backup. The following system variables were introduced: innodb_extended_buffer_pool_size - the size of external buffer pool file, if it equals to 0, external buffer pool will not be used; innodb_extended_buffer_pool_path - the path to external buffer pool file. If innodb_extended_buffer_pool_size is not equal to 0, external buffer pool file will be created on startup. Only clean pages will be flushed to external buffer pool file. There is no need to flush dirty pages, as such pages will become clean after flushing, and then will be evicted when they reach the tail of LRU list. The general idea of this commit is to flush clean pages to external buffer pool file when they are evicted. A page can be evicted either by transaction thread or by background thread of page cleaner. In some cases transaction thread is waiting for page cleaner thread to finish its job. We can't do flushing in external buffer pool file when transaction threads are waithing for eviction, that would heart performance. That's why the only case for flushing is when page cleaner thread evicts pages in background and there are no waiters. For this purprose buf_pool_t::done_flush_list_waiters_count variable was introduced, we flush evicted clean pages only if the variable is zeroed. Clean pages are evicted in buf_flush_LRU_list_batch() to keep some amount of pages in buffer pool's free list. That's why we flush every second page to external buffer pool file, otherwise there could be not enought amount of pages in free list to let transaction threads to allocate buffer pool pages without page cleaner waiting. This might be not a good solution, but this is enought for prototyping. External buffer pool page is introduced to store information in buffer pool page hash about the certain page can be read from external buffer pool file. The first several members of such page must be the same as the members of internal page. External page frame must be equal to the certain value to disthinguish external page from internal one. External buffer pages are preallocated on startup in external pages array. We could get rid of the frame in external page, and check if the page's address belongs to the array to distinguish external and internal pages. There are also external pages free and LRU lists. When some internal page is decided to be flushed in external buffer pool file, a new external page is allocated eighter from the head of external free list, or from the tail of external LRU list. Both lists are protected with buf_pool.mutex. It makes sense, because a page is removed from internal LRU list during eviction under buf_pool.mutex. Then internal page is locked and the allocated external page is attached to io request for external buffer pool file, and when write request is completed, the internal page is replaced with external one in page hash, external page is pushed to the head of external LRU list and internal page is unlocked. After internal page was removed from external free list, it was not placed in external LRU, and placed there only after write completion, so the page can't be used by the other threads until write is completed. Page hash chain get element function has additional template parameter, which notifies the function if external pages must be ignored or not. We don't ignore external pages in page hash in two cases, when some page is initialized for read and when one is reinitialized for new page creating. When an internal page is initialized for read and external page with the same page id is found in page hash, the internal page is locked, the external page in replaced with newly initialized internal page in the page hash chain, the external page is removed from external LRU list and attached to io request to external buffer pool file. When the io request is completed, external page is returned to external free list, internal page is unlocked. So during read external page absents in both external LRU and free lists and can't be reused. When an internal page is initialized for new page creating and external pages with the same page id is found in page hash, we just remove external page from the page hash chain and external LRU list and push it to the head of external free list. So the external page can be used for future flushing. The pages are flushed to and read from external buffer pool file with the same manner as they are flushed to their spaces, i.e. compressed and encrypted pages stay compressed and encrypted in external buffer pool file. Reviewed by: Marko Mäkelä |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42198 Options from MTR opt files are added multiple times Options from .opt files of included files were appended every time the file was sourced, so they got repeated once per include path. It caused unnecessary server restarts, and too long server command lines lead to startup failures on Windows. Now each file caches only its own .opt options plus an ordered list of the files (itself and everything it sources) whose options apply, each file listed once. The test's options are assembled from that list. Options of included files still precede those of the including file. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Alice Sherepa |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42236 rpl.rpl_change_master_long_channel_name fails on Windows (too long path) rpl.rpl_change_master_long_channel_name fails on Windows because it expects a 252-character name (base name, excluding the path) to be valid; on Windows the whole path is limited to 260 characters, so a 252-character name makes it too long. The patch disables the test for Windows. Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Oleg Smirnov
olernov@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-40439 Evaluate cheap subconditions before expensive ones in WHERE and ON conditions The arguments of AND and OR are evaluated left to right with short-circuiting, in the order written in the query. An expensive subcondition written first is therefore evaluated even for rows that a cheap one would reject (AND) or accept (OR). Reorder the arguments of each AND/OR so that the expensive ones come after the cheap ones, keeping the relative order within each group. The walk goes down into nested AND/OR and into trigger conditions. A subcondition is expensive if it contains a subquery, a stored function call, or an item that marks itself as expensive through is_expensive_processor() (a UDF, MATCH()). An AND/OR that has a non-deterministic argument (one with RAND_TABLE_BIT) keeps its order, to prevent unwanted change of behavior. Nested lists are still reordered. The reordering is applied to: - the conditions attached to tables (select_cond, select->cond, on_precond), at the end of make_join_select() and before the attached_conditions_summary trace, so the trace shows the final order; - BNL/BNLH scan filters, in make_scan_filter(). They are built from the original WHERE/ON, and check_join_cache_usage() may build them after make_join_select(); - outer_ref_cond and pseudo_bits_cond, the conditions a subquery checks once per execution before running its join. The steps that later build new conditions from these (index condition pushdown, removal of duplicate BNL conditions) take subsets and keep the order. The fix is OFF by default and enabled by setting REORDER_EXPENSIVE_CONDS flag in @@new_mode. Not covered yet: HAVING, exec_const_cond, terms added after make_join_select() (the index condition remainder rejected by an engine, HAVING moved to a table's condition). Reordering HAVING would need care with Item_is_not_null_test and Item_ref_null_helper, which record NULLs for IN->EXISTS. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jan Lindström
jan.lindstrom@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-41658 follow-up: map all wsrep errors, fix after_statement ordering rpt_handle_event() now calls wsrep_after_statement() unconditionally, so the provider handle and commit-order slot are released even when apply_event_and_update_pos_for_parallel() already failed. Its own failure maps through wsrep_override_error()/wsrep_current_error(), covering every wsrep::client_error code instead of only e_deadlock_error and e_interrupted_error, so has_temporary_error() can recognise any resulting retryable error. Log severity for the genuinely unexpected failure case reverts to WSREP_WARN. The duplicated mark_start_commit() guard in retry_event_group() and handle_rpl_parallel_thread() is factored into one mark_start_commit_unless_wsrep() helper. galera_parallel_slave_rollback.cnf drops the redundant binlog-format=row, already set by the included galera_2nodes_as_slave.cnf. Assisted-by: Claude:claude-4.6-sonnet |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Andrzej Jarzabek
andrzej.jarzabek@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-31956: Fix extended buffer pool crashes, leaks and test flakiness Fix several problems in the extended buffer pool (EBP) that showed up on buildbot: - When an EBP write completed after its tablespace was dropped, IORequest::write_complete() passed the written copy to buf_LRU_free_page(), which registers it in buf_pool.page_hash under the page id of the dropped tablespace, and leaked it if the page could not be evicted. The new buf_page_ext_write_discard() releases the write-fix and U-latch, returns the EBP page to the free list and tries to evict the page. - buf_page_write_complete() leaked the EBP page slot when the write failed, and when the page could not be evicted after a successful write (so the copy was never registered in buf_pool.page_hash). Both cases now return the slot to the free list. free_ext_page() resets the debug in_page_hash flag, because such slots are freed without having been inserted into page_hash. - On Windows the EBP file was opened through mysys create_temp_file(), without FILE_FLAG_OVERLAPPED and without being bound to srv_thread_pool, so the first asynchronous EBP write crashed in StartThreadpoolIo(). create_ext_file() now creates the file with CreateFile(FILE_FLAG_OVERLAPPED | FILE_FLAG_DELETE_ON_CLOSE) and binds it. The new close_ext_file() closes the file the right way on each platform and is also used when setting the file size fails. - buf_flush_LRU_list_batch() counted a page in n->evicted without having evicted it when the write to the EBP could not be started. It invoked buf_LRU_free_page() while the page was still U-latched, so can_relocate() was false and the call silently did nothing, leaving the page in the buffer pool. Release the U-latch before the call, like the path that handles a tablespace that is stopping writes. - The debug variable innodb_force_LRU_eviction returned before the forced eviction had finished: it waited for two done_flush_list signals, which other flushing can also send, and did not wait for the asynchronous writes. It now waits until two page cleaner LRU batches (counted by the new debug-only buf_pool.n_LRU_batches) have completed with the flag set, and then for all pending writes. This fixes the wrong counts seen in innodb.ext_buf_pool and innodb.ext_buf_pool_admission_pct. That wait could never end when no page cleaner is running, because only buf_flush_page_cleaner() increments n_LRU_batches and srv_start() only starts it when !srv_read_only_mode, which innodb_force_recovery=6 implies as well. The update function now does nothing in read only mode, and stops waiting if the page cleaner is no longer running; the page cleaner clears buf_page_cleaner_is_active and broadcasts done_flush_list while holding buf_pool.flush_list_mutex, so the transition cannot be missed. The wait also no longer holds LOCK_global_system_variables, like the other InnoDB update functions that wait, so that it cannot keep other connections from being established. - The debug flag ib_ext_bp_disable_LRU_eviction_for_t never skipped anything, because its continue statement applied to the do ... while (0) of DBUG_EXECUTE_IF() and not to the page loop. Set a variable inside the DBUG_EXECUTE_IF() and act on it after the macro, so that the pages of test/t are really left alone while innodb.ext_buf_pool and innodb.ext_buf_pool_admission_pct are still filling the table. Without this, those pages can be admitted to the EBP and evicted while the tests are inserting, and the exact counts that the tests expect after the forced eviction depend on how the page cleaner happened to be scheduled. - The debug flag ib_ext_bp_count_io_only_for_t offered more pages to the admission selector than it counted. It let a page through when fil_space_t::get() failed, while buf_page_write_complete() counts only the pages of the current test/t. The pages of the test/t that an earlier part of the test dropped can still be resident after their fil_space_t is gone, so a run of innodb.ext_buf_pool_admission_pct could put more than its 10 pages before the selector. Those extra pages consumed admissions without being counted, and because the selector's accumulator only returns to its previous value when the number of candidates times the percentage is a multiple of 100, the error also carried over into the following runs. Offer exactly the pages that are counted. Run innodb.ext_buf_pool and innodb.ext_buf_pool_admission_pct with innodb_stats_persistent=0. The inserts make the background statistics thread recalculate the statistics of test/t asynchronously. When it samples the index after the forced eviction, it reads the pages back from the EBP, and when it does so while the forced batch is running, it changes how many pages that batch admits. This made the tests randomly fail on Windows with too many reads, and with 8 or 10 instead of 9 pages flushed. Add a case to innodb.ext_buf_pool for the n->evicted fix. The new debug flag ib_ext_bp_alloc_fail makes every EBP page allocation fail, so that buf_page_t::flush(space, true) returns false with the page still U-latched. Also name the buf_page_t::space_type enumerators in buf_page_write_complete() instead of casting (oldest_modification() == 2) to the enumeration, which needed static_assert()s on the values of TEMPORARY and PERSISTENT. Also re-record sys_vars.sysvars_innodb,32bit for innodb_extended_buffer_pool_size. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42238 rpl.rpl_row_mysqlbinlog fails on Windows (charset problem) rpl.rpl_row_mysqlbinlog fails because apparently the client command line on Windows cannot interpret the literal cp932 string which is passed to it. Since the point of the test is not how the original INSERT happens, but how it further works while replaying the binlog, it should be acceptable to insert a hex-encoded value Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Andrzej Jarzabek
andrzej.jarzabek@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-31956: Validate innodb_extended_buffer_pool_size, disable on errors innodb_extended_buffer_pool_size stays dynamic, but it is now validated: - If the server was started without the extended buffer pool (EBP), the value cannot be changed. - Otherwise, it can only be set to 0, which stops using the EBP, or to its startup size, which resumes using it. As at startup, a value is rounded down to a multiple of innodb_page_size, so any value that rounds down to the startup size is accepted, with a truncation warning if it was rounded. - buf_pool.extended_pages, the size of the EBP page array, no longer changes; setting 0 used to set it to 0 and break the bounds assertions on the EBP pages that were still in use. - ext_bp_size is now only the storage of the system variable, instead of a union of an atomic and a non-atomic member. fil_system_t::ext_buf_pool_enabled() reads the new atomic flag ext_bp_active instead, because it is also called without holding buf_pool.mutex. srv_start() uses fil_system_t::ext_bp_set_size() to keep the EBP unused until the startup is complete. An I/O error, a page that fails validation (checksum, page id, decryption) or a read past the end of the EBP file now disables the EBP for good with buf_pool_t::ext_disable(), instead of setting innodb_extended_buffer_pool_size to 0 with fil_system_t::ext_buf_pool_disable(), which SET GLOBAL could undo. It discards every EBP page from buf_pool.page_hash, so that nothing more is read from the file, and SET GLOBAL innodb_extended_buffer_pool_size can no longer enable it. This also happens if the size was set to 0 when the error occurs. Reads that fail fall back to reading the page from the data file, instead of flagging the data file as corrupted. If that read fails too, the page is reported to recovery with recv_sys_t::free_corrupted_page(), as for other failed page reads. A failed EBP write is completed by buf_page_ext_write_discard(), which now also evicts the page. This includes a write that cannot be submitted, which buf_page_t::flush() used to ignore, leaving the page write-fixed and latched for good. An asynchronous EBP read that returns fewer bytes than requested, as at the end of the file, is now treated as an I/O error instead of a successful read. os_file_io() named the data file of an EBP request with IORequest::node(), which is invalid for EBP requests; it and os_file_read_func() now use os_io_file_name(). The messages of buf_page_decrypt_after_read() and buf_page_check_corrupt() name the EBP file for pages read from it. buf_page_write_complete() is split into helper functions, and the error paths of EBP reads and writes are marked as unlikely. The EBP path itself is not, because it is the common one while the EBP is in use. The debug flag ib_ext_bp_count_io_only_for_t is now evaluated by buf_page_ext_count_io() for both the EBP admission in buf_flush_LRU_list_batch() and the EBP read and write counters, so that they always agree. It matches the tablespace name test/t exactly. The EBP status variables are moved to their alphabetical place in innodb_status_variables[]. MTR test innodb.ext_buf_pool no longer hides its queries from the result file. Its test of an I/O error on write completion now uses the debug injection ib_ext_bp_write_error of the new test innodb.ext_buf_pool_io_error, and expects innodb_extended_buffer_pool_size to keep its value. The debug injections ib_ext_bp_read_io_error and ib_ext_bp_write_io_error are replaced by those of innodb.ext_buf_pool_io_error. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42228 MTR tests fail with "File already exist" for .expect files on Windows On Windows mtr workers are threads of one process, so a handle opened while reading the .expect file could be inherited by a server spawned at the same time by another worker. That kept the file from being deleted for the lifetime of that server, and the next --write_file of the .expect file failed with "File already exist". Read the .expect file under the spawn lock. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Vladislav Vaintroub |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Elena Stepanova
elenst@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42202 perfschema.relaylog fails when run after other replication tests The test checks file I/O instrumentation accumulated since server startup, so it relied on getting freshly started servers. With duplicate options removed, mtr may now reuse servers left by a previous replication test, and the test sees binary/relay log files and statistics from it. Restart both servers at the beginning of the test, removing binary and relay logs while the servers are down. RESET MASTER and RESET SLAVE are not sufficient, as performance schema keeps instances of files deleted by them, and a restart opens a new binary log anyway. Assisted-by: Claude:claude-opus-5-5 Reviewed-by: Susil Behera |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Andrzej Jarzabek
andrzej.jarzabek@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-31956: Add innodb_extended_buffer_pool_admission_pct buf_flush_LRU_list_batch() wrote every second eligible evicted clean page to the extended buffer pool. Replace that with a dynamic percentage, innodb_extended_buffer_pool_admission_pct (0..100, default 100), so that the write load on the extended buffer pool device can be tuned. 0 stops new admissions; pages already in the extended buffer pool can still be read. buf_pool_t::ext_bp_admit_next() spreads the admissions evenly with a Bresenham-style accumulator: add the percentage, admit and subtract 100 when the sum reaches 100. It costs one add, compare and subtract per candidate and keeps one integer of state. The accumulator is protected by buf_pool.mutex, which the caller already holds; the variable is updated under the same mutex via innodb_buf_pool_update, like innodb_lru_scan_depth. The debug-only innodb_force_LRU_eviction no longer bypasses the admission decision; it only forces the LRU scan. innodb.ext_buf_pool sets the percentage to 100 to keep its previous behaviour. New tests: innodb.ext_buf_pool_admission_pct checks exact admission counts at 100, 80, 50, 30 and 0 percent over 10 candidate pages, and sys_vars.innodb_extended_buffer_pool_admission_pct_basic covers the variable itself. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Oleg Smirnov
olernov@gmail.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-40439 Evaluate cheap subconditions before expensive ones in WHERE and ON conditions The arguments of AND and OR are evaluated left to right with short-circuiting, in the order written in the query. An expensive subcondition written first is therefore evaluated even for rows that a cheap one would reject (AND) or accept (OR). Reorder the arguments of each AND/OR so that the expensive ones come after the cheap ones, keeping the relative order within each group. The walk goes down into nested AND/OR and into trigger conditions. A subcondition is expensive if it contains a subquery, a stored function call, or an item that marks itself as expensive through is_expensive_processor() (a UDF, MATCH()). An AND/OR that has a non-deterministic argument (one with RAND_TABLE_BIT) keeps its order, to prevent unwanted change of behavior. Nested lists are still reordered. The reordering is applied to: - the conditions attached to tables (select_cond, select->cond, on_precond), at the end of make_join_select() and before the attached_conditions_summary trace, so the trace shows the final order; - BNL/BNLH scan filters, in make_scan_filter(). They are built from the original WHERE/ON, and check_join_cache_usage() may build them after make_join_select(); - outer_ref_cond, the condition a subquery checks once per execution before running its join. The steps that later build new conditions from these (index condition pushdown, removal of duplicate BNL conditions) take subsets and keep the order. The fix is OFF by default and enabled by setting REORDER_EXPENSIVE_CONDS flag in @@new_mode. Not covered yet: HAVING, exec_const_cond, terms added after make_join_select() (the index condition remainder rejected by an engine, HAVING moved to a table's condition). Reordering HAVING would need care with Item_is_not_null_test and Item_ref_null_helper, which record NULLs for IN->EXISTS. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Andrzej Jarzabek
andrzej.jarzabek@mariadb.com |
|
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MDEV-42067: Make EBP page counters atomic and clean up their increments buf_pool_stat_t::n_pages_read_from_ebp and n_pages_written_to_ebp were Atomic_counter<ulint> only in debug builds, and plain ulint fields otherwise. They are incremented without holding buf_pool.mutex, from page cleaner and AIO completion threads, which is a data race and can lose counts. Declare them as Atomic_counter<ulint> in all builds, like n_page_gets. The SHOW_VAR entries keep pointing at the fields, as the layout is the same as that of ulint. buf_read_page_low(): do the debug-only (ib_ext_bp_count_io_only_for_t) counting before space is released, instead of after, because it reads the tablespace name. The set of counted events is unchanged. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||