Commit graph

33687 commits

Author SHA1 Message Date
Sergei Golubchik
a006813fb1 merge 2014-09-16 14:08:05 +02:00
Sergei Golubchik
7e29c1b539 5.5 merge 2014-09-16 14:03:17 +02:00
Michael Widenius
8e4566e912 Don't give warning if there are two unique keys used with INSERT .. ON DUPLICATE KEY UPDATE.
We should assume that the store engine will report the first duplicate key for this case.

Old code of suppression of unsafe logging error with LIMIT didn't work, because of wrong usage of my_interval_timer().

Suppress unsafe logging errors to the error log if we get too many unsafe logging errors in a short time.
This is to not overflow the error log with meaningless errors.

- Each error code is suppressed and counted separately.
- We do a 5 minute suppression of new errors if we get more than 10 errors in that time.

Only print unsafe logging errors if log_warnings > 1.



mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result:
  Update test results as INSERT ... ON DUPLICATE KEY UPDATE doesn't get logged anymore
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Update test results as INSERT ... ON DUPLICATE KEY UPDATE doesn't get logged anymore
mysql-test/suite/engines/README:
  Fixed typos
mysql-test/suite/rpl/r/rpl_known_bugs_detection.result:
  Update test results as INSERT ... ON DUPLICATE KEY UPDATE doesn't get logged anymore
sql/sql_base.cc:
  Don't log warning if there are two unique keys used with INSERT .. ON DUPLICATE KEY UPDATE.
  We should assume that the store engine will report the first duplicate key for this case.
sql/sql_class.cc:
  Suppress error in binary log if we get too many unsafe logging errors in a short time.
  Only print unsafe logging errors if log_warnings > 1
2014-09-16 00:00:47 +03:00
Michael Widenius
7a50ce1d31 Use LOCK_show_status when we add things to all_status_vars
This was missing in my last commit for fixing possible lockups in SHOW STATUS.

sql/log.cc:
  Fixed comment
sql/sql_show.cc:
  Use LOCK_show_status when we add things to all_status_vars
sql/sql_test.cc:
  Remove not needed mutex_lock
2014-09-15 17:11:01 +03:00
Sergei Golubchik
c799d65baf 5.3 merge 2014-09-12 16:51:41 +02:00
Alexander Barkov
b23af85662 MDEV-6737 Stored routines do now work with swe7: "The table mysql.proc is missing, corrupt, or contains bad data"
Fixed the bug itself.
Also, added "SET NAMES swe7" which was forgotten in the previous commit,
so latin1 was actually tested lati1 instead of swe7 in a mistake.
Now it tests swe7.
2014-09-12 16:06:18 +04:00
Michael Widenius
fa51a22388 Fixed compiler warnings 2014-09-12 14:49:24 +03:00
Michael Widenius
e36d6f03a4 Don't use LOCK_status for the duration of SHOW STATUS because of possible lookups.
Instead we use LOCK_status only to protect summary of thread statistics and use a new mutex, LOCK_show_status
to protect concurrent SHOW STATUS.

sql/mysqld.cc:
  Add LOCK_show_status
  Don't free LOCK_status while calculating status variables.
sql/mysqld.h:
  Add LOCK_show_status
sql/sql_show.cc:
  Use LOCK_show_status to protect SHOW STATUS instead of LOCK_status.
2014-09-12 14:49:13 +03:00
Sergei Golubchik
269f0a6871 MDEV-6619 SHOW PROCESSLIST returns empty result set after KILL QUERY
don't send an OK packet if the SHOW PROCESSLIST was killed
2014-09-12 08:41:35 +02:00
Michael Widenius
c6051a4beb Automatic merge 2014-09-11 23:50:31 +03:00
Sergei Golubchik
3a91af9a92 MDEV-6647 MariaDB CLI client doesnt show CREATE INDEX progress
SQLCOM_CREATE_INDEX was missing CF_REPORT_PROGRESS flag
2014-09-10 17:45:09 +02:00
Sergei Golubchik
30d7860504 MDEV-6459 max_relay_log_size and sql_slave_skip_counter misbehave on PPC64
make slave_skip_counter and max_relay_log_size ulonglong
(sysvars should generally never be ulong)
2014-09-10 13:22:44 +02:00
Sergei Golubchik
b2c54a9a69 MDEV-6523 CONNECT temporary table created
check_engine() was not called for assisted discovery
2014-09-10 13:22:20 +02:00
Igor Babaev
5023bb899d Fixed bug mdev-6292.
Avoided exponential recursive calls of JOIN_CACHE::join_records() in the case
of non-nested outer joins.
A different solution is required to resolve this performance problem for
nested outer joins.
2014-09-09 16:44:54 -07:00
Michael Widenius
2362d98470 MDEV-6698: safe_mutex: Found wrong usage of mutex 'log_space_lock' and 'LOCK_log'
Moved freeing of mutex earlier, as we don't need to have log_space_cond locked for doing rotate_relay_log()

sql/slave.cc:
  Moved freeing of mutex earlier, as we don't need to have log_space_cond locked for doing rotate_relay_log()
2014-09-09 17:37:08 +03:00
Michael Widenius
9c79227c96 Fixed two bugs with CREATE OR REPLACE and LOCK TABLES:
MDEV-6560 Assertion `! is_set() ' failed in Diagnostics_area::set_ok_status on killing CREATE OR REPLACE
MDEV-6525 Assertion `table->pos_in_locked _tables == __null || table->pos_in_locked_tables->table = table' failed in mark_used_tables_as_free_for_reuse, locking problems and binlogging problems on CREATE OR REPLACE under lock.
 

mysql-test/r/create_or_replace.result:
  Added test for MDEV-6560
mysql-test/t/create_or_replace.test:
  Added test for MDEV-6560
mysql-test/valgrind.supp:
  Added suppression for OpenSuse 12.3
sql/sql_base.cc:
  More DBUG
sql/sql_class.cc:
  Changed that thd_sqlcom_can_generate_row_events() does not report that CREATE OR REPLACE is generating row events.
  This is safe as this function is only used by InnoDB/XtraDB to check if a query is generating row events as part of another transaction. As CREATE is always run as it's own transaction, this isn't a problem.
  This fixed MDEV-6525.
sql/sql_table.cc:
  Remember if reopen_tables() generates an error (which can only happen in case of KILL).
  This fixed MDEV-6560
2014-09-08 20:56:56 +03:00
Sergei Golubchik
6b720ae4cb MDEV-6605 Multiple Clients Inserting Causing Error: Failed to read auto-increment value from storage engine
* handler::get_auto_increment() was not expecting any errors from the storage engine.
  That was wrong, errors could happen.
* ha_partition::get_auto_increment() was doing index lookups in partition under a mutex.
  This was redundant (engine transaction isolation was covering that anyway)
  and harmful (causing deadlocks).
2014-09-08 18:38:13 +02:00
Sergei Golubchik
4d4ce59d2b compilation fixes for WITH_ATOMIC_OPS=rwlocks 2014-09-08 12:59:57 +02:00
Sergei Golubchik
9f0bdda8ab MDEV-6580 Assertion `thd' failed in my_malloc_size_cb_func upon writing status report into error log
thd is NULL in the signal handler, display_table_locks() should expect that
2014-09-07 20:19:12 +02:00
Sergei Golubchik
0c148e413f MDEV-6610 Assertion `thd->is_error() || thd->killed' failed in mysql_execute_command on executing an SP with repeated CREATE TABLE .. SELECT
the bug was introduced by CREATE OR REPLACE implementation.
CREATE IF NOT EXISTS ... SELECT was returning an error status to the caller,
while sending an ok packet to the user. SP code was not prepared for that
and trusted that error status means an error.
2014-09-06 09:46:41 +02:00
Sergei Golubchik
3da761912a MDEV-6616 Server crashes in my_hash_first if shutdown is performed when FLUSH LOGS is running
master_info_index becomes zero during shutdown.
check that it's valid (under a mutex) before dereferencing.
2014-09-06 08:33:56 +02:00
Alexander Barkov
9392d0e280 - MDEV-6695 Bad column name for UCS2 string literals
The Item_string constructors called set_name() on the source string,
  which was wrong because in case of UCS2/UTF16/UTF32 the source value
  might be a not well formed string (e.g. have incomplete leftmost character).
  Now set_name() is called on str_value after its copied 
  (with optionally left zero padding) from the source string.
- MDEV-6694 Illegal mix of collation with a PS parameter
  Item_param::convert_str_value() did not set repertoire.
  Introducing a new structure MY_STRING_METADATA to collect
  character length and repertoire of a string in a single loop,
  to avoid two separate loops. Adding a new class Item_basic_value::Metadata
  as a convenience wrapper around MY_STRING_METADATA, to reuse the
  code between Item_string and Item_param.
2014-09-04 21:58:48 +04:00
Alexander Barkov
bf4347eba0 Creating a new class in_string::Item_string_for_in_vector
and moving set_value() from Item_string to Item_string_for_in_vector,
as set_value() updates the members incompletely
(e.g. does not update max_length),
so it was dangerous to have set_value() available in Item_string.
2014-09-04 12:43:41 +04:00
Alexander Barkov
c9d3b27d29 Using more Item_string_sys 2014-09-04 12:15:05 +04:00
Alexander Barkov
58eb51d1cf MDEV-6044 MySQL BUG#12735829 - SPACE() FUNCTION WARNING REFERS TO REPEAT() IN ER_WARN_ALLOWED_PACKET_OVERFLOWED
Merged from 5.6
2014-09-04 08:50:06 +04:00
Alexander Barkov
1e66871713 Adding Item_string_sys and Item_string_ascii to reduce duplicate code 2014-09-03 18:24:31 +04:00
Alexander Barkov
e42f4e3199 MDEV-6688 Illegal mix of collation with bit string B'01100001' 2014-09-03 16:31:47 +04:00
Kristian Nielsen
36f50be970 MDEV-6462: Slave replicating using GTID doesn't recover correctly when master crashes in the middle of transaction
If the slave gets a reconnect in the middle of a GTID event group, normally
it will re-fetch that event group, skipping the first part that was already
queued for the SQL thread.

However, if the master crashed while writing the event group, the group is
incomplete. This patch detects this case and makes sure that the
transaction is rolled back and nothing is skipped from any following
event groups.

Similarly, a network proxy might cause the reconnect to end up on a
different master server. Detect this by noticing a different server_id,
and similarly in this case roll back the partially received group.
2014-09-02 14:07:01 +02:00
Alexander Barkov
fbaaf3688d Moving Item::str_value from public to protected. 2014-09-03 01:56:21 +04:00
Alexander Barkov
658a1e9420 MDEV-6683 A parameter and a string literal with the same values are not recognized as equal by the optimizer 2014-09-03 01:47:39 +04:00
Alexander Barkov
c70cacacfe MDEV-6679 Different optimizer plan for "a BETWEEN 'string' AND ?" and "a BETWEEN ? AND 'string'"
Item_string::eq() and Item_param::eq() in string context behaved differently.
Introducing a new class Item_basic_value to share the eq() code between
literals (Item_int, Item_double, Item_string, Item_null) and Item_param.
2014-09-02 22:04:48 +04:00
Alexander Barkov
b088609a62 A clean-up for the previous patch 2014-09-02 17:34:29 +04:00
Alexander Barkov
1427e1db99 MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context
MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string)

Item_static_string_func::safe_charset_converter() and 
Item_hex_string::safe_charset_converter() did not
handle character sets with mbminlen>1 properly, as well as
did not handle conversion from binary to multi-byte well.

Introducing Item::const_charset_converter(), to reuse it in a number
of Item_*::safe_charset_converter().
2014-09-01 20:57:32 +04:00
Sergei Golubchik
6389fd3c79 MDEV-6673 I_S.SESSION_VARIABLES shows global values
only look at lex->option_type if it's a SHOW command, not a SELECT
2014-08-31 19:55:11 +02:00
Sergei Golubchik
dd25e7f0ad MDEV-6601 Assertion `!thd->in_active_multi_stmt_transa ction() || thd->in_multi_stmt_transaction_mode()' failed on executing a stored procedure with commit
Don't restore the whole of thd->server_status after a routine invocation,
only restore SERVER_STATUS_CURSOR_EXISTS and SERVER_STATUS_LAST_ROW_SENT,
as --ps --embedded needs.
In particular, don't restore SERVER_STATUS_IN_TRANS.
2014-08-25 16:58:19 +02:00
Sergei Golubchik
57a43b8435 MDEV-6625 SHOW GRANTS for current_user_name@wrong_host_name 2014-08-21 21:25:22 +02:00
Sergei Golubchik
04eec20000 MDEV-5706 MariaDB does not build on hurd-i386
Followup. Don't compile threadpool_unix.cc when thread pool is disabled
2014-08-12 16:39:12 +02:00
Kristian Nielsen
c6a60f6d79 MDEV-6321: close_temporary_tables() in format description event not serialised correctly
After-review fixes.

Mainly catching if the wait in wait_for_workers_idle() is aborted due to kill.
In this case, we should return an error and not proceed to execute the format
description event, as other threads might still be running for a bit until the
error is caught in all threads.
2014-08-20 10:59:39 +02:00
Kristian Nielsen
453c29c3f7 MDEV-6321: close_temporary_tables() in format description event not serialised correctly
Follow-up patch, fixing a possible deadlock issue.

If the master crashes in the middle of an event group, there can be an active
transaction in a worker thread when we encounter the following master restart
format description event. In this case, we need to notify that worker thread
to abort and roll back the partial event group. Otherwise a deadlock occurs:
the worker thread waits for the commit that never arrives, and the SQL driver
thread waits for the worker thread to complete its event group, which it never
does.
2014-08-19 14:26:42 +02:00
Igor Babaev
20fff8e5bd Merge. 2014-08-04 10:05:51 -07:00
Sergei Golubchik
50e192a04f Bug#17638477 UNINSTALL AND INSTALL SEMI-SYNC PLUGIN CAUSES SLAVES TO BREAK
Fix the bug properly (plugin cannot be unloaded as long as it's locked).
Enable and fix the test case.
Significantly reduce number of LOCK_plugin locks for semisync
(practically all locks were removed)
2014-08-03 12:45:14 +02:00
Sergei Golubchik
1c6ad62a26 mysql-5.5.39 merge
~40% bugfixed(*) applied
~40$ bugfixed reverted (incorrect or we're not buggy)
~20% bugfixed applied, despite us being not buggy
(*) only changes in the server code, e.g. not cmakefiles
2014-08-02 21:26:16 +02:00
Sergei Golubchik
4b4de01fae 5.3 merge 2014-08-01 16:51:12 +02:00
Igor Babaev
f735822720 Fixed bug mdev-5721.
Do not define a look-up key for a temporary table if its length
exceeds the maximum length of such keys.
2014-07-31 22:17:43 -07:00
unknown
a270e8abc4 MDEV-6441: memory leak
mysql_derived_prepare() was executed on the statement memory.
Now it is executed on the runtime memory.
All bugs induced by this were fixed.
2014-07-31 10:11:10 +03:00
Sergei Golubchik
c1c6f6f161 MDEV-5924 MariaDB could crash after changing the query_cache size with SET GLOBAL
* remove incorrect assertion (it didn't take into account concurrent clients)
* fix the comment
2014-07-29 12:05:58 +02:00
Alexander Barkov
5b452ae027 MDEV-4511 Assertion `scale <= precision' fails on GROUP BY TIMEDIFF with incorrect types
MDEV-6302 Wrong result set when using GROUP BY FROM_UNIXTIME(...)+0
Fixed.
2014-07-28 13:47:55 +04:00
Alexander Barkov
c57c5be12a MDEV-5745 analyze MySQL fix for bug#12368495 2014-07-28 12:47:14 +04:00
Sergei Golubchik
a6071cc596 MDEV-6082 Assertion `0' fails in TC_LOG_DUMMY::log_and_order on DML after installing TokuDB at runtime on server with disabled InnoDB
We don't support changing tc_log implementation at run time.
If the first XA-capable engine is loaded with INSTALL PLUGIN - disable its
XA capabilities with a warning
2014-07-27 21:02:00 +02:00
Sergei Golubchik
be667b8c42 MDEV-5706 MariaDB does not build on hurd-i386
backport from 10.0 the fix for:
  MDEV-5756 CMake option to build without thread pool
2014-07-25 14:15:33 +02:00