summaryrefslogtreecommitdiff
path: root/sql/sql_admin.cc
Commit message (Collapse)AuthorAgeFilesLines
* MDEV 15532 Assertion `!log->same_pk' failed in row_log_table_apply_deleteMonty2020-11-301-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | The reason for the failure is that thd->mdl_context.release_transactional_locks() was called after commit & rollback even in cases where the current transaction is still active. For 10.2, 10.3 and 10.4 the fix is simple: - Replace all calls to thd->mdl_context.release_transactional_locks() with thd->release_transactional_locks(). The thd function will only call the mdl_context function if there are no active transactional locks. In 10.6 we will better fix where we will change the return value for some trans_xxx() functions to indicate if transaction did close the transaction or not. This will avoid the need of the indirect call. Other things: - trans_xa_commit() and trans_xa_rollback() will automatically call release_transactional_locks() if the transaction is closed. - We can't do that for the other functions as the caller of many of these are doing additional work (like close_thread_tables) before calling release_transactional_locks(). - Added missing abort_result_set() and missing DBUG_RETURN in select_create::send_eof() - Fixed wrong indentation in injector::transaction::commit()
* Merge branch '10.1' into 10.2mariadb-10.2.33Sergei Golubchik2020-08-061-1/+1
|\
| * Fix the typo in fix for MDEV-21472Sergei Petrunia2020-08-031-1/+1
| |
* | Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-0/+10
|\ \ | |/
| * MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks ↵Sergei Petrunia2020-07-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | all rows Do not collect EITS statistics for this statement: ALTER TABLE t ANALYZE PARTITION p EITS stats are currently global, not per-partition. Collecting global stats when we are asked to process just one partition causes issues for DBAs.
* | Fixed deadlock with LOCK TABLES and ALTER TABLEMonty2020-05-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-21398 Deadlock (server hang) or assertion failure in Diagnostics_area::set_error_status upon ALTER under lock This failure could only happen if one locked the same table multiple times and then did an ALTER TABLE on the table. Major change is to change all instances of table->m_needs_reopen= true; to table->mark_table_for_reopen(); The main fix for the problem was to ensure that we mark all instances of the table in the locked_table_list and when we reopen the tables, we first close all tables before reopening and locking them. Other things: - Don't call thd->locked_tables_list.reopen_tables if there are no tables marked for reopen. (performance)
* | MDEV-13266: Race condition in ANALYZE TABLE / statistics collectionVarun Gupta2020-05-051-25/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing a race condition while collecting the engine independent statistics. Thread1> 1) start running "ANALYZE TABLE t PERISTENT FOR COLUMNS (..) INDEXES ($list)" 2) Walk through $list and save it in TABLE::keys_in_use_for_query 3) Close/re-open tables Thread2> 1) Make some use of table t. This involves taking table t from the table cache, and putting it back (with TABLE::keys_in_use_for_query reset to 0) Thread1> continue collecting EITS stats. Since TABLE::keys_in_use_for_query is set to 0 we will not collect statistics for indexes in $list.
* | MDEV-19055 Failures with temporary tables and AriaMichael Widenius2019-06-171-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | There was two separate problems: - Aria pagecache didn't properly handle re-reading of blocks that have given errors before (this triggered an assert) - temporary tables that where opened several times where not properly closed in ALTER, REPAIR or OPTIMIZE table Other things - Added a couple of asserts that will make it easier to find problems like this in the future.
* | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
|\ \ | |/
| * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| |\
| | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | * Update wrong zip-code
* | | Merge branch '10.1' into 10.2Sergei Golubchik2019-03-291-4/+2
|\ \ \ | |/ /
| * | cmake: re-enable -Werror in the maintainer modeSergei Golubchik2019-03-271-2/+2
| | | | | | | | | | | | | | | | | | now we can afford it. Fix -Werror errors. Note: * old gcc is bad at detecting uninit variables, disable it. * time_t is int or long, cast it for printf's
* | | Merge 10.1 into 10.2Marko Mäkelä2019-03-041-5/+0
|\ \ \ | |/ /
| * | MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned offAlexander Barkov2019-03-041-5/+0
| | |
* | | Merge 10.1 into 10.2Marko Mäkelä2018-11-061-0/+3
|\ \ \ | |/ /
| * | wsrep: create a macro for the error: labelSergei Golubchik2018-10-241-0/+3
| | | | | | | | | | | | | | | that is used by WSREP_TO_ISOLATION_BEGIN and other galera macros, to avoid the need for wrapping this label in #ifdef WITH_WSREP/#endif
* | | Merge 10.1 into 10.2Marko Mäkelä2018-05-291-0/+2
|\ \ \ | |/ /
* | | Merge remote-tracking branch 'origin/10.1' into 10.2Monty2018-05-241-3/+4
|\ \ \ | |/ /
| * | Merge remote-tracking branch 'origin/10.0' into 10.1Monty2018-05-241-5/+6
| |\ \
| | * | Fixes for Aria transaction handling with lock tablesMonty2018-05-221-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-10130 Assertion `share->in_trans == 0' failed in storage/maria/ma_close.c MDEV-10378 Assertion `trn' failed in virtual int ha_maria::start_stmt The problem was that maria_handler->trn was not properly reset at commit/rollback and ha_maria::exernal_lock() could get confused because. There was some old code in ha_maria::implicit_commit() that tried to take care of this, but it was not bullet proof. Fixed by adding list of all tables that is part of the maria transaction to TRN. A nice side effect was of the fix is that loops in ha_maria::implict_commit() got to be much simpler. Other things: - Fixed a bug in mysql_admin_table() where argument open_for_modify was wrongly reset for the next table in the chain - rollback admin command also in case of fatal error. - Split _ma_set_trn_for_table() to three version to simplify code and debugging. - Several new asserts to detect the original problem (that file was not properly removed from trn before calling ma_close())
* | | | Merge branch '10.1' into 10.2Sergei Golubchik2018-05-101-2/+5
|\ \ \ \ | |/ / /
| * | | Merge branch '10.0' into 10.1Sergei Golubchik2018-05-081-2/+5
| |\ \ \ | | |/ /
| | * | MDEV-15216 Assertion `! is_set() || m_can_overwrite_status' failed in ↵Sergei Golubchik2018-05-081-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Diagnostics_area::set_error_status upon operation inside XA don't implicitly commit or rollback in mysql_admin_table() unless the statement has CF_IMPLICIT_COMMIT_END flag.
* | | | Merge 10.1 into 10.2Marko Mäkelä2018-04-241-2/+2
|\ \ \ \ | |/ / /
| * | | Merge 10.0 into 10.1Marko Mäkelä2018-04-241-2/+2
| |\ \ \ | | |/ /
| | * | Merge branch '5.5' into 10.0Sergei Golubchik2018-04-201-1/+1
| | |\ \ | | | |/
| | | * Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2018-04-191-1/+1
| | | |\
| | | | * BUG#27216817: INNODB: FAILING ASSERTION:mysql-5.5.60Nisha Gopalakrishnan2018-02-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PREBUILT->TABLE->N_MYSQL_HANDLES_OPENED == 1 ANALYSIS: ========= Adding unique index to a InnoDB table which is locked as mutliple instances may trigger an InnoDB assert. When we add a primary key or an unique index, we need to drop the original table and rebuild all indexes. InnoDB expects that only the instance of the table that is being rebuilt, is open during the process. In the current scenario we have opened multiple instances of the table. This triggers an assert during table rebuild. 'Locked_tables_list' encapsulates a list of all instances of tables locked by LOCK TABLES statement. FIX: === We are now temporarily closing all the instances of the table except the one which is being altered and later reopen them via Locked_tables_list::reopen_tables().
| | * | | MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under ↵Sergei Golubchik2018-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LOCK TABLE after ER_SAME_NAME_PARTITION ALTER TABLE ... ADD PARTITION modifies the open TABLE structure, and sets table->need_reopen=1 to reset these modifications in case of an error. But under LOCK TABLES the table isn't get reopened, despite need_reopen. Fixed by reopening need_reopen tables under LOCK TABLE.
* | | | | Merge branch 'github/10.1' into 10.2Sergei Golubchik2018-02-061-2/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch 'github/10.0' into 10.1Sergei Golubchik2018-02-021-2/+1
| |\ \ \ \ | | |/ / /
| | * | | MDEV-11539 test_if_reopen: Assertion ↵Sergei Golubchik2018-01-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S remove HA_EXTRA_PREPARE_FOR_RENAME - neither OPTIMIZE nor REPAIR need it (was introduced in b58e79566c5 when replacing remove_table_from_cache() with wait_while_table_is_used() even though remove_table_from_cache() did not have it).
* | | | | Merge branch '10.1' into 10.2Sergei Golubchik2017-10-241-1/+0
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch '10.0' into 10.1Sergei Golubchik2017-10-221-1/+0
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '5.5' into 10.0Sergei Golubchik2017-10-181-1/+0
| | |\ \ \ | | | |/ /
| | | * | MDEV-13459 Warnings, when compiling with gcc-7.xSergei Golubchik2017-10-171-1/+0
| | | | | | | | | | | | | | | | | | | | mostly caused by -Wimplicit-fallthrough
* | | | | Fix warnings in Win64Vladislav Vaintroub2017-10-111-1/+2
| | | | |
* | | | | MDEV-13844 : Fix Windows warnings. Fix DBUG_PRINT.Vladislav Vaintroub2017-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix win64 pointer truncation warnings (usually coming from misusing 0x%lx and long cast in DBUG) - Also fix printf-format warnings Make the above mentioned warnings fatal. - fix pthread_join on Windows to set return value.
* | | | | MDEV-10555: Server crashes in mysql_admin_table upon killing ANALYZEOleksandr Byelkin2017-03-131-45/+67
| | | | | | | | | | | | | | | | | | | | Take into acount result of open table operation in mysql_admin_table.
* | | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-12-291-1/+13
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch '10.0' into 10.1Sergei Golubchik2016-09-281-1/+13
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '5.5' into 10.0Sergei Golubchik2016-09-271-1/+13
| | |\ \ \ | | | |/ /
| | | * | MDEV-10424 - Assertion `ticket == __null' failed in MDL_request::set_typeSergey Vojtovich2016-08-171-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reexecution of prepared "ANALYZE TABLE merge_table, table" may miss to reinitialize "table" for subsequent execution and trigger assertion failure. This happens because MERGE engine may adjust table->next_global chain, which gets cleared by close_thread_tables()/ha_myisammrg::detach_children() later. Since reinitilization iterates next_global chain, it won't see tables following merge table. Fixed by appending saved next_global chain after merge children.
* | | | | MDEV-7901: re-implement analyze table for low impactOleksandr Byelkin2016-08-031-134/+165
| | | | | | | | | | | | | | | | | | | | | | | | | Table before collecting engine independent statistics now is reopened in read mode, InnoDB allow write operations in this case.
* | | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-06-301-10/+27
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-9155 Enabling Defragmenting in 10.1.8 still causes OPTIMIZE TABLE to ↵Sergei Golubchik2016-05-051-7/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | take metadatalocks take MDL_SHARED_WRITE instead of MDL_SHARED_NO_READ_WRITE for OPTIMIZE TABLE. For engines that need a stronger lock (like MyISAM), reopen the table with MDL_SHARED_NO_READ_WRITE.
| * | | | commentsSergei Golubchik2016-05-051-5/+3
| | | | |
* | | | | various cleanupsMichael Widenius2016-06-301-1/+1
| | | | |
* | | | | MDEV-5535: Cannot reopen temporary tableNirbhay Choubey2016-06-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysqld maintains a list of TABLE objects for all temporary tables created within a session in THD. Here each table is represented by a TABLE object. A query referencing a particular temporary table for more than once, however, failed with ER_CANT_REOPEN_TABLE error because a TABLE_SHARE was allocate together with the TABLE, so temporary tables always had only one TABLE per TABLE_SHARE. This patch lift this restriction by separating TABLE and TABLE_SHARE objects and storing TABLE_SHAREs for temporary tables in a list in THD, and TABLEs in a list within their respective TABLE_SHAREs.