summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-12-128-16/+83
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2018-12-125-9/+74
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.1 into 10.2Marko Mäkelä2018-12-125-9/+74
| | |\ \ \ | | | |/ /
| | | * | Merge 10.0 into 10.1Marko Mäkelä2018-12-125-9/+74
| | | |\ \ | | | | |/
| | | | * MDEV-17032: Estimates are higher for partitions of a table with ↵Varun Gupta2018-12-075-9/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | @@use_stat_tables= PREFERABLY The problem here is EITS statistics does not calculate statistics for the partitions of the table. So a temporary solution would be to not read EITS statistics for partitioned tables. Also disabling reading of EITS for columns that participate in the partition list of a table.
| * | | | fix handler test failures on s390xSergei Golubchik2018-12-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | keyinfo->name is a LEX_CSTRING also, fix the location comment (that applied to ext_key_part_map)
| * | | | MDEV-17778: Alter table leads to a truncation warning with ANALYZE commandVarun Gupta2018-12-101-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alter statement changed the THD structure by setting the value to FIELD_CHECK_WARN and then not resetting it back. This led ANALYZE to throw a warning which previously it didn't.
* | | | | MDEV-17968 Error 174 "Fatal error during initialization of handler" from ↵Alexander Barkov2018-12-121-3/+18
| | | | | | | | | | | | | | | | | | | | storage engine Aria upon DELETE from partitioned table
* | | | | --echo #Alexander Barkov2018-12-124-1/+81
| | | | | | | | | | | | | | | | | | | | | | | | | --echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY --echo #
* | | | | MDEV-17658 change the structure of mysql.user tableSergei Golubchik2018-12-122-56/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement User_table_json. Fix scripts to use mysql.global_priv. Fix tests.
* | | | | json helpersSergei Golubchik2018-12-121-7/+1
| | | | |
* | | | | MDEV-17658 change the structure of mysql.user tableSergei Golubchik2018-12-121-57/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce User_table_tabular(mysql.user) and User_table_json(mysql.global_priv). The latter is not implemented. Automatic fallback to the old implementation works. Results change because privilege tables are opened in a different order now.
* | | | | cleanup: simplify opening of priv tablesSergei Golubchik2018-12-123-342/+189
| | | | | | | | | | | | | | | | | | | | | | | | | prepare TABLE_LIST in a loop and just before opening don't store TABLE_LIST inside Grant_table_base.
* | | | | cleanup: refactor grant table classes in sql_acl.ccSergei Golubchik2018-12-122-513/+451
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | move all backward compatibility related code into User_table, the caller should not know or care anymore. Other tables (Db_table, etc) are *not* refactored. For consistency with other updates, setting a default role no longer errors out when the mysql.user table is too old.
* | | | | fix the test for the empty password hash stringSergei Golubchik2018-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | because the first byte of a _binary hash_ can be 0x00 too. This fixes main.connect test on centos73-ppc64
* | | | | mysqld: ignore SIGHUP sent by the kernelSergei Golubchik2018-12-121-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SIGHUP causes debug info in the error log and reload of logs/privileges/tables/etc. The server should only do it when a user intentionally sends SUGHUP, not when a parent terminal gets disconnected or something. In particular, not ignoring kernel SIGHUP causes FLUSH PRIVILEGES at some random point during non-systemd Debian upgrades (Debian restarts mysqld, debian-start script runs mysql_upgrade in the background, postinit script ends and kernel sends SIGHUP to all background processes it has started). And during mysql_upgrade privilege tables aren't necessarily ready to be reloaded.
* | | | | simplify usage of logger.set_handlers()Sergei Golubchik2018-12-121-15/+8
| | | | |
* | | | | MDEV-5313 Improving audit api.Alexey Botchkov2018-12-122-1/+31
| | | | | | | | | | | | | | | | | | | | Service added to handle json.
* | | | | Fixed main.create-big failureSergey Vojtovich2018-12-102-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After MDEV-17772 table existence check is performed much earlier, so create_table_select_before_check_if_exists debug sync point is not reachable when table exists. Moved debug sync point to appropriate place.
* | | | | MDEV-17946 : Unsorted acl_dbs after RENAME USERVladislav Vaintroub2018-12-101-0/+2
| | | | |
* | | | | MDEV-13995 MAX(timestamp) returns a wrong result near DST changeAlexander Barkov2018-12-1018-16/+1275
| | | | |
* | | | | Cleanup: Datetime() constructors accepting Longlong_hybrid/Sec6 do not need THDAlexander Barkov2018-12-102-7/+7
| | | | | | | | | | | | | | | | | | | | Removing the unused THD* parameter.
* | | | | Moved early check for table existance to mysql_execute_command()Sergey Vojtovich2018-12-093-65/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-17772 - 3 way lock : ALTER, MDL, BACKUP STAGE BLOCK_DDL While waiting for a (potentially long) RO transaction or SELECT, DDL and LOCK TABLES ... WRITE hold protection against FTWRL and BACKUP STAGE. This effectively makes FTWRL/BACKUP STAGE indirectly wait for this RO transaction or SELECT to finish. Which is not great, as otherwise we could do something useful meanwhile. With this patch BACKUP lock is attempted to be acquired after TABLE/SCHEMA locks. If this attempt fails, TABLE/SCHEMA locks gets released and we start waiting for BACKUP lock. When wait finishes, BACKUP lock is released (to avoid deadlocks) and we attempt to acquire all locks once again. Other changes: - Take MDL lock before testing if table exists as part of CREATE TABLE ... IF EXISTS. This change was an effect of changes in lock_table_name and removes an inconsistency where one could get different error messages from CREATE TABLE .. IF EXISTS depending on active mdl locks. One effect of this change is that we don't binary log CREATE TABLE IF EXISTS if the table exists. This was done because old code was sometimes behaving inconsistenly (it was logged some time and not other times) and sending the query to the slave could make the slave even more inconsistent as there is not guarantee that the new table will have the same definition as the old table on the master.
* | | | | Added syntax and implementation for BACKUP STAGE'sMonty2018-12-0921-34/+518
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0912-103/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Honor lock_wait_timeout when updating stats tablesMonty2018-12-093-34/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Call delete_statistics_tables() after lock_table_names in drop tables. This avoids a deadlock issue with FTWRL and future backup locks. - Added some missing clear_error() - Ensure we don't clear error caused by the caller - Updated function comments
* | | | | Simplify test for updateable TABLE_CATEGORY'sMonty2018-12-093-28/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Re-numbered enum_table_category to make some tests easier - Moved TABLE_CATEGORY_INFORMATION to be first CATEGORY of virtual tables - Don't take MDL locks for not updateable table category's
* | | | | Acquire global read lock (MDL_BACKUP_STMT) after share is acquiredSergey Vojtovich2018-12-094-64/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0912-162/+314
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP Other things: - Added printing of MDL locks to DBUG.
* | | | | Changed FLUSH TABLES to not change share versionMonty2018-12-094-146/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP Originally both table metadata lock and global read lock protection were acquired before getting TABLE from table cache. This will be reordered in a future commit with MDL_BACKUP_XXX locks so that we first take table metadata lock, then get TABLE from table cache, then acquire analogue of global read lock. This patch both simplifies FLUSH TABLES code, makes FLUSH TABLES to lock less and also enables FLUSH TABLES code to be used with backup locks. The usage of FLUSH TABLES changes slightly: - FLUSH TABLES without any arguments will now only close not used tables and tables locked by the FLUSH TABLES connection. All not used table shares will be closed. Tables locked by the FLUSH TABLES connection will be reopened and re-locked after all others has stoped using the table (as before). If there was no locked tables, then FLUSH TABLES is instant and will not cause any waits. FLUSH TABLES will not wait for any in use table. - FLUSH TABLES with a table list, will ensure that the tables are closed before statement returns. The code is now only using MDL locks and not table share versions, which simplices the code greatly. One visible change is that the server will wait for the end of the transaction that are using the tables. Before FLUSH TABLES only waited for the statements to end. Signed-off-by: Monty <monty@mariadb.org>
* | | | | Fixed race condition between flush tables and insert delayedMonty2018-12-091-28/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FLUSH TABLES kills all insert delayed treads. If this happens at same time as a newly started insert delayed query, the insert may fail with either and error ("Query interrupted") or the row may be lost. This patch fixes this by changing a failed attempt of get_delay_table() to convert the query to use a normal insert. The test case for this patch can be found in the FLUSH TABLES commit after this one.
* | | | | Optimize flush tables with read lock (FTWRL) to not wait for select'sMonty2018-12-099-31/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | Added backup handler callsMonty2018-12-092-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of MDEV-5336 Implement LOCK FOR BACKUP Added support for backup calls in Aria to protect removal of redo logs.
* | | | | Fixed that CREATE TABLE code used the right create_infoMonty2018-12-092-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The old code used the original create_info from lex, not the new one that includes more information (like OPT_OR_REPLACE). The bug was not discovered as the code in lock_table_named() only checked for OPT_OR_REPLACE in case of timeout errors. As lock_table_names will be fixed as part of BACKUP STAGE's, there is no changes in lock_table_names() in this commit. - Removed also the 'temporary' copy of statement flags to thd for lock_table_names()
* | | | | Simple cleanups (no logic changes)Monty2018-12-0910-73/+48
| | | | |
* | | | | MDEV-17255: New optimizer defaults and ANALYZE TABLEVarun Gupta2018-12-094-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added to new values to the server variable use_stat_tables. The values are COMPLEMENTARY_FOR_QUERIES and PREFERABLY_FOR_QUERIES. Both these values don't allow to collect EITS for queries like analyze table t1; To collect EITS we would need to use the syntax with persistent like analyze table t1 persistent for columns (col1,col2...) index (idx1, idx2...) / ALL Changing the default value from NEVER to PREFERABLY_FOR_QUERIES.
* | | | | MDEV-15253: Default optimizer setting changes for MariaDB 10.4Varun Gupta2018-12-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | use_stat_tables= PREFERABLY optimizer_use_condition_selectivity= 4
* | | | | MDEV-17928 Conversion from TIMESTAMP to VARCHAR SP variables does not work ↵Alexander Barkov2018-12-085-12/+21
| | | | | | | | | | | | | | | | | | | | well on fractional digits
* | | | | Fix Win64 buildVladislav Vaintroub2018-12-081-7/+7
| | | | |
* | | | | MDEV-17932 : assertion in multi RENAME USER command.Vladislav Vaintroub2018-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort acl_users inside the mysql_rename_user()'s loop, after every successful iteration. This is needed because on the next loop's iteration find_user_exact() is used, which requires correct sorting by name.
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-12-081-9/+9
|\ \ \ \ \ | |/ / / /
| * | | | Fix the 64-bit Windows buildMarko Mäkelä2018-12-081-2/+2
| | | | |
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-12-073-75/+86
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2018-12-073-65/+76
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.1 into 10.2Marko Mäkelä2018-12-073-64/+75
| | |\ \ \ | | | |/ /
| | | * | Merge branch '10.0' into 10.1Sergei Golubchik2018-12-063-64/+80
| | | |\ \ | | | | |/
| | | | * MDEV-17898 FLUSH PRIVILEGES crashes server with segfaultSergei Golubchik2018-12-061-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | merge_role_db_privileges() was remembering pointers into Dynamic_array acl_dbs, and later was using them, while pushing more elements into the array. But pushing can cause realloc, and it can invalidate all pointers. Fix: remember and use indexes of elements, not pointers.
| | | | * correct order of arguments for Dynamic_array<>::CMP_FUNC2Sergei Golubchik2018-12-061-1/+1
| | | | |
| | | | * cleanup: DYNAMIC_ARRAY -> Dynamic_array<ACL_DB> acl_dbsSergei Golubchik2018-12-062-42/+48
| | | | |
| | | | * MDEV-17734: AddressSanitizer: use-after-poison in ↵Varun Gupta2018-11-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | create_key_parts_for_pseudo_indexes In this case we were trying to access memory for key_parts which we did not assign for a fields because it did not any EITS statistics. The check if EITS statistics for a column is avaialable or not was missing.