summaryrefslogtreecommitdiff
path: root/sql/lock.cc
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | | | Changed database, tablename and alias to be LEX_CSTRINGMonty2018-01-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done in, among other things: - thd->db and thd->db_length - TABLE_LIST tablename, db, alias and schema_name - Audit plugin database name - lex->db - All db and table names in Alter_table_ctx - st_select_lex db Other things: - Changed a lot of functions to take const LEX_CSTRING* as argument for db, table_name and alias. See init_one_table() as an example. - Changed some function arguments from LEX_CSTRING to const LEX_CSTRING - Changed some lists from LEX_STRING to LEX_CSTRING - threads_mysql.result changed because process list_db wasn't always correctly updated - New append_identifier() function that takes LEX_CSTRING* as arguments - Added new element tmp_buff to Alter_table_ctx to separate temp name handling from temporary space - Ensure we store the length after my_casedn_str() of table/db names - Removed not used version of rename_table_in_stat_tables() - Changed Natural_join_column::table_name and db_name() to never return NULL (used for print) - thd->get_db() now returns db as a printable string (thd->db.str or "")
* | | | Initialize MYSQL_LOCK->flags variablemariadb-10.3.3Monty2017-12-221-0/+1
| | | | | | | | | | | | | | | | This could crash in mysql_unlock_tables in servers compiled with DBUG
* | | | MDEV 13679 Enabled sequences to be used in DEFAULTMonty2017-12-221-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other changes done to get this to work: - Added 'internal_tables' to TABLE object to list which sequence tables is needed to use the table. - Mark any expression using DEFAULT() with LEX->default_used. This is needed when deciding if we should open internal sequence tables when a table is opened (we don't need to open sequence tables if the main table is only used with SELECT). - Create_and_open_temporary_table() can now also open all internal sequence tables. - Added option MYSQL_LOCK_USE_MALLOC to mysql_lock_tables() to force memory allocation to be used with malloc instead of memroot. - Added flag to MYSQL_LOCK to remember if allocation was done with malloc or memroot (makes code simpler and safer). - init_one_table_for_prelocking() now takes argument for what lock to use instead of it's a routine or something else. - Renamed prelocking placeholders to make them more understandable as they are now used in more code. - Changed test in check_lock_and_start_stmt() if found table has correct locks. The old test didn't work for tables that has lock TL_WRITE_ALLOW_WRITE, which is what sequence tables are using. - Added VCOL_NOT_VIRTUAL option to ensure that sequence functions can't be used with virtual columns - More sequence tests
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-11-101-1/+5
|\ \ \ \
| * | | | Add more execution stages (commit, rollback, etc)Monty2017-11-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done to get more information about where time is spent. Now we can get proper timing for time spent in commit, rollback, binlog write etc. Following stages was added: - Commit - Commit_implicit - Rollback - Rollback implicit - Binlog write - Init for update - This is used instead of "Init" for insert, update and delete. - Staring cleanup Following stages where changed: - "Unlocking tables" stage reset stage to previous stage at end - "binlog write" stage resets stage to previous stage at end - "end" -> "end of update loop" - "cleaning up" -> "Reset for next command" - Added stage_searching_rows_for_update when searching for rows to be deleted. Other things: - Renamed all stages to start with big letter (before there was no consitency) - Increased performance_schema_max_stage_classes from 150 to 160. - Most of the test changes in performance schema comes from renaming of stages. - Removed duplicate output of variables and inital state in a lot of performance schema tests. This was done to make it easier to change a default value for a performance variable without affecting all tests. - Added start_server_variables.test to check configuration - Removed some duplicate "closing tables" stages - Updated position for "stage_init_update" and "stage_updating" for delete, insert and update to be just before update loop (for more exact timing). - Don't set "Checking permissions" twice in a row. - Remove stage_end stage from creating views (not done for create table either). - Updated default performance history size from 10 to 20 because of new stages - Ensure that ps_enabled is correct (to be used in a later patch)
* | | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-10-041-1/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into bb-10.2-extMarko Mäkelä2017-10-041-1/+1
| |\ \ \ \ | | |/ / /
| | * | | Fix several truncation and formatting warnings.Vladislav Vaintroub2017-10-031-1/+1
| | | | |
* | | | | Added DBUG_ASSERT_AS_PRINTF compile flagMonty2017-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If compiling a non DBUG binary with -DDBUG_ASSERT_AS_PRINTF asserts will be changed to printf + stack trace (of stack trace are enabled). - Changed #ifndef DBUG_OFF to #ifdef DBUG_ASSERT_EXISTS for those DBUG_OFF that was just used to enable assert - Assert checking that could greatly impact performance where changed to DBUG_ASSERT_SLOW which is not affected by DBUG_ASSERT_AS_PRINTF - Added one extra option to my_print_stacktrace() to get more silent in case of stack trace printing as part of assert.
* | | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-1/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-06-151-0/+3
|\ \ \ \ | |/ / /