summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-28616 Crash when using derived table over union with order by clausebb-10.3-igorIgor Babaev2023-01-251-0/+3
| | | | | | | | | | | | | | | | | | This bug manifested itself when the server processed a query containing a derived table over union whose ORDER BY clause included a subquery with unresolvable column reference. For such a query the server crashed when trying to resolve column references in the ORDER BY clause used by union. For any union with ORDER BY clause an extra SELECT_LEX structure is created and it is attached to SELECT_LEX_UNIT structure of the union via the field fake_select_lex. The outer context for fake_select_lex must be the same as for other selects of the union. If the union is used in the FROM list of a derived table then the outer context for fake_select_lex must be set to NULL in line with other selects of the union. It was not done and it caused a crash when searching for possible resolution of an unresolvable column reference occurred in a subquery used in the ORDER BY clause. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* MDEV-30323 Some DDLs like ANALYZE can complete on parallel slave out of orderbb-10.3-andreiAndrei2023-01-241-3/+3
| | | | | | | | | | | ANALYZE was observed to race over a preceding in binlog order DML in updating the binlog and slave gtid states. Tagging ANALYZE and other admin class commands in binlog by the fixes of MDEV-17515 left a flaw allowing such race leading to the gtid mode out-of-order error. This is fixed now to observe by ADMIN commands the ordered access to the slave gtid status variables and binlog.
* MDEV-30081 Crash with splitting from constant mergeable derived tableIgor Babaev2023-01-241-1/+1
| | | | | | | | | | This bug manifested itself in very rare situations when splitting optimization was applied to a materialized derived table with group clause by key over a constant meargeable derived table that was in inner part of an outer join. In this case the used tables for the key to access the split table incorrectly was evaluated to a not empty table map. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel ReplicasBrandon Nesterenko2023-01-243-9/+37
| | | | | | | | | | | | | | | | | | | | | | | Problem ======== On a parallel, delayed replica, Seconds_Behind_Master will not be calculated until after MASTER_DELAY seconds have passed and the event has finished executing, resulting in potentially very large values of Seconds_Behind_Master (which could be much larger than the MASTER_DELAY parameter) for the entire duration the event is delayed. This contradicts the documented MASTER_DELAY behavior, which specifies how many seconds to withhold replicated events from execution. Solution ======== After a parallel replica idles, the first event after idling should immediately update last_master_timestamp with the time that it began execution on the primary. Reviewed By =========== Andrei Elkin <andrei.elkin@mariadb.com>
* Added comments re JOIN::all_fields, JOIN::fields_listSergei Petrunia2023-01-241-2/+20
|
* MDEV-30248 Infinite sequence of recursive calls when processing embedded CTEIgor Babaev2023-01-233-81/+16
| | | | | | | | | | | | | | | | This patch fixes the patch for bug MDEV-30248 that unsatisfactorily resolved the problem of resolution of references to CTE. In some cases when such a reference has the same table name as the name of one of CTEs containing this reference the reference could be resolved incorrectly that led to an invalid select tree where units could be mutually dependent. This in its turn could lead to an infinite sequence of recursive calls or to falls into infinite loops. The patch also removes LEX::resolve_references_to_cte_in_hanging_cte() as with the new code for resolution of CTE references the call of this function is not needed anymore. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* MDEV-15178: Filesort::make_sortorder: Assertion `pos->field != __null |Sergei Petrunia2023-01-233-15/+60
| | | | | | | | | | | | | | | | | | | | (Initial patch by Varun Gupta. Amended and added comments). When the query has both 1. Aggregate functions that require sorting data by group, and 2. Window functions we need to use two temporary tables. The first temp.table will hold the join output. Then it is passed to filesort(). Reading it in sorted order allows to compute the aggregate functions. Then, we need to write their values into the second temp. table. Then, Window Function computation step can pass that to filesort() and read them in the order it needs. Failure to create the second temp. table would cause an assertion failure: window function could would not find where to get the values of the aggregate functions.
* Minimize unsafe C functions usage - replace strcat() and strcpy() (and ↵Mikhail Chalov2023-01-202-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strncat() and strncpy()) with custom safe_strcat() and safe_strcpy() functions The MariaDB code base uses strcat() and strcpy() in several places. These are known to have memory safety issues and their usage is discouraged. Common security scanners like Flawfinder flags them. In MariaDB we should start using modern and safer variants on these functions. This is similar to memory issues fixes in 19af1890b56c6c147c296479bb6a4ad00fa59dbb and 9de9f105b5cb88249acc39af73d32af337d6fd5f but now replace use of strcat() and strcpy() with safer options strncat() and strncpy(). However, add '\0' forcefully to make sure the result string is correct since for these two functions it is not guaranteed what new string will be null-terminated. Example: size_t dest_len = sizeof(g->Message); strncpy(g->Message, "Null json tree", dest_len); strncat(g->Message, ":", sizeof(g->Message) - strlen(g->Message)); size_t wrote_sz = strlen(g->Message); size_t cur_len = wrote_sz >= dest_len ? dest_len - 1 : wrote_sz; g->Message[cur_len] = '\0'; All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services -- Reviewer and co-author Vicențiu Ciorbaru <vicentiu@mariadb.org> -- Reviewer additions: * The initial function implementation was flawed. Replaced with a simpler and also correct version. * Simplified code by making use of snprintf instead of chaining strcat. * Simplified code by removing dynamic string construction in the first place and using static strings if possible. See connect storage engine changes.
* MDEV-30052 Crash with a query containing nested WINDOW clausesIgor Babaev2023-01-204-17/+12
| | | | | | | | | | Use SELECT_LEX to save lists for ORDER BY and GROUP BY before parsing WINDOW clauses / specifications. This is needed for proper parsing of a nested WINDOW clause when a WINDOW clause is used in a subquery contained in another WINDOW clause. Fix assignment of empty SQL_I_List to another one (in case of empty list next shoud point on first).
* MDEV-30378 Versioned REPLACE succeeds with ON DELETE RESTRICT constraintNikita Malyavin2023-01-121-0/+1
| | | | | | | | | | | node->is_delete was incorrectly set to NO_DELETE for a set of operations. In general we shouldn't rely on sql_command and look for more abstract ways to control the behavior. trg_event_map seems to be a suitable way. To mind replica nodes, it is ORed with slave_fk_event_map, which stores trg_event_map when replica has triggers disabled.
* fix typoslilinjie2023-01-123-6/+6
| | | | Signed-off-by: lilinjie <lilinjie@uniontech.com>
* MDEV-25277: mysqlbinlog --verbose cannot read row events with compressed ↵Brandon Nesterenko2023-01-111-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | columns: Don't know how to handle column type: 140 Problem: ======= Mysqlbinlog cannot show the type of a compressed column when two levels of verbosity is provided. Solution: ======== Extend the log event printing logic to handle and tag compressed types. Behavioral Changes: ================== Old: When mysqlbinlog is called in verbose mode and the database uses compressed columns, an error is returned to the user. New: The output will append “ COMPRESSED” on the type of compressed columns Reviewed By =========== Andrei Elkin <andrei.elkin@mariadb.com>
* MDEV-28602 Wrong result with outer join, merged derived table and viewSergei Petrunia2023-01-111-0/+8
| | | | | | | | | | | | | | | | | | (Variant 3, initial variant was by Rex Jonston) A LEFT JOIN with a constant as a column of the inner table produced wrong query result if the optimizer had to write the inner table column into a temp table. Query pattern: SELECT ... FROM (SELECT /*non-mergeable select*/ FROM t1 LEFT JOIN (SELECT 'Y' as Val) t2 ON ...) as tbl Fixed this by adding Item_direct_view_ref::save_in_field() which follows the pattern of Item_direct_view_ref's save_org_in_field(), save_in_result_field() and val_XXX() functions: * call check_null_ref() and handle NULL value * if we didn't get a NULL-complemented row, call Item_direct_ref's function.
* MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/errorDaniel Black2023-01-092-8/+8
| | | | | | | | | regression from MDEV-29540 / 8c389393695. INSERT SELECT errors needed to be unconditionally ignored. As this touches the CREATE .. SELECT functionality, show the equalivent test there.
* MDEV-17093: SOURCE_REVISION in log (postfix - not in help)Daniel Black2023-01-081-2/+3
| | | | Don't display the source revision in the mysqld --help output.
* MDEV-27624 Wrong result for nested left join using not_exists optimizationIgor Babaev2023-01-061-6/+29
| | | | | | | | | | | | | | | | | | | | | | | This bug affected queries with nested left joins having the same last inner table such that not_exists optimization could be applied to the most inner outer join when optimizer chose to use join buffers. The bug could lead to producing wrong a result set. If the WHERE condition a query contains a conjunctive IS NULL predicate over a non-nullable column of an inner table of a not nested outer join then not_exists optimization can be applied to tho the outer join. With this optimization when looking for matches for a certain record from the outer table of the join the records of the inner table can be ignored right after the first match satisfying the ON condition is found. In the case of nested outer joins having the same last inner table this optimization still can be applied but only if all ON conditions of the embedding outer joins are satisfied. Such check was missing in the code that tried to apply not_exists optimization when join buffers were used for outer join operations. This problem has been already fixed in the patch for bug MDEV-7992. Yet there it was resolved only for the cases when join buffers were not used for outer joins. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* MDEV-17093: SOURCE_REVISION in log and handle_fatal_signalHaidong Ji2023-01-062-16/+12
| | | | | | | | | | | | | | | | | | MariaDB MDEV-12583 added `SOURCE_REVISION` variable that exposes the SHA1 of source code commit that the current running engine was built from. This info is useful for troubleshooting and debugging. This commit does the following: - addes the `SOURCE_REVISION` value into engine error log. - when a crash triggers handle_fatal_signal, the `SOURCE_REVISION` will be included in crash report. - resolves MDEV-20344: startup messages belong in stderr/error-log not stdout All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
* fix typoslilinjie2023-01-055-6/+6
| | | | Signed-off-by: lilinjie <lilinjie@uniontech.com>
* MDEV-29988 group by fixSergei Golubchik2023-01-021-0/+5
|
* fixes for json.json_table and main.func_json in --psSergei Golubchik2023-01-021-1/+2
|
* MDEV-29988: Major performance regression with 10.6.11Dmitry Shulga2023-01-024-18/+165
| | | | | | | | | | | The idea is to put Item_direct_ref_to_item as a transparent and permanent wrapper before a string which require conversion. So that Item_direct_ref_to_item would be the only place where the pointer to the string item is stored, this pointer can be changed and restored during PS execution as needed. And if any permanent (subquery) optimization would need a pointer to the item, it'll use a pointer to the Item_direct_ref_to_item - which is a permanent item and won't go away.
* MDEV-29988: (revert) Major performance regression with 10.6.11Dmitry Shulga2023-01-021-11/+2
| | | | | | Reverted changed in server code introduced by the commit bd9274faa469cc164099c7497c18a0e0a9b1184b. Tests from this commit are retained.
* --skip-name-resolve=0 didn't workSergei Golubchik2023-01-027-21/+12
| | | | | custom code in `case OPT_SKIP_RESOLVE` was overriding the correct value from handle_options().
* MDEV-30151 parse error 1=2 not between/inSergei Golubchik2023-01-022-6/+6
| | | | | | | | | | | | | | | | the parser couldn't parse `1=2 not between 3 and 5` after `2` it expected only NOT2_SYM, but not NOT_SYM (visible from the sql_yacc.output file), which resulted in Syntax error ... near 'not between 3 and 4' The parser was confused by a rather low NOT_SYM precedence and %prec BETWEEN_SYM didn't resolve this confusion. As a fix, let's remove any %precedence from NOT_SYM and specify %prec explicitly in the only place where it matters for NOT_SYM. In other places, such as for NOT BETWEEN, NOT_SYM won't have a precedence, so bison won't be confused about it.
* MDEV-19071 Wrong results when using STDDEV_SAMP() and viewSergei Golubchik2023-01-021-1/+1
|
* MDEV-25004 Missing row in FTS_DOC_ID_INDEX during DELETE HISTORYAleksey Midenkov2022-12-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. In case of system-versioned table add row_end into FTS_DOC_ID index in fts_create_common_tables() and innobase_create_key_defs(). fts_n_uniq() returns 1 or 2 depending on whether the table is system-versioned. After this patch recreate of FTS_DOC_ID index is required for existing system-versioned tables. If you see this message in error log or server warnings: "InnoDB: Table db/t1 contains 2 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB" use this command to fix the table: ALTER TABLE db.t1 FORCE; 2. Fix duplicate history for secondary unique index like it was done in MDEV-23644 for clustered index (932ec586aad). In case of existing history row which conflicts with currently inseted row we check in row_ins_scan_sec_index_for_duplicate() whether that row was inserted as part of current transaction. In that case we indicate with DB_FOREIGN_DUPLICATE_KEY that new history row is not needed and should be silently skipped. 3. Some parts of MDEV-21138 (7410ff436e9) reverted. Skipping of FTS_DOC_ID index for history rows made problems with purge system. Now this is fixed differently by p.2. 4. wait_all_purged.inc checks that we didn't affect non-history rows so they are deleted and purged correctly. Additional FTS fixes fts_init_get_doc_id(): exclude history rows from max_doc_id calculation. fts_init_get_doc_id() callback is used only for crash recovery. fts_add_doc_by_id(): set max value for row_end field. fts_read_stopword(): stopwords table can be system-versioned too. We now read stopwords only for current data. row_insert_for_mysql(): exclude history rows from doc_id validation. row_merge_read_clustered_index(): exclude history_rows from doc_id processing. fts_load_user_stopword(): for versioned table retrieve row_end field and skip history rows. For non-versioned table we retrieve 'value' field twice (just for uniformity). FTS tests for System Versioning now include maybe_versioning.inc which adds 3 combinations: 'vers' for debug build sets sysvers_force and sysvers_hide. sysvers_force makes every created table system-versioned, sysvers_hide hides WITH SYSTEM VERSIONING for SHOW CREATE. Note: basic.test, stopword.test and versioning.test do not require debug for 'vers' combination. This is controlled by $modify_create_table in maybe_versioning.inc and these tests run WITH SYSTEM VERSIONING explicitly which allows to test 'vers' combination on non-debug builds. 'vers_trx' like 'vers' sets sysvers_force_trx and sysvers_hide. That tests FTS with trx_id-based System Versioning. 'orig' works like before: no System Versioning is added, no debug is required. Upgrade/downgrade test for System Versioning is done by innodb_fts.versioning. It has 2 combinations: 'prepare' makes binaries in std_data (requires old server and OLD_BINDIR). It tests upgrade/downgrade against old server as well. 'upgrade' tests upgrade against binaries in std_data. Cleanups: Removed innodb-fts-stopword.test as it duplicates stopword.test
* MDEV-25004 vers_force_trx option to force transactional System VersioningAleksey Midenkov2022-12-273-22/+40
| | | | | | Works like vers_force but forces trx_id-based system-versioned tables if the storage supports it (currently InnoDB-only). Otherwise creates timestamp-based system-versioned table.
* MDEV-21187: log_slow_filter="" logs queries not using indexesDaniel Black2022-12-141-1/+1
| | | | | | | | | | | | | | | | | Consistent with MDEV-4206 and empty log_slow_filter still means no explict filtering. Since 21518ab2e453 however the log_queries_not_using_indexes became stored in the same variable. As we need to test for the absense of log_queries_not_using_indexes the SERVER_QUERY_NO_INDEX USED part of log_slow_statement, the empty criteria resulted in an always true to log queries not using indexes if log_slow_filter was set to empty. Adjusted the log_slow.test for MDEV-4206 as slow_log_query has been global and session for a while and it was relying on the MDEV-21187 buggy behavior to detect a slow query. Reviewer: Monty
* MDEV-29144 ER_TABLE_SCHEMA_MISMATCH or crash on DISCARD/IMPORTMarko Mäkelä2022-12-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | mysql_discard_or_import_tablespace(): On successful ALTER TABLE...DISCARD TABLESPACE, evict the table handle from the table definition cache, so that ha_innobase::close() will be invoked, like InnoDB expects to be the case. This will avoid an assertion failure ut_a(table->get_ref_count() == 0) during IMPORT TABLESPACE. ha_innobase::open(): Do not issue any ER_TABLESPACE_DISCARDED warning. Member functions for DML will do that. ha_innobase::truncate(), ha_innobase::check_if_supported_inplace_alter(): Issue ER_TABLESPACE_DISCARDED warnings, to compensate for the removal of the warning in ha_innobase::open(). row_quiesce_write_indexes(): Only write information about committed indexes. The ALTER TABLE t NOWAIT ADD INDEX(c) in the nondeterministic test case will most of the time fail due to a metadata lock (MDL) timeout and leave behind an uncommitted index. Reviewed by: Sergei Golubchik
* MDEV-30150 ST_GeomFromGeoJSON, 'geometry' before 'type: feature' errorDaniel Black2022-12-091-1/+2
| | | | | | | | | | | The geometry type requires Type:"Feature" but the feature need not be first in the JSON structure. Adjust code to return an error if geometry isn't a JSON object, but continue parsing searching for Type: "Feature" to trigger the geometry parsing. Thanks Derick Magnusen for the bug report.
* MDEV-29636 Assertion `part_share->auto_inc_initialized || ↵Nayuta Yanagisawa2022-12-071-1/+2
| | | | | | | | | | !can_use_for_auto_inc_init()' failed in ha_partition::set_auto_increment_if_higher upon REPLACE with partition pruning The bug is caused by a similar mechanism as MDEV-21027. The function, check_insert_or_replace_autoincrement, failed to open all the partitions on REPLACE SELECT statements and it results in the assertion error.
* MDEV-30082 View definition losing brackets changes semantics of the query ↵Sergei Golubchik2022-12-022-0/+3
| | | | | | | | | | | | and causes wrong result Item_func_not_all::print() either uses Item_func::print() or directly invokes args[0]->print(). Thus the precedence should be either the one of Item_func or of args[0]. Item_allany_subselect::print() prints args[0], then a comparison op, then a subquery. That is, the precedence should be the one of a comparison.
* try harder to reject not strictly deterministic vcols in indexes/storedSergei Golubchik2022-12-022-6/+14
| | | | | | detect non-determinism in vcol of vcol, like: create table t1 (a int, b real as (rand()), c real as (b) stored);
* MDEV-30016 Virtual columns do not support autoincrement columnsSergei Golubchik2022-12-022-1/+6
| | | | change vcol_upgrade test to use stored gcols
* cleanup: VCOL_NOT_VIRTUAL->VCOL_NEXTVALSergei Golubchik2022-12-023-8/+5
| | | | | | | | | | | | rename to stress that is a specific hack for Item_func_nextval and should not be used for other items. If a vcol uses Item_func_nextval, a corresponding table for the sequence should be added to the prelocking list (in that sense NEXTVAL is not simply a function, but more like a subquery), see add_internal_tables() in DML_prelocking_strategy::handle_table(). At the moment it is only implemented for DEFAULT, not for GENERATED ALWAYS AS, thus the VCOL_NEXTVAL hack.
* MDEV-30056 Impossible to export column grantsSergei Golubchik2022-12-021-3/+2
|
* MDEV-30036 NULL pointer dereference in ↵Sergei Golubchik2022-12-022-22/+0
| | | | | | partition_info::set_partition_bitmaps_from_table remove dead code
* MDEV-30066 (limit + offset) union all (...) limit = incorrect resultSergei Golubchik2022-12-021-5/+8
| | | | | | | | | select_union_direct::send_data() only sends a record when the LIMIT ... OFFSET clause of the individual select won't skip it. Thus, select_union_direct::send_data() should not do any actions related to a sending a record if the offset of a select isn't reached yet
* MDEV-28696 View created as "select b''; " references invalid table(s) or ↵Alexander Barkov2022-12-022-0/+20
| | | | column(s) or function(s) or definer/invoker of view lack rights to use them
* MDEV-30112 ASAN errors in Item_ident::print / generate_partition_syntaxbb-10.3-midenokAleksey Midenkov2022-12-011-0/+2
| | | | | | | | Like in MDEV-16110 we must release items allocated on thd->mem_root by reopening the table. MDEV-16290 relocated MDEV-16110 fix in 10.5 so it works for MDEV-28576 as well. 10.3 without MDEV-16290 now duplicates this fix.
* MDEV-30023 Revoking Privilege on the Column Yields the Errorbb-10.3-vicentiuVicențiu Ciorbaru2022-11-301-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change from MDEV-29465 exposed a flaw in replace_column_table where again we were not properly updating the column-level bits. replace_table_table was changed in MDEV-29465 to properly update grant_table->init_cols, however replace_column_table still only modified grant_column->rights when the GRANT_COLUMN already existed. This lead to a missmatch between GRANT_COLUMN::init_rights and GRANT_COLUMN::rights, *if* the GRANT_COLUMN already existed. As an example: GRANT SELECT (col1) ... Here: For col1 GRANT_COLUMN::init_rights and GRANT_COLUMN::rights are set to 1 (SELECT) in replace_column_table. GRANT INSERT (col1) ... Here, without this patch GRANT_COLUMN::init_rights is still 1 and GRANT_COLUMN::rights is 3 (SELECT_PRIV | INSERT_PRIV) Finally, if before this patch, one does: REVOKE SELECT (col1) ... replace_table_table will see that init_rights loses bit 1 thus it considers there are no more rights granted on that particular table. This prompts the whole GRANT_TABLE to be removed via the first revoke, when the GRANT_COLUMN corresponding to it should still have init_rights == 2. By also updating replace_column_table to keep init_rights in sync properly, the issue is resolved. Reviewed by <serg@mariadb.com>
* Safety fixMonty2022-11-291-3/+4
| | | | | Ensure that all memory allocated by TABLE_LIST::change_refs_to_fields() is in the same memory root!
* MDEV-29169 Using MATCH returns NULL for Virtual ColumnNikita Malyavin2022-11-231-0/+5
| | | | | | | Virtual column values are updated in handler in reading commands, like ha_index_next, etc. This was missing for ha_ft_read. handler::ha_ft_read: add table->update_virtual_fields() call
* MDEV-29817: Issues with handling options for SSL CRLs (and some others)Julius Goryavsky2022-11-221-3/+3
| | | | | | | | | | This patch adds the correct setting of the "--ssl-verify-server-cert" option in the client-side utilities such as mysqlcheck and mysqlslap, as well as the correct setting of the "--ssl-crl" option when executing queries on the slave side, and also add the correct option codes in the "sslopts-logopts.h" file (in the latter case, incorrect values are not a problem right now, but may cause subtle test failures in the future, if the option handling code changes).
* MDEV-12274: Too many connections warning in error log (#2213)Daniel Black2022-11-181-1/+2
| | | | | | | | | | | | Because of the default warning level, aborted unauthenticated connections are in the error log. These errors frequently occur in production environments because cancelled connectiosn occur all the time when web pages are shutdown. Rather than flood our user's errors log with these ordinary messages, lets push them down to the warning level at log-warnings=4 level. Concept approved by Monty.
* MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in ↵Alexander Barkov2022-11-173-14/+18
| | | | | | | | | | | | | | | | | | | | | | type 'int' in strings/dtoa.c Fixing a few problems relealed by UBSAN in type_float.test - multiplication overflow in dtoa.c - uninitialized Field::geom_type (and Field::srid as well) - Wrong call-back function types used in combination with SHOW_FUNC. Changes in the mysql_show_var_func data type definition were not properly addressed all around the code by the following commits: b4ff64568c88ab3ce559e7bd39853d9cbf86704a 18feb62feeb833494d003615861b9c78ec008a90 0ee879ff8ac1b80cd9a963015344f5698a81f309 Adding a helper SHOW_FUNC_ENTRY() function and replacing all mysql_show_var_func declarations using SHOW_FUNC to SHOW_FUNC_ENTRY, to catch mysql_show_var_func in the future at compilation time.
* MDEV-10087 mysqld_update()/mysql_delete() continues execution even after ↵Vlad Lesin2022-11-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | subquery with JOIN gets error from storage engine The issue is that record_should_be_deleted() returns true in mysql_delete() even if sub-select with join gets error from storage engine when DELETE FROM ... WHERE ... IN (SELECT ...) statement is executed. The same is true for mysql_update() where select->skip_record() returns true even if sub-select with join gets error from storage engine. In the test case if sub-select is chosen as deadlock victim the whole transaction is rolled back during sub-select execution, but mysql_delete()/mysql_update() continues transaction execution and invokes table->delete_row() as record_should_be_deleted() wrongly returns true in mysql_delete() and table->update_row() as select->skip_record(thd) wrongly returns 1 for mysql_update(). record_should_be_deleted() wrogly returns true because thd->is_error() returns false SQL_SELECT::skip_record() invoked from record_should_be_deleted(). It's supposed that THD error should be set in rr_handle_error() called from rr_sequential() during sub-select JOIN::exec_inner() execution. But rr_handle_error() does not set THD error because READ_RECORD::print_error is not set in JOIN_TAB::read_record. READ_RECORD::print_error should be initialized in init_read_record()/init_read_record_idx(). But make_join_readinfo() does not invoke init_read_record()/init_read_record_idx() for JOIN_TAB::read_record. The fix is to set JOIN_TAB::read_record.print_error in make_join_readinfo(), i.e. in the same place where JOIN_TAB::read_record.table is set. Reviewed by Sergey Petrunya.
* Merge branch '10.3' into bb-10.3-releaseOleksandr Byelkin2022-11-071-2/+2
|\
| * MDEV-29847: Wrong warning on rlimit capping of max_open_files (#2315)Daniel Black2022-10-281-2/+2
| | | | | | | | | | | | | | Per the code my_set_max_open_files 3 lines earlier, we attempt to set the nofile (number of open files), rlimit to max_open_files. We should use this in the warning because wanted_files may not be the number.
* | MDEV-29926: ASAN heap-use-after-free in Explain_query::~Explain_querymariadb-10.3.37Oleksandr Byelkin2022-11-021-1/+9
|/ | | | Make sure that EXPLAIN object allocated on runtime arena.