Commit graph

7029 commits

Author SHA1 Message Date
Alexander Barkov
19df45a705 MDEV-18333 Slow_queries count doesn't increase when slow_query_log is turned off 2019-03-04 13:49:15 +04:00
Sergei Golubchik
aeefd26ecb Merge branch '10.0' into 10.1 2018-12-29 23:44:45 +01:00
Sergei Golubchik
8634f7e528 Merge branch '5.5' into 10.0 2018-12-20 09:15:01 +01:00
Sachin
f16d4d4c6e MDEV-17720 slave_ddl_exec_mode=IDEMPOTENT does not handle DROP DATABASE
Relevant if exists flag are added for create database and drop database.
2018-12-19 23:47:26 +05:30
Sergey Vojtovich
15eaeace39 MDEV-16987 - ALTER DATABASE possible in read-only mode
Forbid ALTER DATABASE under read_only.
2018-12-13 20:52:23 +04:00
Jan Lindström
1037edcb11 MDEV-17804: Galera tests cause mysql_socket.h:738: inline_mysql_socket_send: Assertion `mysql_socket.fd != -1' failed.
Do not do end of statement logic if thd is already killed as
socket is already closed.
2018-11-26 08:12:30 +02:00
Sergei Golubchik
329058be29 wsrep: create a macro for the error: label
that is used by WSREP_TO_ISOLATION_BEGIN and other galera macros,
to avoid the need for wrapping this label in #ifdef WITH_WSREP/#endif
2018-10-24 14:48:08 +02:00
Sergei Golubchik
db947b7599 Merge branch '10.0-galera' into 10.1 2018-09-07 15:25:27 +02:00
Jan Lindström
c5a8583b31 Merge tag 'mariadb-10.0.36' into 10.0-galera 2018-08-02 11:44:02 +03:00
Jan Lindström
c863159c32 MDEV-16799: Test wsrep.variables crash at sql_class.cc:639 thd_get_ha_data
Problem was that binlog_hton was not initialized fully when needed
i.e. when wsrep_on = true.
2018-07-24 14:54:50 +03:00
Oleksandr Byelkin
0896d7ebc3 Merge branch '10.0' into bb-10.1-merge 2018-07-19 12:55:54 +02:00
sachin
ada54101a7 MDEV-9266 Creating index on temporaray table breaks replication
Problem:- Create/drop index was logged into binlog.

Goal:- Operation on temporary table should not be binlog when binlog format
is row.

Solution:-
We should add CF_FORCE_ORIGINAL_BINLOG_FORMAT when there is ddl on temp
table.
For optimize, analyze, repair we wont change anything ,Then will
be logged in binlog , But they also dont throw any error if operation fails
Since slave wont be having any temp table , but these operation on tmp
table will be processed without breaking replication.

For rename we need a different logic MDEV-16728 will solve it.
2018-07-18 17:13:24 +05:30
Jan Lindström
fe9f2f4bb6 MDEV-16401: Apply review comments to MDEV-16005
Do not hold LOCK_thd_data during my_error or WSREP_DEBUG. Similarly,
release LOCK_thd_data before close_thread_tables() call.
2018-07-16 08:53:40 +03:00
Sergei Golubchik
776fc87686 fix compilation w/o partitioning
followup for d8da920264
2018-06-14 18:06:44 +02:00
Vicențiu Ciorbaru
6e55236c0a Merge branch '10.0-galera' into 10.1 2018-06-12 19:39:37 +03:00
Monty
d8da920264 MDEV-10679 Crash in performance schema and partitioning with discovery
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.
2018-05-26 12:49:25 +03:00
Monty
e744c687ca Merge remote-tracking branch 'origin/10.0' into 10.1 2018-05-24 11:08:02 +03:00
Monty
da71c1bad7 MDEV-16229 Replication aborts with ER_VIEW_SELECT_TMPTABLE after half-failed 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.
2018-05-22 23:05:48 +03:00
Sergei Golubchik
91dfb6141f Merge branch '10.0' into 10.1 2018-05-19 22:05:55 +02:00
Monty
ef295c31e3 MDEV-11129 CREATE OR REPLACE TABLE t1 AS SELECT spfunc() crashes if spfunc() 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()
2018-05-16 21:51:46 +03:00
Oleksandr Byelkin
0bd2b80254 MDEV-15347: Valgrind or ASAN errors in mysql_make_view on query from 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).
2018-05-15 10:21:50 +02:00
Sergei Golubchik
1bc3899a52 Merge branch '10.0' into 10.1 2018-05-08 17:08:23 +02:00
Sergei Golubchik
34045af03f MDEV-15216 Assertion `! is_set() || m_can_overwrite_status' failed in Diagnostics_area::set_error_status upon operation inside XA
don't implicitly commit or rollback in mysql_admin_table()
unless the statement has CF_IMPLICIT_COMMIT_END flag.
2018-05-08 10:48:13 +02:00
Jan Lindström
e1ffb66449 Merge tag 'mariadb-10.0.35' into 10.0-galera 2018-05-07 17:20:39 +03:00
Jan Lindström
648cf7176c Merge remote-tracking branch 'origin/5.5-galera' into 10.0-galera 2018-05-07 13:49:14 +03:00
Sergei Golubchik
9989c26bc9 Merge branch '10.0' into 10.1 2018-05-05 14:01:59 +02:00
Jan Lindström
ed1d9c802d
Merge pull request #729 from codership/MDEV-15794
MDEV-15794 Fix and re-enable test galera_var_retry_autocommit
2018-04-27 14:42:47 +03:00
Sergei Golubchik
619afb151b MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION
followup for bcb36ee21e

move reopening before trans_commit_stmt(thd);
2018-04-26 14:08:03 +02:00
Daniele Sciascia
58c03e8f30 MDEV-15794 Fix and re-enable test galera_var_retry_autocommit
The test was not deterministic and would occasionally fail, due to the
use of `sleep`.
This patch is a complete rewrite of the test using proper sync points.
2018-04-26 13:03:51 +02:00
sjaakola
2f0b8f3e02 MDEV-16005 sporadic failures with galera tests MW-328B and MW-328C
These test can sporadically show mutex deadlock warnings between LOCK_wsrep_thd
and LOCK_thd_data mutexes. This means that these mutexes can be locked in opposite
order by different threads, and thus result in deadlock situation.
To fix such issue, the locking policy of these mutexes should be revised and
enforced to be uniform. However, a quick code review shows that the number of
lock/unlock operations for these mutexes combined is between 100-200, and all these
mutex invocations should be checked/fixed.

On the other hand, it turns out that LOCK_wsrep_thd is used for protecting access to
wsrep variables of THD (wsrep_conflict_state, wsrep_query_state), whereas LOCK_thd_data
protects query, db and mysys_var variables in THD. Extending LOCK_thd_data to protect
also wsrep variables looks like a viable solution, as there should not be a use case
where separate threads need simultaneous access to wsrep variables and THD data variables.

In this commit LOCK_wsrep_thd mutex is refactored to be replaced by LOCK_thd_data.
By bluntly replacing LOCK_wsrep_thd by LOCK_thd_data, will result in double locking
of LOCK_thd_data, and some adjustements have been performed to fix such situations.
2018-04-24 16:57:39 +03:00
Jan Lindström
82e968197a MDEV-15580: Assertion `!lex->explain' failed in lex_start(THD*):
Problem was that we did not delete explain information
when Galera must replay a query.

Could not find easily repeatable test case that would not
cause other problems.
2018-04-13 08:20:02 +03:00
Daniele Sciascia
45eca6178e MDEV-13549 Fix and re-enable MTR test galera.MW-284
The following changes are committed:

* `RESET MASTER` at the end of the test. This was necessary to allow the test
  to run on repeated runs.

* `--source include/galera_wait_ready.inc` after setting `gmcast.isolate=0` to
  get back to a primary component.

* Fix for assertion in `Protocol::end_statement()`. The assertion is due to
  the fact that function `do_command()` calls `thd->protocol->end_statement()`,
  without setting an error, when it is detected that galera is not ready yet.
  Following line somehow disappeared in a past merge:
  ```
  my_message(ER_UNKNOWN_COM_ERROR,
             "WSREP has not yet prepared node for application use", MYF(0));
  ```
2018-04-05 14:43:11 +02:00
Daniele Sciascia
fc26fd1c47 MW-405 Remove redundant conditions
Remove clause on `thd->variables.wsrep_on` in the following code:

if (WSREP(thd))
{
...
        if (thd->variables.wsrep_on &&
            ...

In the above snippet, `WSREP(thd)` already ensures thd->variables.wsrep_on
2018-04-03 08:10:21 +03:00
Sergei Golubchik
de55a7d1f9 Allow table-less selects even when wsrep is not ready
It doesn't make sense to allow selects from I_S but disallow selects
that don't use any tables at all, because any (disallowed) select that
doesn't use tables can be made allowed by adding
"FROM I_S.COLLATIONS LIMIT 1" to the end.

And it break mysql-test rather badly, even check-testcase.test
fails on its first `SELECT '$tmp' = 'No such row'`

This reverts 9a89614857, c5dd2abf4c, and 33028f7c4b:
Refs: MW-245 - changed logic so that in non primary node it is possible to do SET + SHOW + SELECT from information and pfs schema, when dirty reads are not enabled - however, non table selects are not allowed (e.g. SELECT 1)
Refs MW-245 - logic was wrong in detecting if queries are allowed in non primary node. it allowed select with no table list to execute even if dirty reads was not specified
Refs: MW-245 - Adjust tests to account for the new behavior.
2018-03-23 00:55:19 +01:00
Marko Mäkelä
c704523195 Remove orphan wsrep_node_is_ready() 2018-03-21 11:58:17 +02:00
sjaakola
9a89614857 Refs: MW-245 - changed logic so that in non primary node it is possible to do SET + SHOW + SELECT from information and pfs schema, when dirty reads are not enabled - however, non table selects are not allowed (e.g. SELECT 1) 2018-03-20 12:10:41 +02:00
sjaakola
c5dd2abf4c Refs MW-245 - logic was wrong in detecting if queries are allowed in non primary node. it allowed select with no table list to execute even if dirty reads was not specified 2018-03-20 12:10:41 +02:00
sjaakola
8f717ed360 refs MW-245 - allowing USE <database> with dirty reads configuration - fix for logic of setting wsrep ready status 2018-03-20 12:10:41 +02:00
sjaakola
2a729b5f4b refs MW-245 - merged wsrep_dirty_reads and wsrep_reject_queries from PXC 2018-03-20 12:10:41 +02:00
Daniele Sciascia
a3ba3aab5a MDEV-13549 Wrong usage of mutex 'LOCK_wsrep_thd' and 'LOCK_thd_kill' test galera.MW-286
Test MW-286 occasionally failed with error the following message:

```
safe_mutex: Found wrong usage of mutex 'LOCK_wsrep_thd' and 'LOCK_thd_kill'
Mutex currently locked (in reverse order):
LOCK_thd_kill                     mariadb-server/sql/sql_class.h  line 3535
LOCK_wsrep_thd                    mariadb-server/sql/wsrep_thd.cc  line 88
```

The fix consists in calling thd->reset_killed() in wsrep_mysql_parse() after
LOCK_wsrep_thd is unlocked. Which avoids the taking locks LOCK_wsrep_thd and
LOCK_thd_kill in reverse order.
2018-03-08 15:02:43 +01:00
Oleksandr Byelkin
80d3eee072 MDEV-14857: problem with 10.2.11 server crashing when executing stored procedure
Counter for select numbering made stored with the statement (before was global)
So now it does have always accurate value which does not depend on
interruption of statement prepare by errors like lack of table in
a view definition.
2018-02-01 09:51:47 +01:00
sjaakola
91daf8819c MW-416
Moved TOI replication to happen after ACL checking for commands:
SQLCOM_CREATE_EVENT
SQLCOM_ALTER_EVENT
SQLCOM_DROP_EVENT
SQLCOM_CREATE_VIEW
SQLCOM_CREATE_TRIGGER
SQLCOM_DROP_TRIGGER
SQLCOM_INSTALL_PLUGIN
SQLCOM_UNINSTALL_PLUGIN
2017-12-18 16:41:40 +01:00
Alexey Botchkov
6ee9cba745 MDEV-10486 MariaDB 10.x does not update rows_examined in performance_schema tables.
Save the rows_examined counter before it gets emptied.
2017-12-18 15:21:50 +04:00
Jan Lindström
feb8296ee6 MDEV-14401: Stored procedure that declares a handler that catches ER_LOCK_DEADLOCK error causes thd->is_error() assertion
This was missing bug fix from MySQL wsrep i.e. Galera.
Problem was that if stored procedure declares a handler that
catches deadlock error, then the error may have been
cleared in method sp_rcontext::handle_sql_condition().
Use wsrep_conflict_state correctly to determine is the
error already sent to client.

Add test case for both this bug and MDEV-12837: WSREP: BF
lock wait long. Test requires both fixes to pass.
2017-12-09 11:21:23 +02:00
Sergei Golubchik
2a4e4335c4 Merge branch 'github/10.0-galera' into 10.1 2017-11-10 01:38:03 +01:00
Teemu Ollakka
736d75d455 MW-406 Bumped up the wsrep patch version (5.6.37-25.21) 2017-11-08 14:59:30 +02:00
Daniele Sciascia
b79407c5e9 MW-388 Remove unnecessary conditions 2017-11-08 12:49:27 +02:00
Jan Lindström
958ad5a880 MW-388 Fix conflict handling of SPs with DECLARE ... HANDLER
Adapt to MariaDB case
2017-11-08 12:25:46 +02:00
Daniele Sciascia
76f1195f5b MW-388 Fix conflict handling of SPs with DECLARE ... HANDLER
It is possible for a stored procedure that has an error handler
that catches SQLEXCEPTION to call thd->clear_error() on a thd
that failed certification. And because the error is cleared,
wsrep patch proceeds with the normal path and may try to commit
statements that should actually abort.
This patch catches the situation where wsrep_conflict_state is
still set, but the thd's error has been cleared, and rolls back
the statement in such cases.
2017-11-08 12:21:51 +02:00
Sachin Setiya
3cecb1bab3 Merge tag 'mariadb-10.0.33' into bb-10.0-galera 2017-11-03 12:34:05 +05:30