summaryrefslogtreecommitdiff
path: root/sql
Commit message (Collapse)AuthorAgeFilesLines
* small cleanupsSergei Golubchik2015-02-052-6/+6
|
* don't let current_thd to point to a destroyed THDSergei Golubchik2015-02-0311-25/+1
| | | | | | * reset current_thd in THD::~THD, otherwise my_malloc_size_cb_func() might access THD after it was destroyed. * remove now redundant set_current_thd(0) calls that follow delete thd.
* Commit one file that I forgot in last commitMonty2015-02-031-42/+31
|
* cleanup: ha_checktype()Sergei Golubchik2015-02-024-25/+16
| | | | | | | * error reporting was never needed * avoid useless transformaton hton to db_type to hton * in many cases the engine was guaranteed to exist, add asserts * use ha_default_handlerton() instead of ha_checktype(DB_TYPE_DEFAULT)
* trivial cleanup: be explicit about extern variablesSergei Golubchik2015-02-021-1/+1
|
* fix the code to compileSergei Golubchik2015-02-021-3/+0
|
* Cleaned up code for setting slave_parallel_modeMonty2015-02-016-207/+46
| | | | Now this works the same way as all other multi source variables.
* Improve performance for calculating memory allocationMonty2015-02-0112-74/+167
| | | | Extend interface for 'show variables' with current scope
* Merge remote-tracking branch 'refs/remotes/github/10.1' into 10.1Sergei Golubchik2015-02-012-4/+6
|\
| * MDEV-7024: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status ↵Oleksandr Byelkin2015-01-291-1/+1
| | | | | | | | | | | | on executing ANALYZE SELECT via PS select_send::is_result_interceptor() should return FALSE because it return results to the client.
| * MDEV-7023: Error 2027: Malformed packet and assertion `field_types == 0 || ↵Oleksandr Byelkin2015-01-291-3/+5
| | | | | | | | | | | | field_types[field_pos] == MYSQL_TYPE_INT24 || field_types[field_pos] == MYSQL_TYPE_LONG' failure in Protocol_text::store_long The problem was that sp_head::MULTI_RESULTS was not set correctly for ANALYZE statement.
* | main.ctype_ucs2 --ps: Item_func_nullif should use m_args0_copy metadataSergei Golubchik2015-01-311-10/+10
| | | | | | | | in case args[0] changes between PREPARE and EXECUTE
* | main.null --ps: Item_null doesn't need charset converterSergei Golubchik2015-01-311-1/+0
| | | | | | | | | | in particular, not the one that destructively changes Item's charset (meaning different metadata for PREPARE and EXECUTE)
* | fix semisync plugin locking: rpl.rpl_semi_sync_uninstall_plugin failedSergei Golubchik2015-01-311-1/+1
| |
* | small cleanup, remove a useless functionSergei Golubchik2015-01-315-26/+4
| |
* | compiler warningsSergei Golubchik2015-01-313-23/+20
| |
* | Merge branch '10.0' into merge-wipSergei Golubchik2015-01-3143-248/+614
|\ \ | |/ |/|
| * clarify the comment and trivial cleanupsSergei Golubchik2015-01-291-16/+12
| |
| * Master_info_index assumed that file descriptor can never be 0Sergei Golubchik2015-01-241-1/+2
| |
| * MDEV-6668: Server crashes in check_view_single_update on concurrent DDL/DML ↵Michael Widenius2015-01-295-24/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | flow with views and triggers Call mysql_derived_reinit() if we are reusing view. This is needed as during a previous error condition the view may not have been reset sql/sql_derived.cc: More DBUG_PRINT Always reset merged_for_insert (no reason to not do that) sql/sql_derived.h: Added prototype sql/sql_insert.cc: More DBUG_PRINT Added DBUG_ASSERT sql/sql_view.cc: Call mysql_derived_reinit() if we are reusing view. This is needed as during a previous error condition the view may not have been reset sql/table.cc: More DBUG_PRINT
| * MDEV-5719: Wrong result with GROUP BY and LEFT OUTER JOINmariadb-10.0.16Sergey Petrunya2015-01-251-8/+15
| | | | | | | | | | | | | | | | | | | | | | Merged revision 5224 from mysql-5.6 and added a test case. .. revno: 5224 committer: Sergey Glukhov <sergey.glukhov@oracle.com> branch nick: mysql-5.6 timestamp: Wed 2013-06-19 14:24:08 +0400 message: Bug#16620047 INCORRECT QUERY RESULT (AFTER SERVER UPGRADE)
| * 5.5 mergeSergei Golubchik2015-01-2120-73/+257
| |\
| | * MDEV-7475 Wrong implementation of checking PLUGIN_VAR_SET conditionSergei Golubchik2015-01-191-1/+1
| | | | | | | | | | | | correct the check for PLUGIN_VAR_STR
| | * MDEV-7404 REPAIR multiple tables crash in MDL_ticket::has_stronger_or_equal_typeSergei Golubchik2015-01-141-5/+9
| | | | | | | | | | | | | | | mysql_alter_table() that is used in mysql_recreate_table() doesn't expect many tables in the TABLE_LIST.
| | * cleanupSergei Golubchik2015-01-132-6/+2
| | |
| | * MDEV-7333 "'show table status like 'table_name'" on tokudb table lead to ↵Sergei Golubchik2015-01-132-4/+27
| | | | | | | | | | | | | | | | | | MariaDB crash adjust enum values when reading them from frm
| | * MDEV-7410 Temporary table name conflict between sessionsSergei Golubchik2015-01-101-1/+1
| | | | | | | | | | | | | | | workaround for missing SP auto-reparse. allow the user to disable stored_program_cache_size, if he wants
| | * MDEV-7189: main.processlist fails sporadically in buildbotKristian Nielsen2015-01-061-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test case tried to trigger a DEBUG_SYNC point at the end of a SELECT SLEEP(5) statement. It did this by using EXECUTE 2, intending to trigger first at the end of SET DEBUG_SYNC, and second at the end of the SELECT SLEEP(5). However, in --ps-protocol mode, this does not work, because the SELECT is executed in two steps (Prepare followed by Execute). Thus, the DEBUG_SYNC got triggered too early, during the Prepare stage rather than Execute, and the test case could race and information_schema.processlist see the thread in the wrong state. This patch fixes by changing the way the DEBUG_SYNC point is triggered. Now we add a DBUG injection inside the code for SLEEP(5). This ensures that the DEBUG_SYNC point is not activated until the SLEEP(5) is running, ensuring that the following wait for completion will be effective.
| | * Adding mariadb-version on the view creation to view frm. (MDEV-6916 followup)unknown2014-12-212-1/+6
| | |
| | * mergemariadb-5.5.41Sergei Golubchik2014-12-199-29/+179
| | |\
| | | * mysql-5.5.41 mergeSergei Golubchik2014-12-199-29/+179
| | | |\
| | | | * Bug #19372926 : 5.5.38 FAILS FUNC_MATH MTR TEST.mithun2014-11-032-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue : ------- This seems for some platform -(LONGLONG_MIN) is not flagged as out of range. Fix: ---- Fix is backported from mysql-5.6 bug 14314156. Fixed by adding an explicit test for this value in Item_func_neg::int_op(). sql/item_func.cc: For some platforms we need special handling of LONGLONG_MIN to guarantee overflow.
| | | | * Bug#17633291: SET PROPER COMPILE OPTIONS FOR CLANGJon Olav Hauglid2014-10-131-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug#17959689: MAKE GCC AND CLANG GIVE CONSISTENT COMPILATION WARNINGS Bug#18313717: ENABLE -WERROR IN MAINTANER MODE WHEN COMPILING WITH CLANG Bug#18510941: REMOVE CMAKE WORKAROUNDS FOR OLDER VERSIONS OF OS X/XCODE Backport from mysql-5.6 to mysql-5.5
| | | | * Bug #18808072 MYSQLBINLOG USES LOCALTIME() TO PRINT EVENTS, CAUSES KERNEL ↵Venkatesh Duggirala2014-10-081-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MUTEX CONTENTION Problem: For every event read, mysqlbinlog calls localtime() which in turn calls stat(/etc/localtime) which is causing kernel mutex contention. Analysis and Fix: localtime() calls stat(/etc/localtime) for every instance of the call where as localtime_r() the reentrant version was optimized to store the read only tz internal structure. Hence it will not call stat(/etc/localtime). It will call only once at the beginning. The mysql server is calling localtime_r() and mysqlbinlog tool is one place where we are still using localtime(). Once the process (mysqlbinlog) is started if timezone is changed it will be not picked up the the process and it will continue with the same values as the beginning of the process. This behavior is in-lined with mysql server. Also adding localtime_r() and gmtime_r() support for windows.
| | | | * Bug#19145698: READ OUT OF BOUNDS ISSUESujatha Sivakumar2014-10-082-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======== In a master slave replication if a slave receives a Start_log_event_v3 the payload is expected to be of fixed size. If a payload which is smaller than the fixed size is received it causes a read out of bounds issue. Analysis: ======== According to documentation the fixed data part of Start_log_event_v3 looks as shown below. 2 bytes: The binary log format version 50 bytes: The MySQL server's version 4 bytes: Timestamp in seconds when this event was created Since the payload is expected to be of fixed size, therefore ST_SERVER_VER_LEN (50) bytes are memcpy'ed into server_version. But if a malicious master sends a shorter payload it causes a read out of bounds issue. Fix: === In Start_log_event_v3 event's constructor a check has been added which expects the minimum payload length to be of size common_header_len + ST_COMMON_HEADER_LEN_OFFSET bytes. If a malicious packet of lesser length is received it will be considered as an invalid event. sql/log_event.cc: Added code changes to check the minimum packet length of Start_log_event_v3 should be > 56. sql/log_event.h: Moved server_version from stack to heap and modified is_valid function for Start_log_event_v3.
| | | | * Bug#19553099 EXPIRE_LOGS_DAYS=1 CRASH MYSQLD DURING RESTART, DBUG_SYNC(NULL, ↵unknown2014-10-021-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...) - Restarting mysqld with --expire-log-days=1 triggers 'log_in_use()' to be called while current_thd is NULL. - Check current_thd before calling DEBUG_SYNC() to avoid passing NULL pointer to DEBUG_SYNC() - Wrap debug code construct inside #ifndef DBUG_OFF like in other parts of the file
| | | | * Bug #15868071 USING SET GLOBAL SQL_LOG_BIN SHOULD NOT BE ALLOWEDBill Qu2014-09-241-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally, SET SESSION SQL_LOG_BIN is used by DBAs to run a non-conflicting command locally only, ensuring it does not get replicated. Setting GLOBAL SQL_LOG_BIN would not require all sessions to disconnect. When SQL_LOG_BIN is changed globally, it does not immediately take effect for any sessions. It takes effect by becoming the session-level default inherited at the start of each new session, and this setting is kept and cached for the duration of that session. Setting it intentionally is unlikely to have a useful effect under any circumstance; setting it unintentionally, such as while intending to use SET [SESSION] is potentially disastrous. Accidentally using SET GLOBAL SQL_LOG_BIN will not show an immediate effect to the user, instead not having the desired session-level effect, and thus causing other potential problems with local-only maintenance being binlogged and executed on slaves; And transactions from new sessions (after SQL_LOG_BIN is changed globally) are not binlogged and replicated, which would result in irrecoverable or difficult data loss. This is the regular GLOBAL variables way to work, but in replication context it does not look right on a working server (with connected sessions) 'set global sql_log_bin' and none of that connections is affected. Unexperienced DBA after noticing that the command did "nothing" will change the session var and most probably won't unset the global var, causing new sessions to not be binlog. Setting GLOBAL SQL_LOG_BIN allows DBA to stop binlogging on all new sessions, which can be used to make a server "replication read-only" without restarting the server. But this has such big requirements, stop all existing connections, that it is more likely to make a mess, it is too risky to allow the GLOBAL variable. The statement 'SET GLOBAL SQL_LOG_BIN=N' will produce an error in 5.5, 5.6 and 5.7. Reading the GLOBAL SQL_LOG_BIN will produce a deprecation warning in 5.7.
| | | | * Bug#19070633 - POSSIBLE ACCESS TO FREED MEMORY IN IS_FREE_LOCK()Praveenkumar Hulakund2014-09-161-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AND IS_USED_LOCK(). Analysis: ----------- In functions Item_func_is_free_lock::val_int() and Item_func_is_used_lock::val_int(), for the specified user lock name, pointer to its "User_level_lock" object is obtained from hash "hash_user_locks". Mutex "LOCK_user_locks" is acquired for this and released immediately. And we are accessing members of User_level_lock after releasing the mutex. If same user lock is deleted(released) from concurrent thread then accessing members results in invalid(freed) memory access issue. Deleting of user lock is also protected from the mutex "LOCK_user_locks". Since this mutex is released in "val_int" functions mentioned above, delete operation proceeds while concurrent thread tries to access its members. With the test case, valgrind reports invalid read issues in val_int functions. Fix: ----------- To fix this issue, in "val_int" function of classes "Item_func_is_free_lock" and "Item_func_is_used_lock", now releasing mutex "LOCK_user_locks" after accessing User_level_lock members.
| | | | * Bug#18790730 - CROSS-DATABASE FOREIGN KEY WITHOUT PERMISSIONSPraveenkumar Hulakund2014-09-104-1/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CHECK. Analysis: ---------- Issue here is, while creating or altering the InnoDB table, if the foreign key defined on the table references a parent table on which the user has no access privileges then the table is created without reporting any error. Currently the privilege level REFERENCES_ACL is unused and is not used for access evaluation while creating the table with a foreign key constraint or adding the foreign key constraint to a table. But when no privileges are granted to user then also access evaluation on parent table is ignored. Fix: --------- For DMLs, irrelevant of the fact, support does not want any changes to avoid permission checks on every operation. So, as a fix, added a function "check_fk_parent_table_access" to check whether any of the SELECT_ACL, INSERT_ACL, UDPATE_ACL, DELETE_ACL or REFERENCE_ACL privileges are granted for user at table level. If none of them is granted then error is reported. This function is called during the table creation and alter operation.
| | | | * removed WL7219: Audit Log Filtering from mysql-5.5.Ramil Kalimullin2014-09-051-1/+1
| | | | |
| | | | * Bug#19145712 USER AFTER FREE / DOUBLE FREE ISSUEVenkatesh Duggirala2014-08-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: A corrupted header length in FORMAT_DESCRIPTION_LOG_EVENT can cause server to crash. Analysis: FORMAT_DESCRIPTION_EVENT will be considered invalid if header len is too small (i.e. below OLD_HEADER_LEN). Format_description_log_event:: Format_description_log_event(...) { ... if ((common_header_len=buf[ST_COMMON_HEADER_LEN_OFFSET]) < OLD_HEADER_LEN) DBUG_VOID_RETURN; /* sanity check */ ... post_header_len= my_memdup(...) } In that case Format_description_log_event constructor will return early, without allocating any memory for post_header_len. Thence this variable is left uninitialized and making server to crash when server is trying to free the uninitialized value. Fix: When Format_description_log_event constructor returns early, assign NULL to post_header_len.
| | * | | Merge 5.3 -> 5.5Sergey Petrunya2014-12-181-1/+1
| | |\ \ \ | | | |/ / | | |/| |
| | | * | MDEV-6830: Server crashes in best_access_path after a sequence of SELECTs ...Sergey Petrunya2014-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | generate_derived_keys_for_table() did not work correctly in the case where - it had a potential index on derived table - however, TABLE::check_tmp_key() would disallow creation of this index after looking at its future key parts (because of the key parts exceeding max. index length) - the code would leave a KEYUSE structure that refers to a non-existant index. Depending on further optimizer calculations, this could cause a crash.
| | * | | MDEV-7150 Wrong auto increment values on INSERT .. ON DUPLICATE KEY UPDATE ↵Sergei Golubchik2014-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when the inserted columns include NULL in an auto-increment column when restoring auto-inc value in INSERT ... ON DUPLICATE KEY UPDATE, take into account that 1. it may be changed in the UPDATE clause (old code did that) 2. it may be changed in the INSERT clause and then cause a dup key (old code missed that)
| | * | | cleanupunknown2014-12-171-8/+0
| | | | |
| | * | | MDEV-6985: MariaDB crashes on stored procedure callunknown2014-12-171-1/+9
| | | | | | | | | | | | | | | | | | | | Item_ident fixed to allow double cleanup().
| | * | | DEV-7221 from_days fails after null valueAlexander Barkov2014-12-161-4/+3
| | | | |
| | * | | MDEV-6855 Assertion `cond_type == Item::FUNC_ITEM' failed in ↵Michael Widenius2014-12-152-11/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | check_group_min_max_predicates with GROUP BY, aggregate in WHERE SQ, multi-part key mysql-test/r/group_by.result: Test for MDEV-6855 mysql-test/t/group_by.test: Test for MDEV-6855 sql/item.h: Fixed spelling error sql/opt_range.cc: Added handling of cond_type == Item::CACHE_ITEM in WHERE clauses for MIN/MAX optimization. Fixed indentation
| | * | | MDEV-6896 kill user command cause MariaDB crashMichael Widenius2014-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql-test/r/kill-2.result: test case for MDEV-6896 mysql-test/t/kill-2-master.opt: test case for MDEV-6896 mysql-test/t/kill-2.test: test case for MDEV-6896 sql/sql_parse.cc: Use host_or_ip instead of host as host may be 0
| * | | | MDEV-5679 MariaDB holds stdin open after startup as mysqldSergei Golubchik2015-01-191-0/+1
| | | | |