Commit graph

63050 commits

Author SHA1 Message Date
Daniel Black
fa5809ce10 Add Master_gtid_wait_{count,time,timeouts} status
MASTER_GTID_WAIT function needs some status to evaluate its use.

master_gtid_wait_count indicates how many times the function is called.
master_gtid_wait_time indicates how much time in microseconds occurred
waiting (or timing out)
master_gtid_timeouts indicates how many time times this function timed
out rather than all successful gtids events being available.
2015-03-12 06:43:38 +11:00
Sergei Golubchik
5f510a9175 Merge branch '5.5' into 10.0 2015-03-06 18:41:32 +01:00
Kristian Nielsen
3ef0b9b235 Merge MDEV-6589 and MDEV-6403 into 10.0. 2015-03-04 13:36:54 +01:00
Kristian Nielsen
78c74dbe30 MDEV-6403: Temporary tables lost at STOP SLAVE in GTID mode if master has not rotated binlog since restart
The binlog contains specially marked format description events to mark
when a master restart happened (which could have caused temporary
tables to be silently dropped). Such events also cause slave to close
temporary tables.

However, there was a bug that if after this, slave re-connects to the
master in GTID mode, the master can send an old format description
event again. If temporary tables are closed when such event is seen
for the second time, it might drop temporary tables created after that
event, and cause replication failure.

With this patch, the restart flag of the format description event is
cleared by the master when it is sent to the slave in a subsequent
connection, to avoid the errorneous temp table close.
2015-03-04 13:36:29 +01:00
Kristian Nielsen
ad0d203f2e MDEV-6589: Incorrect relay log start position when restarting SQL thread after error in parallel replication
The problem occurs in parallel replication in GTID mode, when we are using
multiple replication domains. In this case, if the SQL thread stops, the
slave GTID position may refer to a different point in the relay log for each
domain.

The bug was that when the SQL thread was stopped and restarted (but the IO
thread was kept running), the SQL thread would resume applying the relay log
from the point of the most advanced replication domain, silently skipping all
earlier events within other domains. This caused replication corruption.

This patch solves the problem by storing, when the SQL thread stops with
multiple parallel replication domains active, the current GTID
position. Additionally, the current position in the relay logs is moved back
to a point known to be earlier than the current position of any replication
domain. Then when the SQL thread restarts from the earlier position, GTIDs
encountered are compared against the stored GTID position. Any GTID that was
already applied before the stop is skipped to avoid duplicate apply.

This patch should have no effect if multi-domain GTID parallel replication is
not used. Similarly, if both SQL and IO thread are stopped and restarted, the
patch has no effect, as in this case the existing relay logs are removed and
re-fetched from the master at the current global @@gtid_slave_pos.
2015-03-04 13:36:04 +01:00
Vicențiu Ciorbaru
45b6edb158 MDEV-6838: Using too big key for internal temp tables
This bug manifests due to wrong computation and evaluation of
keyinfo->key_length. The issues were:
* Using table->file->max_key_length() as an absolute value that must not be
  reached for a key, while it represents the maximum number of bytes
  possible for a table key.
* Incorrectly computing the keyinfo->key_length size during
  KEY_PART_INFO creation. The metadata information regarding the key
  such the field length (for strings) was added twice.
2015-02-28 23:58:05 +02:00
Kristian Nielsen
aa845d123c MDEV-6391: GTID binlog state not recovered if mariadb-bin.state is removed
When the server starts up, check if the master-bin.state file was lost.
If it was, recover its contents by scanning the last binlog file, thus
avoiding running with a corrupt binlog state.
2015-02-27 14:34:52 +01:00
Vicențiu Ciorbaru
ec4ff9a2e7 MDEV-7586: Merged derived tables/VIEWs increment created_tmp_tables
Temporary table count fix. The number of temporary tables was increased
when the table is not actually created. (when do_not_open was passed
as TRUE to create_tmp_table).
2015-02-26 23:09:54 +02:00
Sergei Golubchik
5c66abf0b0 Merge remote-tracking branch 'origin/10.0' into 10.0 2015-02-25 16:34:33 +01:00
Alexander Barkov
f825b5a4ee MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14 2015-02-25 14:13:32 +04:00
Sergei Golubchik
126523d190 MDEV-6703 Add "mysqlbinlog --binlog-row-event-max-size" support
partially cherry-pick from mysql/5.6.
No test case (mysql/5.6 test case is useless, the correct
test case uses too much memory)

commit e061985813db54948f99892d89f7e076242473a5
Author:  <Dao-Gang.Qu@sun.com>
Date:   Tue Jun 1 15:02:22 2010 +0800

    Bug #49931          Incorrect type in read_log_event error
    Bug #49932          mysqlbinlog max_allowed_packet hard coded to 1GB
2015-02-24 15:55:00 +01:00
Kristian Nielsen
a227cf8046 MDEV-7335: Potential parallel slave deadlock with specific binlog corruption
If somehow the COMMIT or XID event in an event group was missing, the code in
parallel replication to handle this was not sufficient, leading to server
deadlock.
2015-02-24 14:39:15 +01:00
Kristian Nielsen
79e9ff44d1 MDEV-7458: Deadlock in parallel replication can allow following transaction to start replicating too early
In parallel replication, don't rollback inside ha_commit_trans() in case of
error.

The rollback will be done later, but the parallel replication code needs to
run unmark_start_commit() before the rollback to properly control the
sequencing of transactions.

I did not manage to come up with a reliable automatic test case for this, but
I tested it manually.
2015-02-23 13:37:34 +01:00
Kristian Nielsen
b5d6aa5517 MDEV-7310: last_commit_pos_offset set to wrong value after binlog rotate in group commit
When the binlog was rotated due to @@max_binlog_size, the values of the
binlog_shapshot_file and binlog_snapshot_position were inconsistent in case of
non-transactional DML. The position was refering to the old file, while the
filename was of the new file after rotation. This patch makes them consistent
by making sure the position is also refering to the new file.
2015-02-23 13:27:51 +01:00
Sergei Golubchik
f2cb45daf3 Merge remote-tracking branch 'origin/10.0' into 10.0 2015-02-22 21:45:24 +01:00
Sergei Golubchik
0ba168020e MDEV-6769 DROP TRIGGER IF NOT EXIST binlogged on master but not on slave
don't return from DROP TRIGGER IF NOT EXISTS on the slave side
early when the trigger couldn't be read
2015-02-22 12:54:52 +01:00
Sergei Golubchik
b739103f12 MDEV-7591 master crashed when slave specfied a future position with semi-repl plugin
cherry-pick the upstream fix

commit d4ba10184cd7bde9c31c610e664ecd0c93605c46
Author: Sujatha Sivakumar <sujatha.sivakumar@oracle.com>
Date:   Wed Jul 2 11:34:11 2014 +0530

    Bug#17453826:ASSERTION ERROR WHEN SETTING FUTURE BINLOG
    FILE/POS WITH SEMISYNC

    Problem:
    ========
    When DMLs are in progress on the master stopping a slave and
    setting ahead binlog name/pos will cause an assert on the
    master.
    ...
2015-02-22 12:54:52 +01:00
Sergei Golubchik
22cf2f117a MDEV-7482 VIEW containing INTERVAL(...)
Item_func::print() prints itself as name + "(" + arguments + ")".
Normally that works, but Item_func_interval internally implements its
arguments as one single Item_row. Item_row prints itself as
"(" + values + ")". As a result, "INTERVAL(1,2)" was being printed
as "INTERVAL((1,2))". Fixed with a custom Item_func_interval::print().
2015-02-22 12:54:52 +01:00
Sergei Petrunia
775528ada3 MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
Enable subquery materialization for non-SELECT queries with a SELECT part
2015-02-20 03:17:46 +03:00
Sergei Petrunia
0f8b194146 MDEV-6687: Assertion `0' failed in Protocol::end_statement on query
Redefine FT_KEYPART in a way that it does not conflict with Hash Join.
Hash join stores field->field_index in KEYUSE::keypart, so we must
use a value of FT_KEYPART that's greater than MAX_FIELDS.
2015-02-19 20:54:20 +03:00
Kristian Nielsen
004dd0aaa8 MDEV-7568: STOP SLAVE crashes the server
The order of initialisation during server startup was incorrect. The slave
threads were started before the parallel replication worker thread pool was
initialised, allowing a race where uninitialised data could be accessed.
2015-02-19 15:43:27 +01:00
Sergei Golubchik
d7e7862364 Merge branch '5.5' into 10.0 2015-02-18 15:16:27 +01:00
Sergei Golubchik
44cf4d6751 fix a case where automatic procedure grant was changing user's password
phase out make_password_from_salt() to be removed in 10.1
2015-02-17 18:07:56 +01:00
Sergei Golubchik
5dce6aa1fe Merge remote-tracking branch 'bzr/5.5' into bb-5.5-merge 2015-02-12 13:14:55 +01:00
Sergei Golubchik
8e80f91fa3 Merge remote-tracking branch 'mysql/5.5' into bb-5.5-merge @ mysql-5.5.42 2015-02-11 23:50:40 +01:00
Sergei Golubchik
63108dc9d2 Fix the tree to work in git. Backport corresponing 10.1 changes. 2015-02-10 12:26:21 +01:00
unknown
c233d6e120 MDEV-7260: Crash in get_best_combination when executing multi-table UPDATE with nested views
Do not use merge_for_insert for commands which use SELECT because optimizer can't work with such tables.

Fixes which makes multi-delete working with normally merged views.
2015-02-11 01:26:50 +01:00
Alexey Botchkov
cfb7d5d78a MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int).
When the distance in ST_BUFFER is too far negative the coordinates can run out of the operational
    area. We should just return an empty geometry in this case.
2015-02-10 16:16:31 +04:00
Igor Babaev
ffd2996e10 Merge 2015-02-05 21:46:04 -08:00
Igor Babaev
587c72088c Fixed bug mdev-7316.
The function table_cond_selectivity() should take into account that condition selectivity
for some fields can be set to 0.
2015-02-05 20:09:08 -08:00
Sergei Golubchik
1e227b8f2c clarify the comment and trivial cleanups 2015-01-29 12:12:29 +01:00
Sergey Petrunya
fb71449b10 MDEV-5719: Wrong result with GROUP BY and LEFT OUTER JOIN
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)
2015-01-25 16:16:25 +01:00
Sergei Golubchik
267fc6f2b7 Master_info_index assumed that file descriptor can never be 0 2015-01-24 09:37:58 +01:00
Michael Widenius
b83f692565 MDEV-6668: Server crashes in check_view_single_update on concurrent DDL/DML 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
2015-01-29 15:12:32 +02:00
Sergei Golubchik
d9c01e4b4a 5.5 merge 2015-01-21 12:03:02 +01:00
Sergei Golubchik
595cf636fd MDEV-7475 Wrong implementation of checking PLUGIN_VAR_SET condition
correct the check for PLUGIN_VAR_STR
2015-01-19 16:29:18 +01:00
Sergei Golubchik
919443f7a5 MDEV-5679 MariaDB holds stdin open after startup as mysqld 2015-01-19 16:11:48 +01:00
Sergei Golubchik
510ca9b697 MDEV-7402 'reset master' hangs, waits for signalled COND_xid_list
Using a boolean flag for 'there is a RESET MASTER in progress' doesn't
work very well for multiple concurrent RESET MASTER statements.
Changed to a counter.
2015-01-19 14:32:28 +01:00
Sergei Golubchik
73ebabd2ee MDEV-7299 Assertion `m_status == DA_ERROR || m_status == DA_OK' fails on concurrent execution of DDL, queries from I_S, and KILL QUERY
Fix MDL to report an error when a wait was killed, but preserve
the old documented behavior of GET_LOCK() where killing it is not an error.

Also remove race conditions in main.create_or_replace test
2015-01-19 14:19:14 +01:00
Sergei Golubchik
c75eec8e0d rename st_my_thread_var::opt_info -> st_my_thread_var::keycache_link 2015-01-19 14:19:05 +01:00
Sergei Golubchik
47c844f236 MDEV-7219 SQL_CALC_FOUND_ROWS yields wrong result
revert the code in filesort that conditionally updated 'found_rows',
rely on filesort_limit_arg instead.
2015-01-19 14:18:44 +01:00
Sergei Golubchik
ce0ed977d5 MDEV-7186 get_lock() crashes on Windows, main.sp_notembedded and main.trigger_notembedded fail in buildbot
user locks are not affected by lowed_case_table_names
2015-01-19 14:18:34 +01:00
Sergei Golubchik
56c323c10f MDEV-6728 KILL QUERY executed on an idle connection can interrupt the next query
reset KILL_QUERY when a new query execution is just about to be started
2015-01-19 14:07:41 +01:00
Michael Widenius
32be7dffbe Return to original stage after mysql_lock_tables
Stage "Filling schema table" is now properly shown in 'show processlist'


mysys/mf_keycache.c:
  Simple cleanup with more comments
sql/lock.cc:
  Return to original stage after mysql_lock_tables
  Made 'Table lock' as a true stage
sql/sql_show.cc:
  Restore original stage after get_schema_tables_result
2015-01-18 13:39:59 +02:00
Alexander Barkov
c11a054a98 MDEV-7152 Wrong result set for WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'
- The code that tested if
     WHERE expr=value AND expr=const
  can be rewritten to:
     WHERE const=value AND expr=const
  was incomplete in case of STRING_RESULT.
- Moving the test into a new function, to reduce duplicate code.
2015-01-18 01:54:11 +04:00
Vicențiu Ciorbaru
09d54b37f5 MDEV-7362: ANALYZE TABLES crash with table-independent-statistics gathering
FULLTEXT indexes do not permit index first lookups. By calling:
ha_index_first() with a garbage parameter, random data gets overwritten
that causes the table->field array to be corrupted. Subsequently, when
the field array is accessed, a segfault occurs.

By not allowing index statistics for FULLTEXT indexes, the problem is
resolved.
2015-01-17 16:58:10 +00:00
Alexander Barkov
6e6750ad6c MDEV-7366 SELECT 'a' = BINARY 'A' returns 1 (utf8 charset, utf8_unicode_ci collation)
Fixing a wrong assymetric code in Arg_comparator::set_cmp_func().
It existed for a long time, but showed up in 10.0.14 after the fix
for "MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string)".
2015-01-17 17:52:03 +04:00
Jan Lindström
6164157b3f MDEV-7254: Assigned expression is evaluated twice when updating
column TIMESTAMP NOT NULL
      
Analysis: Problem was that value->is_null() function is called
even when user had explicitly set the value for timestamp
field. Calling this function had the side effect that
expression was evaluated twice.
      
Fix: (by Sergei Golubchik) check instead value->null_value.
2015-01-16 12:00:07 +02:00
Sergei Golubchik
5900333aa5 MDEV-7404 REPAIR multiple tables crash in MDL_ticket::has_stronger_or_equal_type
mysql_alter_table() that is used in mysql_recreate_table() doesn't expect
many tables in the TABLE_LIST.
2015-01-14 12:10:13 +01:00
Sergei Golubchik
e53b41a9ec cleanup 2015-01-13 19:28:03 +01:00