summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '10.5' into 10.6Sergei Golubchik2022-10-0233-263/+669
|\
| * Merge branch '10.4' into 10.5Sergei Golubchik2022-10-0233-263/+669
| |\
| | * Merge branch '10.3' into 10.4Sergei Golubchik2022-10-0129-262/+428
| | |\
| | | * cleanup: suppress rocksdb compilation warning, fix a commentSergei Golubchik2022-10-011-2/+2
| | | |
| | | * compilation errorSergei Golubchik2022-10-012-3/+2
| | | | | | | | | | | | | | | | extended initializers are only allowed since c++11
| | | * MDEV-17124: mariadb 10.1.34, views and prepared statements: ERROR 1615 ↵Oleksandr Byelkin2022-09-3011-63/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (HY000): Prepared statement needs to be re-prepared The problem is that if table definition cache (TDC) is full of real tables which are in tables cache, view definition can not stay there so will be removed by its own underlying tables. In situation above old mechanism of detection matching definition in PS and current version always require reprepare and so prevent executing the PS. One work around is to increase TDC, other - improve version check for views/triggers (which is done here). Now in suspicious cases we check: - timestamp (microseconds) of the view to be sure that version really have changed; - time (microseconds) of creation of a trigger related to time (microseconds) of statement preparation.
| | | * Better declaration of the buffer sizeOleksandr Byelkin2022-09-302-8/+13
| | | |
| | | * MDEV-28548: ER_TABLEACCESS_DENIED_ERROR is missing information about DBAnel Husakovic2022-09-307-52/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added missing information about database of corresponding table for various types of commands - Update some typos - Reviewed by: <vicentiu@mariadb.org>
| | | * MDEV-29361 Infinite recursive calls when detecting CTE dependenciesIgor Babaev2022-09-284-35/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch resolves the problem of improper name resolution of table references to embedded CTEs for some queries. This improper binding could lead to - infinite sequence of calls of recursive functions - crashes due to resolution of null pointers - wrong result sets returned by queries - bogus error messages If the definition of a CTE contains with clauses then such CTE is called embedding CTE while CTEs from the with clauses are called embedded CTEs. If a table reference used in the definition of an embedded CTE cannot be resolved within the unit that contains this reference it still may be resolved against a CTE definition from the with clause with one of the embedding CTEs. A table reference can be resolved against a CTE definition if it used in the the scope of this definition and it refers to the name of the CTE. Table reference t is in the scope of the CTE definition of CTE cte if - the definition of cte is an element of a with clause declared as RECURSIVE and the reference t belongs either to the unit to which this with clause is attached or to one of the elements of this clause - the definition of cte is an element of a with clause without RECURSIVE specifier and the reference t belongs either to the unit to which this with clause is attached or to one of the elements from this clause that are placed before the definition of cte. If a table reference can be resolved against several CTE definitions then it is bound to the most embedded. The code before this patch not always resolved table references used in embedded CTE according to the above rules. Approved by Oleksandr Byelkin <sanja@mariadb.com>
| | | * Use memory safe snprintf() in Connect Engine and elsewhere (#2210)Mikhail Chalov2022-09-282-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Continue with similar changes as done in 19af1890 to replace sprintf(buf, ...) with snprintf(buf, sizeof(buf), ...), specifically in the "easy" cases where buf is allocated with a size known at compile time. 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.
| | | * MDEV-21134 Crash with partitioned table, PARTITION syntax, and index_merge.Alexey Botchkov2022-09-271-0/+15
| | | | | | | | | | | | | | | | | | | | When the partition table is cloned, the handlers for the partitions that were not opened should anyway be created (but not opened).
| | | * MDEV-29022 add_slave destroy child list and has dead codeOleksandr Byelkin2022-09-278-74/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Nowdays subquery in a UNION's ORDER BY placed correctly in fake select, the only problem was incorrect Name_resolution_contect is fixed by this patch in parsing, so we do not need scanning/reseting of ORDER BY of a union.
| | * | MDEV-20760 Add Type_handler::KEY_pack_flags()Alexander Barkov2022-09-302-10/+35
| | | | | | | | | | | | | | | | | | | | | | | | Backporting from 10.5 to 10.4 This is needed to fix MDEV-28727 easier.
| | * | MDEV-29672 Add MTR tests covering key and key segment flags and typesAlexander Barkov2022-09-304-1/+237
| | | |
| | * | MDEV-29613 fixup: clang -Wunused-but-set-variableMarko Mäkelä2022-09-261-1/+5
| | | |
* | | | Merge branch '10.5' into 10.6Sergei Golubchik2022-09-305-7/+13
|\ \ \ \ | |/ / /
| * | | correctness assertSergei Golubchik2022-09-292-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | thd_get_ha_data() can be used without a lock, but only from the current thd thread, when calling from anoher thread it *must* be protected by thd->LOCK_thd_data * fix group commit code to take thd->LOCK_thd_data * remove innobase_close_connection() from the innodb background thread, it's not needed after 87775402cd0c and was failing the assert with current_thd==0
| * | | MDEV-29368 Assertion `trx->mysql_thd == thd' failed in innobase_kill_query ↵Sergei Golubchik2022-09-293-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from process_timers/timer_handler and use-after-poison in innobase_kill_query This is a 10.5 version of 9b750dcbd89e, fix for MDEV-23536 Race condition between KILL and transaction commit InnoDB needs to remove trx from thd before destroying it (trx), otherwise a concurrent KILL might get a pointer from thd to a destroyed trx. ha_close_connection() should allow engines to clear ha_data in hton->on close_connection(). To prevent the engine from being unloaded while hton->close_connection() is running, we remove the lock from ha_data and unlock the plugin manually.
| * | | debug_sync: ignore "sort" kills and disconnectsSergei Golubchik2022-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | only "hard" kills will now interrupt debug_sync waits. this is needed to have debug_sync points that work during disconnect
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-09-2630-48/+110
|\ \ \ \ | |/ / /
| * | | Merge 10.4 into 10.5Marko Mäkelä2022-09-2632-52/+115
| |\ \ \ | | |/ /
| | * | Fix build without either ENABLED_DEBUG_SYNC or DBUG_OFFMarko Mäkelä2022-09-2317-10/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are separate flags DBUG_OFF for disabling the DBUG facility and ENABLED_DEBUG_SYNC for enabling the DEBUG_SYNC facility. Let us allow debug builds without DEBUG_SYNC. Note: For CMAKE_BUILD_TYPE=Debug, CMakeLists.txt will continue to define ENABLED_DEBUG_SYNC.
| | * | Merge 10.3 into 10.4Marko Mäkelä2022-09-231-2/+3
| | |\ \ | | | |/
| | | * Backport fix for MDEV-29352 to 10.3-10.5Alexey Botchkov2022-09-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for MDEV-29352 was pushed to 10.6+ but the code causing the bug is old and the bug is unlikely to be a recent regression in 10.6. So, we apply the fix also to older versions, 10.3-10.5. The original commit message: MDEV-29352 SIGSEGV's in strlen and unknown location on optimized builds at SHUTDOWN When the UDF creation frails to write the newly created UDF into the related system table, the UDF is still created in memory. However, as it is now, the related DLL is unloaded in this case right in the mysql_create_function. And failure happens when the UDF handle is freed and tries to unload the respective DLL which is still unloaded.
| | * | MDEV-29613 Improve WITH_DBUG_TRACE=OFFMarko Mäkelä2022-09-2314-37/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 28325b08633372cc343dfcbc41fe252020cf6e6e a compile-time option was introduced to disable the macros DBUG_ENTER and DBUG_RETURN or DBUG_VOID_RETURN. The parameter name WITH_DBUG_TRACE would hint that it also covers DBUG_PRINT statements. Let us do that: WITH_DBUG_TRACE=OFF shall disable DBUG_PRINT() as well. A few InnoDB recovery tests used to check that some output from DBUG_PRINT("ib_log", ...) is present. We can live without those checks. Reviewed by: Vladislav Vaintroub
| | * | MDEV-28868 : wsrep_incoming_address status variable prints 0 as port number ↵Jan Lindström2022-09-221-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | if the port is not mentioned in wsrep_node_incoming_address system variable Problem was that mysqld_port is not set on set_ports() because it will be executed later. Fix is naturally fall back to MYSQL_PORT.
* | | | MDEV-29347 MariaDB 10.6.8 fails to start when ONLY_FULL_GROUP_BY gets providedSergei Golubchik2022-09-261-1/+2
| | | |
* | | | MDEV-29352 SIGSEGV's in strlen and unknown location on optimized builds at ↵Alexey Botchkov2022-09-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SHUTDOWN When the UDF creation frails to write the newly created UDF into the related system table, the UDF is still created in memory. However, as it is now, the related DLL is unloaded in this case right in the mysql_create_function. And failure happens when the UDF handle is freed and tries to unload the respective DLL which is still unloaded.
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-09-206-56/+64
|\ \ \ \ | |/ / /
| * | | Merge 10.4 into 10.5Marko Mäkelä2022-09-206-48/+77
| |\ \ \ | | |/ /
| | * | Merge 10.3 into 10.4Marko Mäkelä2022-09-206-48/+77
| | |\ \ | | | |/
| | | * MDEV-29561 SHOW CREATE TABLE produces syntactically incorrect structureAlexander Barkov2022-09-203-10/+26
| | | |
| | | * MDEV-22647 Assertion `!check_audit_mask(mysql_global_audit_mask, ↵Sergei Golubchik2022-09-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | event_class_mask)' check_audit_mask(mysql_global_audit_mask, event_class_mask) is tested in mysql_audit_general_log() and then assert in mysql_audit_acquire_plugins() verifies that the condition still holds. But this code path is not protected by LOCK_audit_mask, so mysql_global_audit_mask can change its value between the if() and the assert. That is, the assert is invalid and will fire if the audit plugin is unloaded concurrently with mysql_audit_general_log(). Nothing bad will happen in this case though, we'll just do a useless loop over all remaining installed audit plugins. That is, the fix is simply to remove the assert.
| | | * Add missing comment and remove unnecessary initializationAnel Husakovic2022-09-142-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Commit c8948b0d0db4 introduced `get_one_variable()` - updating missing argument. - Remove caller setting of empty string in `rpl_filter`, since underlying functions will do the same (commit 9584cbe7fcc4 introduced). Reviewed by: <brandon.nesterenko@mariadb.com>
| | | * MDEV-29509 execute granted indirectly (via roles) doesn't always workVicențiu Ciorbaru2022-09-141-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue manifests due to a bug in mysql_routine_grant. This was a side effect of e46eea8660fb which fixed the problem of not giving appropriate error message (ER_NONEXISTING_PROC_GRANT) when a routine grant existed due to role inheritance. When granting a routine privilege, it is possible to have a GRANT_NAME entry already created from an inherited role, but with it's init_privs set to 0. In this case we must not create a *new* grant entry, but we must edit this grant entry to set its init_privs. Note that this case was already covered by MDEV-29458, however due to a forgotten "flush privileges;" the actual code path never got hit. Remove the flush privilege command as it was never intended to be there in the first place.
| | | * cleanup: indentation and whitespace fixesVicențiu Ciorbaru2022-09-141-12/+11
| | | |
| | | * MDEV-29458: Role grant commands do not propagate all grantsVicențiu Ciorbaru2022-09-141-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was an issue in updating in-memory role datastructures when propagating role grants. The issue is that changing a particular role's privilege (on any privilege level, global, database, etc.) was done such that it overwrote the entire set of bits for that particular level of privileges. For example: grant select on *.* to r1 -> sets the access bits to r1 to select, regardless of what bits were present for role r1 (inherited from any other roles). Before this fix, the rights of role r1 were propagated to any roles r1 was granted to, however the propagated rights did *not* include the complete rights r1 inherited from its own grants. For example: grant r2 to r1; grant select on *.* to r2; grant insert on *.* to r1; # This command completely disregards the # select privilege from r2. In order to correct this, ensure that before rights are propagated onwards, that the current's role rights have been updated from its grants. Additionally, the patch exposed a flaw in the DROP ROLE code. When deleting a role we removed all its previous grants, but what remained was the actual links of roles granted to the dropped role. Having these links present when propagating grants meant that we would have leftover ACL_xxx entries. Ensure that the links are removed before propagating grants.
| | | * MDEV-29465: Inherited columns privs for roles wrongly set mysql.tables_priv ↵Vicențiu Ciorbaru2022-09-141-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | column There was a bug in the ACL internal data structures GRANT_TABLE and GRANT_COLUMN. The semantics are: GRANT_TABLE::init_cols and GRANT_COLUMN::init_privs represent the bits that correspond to the privilege bits stored in the physical tables. The other struct members GRANT_TABLE::cols and GRANT_COLUMN::privs represent the actual access bits, as they may be modified through role grants. The error in logic was mixing the two fields and thus we ended up storing the logical access bits in the physical tables, instead of the physical (init_xxx) bits. This caused subsequent DBUG_ASSERT failures when dropping the involved roles.
| * | | Merge remote-tracking branch 'origin/10.4' into 10.5Alexander Barkov2022-09-142-27/+6
| |\ \ \ | | |/ /
| | * | Merge 10.3 into 10.4Marko Mäkelä2022-09-132-27/+6
| | |\ \ | | | |/
| | | * MDEV-29446 Change SHOW CREATE TABLE to display default collationAlexander Barkov2022-09-122-27/+6
| | | |
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-09-125-13/+19
|\ \ \ \ | |/ / /
| * | | MDEV-24660 MYSQL_BIN_LOG::cleanup(): Assertion `b->xid_count == 0'Andrei2022-09-092-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The shutdown time assert was caused by untimely deactivation of the binlog background thread and related structs destruction. It could specifically occur when a transaction is replication unsafe and has to be completed with a ROLLBACK event in binlog. This gets fixed with the binlog background thread stop relocation to a point and user transactions have been completed. A test case is added to binlog.binlog_checkpoint which also receives as a bonus a minor correction to reactivate a MDEV-4322 test case that originally required a shutdown phase (that ceased to do).
| * | | MDEV-29322 ASAN heap-use-after-free in Query_log_event::do_apply_eventAndrei2022-09-073-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ASAN report was made in the parallel slave execution of a query event and implicitly involved (so also parallelly run) Format-Description event. The Query actually had unexpected impossible dependency on a preceding "old" FD whose instance got destructed, to cause the ASAN error. The case is fixed with storing the FD's value into Query-log-event at its instantiating on slave. The stored value is from the very FD of the Query's original binlog so remains to be correct at the query event applying. The branch C. of a new rpl_parallel_29322.test also demonstrates (may need few --repeat though) the bug in its simple form of the same server version binlog.
* | | | Merge branch '10.5' into 10.6Vladislav Vaintroub2022-09-072-16/+6
|\ \ \ \ | |/ / / | | | | | | | | | | | | | | | | # Conflicts: # sql/sql_connect.cc # sql/threadpool_common.cc
| * | | Merge branch '10.4' into 10.5Vladislav Vaintroub2022-09-072-16/+6
| |\ \ \ | | |/ / | | | | | | | | | | | | # Conflicts: # sql/sql_connect.cc
| | * | MDEV-18353 - minor cleanupVladislav Vaintroub2022-09-072-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not repeat yourself. Instead of having the same DBUG_EXECUTE_IF code in threadpool and thread-per-connection, add this code to setup_connection_thread_globals() which is executed in all scheduling modes.
* | | | Merge 10.5 into 10.6Marko Mäkelä2022-09-074-4/+16
|\ \ \ \ | |/ / /
| * | | Merge 10.4 into 10.5Marko Mäkelä2022-09-074-3/+15
| |\ \ \ | | |/ /
| | * | Merge 10.3 into 10.4Marko Mäkelä2022-09-074-3/+15
| | |\ \ | | | |/