summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-31240, MDEV-31241: Crashes in subselects in choose_best_splitting after ↵bb-10.4-mdev31240Sergei Petrunia2023-05-113-0/+74
| | | | | | | | upgrade In JOIN_TAB::choose_best_splitting(), take into account that best_param_tables may contain OUTER_REF_TABLE_BIT (and no table in join->positions[] has this bit set).
* Merge branch '10.4' into 10.4.29 releasebb-10.4-releaseOleksandr Byelkin2023-05-1169-448/+1184
|\
| * MDEV-30765 SHOW TABLES not working properly with lower_case_table_names=2bb-10.4-mdev-30765Oleg Smirnov2023-05-114-7/+58
| | | | | | | | | | | | | | | | | | lower_case_table_names=2 means "table names and database names are stored as declared, but they are compared in lowercase". But names of objects in grants are stored in lowercase for any value of lower_case_table_names. This caused an error when checking grants for objects containing uppercase letters since table_hash_search() didn't take into account lower_case_table_names value
| * bump the VERSIONbb-10.4-bumpversionDaniel Bartholomew2023-05-101-1/+1
| |
| * MDEV-31224 Crash with EXPLAIN EXTENDED for multi-table update of system tableIgor Babaev2023-05-094-3/+40
| | | | | | | | | | | | | | | | EXPLAIN EXTENDED should always print the field item used in the left part of an equality expression from the SET clause of an update statement as a reference to table column. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| * MDEV-31181 Crash with EXPLAIN EXTENDED for single-table DELETE using IN ↵Igor Babaev2023-05-084-7/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | predicand This bug affected EXPLAIN EXTENDED command for single-table DELETE that used an IN subquery in its WHERE clause. A crash happened if the optimizer chose to employ index_subquery or unique_subquery access when processing such command. The crash happened when the command tried to print the transformed query. In the current code of 10.4 for single-table DELETE statements the output of any explain command is produced after the join structures of all used subqueries have been destroyed. JOIN::destroy() sets the field tab of the JOIN_TAB structures created for subquery tables to NULL. As a result subselect_indexsubquery_engine::print(), subselect_indexsubquery_engine() cannot use this field to get the alias name of the joined table. This patch suggests to use the field TABLE_LIST::TAB that can be accessed from JOIN_TAB::tab_list to get the alias name of the joined table. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| * Fixed wrong test cases (embedded and ASAN)bb-10.4-montyMonty2023-05-0510-270/+248
| | | | | | | | | | | | | | | | | | | | - main.selectivity failed because one test produced different result with embedded (missing feature). Fixed by moving the failing part to selectivity_notembedded. - Disabled maria.encrypt-no-key for embedded as embedded does not support encryption - Moved test from join_cache to join_cache_notasan that tried to alloc() a buffer bigger than available memory.
| * Added missing test fileMonty2023-05-051-0/+0
| |
| * Cleanup of sql_join_cache code (no logic changes)Monty2023-05-052-81/+84
| | | | | | | | | | | | | | | | | | | | | | - Remove virtual from get_min_join_buffer_size() and get_max_join_buffer_size(). - Avoid some calls to get_min_buffer_size() - Simply cache usage in get_..._join_buffer_size() - Simplify get_max_join_buffer_size() when using optimize_buff_size - Reindented some long comments Reviewer: Sergei Petrunia <sergey@mariadb.com>
| * Fixed calculation of JOIN_CACHE::max_recordsMonty2023-05-053-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code did set max_records to either number_of_rows (partial_join_cardinality) or memory size (join_buffer_space_limit) which did not make sense. Fixed by setting max_records to number of rows that fits into join_buffer_size. Other things: - Initialize buffer cache values in JOIN_CACHE constructors (safety) Reviewer: Sergei Petrunia <sergey@mariadb.com>
| * MDEV-28217 Incorrect Join Execution When Controlling Join Buffer SizeMonty2023-05-045-28/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that join_buffer_size conflicted with join_buffer_space_limit, which caused the query to be run without join buffer. However this caused wrong results as the optimizer assumed that hash+join buffer would ensure that the equi-join condition would be satisfied, and didn't check it itself. Fixed by not using join_buffer_space_limit when optimize_join_buffer_size=off. This matches the documentation at https://mariadb.com/kb/en/block-based-join-algorithms Other things: - Removed not used variable JOIN_TAB::join_buffer_size_limit - Give an error if we cannot allocate a join buffer. This can only happen if the join_buffer variables are wrongly configured or we are running out of memory. In the future, instead of returning an error, we could properly convert the query plan that uses BNL-H join into one that doesn't use join buffering: make sure the equi-join condition is checked where appropriate. Reviewer: Sergei Petrunia <sergey@mariadb.com>
| * MDEV-31174 New class Native_functions_hashAlexander Barkov2023-05-037-51/+99
| |
| * MDEV-30892 test galera.galera_log_bin is not deterministicbb-10.4-MDEV-30892-galerasara2023-05-036-12/+12
| | | | | | | | | | | | | | | | | | galera.galera_log_bin test created the test tables and executed initial DML into node 2 Then connection is switched to node 1, where ALTER TABLE was attempted. But there is no guarantee that the table to alter was yet replicated to node 1. The fix in this commit, creates the test tables in node 1 instead, so it is guaranteed that they are available for the later ALTER Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
| * MDEV-6768 Wrong result with aggregate with join with no result setMonty2023-05-028-107/+405
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a query does implicit grouping and join operation produces an empty result set, a NULL-complemented row combination is generated. However, constant table fields still show non-NULL values. What happens in the is that end_send_group() is called with a const row but without any rows matching the WHERE clause. This last part is shown by 'join->first_record' not being set. This causes item->no_rows_in_result() to be called for all items to reset all sum functions to their initial state. However fields are not set to NULL. The used fix is to produce NULL-complemented records for constant tables as well. Also, reset the constant table's records back in case we're in a subquery which may get re-executed. An alternative fix would have item->no_rows_in_result() also work with Item_field objects. There is some other issues with the code: - join->no_rows_in_result_called is used but never set. - Tables that are used with group functions are not properly marked as maybe_null, which is required if the table rows should be regarded as null-complemented (not existing). - The code that tries to detect if mixed_implicit_grouping should be set didn't take into account all usage of fields and sum functions. - Item_func::restore_to_before_no_rows_in_result() called the wrong function. - join->clear() does not use a table_map argument to clear_tables(), which caused it to ignore constant tables. - unclear_tables() does not correctly restore status to what is was before clear_tables(). Main bug fix was to always use a table_map argument to clear_tables() and always use join->clear() and clear_tables() together with unclear_tables(). Other fixes: - Fixed Item_func::restore_to_before_no_rows_in_result() - Set 'join->no_rows_in_result_called' when no_rows_in_result_set() is called. - Removed not used argument from setup_end_select_func(). - More code comments - Ensure that end_send_group() modifies the same fields as are in the result set. - Changed return_zero_rows() to use pointers instead of references, similar to the rest of the code.
| * Fixed "Trying to lock uninitialized mutex' in parallel replicationMonty2023-05-021-3/+1
| | | | | | | | | | | | The problem was that mutex_init() was called after the worker was put into the domain_hash, which allowed other threads to access it before mutex was initialized.
| * MDEV-28054 Various crashes upon INSERT/UPDATE after changing Aria settingsMonty2023-05-0215-62/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | The cause of the crash was that test was setting aria_sort_buffer_size to MAX_LONG_LONG, which caused an overflow in my_malloc() when trying to allocate the buffer + 8 bytes. Fixed by reducing max size of sort_buffer for Aria and MyISAM Other things: - Added code in maria_repair_parallell() to not allocate a big sort buffer for small files. - Updated size of minumim sort buffer in Aria
| * MDEV-26258 Various crashes/asserts/corruptions when Aria encryption is ↵Monty2023-05-0214-44/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | enabled/used, but the encryption plugin is not loaded The reason for the MDEV reported failures is that the tests are enabling encryption for Aria but not providing any encryption keys. Fixed by checking if encryption keys exists before creating the table. Other things: - maria.encrypt_wrong-key changed as we now get the error on CREATE instead during insert.
* | MDEV-31194: Server crash or assertion failure with join_cache_level=4mariadb-10.4.29Sergei Petrunia2023-05-053-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem, introduced in patch for MDEV-26301: When check_join_cache_usage() decides not to use join buffer, it must adjust the access method accordingly. For BNL-H joins this means switching from pseudo-"ref access"(with index=MAX_KEY) to some other access method. Failing to do this will cause assertions down the line when code that is not aware of BNL-H will try to initialize index use for ref access with index=MAX_KEY. The fix is to follow the regular code path to disable the join buffer for the join_tab ("goto no_join_cache") instead of just returning from check_join_cache_usage().
* | MDEV-31189 Server crash or assertion failure in upon 2nd execution of PS ↵Oleksandr Byelkin2023-05-043-4/+45
| | | | | | | | | | | | | | with views and HAVING Do not try to decide merge/materialize for derived if it was already decided (even if it is a view).
* | MDEV-31057 rocksdb does not compile with gcc-13Sergei Golubchik2023-05-041-0/+5
| | | | | | | | | | | | RocksDB (in a submodule) has to include <cstdint> to use uint64_t but it doesn't. Until the submodule is upgraded, let's replace problematic types with something that's available
* | MDEV-31164 default current_timestamp() not working when used INSERT ON ↵Sergei Golubchik2023-05-043-0/+68
| | | | | | | | | | | | | | | | DUPLICATE KEY in some cases select_insert::store_values() must reset has_value_set bitmap before every row, just like mysql_insert() does. because ON DUPLICATE KEY UPDATE and triggers modify it
* | MDEV-31181 Server crash in subselect_uniquesubquery_engine::print upon ↵Oleksandr Byelkin2023-05-043-0/+43
| | | | | | | | | | | | EXPLAIN EXTENDED DELETE Temporary fix to avoid the server crash.
* | Fix of selectivity test to behave correctly with embedded and view protocols.Oleksandr Byelkin2023-05-047-217/+335
| |
* | MDEV-26301: Split optimization refills: Optimizer Trace coverageSergei Petrunia2023-05-034-13/+245
| | | | | | | | Add Optimizer Trace printouts.
* | MDEV-26301 Split optimization refills temporary table too many timesIgor Babaev2023-05-035-32/+910
| | | | | | | | | | | | | | | | This patch optimizes the number of refills for the lateral derived table to which a materialized derived table subject to split optimization is is converted. This optimized number of refills is now considered as the expected number of refills of the materialized derived table when searching for the best possible splitting of the table.
* | MDEV-29621 part 2 of post-merge fixes in galeraAndrei2023-05-031-1/+1
| | | | | | | | | | (part 1 is in the previous commit) to [ pass ] galera.MDEV-18832, galera.MDEV-27862
* | Protect a new condition (by Andrei)Oleksandr Byelkin2023-05-031-1/+5
| |
* | Merge branch '10.3' into 10.4Oleksandr Byelkin2023-05-021-0/+0
|\ \
| * | New CC 3.1mariadb-10.3.39bb-10.3-release10.3Oleksandr Byelkin2023-05-021-0/+0
| | |
* | | Merge branch '10.4' into bb-10.4-releaseOleksandr Byelkin2023-05-027-6/+72
|\ \ \ | | |/ | |/|
| * | wsrep-lib external submodule updatebb-10.4-MDEV-30838-v2-galeraJulius Goryavsky2023-05-021-0/+0
| | |
| * | MDEV-30838 Assertion `m_thd == _current_thd()'Daniele Sciascia2023-05-024-4/+43
| | | | | | | | | | | | | | | | | | | | | | | | - Update wsrep-lib which contains fix for the assertion - Fix error handling for appending fragment to streaming log, make sure tables are closed after rollback. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
| * | MDEV-30414 sporadic failures with galera var retry autocommitsara2023-05-022-2/+29
| | | | | | | | | | | | | | | | | | changed tast case 2 to be deterministic Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2023-05-0238-268/+624
|\ \ \ | |/ / |/| / | |/
| * MDEV-29621: Replica stopped by locks on sequenceAndrei2023-04-278-13/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using binlog_row_image=FULL with sequence table inserts, a replica can deadlock because it treats full inserts in a sequence as DDL statements by getting an exclusive lock on the sequence table. It has been observed that with parallel replication, this exclusive lock on the sequence table can lead to a deadlock where one transaction has the exclusive lock and is waiting on a prior transaction to commit, whereas this prior transaction is waiting on the MDL lock. This fix for this is on the master side, to raise FL_DDL flag on the GTID of a full binlog_row_image write of a sequence table. This forces the slave to execute the statement serially so a deadlock cannot happen. A test verifies the deadlock also to prove it happen on the OLD (pre-fixes) slave. OLD (buggy master) -replication-> NEW (fixed slave) is provided. As the pre-fixes master's full row-image may represent both SELECT NEXT VALUE and INSERT, the parallel slave pessimistically waits for the prior transaction to have committed before to take on the critical part of the second (like INSERT in the test) event execution. The waiting exploits a parallel slave's retry mechanism which is controlled by `@@global.slave_transaction_retries`. Note that in order to avoid any persistent 'Deadlock found' 2013 error in OLD -> NEW, `slave_transaction_retries` may need to be set to a higher than the default value. START-SLAVE is an effective work-around if this still happens.
| * New CCOleksandr Byelkin2023-04-261-0/+0
| |
| * Merge branch 'merge-zlib' into 10.3bb-10.3-sergSergei Golubchik2023-04-2028-252/+333
| |\
| | * 1.2.13Sergei Golubchik2023-04-2092-968/+674
| | |
* | | MDEV-31153 New methods Schema::make_item_func_* for REPLACE, SUBSTRING, TRIMAlexander Barkov2023-04-297-74/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding virtual methods to class Schema: make_item_func_replace() make_item_func_substr() make_item_func_trim() This is a non-functional preparatory change for MDEV-27744.
* | | Adding "const" qualifiers to a few trivial Lex_input_string methodsAlexander Barkov2023-04-292-23/+23
| | |
* | | MDEV-30221: Move environmental macros to before master-slavebb-10.4-MDEV-30221Angelique2023-04-289-14/+14
| | | | | | | | | | | | The fix was introduced, along with re-ordering to do other macros that check test environment capabilities before master/slave is set up.
* | | MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogrambb-10.4-mdev31067-variant2Sergei Petrunia2023-04-285-53/+234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Variant #2. When Histogram::point_selectivity() sees that the point value of interest falls into one bucket, it tries to guess whether the bucket has many different (unpopular) values or a few popular values. (The number of rows is fixed, as it's a Height-balanced histogram). The basis for this guess is the "width" of the value range the bucket covers. Buckets covering wider value ranges are assumed to contain values with proportionally lower frequencies. This is just a [brave] guesswork. For a very narrow bucket, it may produce an estimate that's larger than total #rows in the bucket or even in the whole table. Remove the guesswork and replace it with basic logic: return either the per-table average selectivity of col=const, or selectivity of one bucket, whichever is lower.
* | | MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default valueSergei Golubchik2023-04-283-1/+14
| | | | | | | | | | | | exclude generated columns from the "has default value" check
* | | MDEV-31113 Server crashes in store_length / ↵bb-10.4-mdev-31113Oleg Smirnov2023-04-283-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Type_handler_string_result::make_sort_key with DISTINCT and group function Fix-up for commit 476b24d084e7e717310155bb986eb086d3c1e1a6 Author: Monty Date: Thu Feb 16 14:19:33 2023 +0200 MDEV-20057 Distinct SUM on CROSS JOIN and grouped returns wrong result which misses initializing of sorder->suffix_length. In this commit the initialization is implemented by passing MY_ZEROFILL flag to the allocation of SORT_FIELD elements
* | | MDEV-31129 build failure with RocksDB, incompatible pointer to integer ↵Sergei Golubchik2023-04-271-1/+1
| | | | | | | | | | | | | | | | | | conversion FreeBSD 13.2
* | | return accidentally removed in 45d4f6b97b4811b1b7783dcd19526be1dbb196dc commentbb-10.4-MDEV-30889Oleksandr Byelkin2023-04-271-0/+6
| | |
* | | MDEV-30889: 3 - Item_in_optimizer leakOleksandr Byelkin2023-04-265-24/+33
| | | | | | | | | | | | Keep Item_in_optimizer cache always (but only once) in statement memory.
* | | MDEV-30889: 2 - Allocation in TABLE_SHARE::init_from_sql_statement_stringOleksandr Byelkin2023-04-261-15/+0
| | | | | | | | | | | | | | | Fix leack in TABLE_SHARE::init_from_sql_statement_string by removing uneeded switching arenas.
* | | MDEV-30889: 1 - Allocation in Item_subselect::mark_as_dependentOleksandr Byelkin2023-04-261-2/+2
| | | | | | | | | | | | | | | | | | Fix leack in Item_subselect::mark_as_dependent (allocation of temporary list in statement memory inctroduced in f4d552104364fe195237f39862d91f657c7a34cb )
* | | MDEV-30218 update test resultSergei Golubchik2023-04-261-1/+1
| | | | | | | | | | | | followup for d1a46c68cd4