summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-14398 When innodb_encryption_rotate_key_age=0 is set,bb-10.1-mdev-14398Thirunarayanan Balathandayuthapani2018-06-128-257/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | server won't encrypt tablespaces. The following commit makes the dependency between innodb-encryption-rotate-key-age and encryption/decryption. commit 50eb40a2a8aa3af6cc271f6028f4d6d74301d030 Author: Jan Lindström <jan.lindstrom@mariadb.com> Date: Tue Mar 14 12:56:01 2017 +0200 MDEV-11738: Mariadb uses 100% of several of my 8 cpus doing nothing MDEV-11581: Mariadb starts InnoDB encryption threads when key has not changed or data scrubbing turned off Background: Key rotation is based on background threads (innodb-encryption-threads) periodically going through all tablespaces on fil_system. For each tablespace current used key version is compared to max key age (innodb-encryption-rotate-key-age). This process naturally takes CPU. Similarly, in same time need for scrubbing is investigated. Currently, key rotation is fully supported on Amazon AWS key management plugin only but InnoDB does not have knowledge what key management plugin is used. The above commit basically make use of innodb-encryption-rotate-key-age=0 to disable key rotation and background data scrubbing. It only encrypts/decrypts for the newly created table. One more issue is with above commit is that, even though the innodb_encrypt_table value is changed at run time. It doesn't affect the state of the old tablespace. Different Solution: =================== (1) Key rotation thread can iterate through tablespace list and check whether it matches with innodb_encrypt_tables parameter. If it doesn't match then do the operation based on the innodb_encrypt_tables parameter. InnoDB shouldn't iterate the fil_system->space_list again and again. It increases the CPU usage. (2) Key rotation thread should store lastly used tablespace id. If the value of innodb-encryption-rotate-key-age is set to 0 then InnoDB should start the traversion from lastly used space id. So that key rotation thread only does the encryption/decryption for newly added tablespace. (i) If lastly used tablespace id is not found or dropped then InnoDB should traverse it from system tablespace again. (3) If innodb_encrypt_tables value changed at runtime then InnoDB should traverse the tablespace from system tablespace again.
* MDEV-16416 Crash on IMPORT TABLESPACE of a ROW_FORMAT=COMPRESSED tableMarko Mäkelä2018-06-074-181/+147
| | | | | | | | | | | fil_iterate(): Invoke fil_encrypt_buf() correctly when a ROW_FORMAT=COMPRESSED table with a physical page size of innodb_page_size is being imported. Also, validate the page checksum before decryption, and reduce the scope of some variables. AbstractCallback::operator()(): Remove the parameter 'offset'. The check for it in FetchIndexRootPages::operator() was basically redundant and dead code since the previous refactoring.
* Merge 10.0 to 10.1Marko Mäkelä2018-06-066-236/+8
|\
| * MDEV-16124 fil_rename_tablespace() times out and crashes server during ↵Marko Mäkelä2018-06-056-236/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | table-rebuilding ALTER TABLE InnoDB insisted on closing the file handle before renaming a file. Renaming a file should never be a problem on POSIX systems. Also on Windows it should work if the file was opened in FILE_SHARE_DELETE mode. fil_space_t::stop_ios: Remove. We no longer need to stop file access during rename operations. fil_mutex_enter_and_prepare_for_io(): Remove the wait for stop_ios. fil_rename_tablespace(): Remove the retry logic; do not close the file handle. Remove the unused fault injection that was added along with the DATA DIRECTORY functionality (MySQL WL#5980). os_file_create_simple_func(), os_file_create_func(), os_file_create_simple_no_error_handling_func(): Include FILE_SHARE_DELETE in the share_mode. (We will still prevent multiple InnoDB instances from using the same files by not setting FILE_SHARE_WRITE.)
* | MDEV-15824 innodb_defragment=ON trumps innodb_optimize_fulltext_only=ON in ↵Marko Mäkelä2018-06-054-28/+44
| | | | | | | | | | | | | | | | OPTIMIZE TABLE ha_innobase::optimize(): If both innodb_defragment and innodb_optimize_fulltext_only are at their default settings (OFF), fall back to ALTER TABLE. Else process one or both options.
* | Add FLUSH TABLES to avoid corruption of MyISAM system tablesMarko Mäkelä2018-06-052-1/+4
| |
* | Remove dead code that was added in MDEV-5834Marko Mäkelä2018-06-0510-319/+12
| | | | | | | | | | | | | | | | ha_innobase::set_partition_owner_stats(): Remove (unused function). ha_innobase::ha_partition_stats: Remove (the variable is never read). Remove unused ut_timer functions.
* | MDEV-16303 - do not install wsrep.ini on WindowsVladislav Vaintroub2018-05-291-2/+9
| |
* | MDEV-16283 ALTER TABLE...DISCARD TABLESPACE still takes long on a large ↵Marko Mäkelä2018-05-2920-174/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buffer pool Also fixes MDEV-14727, MDEV-14491 InnoDB: Error: Waited for 5 secs for hash index ref_count (1) to drop to 0 by replacing the flawed wait logic in dict_index_remove_from_cache_low(). On DISCARD TABLESPACE, there is no need to drop the adaptive hash index. We must drop it on IMPORT TABLESPACE, and eventually on DROP TABLE or DROP INDEX. As long as the dict_index_t object remains in the cache and the table remains inaccessible, the adaptive hash index entries to orphaned pages would not do any harm. They would be dropped when buffer pool pages are reused for something else. btr_search_drop_page_hash_when_freed(), buf_LRU_drop_page_hash_batch(): Remove the parameter zip_size, and pass 0 to buf_page_get_gen(). buf_page_get_gen(): Ignore zip_size if mode==BUF_PEEK_IF_IN_POOL. buf_LRU_drop_page_hash_for_tablespace(): Drop the adaptive hash index even if the tablespace is inaccessible. buf_LRU_drop_page_hash_for_tablespace(): New global function, to drop the adaptive hash index. buf_LRU_flush_or_remove_pages(), fil_delete_tablespace(): Remove the parameter drop_ahi. dict_index_remove_from_cache_low(): Actively drop the adaptive hash index if entries exist. This should prevent InnoDB hangs on DROP TABLE or DROP INDEX. row_import_for_mysql(): Drop any adaptive hash index entries for the table. row_drop_table_for_mysql(): Drop any adaptive hash index for the table, except if the table resides in the system tablespace. (DISCARD TABLESPACE does not apply to the system tablespace, and we do no want to drop the adaptive hash index for other tables than the one that is being dropped.) row_truncate_table_for_mysql(): Drop any adaptive hash index entries for the table, except if the table resides in the system tablespace.
* | Fix type mismatchMarko Mäkelä2018-05-291-1/+1
| |
* | MDEV-14589 InnoDB should not lock a delete-marked recordMarko Mäkelä2018-05-294-28/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the transaction isolation level is SERIALIZABLE, or when a locking read is performed in the REPEATABLE READ isolation level, InnoDB must lock delete-marked records in order to prevent another transaction from inserting something. However, at READ UNCOMMITTED or READ COMMITTED isolation level or when the parameter innodb_locks_unsafe_for_binlog is set, the repeatability of the reads does not matter, and there is no need to lock any records. row_search_for_mysql(): Skip locks on delete-marked committed records upfront, instead of invoking row_unlock_for_mysql() afterwards. The unlocking never worked for secondary index records.
* | MDEV-10679 Crash in performance schema and partitioning with discoveryMonty2018-05-266-6/+33
| | | | | | | | | | | | | | Crash happened because in discover, table->work_part_info was not properly reset before execution. Fixed by resetting before calling execute alter table, create table or mysql_create_frm_image.
* | Avoid warnings in String::copy when copying string on itself (ok to do)Monty2018-05-261-1/+10
| |
* | Fixed compiler warningsMonty2018-05-262-46/+43
| | | | | | | | When merging this with 10.2 and later, one can just use the 10.2 or later code
* | MDEV-16093 Memory leak with triggersMonty2018-05-263-2/+31
| | | | | | | | | | Problem was that blob memory allocated in Table_trigger_list was not properly freed
* | embedded use-after-free ASAN errorSergei Golubchik2018-05-251-0/+2
| | | | | | | | | | | | Close MYSQL (and destroy THD) in the same thread where it was used, because THD embeds MDL_context, that owns some LF_PINS, that remember a pointer to my_thread_var->stack_ends_here.
* | Add a missing dependency to a testMarko Mäkelä2018-05-241-0/+1
| |
* | Merge 10.0 into 10.1Marko Mäkelä2018-05-242-18/+38
|\ \ | |/
| * MDEV-16267 Wrong INFORMATION_SCHEMA.INNODB_BUFFER_PAGE.TABLE_NAMEMarko Mäkelä2018-05-242-18/+38
| | | | | | | | | | i_s_innodb_buffer_page_fill(), i_s_innodb_buf_page_lru_fill(): Only invoke Field::set_notnull() if the index was found.
* | Merge remote-tracking branch 'origin/10.0' into 10.1Monty2018-05-2431-131/+606
|\ \ | |/
| * Fixed ASAN heap-use-after-free handler::ha_index_or_rnd_endMonty2018-05-233-1/+26
| | | | | | | | | | | | | | | | MDEV-16123 ASAN heap-use-after-free handler::ha_index_or_rnd_end MDEV-13828 Segmentation fault on RENAME TABLE Problem was that destructor called methods for closed table. Fixed by removing code in destructor.
| * MDEV-15308 Assertion `ha_alter_info->alter_info->drop_list.elementsbb-10.0-montyMonty2018-05-223-4/+118
| | | | | | | | | | Problem was that handle_if_exists_options() didn't correct alter_info->flags when things was removed from the list.
| * MDEV-16229 Replication aborts with ER_VIEW_SELECT_TMPTABLE after half-failed ↵Monty2018-05-228-7/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RENAME Problem was that detection of temporary tables was all wrong for RENAME TABLE. (Temporary tables where opened by top level call to open_temporary_tables(), which can't detect if a temporary table was renamed to something and then reused). Fixed by adding proper parsing of rename list to check against the current name of a table at each rename stage. Also change do_rename_temporary() to check against the current state of temporary tables, not according to the state of start of RENAME TABLE.
| * Fixes for Aria transaction handling with lock tablesMonty2018-05-2217-120/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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())
* | MDEV-10259 mysqld crash with certain statement length and...sachin2018-05-225-3/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | order with Galera and encrypt-tmp-files=1 Problem:- If trans_cache (IO_CACHE) uses encrypted tmp file then on next DML server will crash. Case:- Lets take a case , we have a table t1 , We try to do 2 inserts in t1 1. A really long insert so that trans_cache has to use temp_file 2. Just a small insert Analysis:- Actually server crashes from inside of galera library. /lib64/libc.so.6(abort+0x175)[0x7fb5ba779dc5] /usr/lib64/galera/libgalera_smm.so(_ZN6galera3FSMINS_9TrxHandle5State... mysys/stacktrace.c:247(my_print_stacktrace)[0x7fb5a714940e] sql/signal_handler.cc:160(handle_fatal_signal)[0x7fb5a715c1bd] sql/wsrep_hton.cc:257(wsrep_rollback)[0x7fb5bcce923a] sql/wsrep_hton.cc:268(wsrep_rollback)[0x7fb5bcce9368] sql/handler.cc:1658(ha_rollback_trans(THD*, bool))[0x7fb5bcd4f41a] sql/handler.cc:1483(ha_commit_trans(THD*, bool))[0x7fb5bcd4f804] but actual issue is not in galera but in mariadb, because for 2nd insert we should never call rollback. We are calling rollback because log_and_order fails it fails because write_cache fails , It fails because after reinit_io_cache(trans_cache) , my_b_bytes_in_cache says 0 so we look into tmp_file for data , which is obviously wrong since temp was used for previous insert and it no longer exist. wsrep_write_cache_inc() reads the IO_CACHE in a loop, filling it with my_b_fill() until it returns "0 bytes read". Later MYSQL_BIN_LOG::write_cache() does the same. wsrep_write_cache_inc() assumes that reading a zero bytes past EOF leaves the old data in the cache Solution:- There is two issue in my_b_encr_read 1st we should never equal read_end to info->buffer. I mean this does not make sense read_end should always point to end of buffer. 2nd For most of the case(apart from async IO_CACHE) info->pos_in_file should be equal to info->buffer position wrt to temp file , since in this case we are not changing info->buffer it should remain unchanged.
* | MDEV-12900: spider tests failed in buildbot with valgrindJacob Mathew2018-05-213-83/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The failures with valgrind occur as a result of Spider sometimes using the wrong transaction for operations in background threads that send requests to the data nodes. The use of the wrong transaction caused the networking to the data nodes to use the wrong thread in some cases. Valgrind eventually detects this when such a thread is destroyed before it is used to disconnect from the data node by that wrong transaction when it is freed. I have fixed the problem by correcting the transaction used in each of these cases. Author: Jacob Mathew. Reviewer: Kentoku Shiba. Cherry-Picked: Commit afe5a51 on branch 10.2
* | Merge branch '10.0' into 10.1Sergei Golubchik2018-05-1928-110/+333
|\ \ | |/
| * Merge branch '5.5' into 10.0Sergei Golubchik2018-05-1914-79/+145
| |\
| | * MDEV-16220 MTR - do not pass UTF8 on the command line for mysql client.Vladislav Vaintroub2018-05-186-23/+68
| | | | | | | | | | | | | | | | | | | | | It should work ok on all Unixes, but on Windows ,only worked by accident in the past, with client not being Unicode safe. It stopped working with Visual Studio 2017 15.7 update now.
| | * MDEV-15318 CREATE .. SELECT VALUES produces invalid table structureSergei Golubchik2018-05-173-4/+23
| | | | | | | | | | | | | | | | | | When Item_insert_value needs a dummy field, use zero-length Field_string, not Field_null. The latter isn't compatible with CREATE ... SELECT.
| | * (almost) sane core handling in mtrSergey Vojtovich2018-05-161-36/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Analyze core independently of max-save-datadir and max-save-core setting. Increment $num_saved_cores only if core was actually saved. "Move any core files from e.g. mysqltest" independently of max-save-datadir setting. Note: it may overwrite core from mysqld, which might not be desired (it did work this way even before).
| | * MDEV-654 Assertion `share->now_transactional' failed in flush_log_for_bitmap ↵Monty2018-05-152-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | on concurrent workload with Aria tables Problem was that we the bitmap needs to be flushed before disabling logging of redo entires, as writing the bitmap to disk by background checkpoint may cause redo entries.
| * | MDEV-11129 CREATE OR REPLACE TABLE t1 AS SELECT spfunc() crashes if spfunc() ↵Sergei Golubchik2018-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | references t1 fix a typo that broke the main.view test followup for ef295c31e3d
| * | MDEV-11129 CREATE OR REPLACE TABLE t1 AS SELECT spfunc() crashes if spfunc() ↵Monty2018-05-167-22/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | references t1 Fixed by extending unique_table() with a flag to not allow usage of the replaced table. I also cleaned up find_dup_table() to not use goto next. I also added more comments to the code in find_dup_table()
| * | Fix that FLUSH TABLES FOR EXPORT also works for Aria tables.Monty2018-05-165-1/+43
| | | | | | | | | | | | - Added missing test case for MyISAM
| * | MDEV-14943 Alter table ORDER BY bugMonty2018-05-155-8/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem was that if copy_data_between_tables() didn't do proper clean up in case of failures: - copy object was not properly freed - end_bulk_insert() was not called - mysql_trans_prepare_alter_copy_data() set THD->transaction.on to false which was not properly restored The last part caused a crash in Aria as Aria depends on that THD is correct. Other things: - Reset info->switched_transactional after usage (safety) - Reset bulk_insert_single_undo (safety)
* | | MDEV-7914: spider/bg.ha, spider/bg.ha_part crash server sporadically in buildbotJacob Mathew2018-05-184-36/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crash occurs when a thread that is closing its connection attempts to access Spider transaction information when another thread has freed that memory while processing Spider plugin deinit. This occurs because Spider does not adjust the plugin's reference count when it sets a transaction information pointer for the plugin. The fix I implemented changes the way Spider sets the transaction information pointer to use thd_set_ha_data() so that Spider's plugin reference counter is adjusted as well. Author: Jacob Mathew. Reviewer: Kentoku Shiba. Merged From: Commit ab9d420 on branch 10.2
* | | MDEV-15347: Valgrind or ASAN errors in mysql_make_view on query from ↵Oleksandr Byelkin2018-05-1511-34/+60
| | | | | | | | | | | | | | | | | | | | | information_schema Make each lex pointing to statement lex instead of global pointer in THD (no need store and restore the global pointer and put it on SP stack).
* | | Merge 10.0 into 10.1Marko Mäkelä2018-05-117-23/+124
|\ \ \ | |/ /
| * | Bug #26334149 - MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE ORPHANED ↵Sachin Agarwal2018-05-113-2/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DUE TO RENAME TABLE Problem: When FTS index is added into a table which doesn't have 'FTS_DOC_ID' column, Innodb rebuilds table to add column 'FTS_DOC_ID'. when this FTS index is dropped from this table. Innodb doesn't not rebuild table to remove 'FTS_DOC_ID' column and deletes FTS index auxiliary tables. But it doesn't delete FTS common auxiliary tables. Later when the database having this table is renamed, FTS auxiliary tables are not renamed because table's flags2 (dict_table_t.flags2) has been resetted for DICT_TF2_FTS flag during FTS index drop operation. Now when we drop old database, it leads to an assert. Fix: During renaming of FTS auxiliary tables, ORed a condition to check if table has DICT_TF2_FTS_HAS_DOC_ID flag set. RB: 18769 Reviewed by : Jimmy.Yang@oracle.com
| * | Bug #27041445 SERVER ABORTS IF FTS_DOC_ID EXCEEDS FTS_DOC_ID_MAX_STEPThirunarayanan Balathandayuthapani2018-05-113-7/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======= Multiple insert statement in table contains FULLTEXT KEY and a FTS_DOC_ID column aborts the server if the FTS_DOC_ID exceeds FTS_DOC_ID_MAX_STEP. Solution: ======== Remove the exception for first committed insert statement. Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com> RB: 18023
| * | Merge 5.5 into 10.0 (no changes)Marko Mäkelä2018-05-110-0/+0
| |\ \ | | |/
| | * MDEV-15480 Audit plugin does not respect QUERY_DML for audit plugin.Alexey Botchkov2018-05-103-4/+44
| | | | | | | | | | | | QUERY_DML_NO_SELECT flag added.
| * | Remove a redundant condition added by the 5.6.40 mergeMarko Mäkelä2018-05-112-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | When Oracle fixed MDEV-13899 in their own way, they moved the condition to the only caller of PageConverter::update_records(). Thus, the merge of 5.6.40 into MariaDB added a redundant condition. PageConverter::update_records(): Move the page_is_leaf() condition to the only caller, PageConverter::update_index_page().
| * | MDEV-15480 Audit plugin does not respect QUERY_DML for audit plugin.Alexey Botchkov2018-05-103-4/+44
| | | | | | | | | | | | QUERY_DML_NO_SELECT flag added.
* | | MDEV-15480 Audit plugin does not respect QUERY_DML for audit plugin.Alexey Botchkov2018-05-103-4/+44
| | | | | | | | | | | | QUERY_DML_NO_SELECT flag added.
* | | bump the VERSIONDaniel Bartholomew2018-05-091-1/+1
| | |
* | | install disks plugin on debianSergei Golubchik2018-05-091-0/+1
| | |
* | | Merge 10.0 into 10.1Marko Mäkelä2018-05-094-4/+8
|\ \ \ | |/ /
| * | MDEV-16119 InnoDB lock->index refers to a freed object after failed ADD INDEXMarko Mäkelä2018-05-094-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is hard to repeat, and I failed to create a deterministic test case. Online index creation creates stubs for to-be-created indexes. If index creation fails, we could remove these stubs while locks exist in the indexes. (This would require that the index creation was completed, and a concurrent DML operation acquired a lock on a record in the uncommitted index. If a duplicate key error occurs in an uncommitted index, the error will be reported for the CREATE UNIQUE INDEX, not for the DML operation that tried to insert the duplicate.) dict_table_try_drop_aborted(), row_merge_drop_indexes(): If transactional locks exist on the table, keep the table->indexes intact.