summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-5244: Make extended_keys=ON by default in 10.0Sergey Petrunya2014-02-251-0/+1
| | | | | | | | | - Change the default flag value to ON. - Update the testcases to be run extended_keys=ON: = trivial test result updates = If extended_keys setting makes a difference for a testcase, run the testcase with extended_keys=off. There were only a few such cases - Update to vcol_select_innodb looks like a worse plan but it will be gone in 10.0.
* Backport from 10.0 to 10.0-base the following:Sergey Petrunya2014-02-121-11/+29
| | | | | | | | | | | | revision-id: psergey@askmonty.org-20140204092710-2yt5ysa5ej3l2c03 MDEV-5606: range optimizer: "x < y" is sargable, while "y > x" is not Port to mariadb-1.0 the following fix from mysql-5.6: Revision ID: jorgen.loland@oracle.com-20120314131055-ml54x9deueqfsff4 BUG#13701206: WHERE A>=B DOES NOT GIVE SAME EXECUTION PLAN AS WHERE B<=A (RANGE OPTIMIZER) that fix didn't have a public testcase, so I created one.
* Fixed bug mdev-5630.Igor Babaev2014-02-111-0/+5
| | | | | | The function calculate_cond_selectivity_for_table() must consider the case when the key range tree returned by the call of get_mm_tree() is of the type SEL_TREE::ALWAYS.
* MDEV-4937: sql_slave_skip_counter does not work with GTIDunknown2014-02-114-1/+30
| | | | | | | | | | | | | | As a side-effect of purge_relay_logs(), sql_slave_skip_counter was silently ignored in GTID mode. But sql_slave_skip_counter in fact is not a good match with GTID. And it is not really needed either, as users can explicitly set @@gtid_slave_pos to skip specific GTIDs, in a way that matches well how GTID replication works. So with this patch, we give an error on attempts to set sql_slave_skip_counter when using GTID, with a suggestion to use gtid_slave_pos instead, if needed.
* Merge of MDEV-4984, MDEV-4726, and MDEV-5636 into 10.0-base.unknown2014-02-1018-48/+808
|\ | | | | | | | | | | | | MDEV-4984: Implement MASTER_GTID_WAIT() and @@LAST_GTID. MDEV-4726: Race in mysql-test/suite/rpl/t/rpl_gtid_stop_start.test MDEV-5636: Deadlock in RESET MASTER
| * MDEV-5636: Deadlock in RESET MASTERunknown2014-02-092-12/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is a deadlock between MYSQL_BIN_LOG::reset_logs() and MYSQL_BIN_LOG::mark_xid_done(). The former takes LOCK_log and waits for the latter to complete. But the latter also tries to take LOCK_log; this can lead to a deadlock. There was already code that tries to deal with this, with the flag reset_master_pending. However, there was still a small opportunity for deadlock, when an previous mark_xid_done() is still running when reset_logs() is called and is at the precise point where it first releases LOCK_xid_list and then re-aquires both LOCK_log and LOCK_xid_list. Solve by setting reset_master_pending in reset_logs() before taking LOCK_log. And also count how many invocations of LOCK_xid_list are in the progress of releasing and re-aquiring locks, and in reset_logs() wait for that number to drop to zero after setting reset_master_pending and before taking LOCK_log.
| * MDEV-4984: Implement MASTER_GTID_WAIT() and @@LAST_GTID.unknown2014-02-082-201/+242
| | | | | | | | | | | | | | | | Rewrite the gtid_waiting::wait_for_gtid() function. The code was rubbish (and buggy). Now the logic is much clearer. Also fix a missing slave sync that could cause test failure.
| * MDEV-4984: Implement MASTER_GTID_WAIT() and @@LAST_GTID.unknown2014-02-081-5/+5
| | | | | | | | Couple of small fixes following buildbot testing.
| * MDEV-4984: Implement MASTER_GTID_WAIT() and @@LAST_GTID.unknown2014-02-0717-36/+743
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MASTER_GTID_WAIT() is similar to MASTER_POS_WAIT(), but works with a GTID position rather than an old-style filename/offset. @@LAST_GTID gives the GTID assigned to the last transaction written into the binlog. Together, the two can be used by applications to obtain the GTID of an update on the master, and then do a MASTER_GTID_WAIT() for that position on any read slave where it is important to get results that are caught up with the master at least to the point of the update. The implementation of MASTER_GTID_WAIT() is implemented in a way that tries to minimise the performance impact on the SQL threads, even in the presense of many waiters on single GTID positions (as from @@LAST_GTID).
* | MDEV-5509: Seconds_behind_master incorrect in parallel replicationunknown2014-01-085-13/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was a race between the SQL driver thread and the worker threads. The SQL driver thread would set rli->last_master_timestamp to zero to mark that it has caught up with the master, while the worker threads would set it to the timestamp of the executed event. This can happen out-of-order in parallel replication, causing the "caught up" status to be overwritten and Seconds_Behind_Master to wrongly grow when the slave is idle. To fix, introduce a separate flag rli->sql_thread_caught_up to mark that the SQL driver thread is caught up. This avoids issues with worker threads overwriting the SQL driver thread status. In parallel replication, we then make SHOW SLAVE STATUS check in addition that all worker threads are idle before showing Seconds_Behind_Master as 0 due to slave idle.
* | merge 5.5->10.0-baseunknown2014-02-051-1/+1
|\ \
| * \ merge of MDEV-5369 (5.3->5.5)unknown2014-01-291-1/+1
| |\ \
| | * | MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of PS with LEFT ↵unknown2014-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | JOIN, TEMPTABLE view Set of JOIN_TYPE_OUTER made only once to avoid interference with optimization joins which made only once per query.
* | | | 5.5 mergeSergei Golubchik2014-02-0145-375/+619
|\ \ \ \ | |/ / / | | | / | |_|/ |/| |
| * | MDEV-5345 - Deadlock between mysql_change_user(), SHOW VARIABLES andSergey Vojtovich2014-01-282-79/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | INSTALL PLUGIN There was mixed lock order between LOCK_plugin, LOCK_global_system_variables and LOCK_system_variables_hash. This patch ensures that write-lock on LOCK_system_variables_hash doesn't intersect with LOCK_plugin. Fixed by moving initialization/deinitialization of plugin options from plugin_add()/plugin_del() to plugin_initialize()/plugin_deinitalize(). So that plugin options are handled without protection of LOCK_plugin.
| * | merge 5.3 -> 5.5Alexander Barkov2014-01-283-10/+3
| |\ \ | | |/
| | * MDEV-5506 safe_mutex: Trying to lock unitialized mutex at safemalloc.cAlexander Barkov2014-01-284-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | on server shutdown after SELECT with CONVERT_TZ It's wrong to return my_empty_string from val_str(). Removing my_empty_string. Using make_empty_result() instead.
| * | MDEV-5576 ALTER TABLE progress report > 100%Sergei Golubchik2014-01-271-0/+1
| | |
| * | MDEV-5461 Assertion `length <= column->length' fails in write_block_record ↵Sergei Golubchik2014-01-261-30/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with functions in select list, GROUP BY, ORDER BY Old code in create_tmp_table(), that created an extra one-byte field (recinfo) before every NULL-able grouping field (Field) in the tmp table, did not actually work. Because the matching code in end_update(), that was supposed to update this byte, was using a wrong offset, updating the first byte of the Field, not a byte before it. Normally this wasn't an issue, because the Field value (written later in end_update) was overwriting this byte anyway. But in this bug the Field was Field_null, with zero length, so end_update() was overwriting the first byte of the following field. And the following field was not-nullable constant, which was stored only once in create_tmp_table and never updated later. Fixed by removing the code that didn't do any useful work anyway.
| * | Fix for MDEV-5168: MariaDB returns warnings for INSERT IGNOREMichael Widenius2014-01-264-5/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added variable "OLD_MODE" that can be used to turn off the new behavior mysql-test/r/insert.result: Added test case mysql-test/r/mysqld--help.result: Added old_mode mysql-test/suite/sys_vars/r/old_mode_basic.result: Added testing of new variable mysql-test/suite/sys_vars/t/old_mode_basic.test: Added testing of new variable mysql-test/t/insert.test: Added test case sql/sql_class.h: Added bit flags for OLD_MODE sql/sql_insert.cc: Disable duplicate key warnings for INSERT IGNORE of OLD_MODE NO_DUP_KEY_WARNINGS_WITH_IGNORE is used sql/sql_show.cc: Don't show progress reporting on SHOW PROCESSLIST if OLD_MODE NO_PROGRESS_INFO is used sql/sys_vars.cc: Added OLD_MODE
| * | Fixed that setup_natural_join_row_types can safely be called twiceMichael Widenius2014-01-262-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | sql/item.h: Added cache for setup_natural_join_row_types sql/sql_base.cc: Cache old value of first_name_resolution_table for next call. (It's not safe to try to recalculate the value as the join structure may have been changed by the optimizer)
| * | Fixed bug that I accidently introduced in mysql_tzinfo_to_sqlMichael Widenius2014-01-261-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added test cases mysql-test/r/mysql_tzinfo_to_sql_symlink.result: Updated results mysql-test/std_data/zoneinfo/garbage: test file mysql-test/std_data/zoneinfo/ignored.tab: test file mysql-test/t/mysql_tzinfo_to_sql_symlink.test: Added test cases for all options sql/tztime.cc: Better error messages. Fixed wrong place for 'continue'
| * | Merge 5.3 -> 5.5Alexander Barkov2014-01-274-23/+27
| |\ \ | | |/
| | * MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(...):Alexander Barkov2014-01-274-23/+26
| | | | | | | | | | | | | | | Assertion `mon > 0 && mon < 13' failed.'
| | * [Backport to 5.3]Sergey Petrunya2014-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | MDEV-5337: Wrong result in mariadb 5.5.32 with ORDER BY + LIMIT when index_condition_pushdown=on - in test_if_skip_sort_order(), correct the condition under which we have the code that restores the previously pushed index condition.
| | * MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP ↵Alexander Barkov2014-01-242-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BY, ROLLUP The crash happened because Item_func_monthname was derived from Item_func_month, so Item_func_monthname::is_null() did not work fine. Backporting a change from 5.5: Item_func_monthname is now derived from Item_str_func.
| | * MDEV-5368: Server crashes in Item_in_subselect::optimize on ...Sergey Petrunya2014-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - convert_subq_to_sj() must connect child select's tables into parent select's TABLE_LIST::next_local chain. - The problem was that it took child's leaf_tables.head() which is different. This could cause certain tables (in this bug's case, child select's non-merged semi-join) not to be present in TABLE_LIST::next_local chain. Which would cause non-merged semi-join not to be initialized in setup_tables(), which would lead to NULL pointer dereference.
| * | merge 5.3->5.5unknown2014-01-266-39/+14
| |\ \ | | |/
| | * merge of MDEV-5356 5.1->5.3 (with more fixes and test suite).unknown2014-01-236-39/+14
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | THD::thd->activate_stmt_arena_if_needed() should be used to temporary activating statement arena instead of direct usage of THD::set_n_backup_active_arena() because possible such scenario: 1) func1 saves current arena and activates copy1 of statement arena 2) func2 saves copy1 of statement arena setup by func1 and activates copy2 3) some changes made for copy 2 4) func2 stores changed copy2 back to statenet arena and activates copy1 5) func1 store unchanged copy1 back to statemnt arena (rewrite changed copy 2 so changes become lost) and activates arena which was before.
| | | * MDEV-5356: Server crashes in Item_equal::contains on 2nd execution of a PSunknown2014-01-233-15/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | THD::thd->activate_stmt_arena_if_needed() should be used to temporary activating statement arena instead of direct usage of THD::set_n_backup_active_arena() because possible such scenario: 1) func1 saves current arena and activates copy1 of statement arena 2) func2 saves copy1 of statement arena setup by func1 and activates copy2 3) some changes made for copy 2 4) func2 stores changed copy2 back to statenet arena and activates copy1 5) func1 store unchanged copy1 back to statemnt arena (rewrite changed copy 2 so changes become lost) and activates arena which was before.
| | | * make 5.1 compiling with modern gcc.unknown2013-12-201-2/+2
| | | |
| * | | MergeSergey Petrunya2014-01-241-1/+1
| |\ \ \
| | * | | MDEV-5337: Wrong result in mariadb 5.5.32 with ORDER BY + LIMIT when ↵Sergey Petrunya2014-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | index_condition_pushdown=on - in test_if_skip_sort_order(), correct the condition under which we have the code that restores the previously pushed index condition.
| * | | | Fixed Mageia Bug 12355: mariadb produces warning messages while loading ↵Michael Widenius2014-01-241-37/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | timezone information - Warnings about wrong symlink messages or non-timezone files with '.tab' are now only given if run with --verbose - Added long option handling - Added --help, --verbose and --version options sql/tztime.cc: Add usage of my_getopt, to get long options
| * | | | Fix for MDEV-5531: double call procedure in one session - hard shutdown the ↵Michael Widenius2014-01-249-46/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | server Main fix was to not cache derivied tables as they may be temporary tables that are deleted before the next query. This was a bit tricky as Item_field::fix_fields depended on cached_tables to be set to resolve some columns. mysql-test/r/sp-bugs.result: Added test case mysql-test/t/sp-bugs.test: Added test case sql/item.cc: Fixed fix_outer_field to handle case where found field did not have in cached_table Idea is that if cached_table is not avaliable, use from_field->table->pos_in_table_list instead sql/records.cc: Also accept INTERNAL_TMP_TABLE for memmap sql/sql_base.cc: More DBUG_PRINT Fixed that setup_natural_join_row_types() is not run twice. Original code modified context->first_name_resolution_table also for second executions. This was wrong as this could give wrong results if some joins had been optimized away between calls. sql/sql_derived.cc: Mark derived tables as internal temporary tables (INTERNAL_TMP_TABLE), not as NON_TRANSACTIONAL_TMP_TABLE. This is more correct as the tables are not visible by the end user. sql/sql_insert.cc: Reset pos_in_table_list before calling fix_fields. One of the consequences of the change of not caching all generated tables in Item_ident is that pos_in_table_list needs to be correct in calls to fix_fields. sql/sql_lex.cc: More DBUG_PRINT sql/sql_parse.cc: Don't cache derivied tables as they may be temporary tables that are deleted before the next query sql/sql_select.cc: Reset table_vector. This was required as some code checked the vector to see if temporary tables had already been created. sql/table.cc: Mark tables with field translations as cacheable (as these will not disapper between stmt executions.
| * | | | MDEV-5419 no audit events for warnings converted to errors in the strict mode.Alexey Botchkov2014-01-232-1/+3
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Plugins get error notifications only when my_message_sql() is called. But errors are launched with THD::raise_condition() calls in other places. These are push_warning(), implementations of SIGNAL and RESIGNAL commands. So it makes sence to notify plugins there in THD::raise_condition().
| * | | MergeSergey Petrunya2014-01-231-1/+1
| |\ \ \
| | * | | MDEV-5368: Server crashes in Item_in_subselect::optimize on ...Sergey Petrunya2014-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - convert_subq_to_sj() must connect child select's tables into parent select's TABLE_LIST::next_local chain. - The problem was that it took child's leaf_tables.head() which is different. This could cause certain tables (in this bug's case, child select's non-merged semi-join) not to be present in TABLE_LIST::next_local chain. Which would cause non-merged semi-join not to be initialized in setup_tables(), which would lead to NULL pointer dereference.
| * | | | MDEV-5406 add index to an innodb table with a uniqueness violation crashes ↵Sergei Golubchik2014-01-231-8/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysqld After table->file->add_index() in mysql_alter_table() the table in the engine has the intermediate temporary structure, it's neither the original nor the final table structure (it'll be final after successful table->file->drop_index() call). So, when add_index() fails with a unique key violation, we cannot simply get the failed key number and easily map it to the key name and key structure via table->key_info[key_no]. For now we'll create this "intermediate temporary structure", emulating InnoDB internal rules. This bug and the fix will go away in 10.0 that uses completely different online alter table code. mysql-test/t/alter_table_trans.test: mdev:5406
| * | | | MDEV-5421 Assertion `! is_set()' fails on INSERT IGNORE when a table has no ↵Sergei Golubchik2014-01-233-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | partition for a value make print_no_partition_found() to respect MYF(errflag) mysql-test/suite/parts/t/insert_ignore-5421.test: mdev:5421
| * | | | MySQL-5.5.35 mergeSergei Golubchik2014-01-2214-27/+60
| |\ \ \ \
| | * \ \ \ merge 5.1 => 5.5Tor Didriksen2013-11-011-1/+3
| | |\ \ \ \
| | | * | | | Bug#17617945 BUFFER OVERFLOW IN GET_MERGE_MANY_BUFFS_COST WITH SMALL ↵Tor Didriksen2013-11-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SORT_BUFFER_SIZE get_cost_calc_buff_size() could return wrong value for the size of imerge_cost_buff.
| | * | | | | remerge 5.1 => 5.5Tor Didriksen2013-10-291-2/+4
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Bug#17326567 MYSQL SERVER FILESORT IMPLEMENTATION HAS A VERY SERIOUS BUGTor Didriksen2013-10-291-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The filesort implementation needs space for at least 15 records (plus some internal overhead) in its main sort buffer.
| | * | | | | Bug #16051817 GOT ERROR 124 FROM STORAGE ENGINE Aditya A2013-10-212-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ON DELETE FROM A PARTITIONED TABLE PROBLEM ------- The user first disables all the non unique indexes in the table and then rebuilds one partition. During rebuild the indexes on that particular partition are enabled. Now when we give a query the optimizer is unaware that on one partition indexes are enabled and if the optimizer selects that index,myisam thinks that the index is not active and gives an error. FIX --- Before rebuilding a partition check whether non unique indexes are disabled on the partitons. If they are disabled then after rebuild disable the index on the partition. [Approved by Mattiasj #rb3469]
| | * | | | | Bug #17357535 BACKPORT BUG#16241992 TO 5.5Anirudh Mangipudi2013-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: COM_CHANGE_USER allows brute-force attempts to crack a password at a very high rate as it does not cause any significant delay after a login attempt has failed. This issue was reproduced using John-The-Ripper password cracking tool through which about 5000 passwords per second could be attempted. Solution: The non-GA version's solution was to disconnect the connection when a login attempt failed. Now since our aim to to reduce the rate at which passwords are tested, we introduced a sleep(1) after every login attempt failed. This significantly increased the delay with which the password was cracked.
| | * | | | | Bug#17559867 AFTER REBUILDING , A MYISAM PARTITION ENDS UP Aditya A2013-10-181-0/+2
| | |\ \ \ \ \ | | | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | AS A INNODB PARTITTION. [Merged from 5.1]
| | | * | | | Bug#17559867 AFTER REBUILDING,A MYISAM PARTITION ENDS UP Aditya A2013-10-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AS A INNODB PARTITTION. PROBLEM ------- The correct engine_type was not being set during rebuild of the partition due to which the handler was always created with the default engine, which is innodb for 5.5+ ,therefore even if the table was myisam, after rebuilding the partitions ended up as innodb partitions. FIX --- Set the correct engine type during rebuild. [Approved by mattiasj #rb3599]
| | * | | | | Bug#17234370 LAST_INSERT_ID IS REPLICATED INCORRECTLY IFVenkatesh Duggirala2013-10-161-1/+0
| | |\ \ \ \ \ | | | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REPLICATION FILTERS ARE USED. Merging fix from mysql-5.1