summaryrefslogtreecommitdiff
path: root/sql/lock.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.6 into 10.7Marko Mäkelä2022-01-121-1/+1
|\
| * Merge 10.5 into 10.6Marko Mäkelä2022-01-121-1/+1
| |\
| | * MDEV-23836: Assertion `! is_set() || m_can_overwrite_status' inRucha Deodhar2022-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Diagnostics_area::set_error_status (interrupted ALTER TABLE under LOCK) Analysis: KILL_QUERY is not ignored when local memory used exceeds maximum session memory. Hence the query proceeds, OK is sent and we end up reopening tables that are marked for reopen. During this, kill status is eventually checked and assertion failure happens during trying to send error message because OK has already been sent. Fix: Ok is already sent so statement has already executed. It is too late to give error. So ignore kill.
* | | MDEV-26352 : Add new thread states for certain WSREP scenariosJan Lindström2021-09-031-1/+4
|/ / | | | | | | | | | | | | | | This adds following new thread states: * waiting to execute in isolation - DDL is waiting to execute in TOI mode. * waiting for TOI DDL - some other statement is waiting for DDL to complete. * waiting for flow control - some statement is paused while flow control is in effect. * waiting for certification - the transaction is being certified.
* | Merge 10.5 into 10.6Marko Mäkelä2021-05-261-3/+4
|\ \ | |/
| * Merge 10.4 into 10.5Marko Mäkelä2021-05-261-3/+4
| |\
| | * MDEV-25562 Assertion `pause_seqno_.is_undefined() == false' failed in void ↵mkaruza2021-05-211-3/+4
| | | | | | | | | | | | | | | | | | | | | wsrep::server_state::resume() If pause() is not executed in galera and returns seqno = -1 we should skip resume().
* | | Add TL_FIRST_WRITE in SQL layer for determining R/WDaniel Black2021-04-081-7/+7
|/ / | | | | | | | | | | | | Use < TL_FIRST_WRITE for determining a READ transaction. Use TL_FIRST_WRITE as the relative operator replacing TL_WRITE_ALLOW_WRITE as the minimium WRITE lock type.
* | Merge branch '10.4' into 10.5Sergei Golubchik2021-02-231-7/+10
|\ \ | |/
| * Merge branch '10.3' into 10.4Sergei Golubchik2021-02-231-7/+10
| |\
| | * MDEV-24929 Server crash in thr_multi_unlock or in get_schema_tables_resultMonty2021-02-221-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.4' into 10.5Oleksandr Byelkin2020-08-041-1/+1
|\ \ \ | |/ /
| * | Merge branch '10.3' into 10.4Oleksandr Byelkin2020-08-031-1/+1
| |\ \ | | |/
| | * Merge branch '10.2' into 10.3Oleksandr Byelkin2020-08-031-1/+1
| | |\
| | | * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-1/+1
| | | |\
| | | | * Code comment spellfixesIan Gilfillan2020-07-221-1/+1
| | | | |
| | | | * imporve clang buildEugene Kosov2019-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug Maintainer mode makes all warnings errors. This patch fix warnings. Mostly about deprecated `register` keyword. Too much warnings came from Mroonga and I gave up on it.
* | | | | cleanup: ha_external_unlock() helperSergei Golubchik2020-05-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | as mentioned in f9f33b85be6 and generally to make it easier to talk about
* | | | | Merge 10.4 into 10.5Marko Mäkelä2020-04-251-4/+9
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | The functional changes of commit 5836191c8f0658d5d75484766fdcc3d838b0a5c1 (MDEV-21168) are omitted due to MDEV-742 having addressed the issue.
| * | | | MDEV-7962 wsrep_on() takes 0.14% in OLTP ROMarko Mäkelä2020-04-241-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason why we have wsrep_on() at all is that the macro WSREP(thd) depends on the definition of THD, and that is intentionally an opaque data type for InnoDB. So, we cannot avoid invoking wsrep_on(), but we can evaluate the less expensive conditions thd && WSREP_ON before calling the function. Global_read_lock: Use WSREP_NNULL(thd) instead of wsrep_on(thd) because we not only know the definition of THD but also that the pointer is not null. wsrep_open(): Use WSREP(thd) instead of wsrep_on(thd). InnoDB: Replace thd && wsrep_on(thd) with wsrep_on(thd), now that the condition has been merged to the definition of the macro wsrep_on().
* | | | | Handle errors from external_unlock & mysql_unlock_tablesMonty2020-04-191-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other things: - Handler errors from ha_maria::implict_commit - Disable DBUG in safe_mutex_lock to get trace file easier to read
* | | | | MDEV-21743 Split up SUPER privilege to smaller privilegesAlexander Barkov2020-03-101-4/+4
| | | | |
* | | | | perfschema mdl related instrumentation changesSergei Golubchik2020-03-101-7/+11
| | | | |
* | | | | perfschema memory related instrumentation changesSergei Golubchik2020-03-101-2/+3
| | | | |
* | | | | MDEV-21702 Add a data type for privilegesAlexander Barkov2020-02-111-1/+1
|/ / / /
* | | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\ \ \ \ | |/ / /
| * | | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\ \ \ | | |/ /
| | * | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\ \ | | | |/
| | | * Update FSF addressVicențiu Ciorbaru2019-05-111-1/+1
| | | |
* | | | Fixed main.flush_read_lock sporadic failureSergey Vojtovich2019-05-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | With MDEV-19384 fixed FTWRL releases HANDLER locks early, which allows concurrent threads to go. Test case may get stuck on FTWRL waiting for LOCK TABLES.
* | | | MDEV-19384 Deadlock in FTWRLMonty2019-05-061-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The deadlock happened between FTWRL under open HANDLER, LOCK TABLE and DROP DATABASE Fixed by reverting the previous fix for handler open in lock_global_read_lock() Fixed the original (wrong) test case in flush_read_lock.test to be repeatable.
* | | | Merge 10.3 into 10.4Marko Mäkelä2019-05-051-8/+3
|\ \ \ \ | |/ / /
| * | | Allocate Transaction_state_tracker staticallySergey Vojtovich2019-05-031-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | One less new/delete per connection. Part of MDEV-14984 - regression in connect performance
* | | | Fixed deadlock in main.flush_read_lockMonty2019-05-021-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | local_global_read_lock did release all HANDLER's before taking its MDL_BACKUP_FTWRL# locks. This had a potential race condition if there was a waiting LOCK TABLE for one of the freed handlers. Fixed by moving the release of HANDLER's to after the backup locks are taken. After commit 8cf7e3459 it's not anymore critical to free HANDLER's in FTWRL, but we will keep the mysql_ha_cleanup_no_free() call until 10.5 to not cause any issues with 10.4 just before it's going GA.
* | | | Fix for galera_3nodes.galera_var_dirty_reads2mkaruza2019-03-071-12/+13
| | | | | | | | | | | | | | | | Call desync_and_pause() and resync_and_resume() only if state is s_synced.
* | | | Galera4Brave Galera Crew2019-01-231-56/+20
| | | |
* | | | Added syntax and implementation for BACKUP STAGE'sMonty2018-12-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP - Changed check of Global_only_lock to also include BACKUP lock. - We store latest MDL_BACKUP_DDL lock in thd->mdl_backup_ticket to be able to downgrade lock during copy_data_between_tables()
* | | | Added new MDL_BACKUP locks for all backup stagesMonty2018-12-091-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP - Added new locks to MDL_BACKUP for all stages of backup locks and a new MDL lock needed for backup stages. - Renamed MDL_BACKUP_STMT to MDL_BACKUP_DDL - flush_tables() takes a new parameter that decides what should be flushed. - InnoDB, Aria (transactional tables with checksums), Blackhole, Federated and Federatedx tables are marked to be safe for online backup. We are using MDL_BACKUP_TRANS_DML instead of MDL_BACKUP_DML locks for these which allows any DML's to proceed for these tables during the whole backup process until BACKUP STAGE COMMIT which will block the final commit.
* | | | Acquire global read lock (MDL_BACKUP_STMT) after share is acquiredSergey Vojtovich2018-12-091-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP FLUSH TABLE table_names have changed slighty as we are now opening tables before taking the MDL lock. The difference is that FLUSH TABLE table_name will now be blocked by a table that is waiting for FTWRL. There should not be any new deadlocks as part of this change. The end result is still better in most cases as FTWRL is now only waiting for write statements to end, not for read only statements and it's not flushing tables in use from the table cache. Share will be needed to be able to determine if table supports online backup. Appropriate metadata lock type in BACKUP namespace will be acquired basing on this information. Also made pending global read lock request to be preferred victim of MDL deadlock detector. This allows us to hide some non-fatal deadlocks and make FTWRL less likely to break concurrent queries.
* | | | Combine GLOBAL and COMMIT namespaces into BACKUP namespace.Sergey Vojtovich2018-12-091-37/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP Other things: - Added printing of MDL locks to DBUG.
* | | | Optimize flush tables with read lock (FTWRL) to not wait for select'sMonty2018-12-091-0/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP The idea is that instead of waiting in close_cached_tables() for all tables to be closed, we instead call flush_tables() that does: - Flush not used objects in table cache to free memory - Collect all tables that are open - Call HA_EXTRA_FLUSH on the objects, to get them into "closed state" - Added HA_EXTRA_FLUSH support to archive and CSV - Added multi-user protection to HA_EXTRA_FLUSH in MyISAM and Aria The benefit compared to old code is: - FTWRL doesn't have to wait for long running read operations or open HANDLER's
* | | Merge 10.2 into 10.3Marko Mäkelä2018-11-061-16/+0
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | main.derived_cond_pushdown: Move all 10.3 tests to the end, trim trailing white space, and add an "End of 10.3 tests" marker. Add --sorted_result to tests where the ordering is not deterministic. main.win_percentile: Add --sorted_result to tests where the ordering is no longer deterministic.
| * | Merge 10.1 into 10.2Marko Mäkelä2018-11-061-16/+0
| |\ \ | | |/
| | * Merge branch '10.0' into 10.1Sergei Golubchik2018-10-301-16/+0
| | |\
| | | * Remove unused code.Sergey Vojtovich2018-10-191-17/+0
| | | |
| | | * MDEV-8453 Alter table not returning engine errorsSergei Golubchik2017-08-011-34/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | remove ~15 years old print_lock_error() function, use handler::print_error() instead Backport from 10.1
* | | | Add likely/unlikely to speed up executionMonty2018-05-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added to: - if (error) - Lex - sql_yacc.yy and sql_yacc_ora.yy - In header files to alloc() calls - Added thd argument to thd_net_is_killed()
* | | | Merge 10.2 into 10.3Marko Mäkelä2018-04-241-2/+2
|\ \ \ \ | |/ / /
| * | | register keyword c++17 warningEugene Kosov2018-04-241-2/+2
| | | |
* | | | Fix for MDEV-14831Monty2018-04-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-14831 CREATE OR REPLACE SEQUENCE under LOCK TABLE corrupts the sequence, causes ER_KEY_NOT_FOUND The problem was that sequence_insert didn't properly handle the case where there where there was a LOCK TABLE while creating the sequence. Fixed by opening the sequence table, for inserting the first record, in a new environment without any other open tables. Found also a bug in Locked_tables_list::reopen_tables() where the lock structure for the new tables was allocated in THD::mem_root, which causes crashes. This could cause problems with other create tables done under LOCK TABLES.