summaryrefslogtreecommitdiff
path: root/mysql-test/main
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-23634: Select query hanged the server and leads to OOM ...bb-10.4-mdev23634Sergei Petrunia2021-04-0815-37/+73
| | | | | | | | | | Handle "col<>const" in the same way that MDEV-21958 did for "col NOT IN(const-list)": do not use the condition for range/index_merge accesses if there is a unique UNIQUE KEY(col). The testcase is in main/range.test. The rest of test updates are due to widespread use of 'pk<>1' in the testsuite. Changed the test to use different but equivalent forms of the conditions.
* MDEV-25334 FTWRL/Backup blocks DDL on temporary tables with binlog enabled, ↵Monty2021-04-072-0/+89
| | | | | | | | assertion fails in Diagnostics_area::set_error_status Fixed by adding a MDL_BACKUP_COMMIT lock before altering temporary tables whose creation was logged to binary log (in which case the ALTER TABLE must also be logged)
* Merge 10.3 into 10.4Marko Mäkelä2021-03-314-2/+192
|\
| * Merge 10.2 into 10.3Marko Mäkelä2021-03-314-2/+192
| |
* | Merge 10.3 into 10.4Marko Mäkelä2021-03-276-7/+333
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2021-03-274-7/+82
| |
| * MDEV-25128 Wrong result from join with materialized semi-join andIgor Babaev2021-03-232-0/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | splittable derived If one of joined tables of the processed query is a materialized derived table (or view or CTE) with GROUP BY clause then under some conditions it can be subject to split optimization. With this optimization new equalities are injected into the WHERE condition of the SELECT that specifies this derived table. The injected equalities are generated for all join orders with which the split optimization can employed. After the best join order has been chosen only certain of this equalities are really needed. The others can be safely removed. If it's not done and some of injected equalities involve expressions over semi-joins with look-up access then the query may return a wrong result set. This patch effectively removes equalities injected for split optimization that are needed only at the optimization stage and not needed for execution. Approved by serg@mariadb.com
* | MDEV-25206 Crash with CREATE VIEW .. SELECT with non-existing fieldIgor Babaev2021-03-212-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | in ON condition The fix of the bug MDEV-25002 for 10.4 turned out to be incomplete. It caused crashes when executing CREATE VIEW, CREATE TABLE .. SELECT, INSERT .. SELECT statements if their SELECTs contained references to non-existing fields. This patch complements the fix for MDEV-25002 in order to avoid such crashes. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* | Merge 10.3 into 10.4Marko Mäkelä2021-03-202-2/+66
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2021-03-192-2/+66
| |
* | Merge 10.3 into 10.4Marko Mäkelä2021-03-1917-15/+504
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2021-03-1816-13/+498
| |
* | Merge 10.3 into 10.4Marko Mäkelä2021-03-112-0/+15
|\ \ | |/
| * MDEV-24868 Server crashes in optimize_schema_tables_memory_usage after ↵Nayuta Yanagisawa2021-03-082-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | select from information_schema.innodb_sys_columns optimize_schema_tables_memory_usage() crashed when its argument included TABLE struct that was not fully initialized. To prevent such a crash, we check if a table is an information schema table at the beginning of each iteration. Closes #1768
* | MDEV-20946: Hard FTWRL deadlock under user level locksRinat Ibragimov2021-03-102-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was possibile for a user to create an interlocked state which may go on for a significant period of time. There is a tight loop in the FTWRL code path that tries to repeatedly acquire a read lock. As the weight of FTWRL lock is the smallest among others, it's always selected by the deadlock detector, but can never be killed. Imaging the following sequence: connection_0 connection_1 GET_LOCK("l1", 0); LOCK TABLES t WRITE; FLUSH TABLES WITH READ LOCK; GET_LOCK("l1", 1000); The GET_LOCK statement in connection_1 triggers the deadlock detector, which tries to select the lock in FTWRL, since its weight is 0. However, since a loop in Global_read_lock::lock_global_read_lock() tries to always win, it tries to acquire lock again. Which invokes the deadlock detector, and that cycle continues until GET_LOCK in connection_1 times out. This patch resolves the live-locking by introducing a dynamic bonus to the deadlock weight associated with every lock. Each lock gets a bonus weight each time it's selected by the deadlock detector. In case of a live-lock situation, those locks that cannot be killed, get additional weight each iteration. Eventually their weight becomes so high that the deadlock detector shifts its attention to other lock, until it find the one that can be killed.
* | MDEV-24363 (followup fix) mysql.user view shouldRobert Bindar2021-03-084-8/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | not be dropped if the DEFINER is custom. Revert changes to MDEV-23102 tests as they were designed to catch this corner case. The explanation for this corner case is that users historically used to tweak the mysql.user table and probably still do even though mysql.user is now a view. Thus, if the DEFINER of the view is not default, i.e. root@localhost or mariadb.sys@localhost, we should avoid dropping the view during upgrade process to not discard potential custom changes.
* | MDEV-24975 Server consumes extra 4G memory upon querying ↵Sergei Golubchik2021-03-082-0/+22
| | | | | | | | | | | | | | | | | | | | INFORMATION_SCHEMA.OPTIIMIZER_TRACE if a query used no fields from an I_S table, we were creating a temp table with one, first, field (as a table cannot have zero fields), with its length truncated to 1. Now - force also this dummy field to be a normal field, not a BLOB
* | MDEV-24363 (followup refactor) avoid listing mysql.userRobert Bindar2021-03-084-198/+6
| | | | | | | | | | | | view definition in tests as it wastes lots of time when they fail for minor fixes like adding/changing a new column in the view, also it's less code
* | MDEV-24363 mysql.user password_expired column is incorrectRobert Bindar2021-03-0812-11/+207
| | | | | | | | | | | | | | | | | | The mysql.user view password_expired column should display the right result, in sync with whether an account has its password expired or not For mariadb 10.4+ upgrades before this commit, the mysql.user view needs to be dropped and recreated to actually make the view display the correct value for the password_expired column.
* | Merge 10.3 into 10.4Marko Mäkelä2021-03-082-0/+46
|\ \ | |/
| * Merge branch '10.2' into 10.3Vicențiu Ciorbaru2021-03-042-0/+46
| |
* | Merge 10.3 into 10.4Marko Mäkelä2021-03-082-0/+281
|\ \ | |/
| * MDEV-22786 Crashes with nested table value constructorsIgor Babaev2021-03-032-0/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug caused crashes of the server when processing queries with nested table value constructors (TVC) . It happened because the grammar rules to parse TVC used the same global lists for both nested TVC and nesting TVC. As a result invalid select trees were constructed for queries with nested TVC and this led to crashes at the prepare stage. This patch provides its own lists structures for each TVC nest level. Besides the patch fixes a bug in the function wrap_tvc() that missed inheritance of the SELECT_LEX::exclude_from_table_unique_test for selects that wrapped TVCs. This inheritance is critical for specifications of derived tables that employ nested TVCs. Approved by dmitry.shulga@mariadb.com
* | Merge 10.3 into 10.4Marko Mäkelä2021-03-0510-2/+199
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2021-03-034-0/+79
| |
| * MDEV-24919 Crash with subselect formed by table value constructor andIgor Babaev2021-03-012-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | used in set function If a subselect is formed by a table value constructor (TVC) then the following transformation is applied at the prepare stage: VALUES (v1), ... (vn) => SELECT * FROM (VALUES (v1), ... (vn)) tvc_x. The transformation is performed by the function wrap_tvc() that resets THD::LEX::current select to the top level select of the result of the transformation. After the call of wrap_tvc() in the function Item_subselect::wrap_tvc_into_select() the field THD::LEX::current must be reset to the same select as before the call. It was not done. As a result if the subselect formed by a TVC was an argument of a set function then an assertion was hit in the function Item_sum::check_sum_func(). Approved by Oleksandr Byelkin <sanja@mariadb.com>
| * MDEV-24958 Server crashes in my_strtod ... with DEFAULT(blob)Monty2021-03-012-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes also: MDEV-24942 Server crashes in _ma_rec_pack... with DEFAULT() on BLOB This was caused by two different bugs, both related to that the default value for the blob was not calculated before it was used: - There where now Item_default_value::..result() wrappers, which is needed as item in HAVING uses these. This causes crashes when using a reference to a DEFAULT(blob_field) in HAVING. It also caused wrong results when used with other fields with default value expressions that are not constants. - create_tmp_field() did not take into account that blob fields with default expressions are not yet initialized. Fixed by treating Item_default_value(blob) like a normal item expression.
| * MDEV-24710 Uninitialized value upon CREATE .. SELECT ... VALUE...Monty2021-03-012-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The failure happened for group by queries when all tables where marked as 'const tables' (tables with 0-1 matching rows) and no row matched the where clause and there was in addition a direct reference to a field. In this case the field would not be properly reset and the query would return 'random data' that happended to be in table->record[0]. Fixed by marking all const tables as null tables in this particular case. Sergei also provided an extra test case for the code. @reviewer Sergei Petrunia <psergey@askmonty.org>
* | MDEV-23843 Assertions in Diagnostics_area upon table operations under FTWRLMonty2021-03-022-0/+25
| | | | | | | | Fixed binary logging in ANALYZE TABLE to work as optimize table
* | Merge 10.3 into 10.4Marko Mäkelä2021-02-252-1/+2
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2021-02-252-1/+2
| |
* | Merge branch '10.3' into 10.4Daniel Black2021-02-252-2/+165
|\ \ | |/
| * MDEV-24910 Crash with SELECT that uses table value constructor as a subselectIgor Babaev2021-02-242-2/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug caused crashes of the server when processing queries with table value constructors (TVC) that contained subqueries and were used itself as subselects. For such TVCs the following transformation is applied at the prepare stage: VALUES (v1), ... (vn) => SELECT * FROM (VALUES (v1), ... (vn)) tvc_x. This transformation allows to reduce the problem of evaluation of TVCs used as subselects to the problem of evaluation of regular subselects. The transformation is implemented in the wrap_tvc(). The code the function to mimic the behaviour of the parser when processing the result of the transformation. However this imitation was not free of some flaws. First the function called the method exclude() that completely destroyed the select tree structures below the transformed TVC. Second the function used the procedure mysql_new_select to create st_select_lex nodes for both wrapping select of the transformation and TVC. This also led to constructing of invalid select tree structures. The patch actually re-engineers the code of wrap_tvc(). Approved by Oleksandr Byelkin <sanja@mariadb.com>
* | Merge branch 'github/10.4' into 10.4Sergei Golubchik2021-02-233-0/+8
|\ \
| * | MDEV-24114 SHOW CREATE USER doesnt display correct password expiry statusRobert Bindar2021-02-233-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given PASSWORD EXPIRE and PASSWORD EXPIRE [NEVER|INTERVAL x DAY] are two different mechanisms, SHOW CREATE USER should display all the information required to restore the state of an account which includes both a manual expired state and an automatic policy. The solution proposed here keeps a CREATE USER ... PASSWORD EXPIRE statement and adds an aditional ALTER USER .. PASSWORD EXPIRE [NEVER|INTERVAL x DAY] when necessary This way a tool can restore almost the complete state of an account as it was before a dump. The only information left still is the value of the password_last_changed column from mysql.global_priv
* | | Merge branch '10.3' into 10.4Sergei Golubchik2021-02-2319-12/+619
|\ \ \ | | |/ | |/|
| * | MDEV-24929 Server crash in thr_multi_unlock or in get_schema_tables_resultMonty2021-02-222-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was caused by two different bugs: 1) Information_schema tables where not locked by lock_tables, but get_lock_data() was not filtering these out. This caused a crash when mysql_unlock_some_tables() tried to unlock tables early, including not locked information schema tables. Fixed by not locking SYSTEM_TMP_TABLES 2) In some cases the optimizer will notice that we do not need to read the information_schema tables at all. In this case join_tab->read_record is not set, which caused a crash in get_schema_tables_result() Fixed by ignoring const tables in get_schema_tables_result()
| * | Merge branch '10.2' into 10.3Sergei Golubchik2021-02-2213-7/+401
| | |
| * | Merge branch 'bb-10.3-release' into 10.3Sergei Golubchik2021-02-2239-171/+1141
| |\ \
| * | | MDEV-24936 EXPLAIN for query based on table value constructor lacks infoIgor Babaev2021-02-222-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on used subqueries If a query was based on a table value constructor that contained subqueries then EXPLAIN for such query did not contain any lines explaining the execution plans of the subqueries. This happened because - no optimize() method was called for any subquery used by the table value constructor when EXPLAIN command for the query was processed; - EXPLAIN node created for the table value constructor itself did not assume that some child nodes could be attached to it. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| * | | MDEV-22703 DEFAULT() on a BLOB column can overwrite the default recordMonty2021-02-212-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can cause crashes when accessing already released memory The issue was the Item_default created a internal field, pointing to share->default_values, to be used with the DEFAULT() function. This does not work for BLOB fields as these are freed at end of query. Fixed by storing BLOB field data inside and area allocated by Item_default_value, like we do for nondeterministic default values.
| * | | MDEV-24840 Crash caused by query with IN subquery containing unionIgor Babaev2021-02-102-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of two table value costructors This bug affected queries with a [NOT] IN/ANY/ALL subquery whose top level unit contained several table value constructors. The problem appeared because the code of the function Item_subselect::fix_fields() that was responsible for wrapping table value constructors encountered at the top level unit of a [NOT] IN/ANY/ALL subquery did not take into account that the chain of the select objects comprising the unit were not immutable. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* | | | Merge branch 'bb-10.4-release' into 10.4Sergei Golubchik2021-02-2345-143/+1236
|\ \ \ \ | |_|_|/ |/| | |
| * | | Merge branch 'bb-10.3-release' into bb-10.4-releaseSergei Golubchik2021-02-1243-143/+1216
| |\ \ \ | | | |/ | | |/| | | | | | | | | Note, the fix for "MDEV-23328 Server hang due to Galera lock conflict resolution" was null-merged. 10.4 version of the fix is coming up separately
| | * | main.mysqldump test isn't that bigSergei Golubchik2021-02-012-19/+1
| | | | | | | | | | | | | | | | and it is that important to be run every time
| | * | Merge branch '10.2' into 10.3Sergei Golubchik2021-02-0139-152/+1140
| | |/
| | * MDEV-24675 Server crash when table value constructor uses a subselectIgor Babaev2021-01-262-0/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch actually fixes the bug MDEV-24675 and the bug MDEV-24618: Assertion failure when TVC uses a row in the context expecting scalar value The cause of these bugs is the same wrong call of the function that fixes value expressions in the value list of a table value constructor. The assertion failure happened when an expression in the value list is of the row type. In this case an error message was expected, but it was not issued because the function fix_fields_if_needed() was called for to check fields of value expressions in a TVC instead of the function fix_fields_if_needed_for_scalar() that would also check that the value expressions are are of a scalar type. The first bug happened when a table value expression used an expression returned by single-row subselect. In this case the call of the fix_fields_if_needed_for_scalar virtual function must be provided with and address to which the single-row subselect has to be attached. Test cases were added for each of the bugs. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| * | MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" errorSergei Golubchik2021-02-072-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partially revert 76063c2a13. Item::clone() is not an all-purpose Item copying machine, it was specifically created for pushdown of predicates into derived tables and views and it does not copy everything. In particular, it does not copy Item_func_regex. Fix the bug differently by preserving the old constraint name. But keep setting automatic_name=true to have it regenerated for cases like ALTER TABLE ... ADD CONSTRAINT.
* | | MDEV-23843 Assertions in Diagnostics_area upon table operations under FTWRLMonty2021-02-142-0/+51
|/ / | | | | | | | | | | | | | | | | | | | | 2 different problems: - MYSQL_BIN_LOG::write() did not check if mdl_context.acquire_lock() failed - Sql_cmd_optimize_table::execute() and Sql_cmd_repair_table::execute() called write_bin_log(), which could fail if sql_admin() had already called my_eof() Fixed by adding check for aquire_lock() return status and protect write_bin_log() in the above two functions with set_overwrite_status().
* | Merge 10.3 into 10.4Marko Mäkelä2021-01-2514-20/+266
|\ \ | |/