Commit graph

180192 commits

Author SHA1 Message Date
Marko Mäkelä
d9c85ee45a MDEV-15752 Possible race between DDL and accessing I_S.INNODB_TABLESPACES_ENCRYPTION
fil_crypt_read_crypt_data(): Do not attempt to read the tablespace
if the file is unaccessible due to a pending DDL operation, such as
renaming the file or DROP TABLE or TRUNCATE TABLE. This is only
reducing the probability of the race condition, not completely
preventing it.
2018-04-07 19:52:35 +03:00
Vicențiu Ciorbaru
4c89cff558 Merge branch '10.0' into 10.1 2018-04-07 17:11:22 +03:00
Sergei Petrunia
b4c2ceb214 MDEV-15769: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed
Adjust the fix for MDEV-15472:
In close_cached_tables(), locked_tables_list.reopen_tables(...) call
might be made when a previous call to some function has already returned
error.
In this scenario, the function should return 0, even if reopen_tables(...)
call has succeeded.
2018-04-07 15:03:15 +03:00
Sergei Petrunia
1cb2e0333d MDEV-12466 : Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt || ...
When "FLUSH TABLE ... FOR EXPORT" fails, the SQL layer should rollback
the statement. Otherwise we hit an assert when we try to close the
tables while having a non-empty list of statement transaction participants.
2018-04-07 14:05:28 +03:00
Jan Lindström
4ede2fec4c Disable galera_var_auto_inc_control_on test. 2018-04-07 08:52:24 +03:00
Jan Lindström
3756e27aa7
Merge pull request #694 from codership/MDEV-13549-fixes-for-galera_wsrep_desync_wsrep_on
MDEV-13549 Fix test galera.galera_wsrep_desync_wsrep_on
2018-04-07 08:51:33 +03:00
Jan Lindström
c0b781d25e Disable test galera_var_auto_inc_control_on as it fails. 2018-04-06 16:33:41 +03:00
Daniele Sciascia
7925cdff6b MDEV-13549 Fix test galera.galera_wsrep_desync_wsrep_on
The test tends to fail if many parallel instances of it are executed:

```
mysqltest: At line 23: query 'ALTER TABLE t1 ADD PRIMARY KEY (f1)' failed:
1317: Query execution was interrupted
```

The `ALTER` fails because it is BF aborted due to an earlier `INSERT SELECT`
that is being applied:

```
INSERT INTO t1 (f1) SELECT ...

--connection node_2
SET GLOBAL wsrep_desync = TRUE;
SET SESSION wsrep_on = FALSE;

ALTER TABLE t1 ADD PRIMARY KEY (f1);

SET SESSION wsrep_on = TRUE;
SET GLOBAL wsrep_desync = FALSE;
```

And because the `ALTER` is executed with `wsrep_on = OFF`, it does not
run in total order isolation.
To avoid the problem it must be ensured that the `ALTER` only after the
large `INSERT SELECT` is done. To do so it is sufficient to issue
`SELECT COUNT(*) FROM t1;` from `node_2` before turning off wsrep.
The `SELECT` will trigger `wsrep_sync_wait` and proceed only after the
`INSERT SELECT` from node_1 is done.
2018-04-06 15:15:44 +02:00
Marko Mäkelä
8325d71f6c Fix a compilation error 2018-04-06 13:10:01 +03:00
Jan Lindström
81075d45c6 MDEV-15566: System tablespace does not easily key rotate to unencrypted
Problem was that key rotation from encrypted to unecrypted was skipped
when encryption is disabled (i.e. set global innodb-encrypt-tables=OFF).

fil_crypt_needs_rotation
        If encryption is disabled (i.e. innodb-encrypt-tables=off)
	and there is tablespaces using default encryption (e.g.
	system tablespace) that are still encrypted state we need
	to rotate them from encrypted state to unencrypted state.
2018-04-06 12:59:43 +03:00
Jan Lindström
3be6cef593 MDEV-13549: Galera test failures
Fix test case galera_toi_ddl_nonconflicting as we need to wait
until both alter tables are finished on that Galera node.
2018-04-06 12:37:05 +03:00
Sergey Vojtovich
400a8eb60f MDEV-15291 - OQGraph fails to build on FreeBSD
Boost includes sys/param.h on FreeBSD, which in turn defines setbit()
macro. This macro is conflicting with open_query::judy_bitset::setbit().

Reordered includes such that oqgraph_judy.h never sees this macro.
Also removed duplicate includes of graphcore-config.h, which is included
by graphcore-graph.h/oqgraph_shim.h/oqgraph_thunk.h.
2018-04-06 13:33:08 +04:00
Marko Mäkelä
3498a656c9 MDEV-14705: Follow-up fixes
buf_flush_remove(): Disable the output for now, because we
certainly do not want this after every page flush on shutdown.
It must be rate-limited somehow. There already is a timeout
extension for waiting the page cleaner to exit in
logs_empty_and_mark_files_at_shutdown().

log_write_up_to(): Use correct format.

srv_purge_should_exit(): Move the timeout extension to the
appropriate place, from one of the callers.
2018-04-06 12:29:25 +03:00
Jan Lindström
d61ed5dd8a MDEV-13549: Galera test failures
Fix test case galera.pxc-421 to reset auto_increment_offset
correctly.
2018-04-06 12:28:48 +03:00
Daniel Black
1479273cdb MDEV-14705: slow innodb startup/shutdown can exceed systemd timeout
Use systemd EXTEND_TIMEOUT_USEC to advise systemd of progress

Move towards progress measures rather than pure time based measures.

Progress reporting at numberious shutdown/startup locations incuding:
* For innodb_fast_shutdown=0 trx_roll_must_shutdown() for rolling back incomplete transactions.
* For merging the change buffer (in srv_shutdown(bool ibuf_merge))
* For purging history, srv_do_purge

Thanks Marko for feedback and suggestions.
2018-04-06 09:58:14 +03:00
Daniel Black
e7f4e61f6e MDEV-14705: Speed up InnoDB shutdown
Suggested by Marko on github pr #576

buf_all_freed only needs to be called once, not 3 times.

buf_all_freed will always return TRUE if it returns.
It will crash if any page was not flushed so its effectively
an assert anyway.

The following calls are likely redundant and could be removed:

		fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
		fil_flush_file_spaces(FIL_TYPE_LOG);
2018-04-06 09:58:14 +03:00
Marko Mäkelä
76ec37f522 MDEV-14705: Do not rollback on InnoDB shutdown
row_undo_step(): If fast shutdown has been requested, abort the
rollback of any non-DDL transactions. Starting with MDEV-12323,
we aborted the rollback of recovered transactions. These
transactions would be rolled back on subsequent server startup.

trx_roll_report_progress(): Renamed from trx_roll_must_shutdown(),
now that the shutdown check has been moved to the only caller.
2018-04-06 09:58:14 +03:00
Jan Lindström
3a6283cb3c Fix out of array access. 2018-04-06 08:48:11 +03:00
Jan Lindström
afbd45a791 MDEV-13549: Galera test failures
Enable tests that pass on 10.1:
       galera_var_auto_inc_control_on
       galera_var_retry_autocommit
       pxc-421
       lp1376747-2
       lp1376747
       galera_toi_ddl_nonconflicting
       galera_parallel_simple
       galera_admin
       galera_pc_ignore_sb
       galera_lock_table
       galera_unicode_identifiers
       galera.galera_gcs_fc_limit
       galera.galera_gtid
2018-04-05 17:15:40 +03:00
Jan Lindström
6449f0559b MDEV-13549: Galera test failures
Fix test case MW-44 by disabling Galera replication of MyISAM
tables (mysql.general_log especially) to avoid MDL lock
wait later.
2018-04-05 17:15:24 +03:00
Jan Lindström
33b103b4ca MDEV-13549: Galera test failures
Test did not reset modified variables correctly.
2018-04-05 17:15:24 +03:00
Jan Lindström
b1bf571e3d MDEV-13549: Galera test failures
galera_wsrep_desync_wsrep_on test does work on 10.1
2018-04-05 17:15:24 +03:00
Jan Lindström
a41bd33d3b MDEV-13549: Galera test failures
Fix test failure on galera_gcs_fragment. Test requires Galera debug
library with debug_sync functionality.
2018-04-05 17:15:23 +03:00
Jan Lindström
e2e1483dd2
Merge pull request #675 from codership/MDEV-13549-fixes-for-MW-284
MDEV-13549 Fix and re-enable MTR test galera.MW-284
2018-04-05 17:13:53 +03:00
Sergey Vojtovich
5ccf3f96ac Fix misuse of MY_CHECK_CXX_COMPILER_FLAG
- compile_flags already include from top CMakeLists.txt
- MY_CHECK_CXX_COMPILER_FLAG() accepts only one parameter
- output variable of MY_CHECK_CXX_COMPILER_FLAG() is have_CXX__Wa__nH
- same check for mariabackup

Based on contribution by satanson (PR#466).
2018-04-05 17:45:36 +04: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
Marko Mäkelä
4fde1361a6 MDEV-15553 Assertion failed in dict_table_get_col_name
dict_foreign_qualify_index(): Avoid a redundant and harmful
computation of col_name of a virtual column. This fixes the
assertion failure.

dict_foreign_push_index_error(): Do not call dict_table_get_col_name()
on a virtual column. (It is unclear if this condition is actually
reachable.)
2018-04-05 15:01:17 +03:00
Ian Gilfillan
8901155780 Update contributors 2018-04-05 14:23:18 +04:00
Jan Lindström
87d763015a MDEV-13549: Galera test failures
Fix test failure on galera_toi_dll_fk_insert. DEFAULT value seems
to be 3 but test expects it to be 1.
2018-04-05 10:31:42 +03:00
Jan Lindström
2ad51c3153
Merge pull request #686 from codership/MDEV-13549-fixes-for-mysql-wsrep#90
MDEV-13549 Fix and re-enable MTR test galera.mysql-wsrep#90
2018-04-05 08:59:28 +03:00
Jan Lindström
4f3d2e60ad
Merge pull request #690 from codership/MDEV-13549-fixes-for-galera_gra_log
MDEV-13549 Fix and re-enable MTR test galera.galera_gra_log
2018-04-04 15:26:05 +03:00
Alexander Barkov
6beb08c7b6 MDEV-15624 Changing the default character set to utf8mb4 changes query evaluation in a very surprising way 2018-04-04 09:12:44 +04:00
Vicențiu Ciorbaru
6a72b9096a Merge branch '5.5' into 10.0 2018-04-03 18:08:30 +03:00
Daniele Sciascia
eeb684221d MDEV-13549 Fix and re-enable MTR test galera.galera_gra_log
Test galera checks that a `GRA_x_x.log` file is created whenever
wsrep applier fails to apply some replication event. The file
contains the corresponding binlog event that failed to apply.
The test creates a new file by concatenating a pre-recorded
file containing the binlog header (see `std-data/binlog-header.log`)
and the `GRA_x_x.log` file. The test then checks that the resulting
file, containing the binlog header and the event that failed to
apply, is correctly read by `mysqlbinlog` program.
The test fails in MariaDB because the GRA_x_x.log file created
by MariaDB already contains the binlog header (see MDEV-7867).
This patch fixes/simplifies test `galera.galera_gra_log` so that
it doesn't concatenate `std-data/binlog-header.log` with the
`GRA_x_x.log` file. File `std-data/binlog-header.log` is deleted
altoghether, because not used by any other test.
2018-04-03 16:30:58 +02:00
Michael Gmelin
ed33296246 Fix LibreSSL X509 (SSL) certificate hostname checking.
(Currently) LibreSSL doesn't calculate the string length of the hostname
that's passed to X509_check_host automatically in case namelen/chklen is 0.
This causes server certificate validation to fail when building MariaDB with
LibreSSL.

The proposed fix makes MariaDB determine the string length passed to
X509_check_host. As there are no ill side-effects (OpenSSL's X509_check_host
also simply calls strlen if namelen == 0, see also X509_check_host(3)), this
wasn't wrapped in any #ifdef like constructs.

Please see here for a proposed patch to modify LibreSSL's behavior:
https://github.com/libressl-portable/openbsd/pull/87
2018-04-03 16:20:04 +02:00
Sergei Golubchik
f5369faf5b don't disable SSL when connecting via libmysqld 2018-04-03 16:19:10 +02:00
Sergei Golubchik
df6197c8b9 compiler warning
warning: format '%p' expects argument of type 'void *', but argument 4 has type 'long int'
2018-04-03 16:19:10 +02:00
Marko Mäkelä
bc2501453c Remove an unused variable 2018-04-03 16:58:35 +03:00
Marko Mäkelä
3c21eccb8c MDEV-15764 InnoDB may write uninitialized garbage to redo log
log_write_up_to(): Erase the end of the current log block.
Simplify the computation of pad_size.

log_buffer_switch(): Evaluate a condition only once.
2018-04-03 15:58:13 +03:00
Alexander Barkov
606e21867c MDEV-15630 uuid() function evaluates at wrong time in query 2018-04-03 16:28:52 +04:00
Thirunarayanan Balathandayuthapani
d9c5a46678 MDEV-15737 assertion in mariabackup.exe!recv_calc_lsn_on_data_add()
- recovered_lsn shouldn't be initialized during xtrabackup_copy_logfile().
If partial redo log read during the end of xtrabackup_copy_logfile() then
recovered_lsn will be different from scanned_lsn. Re-initialization of
recovered_lsn could lead to partial read again. It is a regression of
MDEV-14545
2018-04-03 16:43:36 +05:30
Daniel Black
8ffbb825e6 increase upper value of max_prepared_stmt_count to UINT32_MAX
The upper 1M limit for max_prepared_stmt_count was set over 10 years
ago. It doesn't suite current hardware and a sysbench oltp_read_write
test with 512 threads will hit this limit.
2018-04-03 10:37:20 +04:00
Jan Lindström
7ffa82b03c MDEV-14616: WSREP has not yet prepared node for application use error
MariaDB adjustments.

mysqltest.cc : Allow 12 error codes at --error

wait_until_connected_again.inc: Replace numeric error codes with symbols

mysqltest.test: Add error codes to test that tests too many errorcodes
2018-04-03 08:10:21 +03:00
Daniele Sciascia
992370693f MW-405 Remove wait_until_connected_again.inc from kill_galera.inc
kill_galera.inc can no longer rely on wait_until_connected_again.inc.
This is because wait_until_connected_again now tries to make sure
that the server it is connected eventually transition to ready
state. Whereas some tests may need to kill galera while the server
is in a non-primary view.
2018-04-03 08:10:21 +03:00
Daniele Sciascia
54652161a2 MW-405 Adjust galera_pc_weight to new wait_until_connected_again
Test galera_3nodes.galera_pc_weight started to fail because it
expects to use wait_until_connected_again while remaining in
non-primary view. Hopefully this is the only test which makes
this assumption, and fortunately those wait_until_connected_again
seem unnecessary, so this patch removes them.
2018-04-03 08:10:21 +03: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
Daniele Sciascia
d970f805e6 MW-405 Make sure wsrep is ready in wait_until_connected_again.inc
wait_until_connected_again issues 'SHOW STATUS' query repeatedly
until mysqld replies without errors.
However, SHOW STATUS is treated specially by wsrep in that it is
allowed to proceed even if wsrep is not yet in ready state. As a
consequence, after returning from wait_until_connected_again,
wsrep may not be ready yet and subsequent queries may fail with
error "1047 WSREP has not yet prepared node for application use".
To avoid those errors, the patch includes wait_wsrep_ready.inc at
the end of the wait_until_connected_again.
2018-04-03 08:10:21 +03:00
Galina Shalygina
6223f1dd98 MDEV-15579 Crash in Item_field::used_tables() called by
Item::derived_field_transformer_for_having

The crash occurred due to an inappropriate handling of multiple equalities
when pushing conditions into materialized views/derived tables. If equalities
extracted from a multiple equality can be pushed into a materialized
view/derived table they should be plainly conjuncted with other pushed
predicates rather than form a separate AND sub-formula.
2018-04-03 00:17:45 +02:00
Varun Gupta
10f6b7001b MDEV-9744: session optimizer_use_condition_selectivity=5 causing SQL Error (1918):
Encountered illegal value '' when converting to DECIMAL

The issue was that EITS data was allocated but then not read for some reason (one being to avoid a deadlock),
then the optimizer was using these bzero'ed buffers as EITS statistics.
This should not be allowed, we should use statistcs for a table only when we have successfully loaded/read
the stats from the statistical tables.
2018-04-02 13:14:30 +03:00
Vladislav Vaintroub
27c24808f7 MDEV-15636 mariabackup --lock-ddl-per-table hangs if ALTER table is running
concurrently.

There is a deadlock between

C1 mariabackup's connection that holds MDL locks
C2 Online ALTER TABLE that wants to have MDL exclusively
   and tries to upgrade its mdl lock.
C3 another mariabackup's connection that does FLUSH TABLES (or FTWRL)

C3 waits waits for C2,  which waits for C1, which waits for C3,
thus the deadlock.


MDL locks cannot be released until FLUSH  succeeds, because
otherwise it would allow ALTER to sneak in, causing backup to abort and
breaking lock-ddl-per-table's promise.

The fix here workarounds the deadlock, by killing connections in
"Waiting for metadata lock" status (i.e ALTER). This killing continues
until FTWRL succeeds.

Killing connections is skipped in case --no-locks parameter
was  passed to backup, because there won't be a FLUSH.

For the reference,in Percona's xtrabackup --lock-ddl-per-connection
silently implies --no-lock ie FLUSH is always skipped there.

A rather large part of fix is introducing DBUG capability to start
a query  the new connection at the right moment of backup
compensating somewhat for mariabackup' lack of send_query or DBUG_SYNC.
2018-04-01 14:26:06 +00:00