Commit graph

20585 commits

Author SHA1 Message Date
Sergei Petrunia
821b866b55 Merge branch 'bb-10.2-myrocks-merge' into 10.2 2019-06-21 12:56:26 +03:00
Sergei Petrunia
7345c0de26 Fix tests: some build hosts have ramdisk in /run/shm instead of /dev/shm 2019-06-20 21:34:15 +03:00
Sergei Petrunia
622ecfc7c6 Update test results 2019-06-20 19:35:36 +03:00
Sergei Petrunia
a2e9e3fbd4 MyRocks: dont show read-Free replication variables
MariaDB doesn't support Read-Free replication, so showing them only causes
confusion.
Removed variables:
- @@rocksdb_read_free_rpl
- @@rocksdb_read_free_rpl_tables
2019-06-20 15:29:17 +03:00
Michael Widenius
8acbf9c1f9 MDEV-19595 fixed
The test cases for the MDEV found several independent bugs
in MariaDB server and Aria:
- If a temporary table was marked as crashed, it could never
  be deleted.
- Opening of a crashed temporary table gave an error message
  but the error was never forwarded to the caller which caused
  an assert() in my_ok()
- init_read_record() did mmap of all temporary tables, which is
  probably not a good idea as this area can potentially be
  very big. Changed code to only mmap internal temporary tables.
- mmap-ed tables where not unmapped in case of repair/optimize
  which caused bad data in table and crashes if the original
  table files where replaced with new ones (as the old mmap
  was still in place). Fixed by removing the mmap in case
  of repair.
- Cleaned up usage of code that disabled mmap in Aria
2019-06-19 00:35:44 +03:00
Michael Widenius
b23c82fef3 MDEV-18078 Assertion `trnman_has_locked_tables(trn) > 0' failed
Problem was that in case of implicit rollback for alter table
Aria did try to run commit twice.

The test case for this is tricky to do in 10.2, so it will
be added to 10.4 as part of BACKUP STAGE testing.
2019-06-18 14:32:24 +03:00
Michael Widenius
c8b5fa4afc MDEV-19055 Failures with temporary tables and Aria
There was two separate problems:
- Aria pagecache didn't properly handle re-reading of blocks
  that have given errors before (this triggered an assert)
- temporary tables that where opened several times where
  not properly closed in ALTER, REPAIR or OPTIMIZE table

Other things
- Added a couple of asserts that will make it easier to
  find problems like this in the future.
2019-06-17 17:50:08 +03:00
Sergei Petrunia
7f845c6653 Fix typo 2019-06-16 23:21:12 +03:00
Sergei Petrunia
a0251c7d75 Post-merge build fixes
- Don't add DZSTD_STATIC_LINKING_ONLY
- Don't use upstream's way of linking with Jemalloc (MyRocks/MariaDB has
  its own in build_rocksdb.cmake)
- Don't depend on libunwind
2019-06-16 21:44:02 +03:00
Sergei Petrunia
15087b41a5 More Post-merge fixes 2019-06-16 21:07:23 +03:00
Sergei Petrunia
27e05d92be Post-merge fixes cont'd 2019-06-16 20:41:53 +03:00
Sergei Petrunia
6152ecea21 Post-merge fixes: fix rocksdb.tbl_opt_data_index_dir
MariaDB generates both errors and warnings. Warnings are not normally
visible when errors are also produced.
2019-06-16 20:28:01 +03:00
Sergei Petrunia
c399405885 Post-merge fixes: rocksdb.bloomfilter3, use_direct_io_for_flush_and_compaction 2019-06-16 17:42:45 +03:00
Marko Mäkelä
2b660fb4c2 mtr_t::is_block_dirtied(): Define inline 2019-06-16 15:55:09 +03:00
Marko Mäkelä
a94638f155 Clarify the purpose of MTR_LOG_NONE 2019-06-16 15:54:14 +03:00
Marko Mäkelä
e9795d0208 Add mtr_buf_t::for_each_block_in_reverse() const
Avoid unnecessary creation of named objects for invoking
mtr_buf_t::for_each_block_in_reverse().
2019-06-16 15:53:06 +03:00
Sergei Petrunia
23b967d639 Post-merge fixes: fix linking on Windows 2019-06-16 15:29:04 +03:00
Sergei Petrunia
ba2f20cc33 Post-merge fix: fix compilation on Windows 2019-06-16 12:53:13 +03:00
Sergei Petrunia
9c75b3d283 Post-merge fixes 2019-06-16 12:44:04 +03:00
Sergei Petrunia
93c84cc8f2 MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. 2019-06-16 12:13:52 +03:00
Sergei Petrunia
e9e5e7fc92 Post-merge fix: MariaDB doesn't have I_S.PROCESSLIST.SRV_ID 2019-06-16 00:36:04 +03:00
Sergei Petrunia
9ab0d7b4e9 Merge from MyRocks upstream:
Copy of
    commit dcd9379eb5707bc7514a2ff4d9127790356505cb
    Author: Manuel Ung <mung@fb.com>
    Date:   Fri Jun 14 10:38:17 2019 -0700

        Skip valgrind for rocksdb.force_shutdown

        Summary:
        This test does unclean shutdown, and leaks memory.

        Squash with: D15749084

        Reviewed By: hermanlee

        Differential Revision: D15828957

        fbshipit-source-id: 30541455d74
2019-06-16 00:28:33 +03:00
Sergei Petrunia
5173e396ff Copy of
commit dcd9379eb5707bc7514a2ff4d9127790356505cb
Author: Manuel Ung <mung@fb.com>
Date:   Fri Jun 14 10:38:17 2019 -0700

    Skip valgrind for rocksdb.force_shutdown

    Summary:
    This test does unclean shutdown, and leaks memory.

    Squash with: D15749084

    Reviewed By: hermanlee

    Differential Revision: D15828957

    fbshipit-source-id: 30541455d74
2019-06-15 21:29:46 +03:00
Sergei Petrunia
91be2212c6 MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. 2019-06-15 19:55:57 +03:00
Oleksandr Byelkin
50653e021f Merge branch '10.1' into 10.2 2019-06-13 16:42:21 +02:00
Thirunarayanan Balathandayuthapani
e9145aab44 MDEV-19435 buf_fix_count > 0 for corrupted page when it exits the LRU list
Problem:
=========
One of the purge thread access the corrupted page and tries to remove from
LRU list. In the mean time, other purge threads are waiting for same page
in buf_wait_for_read(). Assertion(buf_fix_count == 0) fails for the
purge thread which tries to remove the page from LRU list.

Solution:
========
- Set the page id as FIL_NULL to indicate the page is corrupted before
removing the block from LRU list. Acquire hash lock for the particular
page id and wait for the other threads to release buf_fix_count
for the block.

- Added the error check for btr_cur_open() in row_search_on_row_ref().
2019-06-13 16:13:51 +03:00
Oleksandr Byelkin
5b65d61d93 Merge branch '5.5' into 10.1 2019-06-12 22:54:46 +02:00
Marko Mäkelä
94e665596d MDEV-19740: Remove some broken InnoDB systemd code
GCC 9.1.1 noticed that sd_notifyf() was always being invoked with
str=NULL argument for "%s". This code was added in
commit 2e814d4702
but not mentioned in the commit comment.

The STATUS messages for systemd matter during startup and shutdown,
and should not be emitted during normal operation.

ib_senderrf(): Remove the potentially harmful sd_notifyf() calls.
2019-06-12 16:25:55 +03:00
Marko Mäkelä
4bbd8be482 Merge 10.1 into 10.2 2019-06-12 10:30:01 +03:00
Thirunarayanan Balathandayuthapani
b2f76bac03 MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB: Redo log crypto: failed to decrypt log block"
- Post-push fix to change the copyright of both xtradb and innodb file.
2019-06-12 12:25:00 +05:30
Thirunarayanan Balathandayuthapani
c5fe1b8fc1 MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB: Redo log crypto: failed to decrypt log block"
- If InnoDB encounters garbage or incomplete written log block during
recovery then don't throw the error. Treat it as end of the log.
- This kind of incomplete or empty block can be result of killing
InnoDB when writing the redo log.
2019-06-12 12:17:13 +05:30
Marko Mäkelä
cbac8f9351 MDEV-19725 Incorrect error handling in ALTER TABLE
Some I/O functions and macros that are declared in os0file.h used to
return a Boolean status code (nonzero on success). In MySQL 5.7, they
were changed to return dberr_t instead. Alas, in MariaDB Server 10.2,
some uses of functions were not adjusted to the changed return value.

Until MDEV-19231, the valid values of dberr_t were always nonzero.
This means that some code that was incorrectly checking for a zero
return value from the functions would never detect a failure.

After MDEV-19231, some tests for ALTER ONLINE TABLE would fail with
cmake -DPLUGIN_PERFSCHEMA=NO. It turned out that the wrappers
pfs_os_file_read_no_error_handling_int_fd_func() and
pfs_os_file_write_int_fd_func() were wrongly returning
bool instead of dberr_t. Also the callers of these functions were
wrongly expecting bool (nonzero on success) instead of dberr_t.

This mistake had been made when the addition of these functions was
merged from MySQL 5.6.36 and 5.7.18 into MariaDB Server 10.2.7.

This fix also reverts commit 40becbc3c7
which attempted to work around the problem.
2019-06-10 18:15:25 +03:00
Thirunarayanan Balathandayuthapani
bb5d04c9b8 MDEV-19695 Import tablespace doesn't work with ROW_FORMAT=COMPRESSED encrypted tablespace
Problem:
=======
fil_iterate() writes imported tablespace page0 as it is to discarded
tablespace. Space id wasn't even changed. While opening the tablespace,
tablespace fails with space id mismatch error.

Fix:
====
fil_iterate() copies the page0 with discarded space id to imported
tablespace.
2019-06-06 12:54:34 +05:30
Thirunarayanan Balathandayuthapani
b4287ec386 MDEV-19541 InnoDB crashes when trying to recover a corrupted page
- Use corrupt page id instead of whole block after releasing it from
LRU list.
2019-06-05 16:36:51 +05:30
Monty
40becbc3c7 Fixed bug in online alter table when not compiled with performance schema
os_file_write_func() and os_file_read_no_error_handling_func() returned
different result values depending on if UNIV_PFS_IO was defined or not.

Other things:
- Added some comments about return values for some functions
2019-06-03 15:06:51 +03:00
Vlad Lesin
c9b49a4be7 MDEV-18207: ASAN heap-use-after-free in _ma_get_status upon concurrent operations with sequence
The issue is that two MARIA_HA instances shares the same MARIA_STATUS_INFO
object during UNION execution, so the second MARIA_HA instance state pointer
MARIA_HA::state points to the MARIA_HA::state_save of the first MARIA instance.

This happens in
thr_multi_lock(...) {
...
	for (first_lock=data, pos= data+1 ; pos < end ; pos++)
	{
...
		if (pos[0]->lock == pos[-1]->lock && pos[0]->lock->copy_status)
			(pos[0]->lock->copy_status)((*pos)->status_param,
																	(*first_lock)->status_param);
...
	}
...
}

Usually the state is restored from ha_maria::external_lock(...):

\#0  _ma_update_status (param=0x6290000e6270) at ./storage/maria/ma_state.c:309
\#1  0x00005555577ccb15 in _ma_update_status_with_lock (info=0x6290000e6270) at ./storage/maria/ma_state.c:361
\#2  0x00005555577c7dcc in maria_lock_database (info=0x6290000e6270, lock_type=2) at ./storage/maria/ma_locking.c:66
\#3  0x0000555557802ccd in ha_maria::external_lock (this=0x61d0001b1308, thd=0x62a000048270, lock_type=2) at ./storage/maria/ha_maria.cc:2727

But _ma_update_status() does not take into account the case when
MARIA_HA::status points to the MARIA_HA::state_save of the other MARIA_HA
instance.

The fix is to restore MARIA_HA::state in ha_maria::external_lock() after
maria_lock_database() call for transactional tables.
2019-05-31 10:03:17 +03:00
Marko Mäkelä
9d142a895c Define page_id_t in buf0types.h 2019-05-31 09:57:40 +03:00
Eugene Kosov
5de08a53ef MDEV-13631 Make use of clang-format
Add .clang-format files to a root directory and to storage/innobase
2019-05-30 23:27:31 +04:00
Sergey Vojtovich
dd939d6f7e MDEV-15734 - calculation inside sizeof() warning
Reverted incorrect change introduced by 548d03d7.

As result is char**, third qsort() parameter must be sizeof(char*).
Not sizeof(result[0] + 2), which is same as sizeof(result[0]).
Not even sizeof(result[0]) + 2, which would cause invalid memory access.

Proper sorting is responsibility of logfilenamecompare() callback.
2019-05-30 19:52:31 +04:00
Sergey Vojtovich
80a142f146 Lintian complains about script-not-executable
Removed #! sequence from non-executable script.
2019-05-30 17:19:13 +04:00
Faustin Lammler
4adf52a048 Add missing script header 2019-05-30 17:18:24 +04:00
Sujatha
a47464d1c1 MDEV-11094: Blackhole table updates on slave fail when row annotation is enabled
Post push fix.

Simplified the earlier fixes.
2019-05-29 17:35:29 +05:30
Sujatha
b347396181 MDEV-11094: Blackhole table updates on slave fail when row annotation is enabled
Problem:
=======
rpl_blackhole.test fails when executed with following options
mysqld=--binlog_annotate_row_events=1, mysqld=--replicate_annotate_row_events=1

Test output:
------------
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
rpl.rpl_blackhole_bug 'mix'              [ pass ]    791
rpl.rpl_blackhole_bug 'row'              [ fail ]
Replicate_Wild_Ignore_Table
Last_Errno	1032
Last_Error	Could not execute Update_rows_v1 event on table test.t1; Can't find
record in 't1', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's
master log master-bin.000001, end_log_pos 1510

Analysis:
=========
Enabling "replicate_annotate_row_events" on slave, Tells the slave to write
annotate rows events received from the master to its own binary log. The
received annotate events are applied after the Gtid event as shown below.
thd->query() will be set to the actual query received from the master, through
annotate event. Annotate_rows event should not be deleted after the event is
applied as the thd->query will be used to generate new Annotate_rows event
during applying the subsequent Rows events. After the last Rows event has been
applied, the saved Annotate_rows event (if any) will be deleted.

In balckhole engine all the DML operations are noops as they donot store any
data. They simply return success without doing any operation. But the existing
strictly expects thd->query() to be 'NULL' to identify that row based
replication is in use. This assumption will fail when row annotations are
enabled as the query is not 'NULL'. Hence various row based operations like
'update', 'delete', 'index lookup' will fail when row annotations are enabled.

Fix:
===
Extend the row based replication check to include row annotations as well.
i.e Either the thd->query() is NULL or thd->query() points to query and row
annotations are in use.
2019-05-29 15:18:52 +05:30
Marko Mäkelä
6eefeb6fea MDEV-19541: Avoid infinite loop of reading a corrupted page
row_search_mvcc(): Duplicate the logic of btr_pcur_move_to_next()
so that an infinite loop can be avoided when advancing to the next
page fails due to a corrupted page.
2019-05-29 11:20:56 +03:00
Marko Mäkelä
1ca75ae1c8 MDEV-19587 innodb_force_recovery=5 crash on DROP SCHEMA
At higher levels of innodb_force_recovery, the InnoDB transaction
subsystem will not be set up at all.

At slightly lower levels, recovered transactions will not be rolled back,
and DDL operations could hang due to locks being held at all.

Let us consistently refuse all writes if the predicate
high_level_read_only holds. We failed to refuse DROP TABLE
and DROP DATABASE. (Refusing DROP TABLE is a partial backport
from MDEV-19570 in the 10.5 branch.)
2019-05-28 16:43:02 +03:00
Thirunarayanan Balathandayuthapani
96d9f03328 MDEV-19602 Replace mysql_version check with frm_version for virtual columns inside InnoDB
- Replace mysql_version check with omit_virtual_cols() in
ha_innobase::check_if_supported_inplace_alter().
2019-05-28 16:02:48 +03:00
Marko Mäkelä
d59e15bdb9 Merge 10.1 into 10.2 2019-05-28 15:56:24 +03:00
Thirunarayanan Balathandayuthapani
88157247fc MDEV-19509 InnoDB skips the tablespace in rotation list
- If one of the encryption threads already started the initialization
of the tablespace then don't remove the other uninitialized tablespace
from the rotation list.

- If there is a change in innodb_encrypt_tables then
don't remove the processed tablespace from rotation list.
2019-05-28 15:55:33 +03:00
Thirunarayanan Balathandayuthapani
79b46ab2a6 MDEV-19541 InnoDB crashes when trying to recover a corrupted page
- Don't apply redo log for the corrupted page when innodb_force_recovery > 0.
- Allow the table to be dropped when index root page is
corrupted when innodb_force_recovery > 0.
2019-05-28 11:55:02 +03:00
Marko Mäkelä
626f2a1c17 MDEV-19614 SET GLOBAL innodb_ deadlock due to LOCK_global_system_variables
The update callback functions for several settable global InnoDB variables
are acquiring InnoDB latches while holding LOCK_global_system_variables.

On the other hand, some InnoDB code is invoking THDVAR() while holding
InnoDB latches. An example of this is thd_lock_wait_timeout() that is
called by lock_rec_enqueue_waiting(). In some cases, the
intern_sys_var_ptr() that is invoked by THDVAR() may acquire
LOCK_global_system_variables, via sync_dynamic_session_variables().

In lock_rec_enqueue_waiting(), we really must be holding some InnoDB
latch while invoking THDVAR(). This implies that
LOCK_global_system_variables must conceptually reside below any InnoDB
latch in the latching order. That in turns implies that the various
update callback functions must release LOCK_global_system_variables
before acquiring any InnoDB mutexes or rw-locks, and reacquire
LOCK_global_system_variables later. The validate functions are being
invoked while not holding LOCK_global_system_variables and thus they
do not need any changes.

The following statements are affected by this:

SET GLOBAL innodb_adaptive_hash_index = …;
SET GLOBAL innodb_cmp_per_index_enabled = 1;
SET GLOBAL innodb_old_blocks_pct = …;
SET GLOBAL innodb_fil_make_page_dirty_debug = …; -- debug builds only
SET GLOBAL innodb_buffer_pool_evict = uncompressed; -- debug builds only
SET GLOBAL innodb_purge_run_now = 1; -- debug builds only
SET GLOBAL innodb_purge_stop_now = 1; -- debug builds only
SET GLOBAL innodb_log_checkpoint_now = 1; -- debug builds only
SET GLOBAL innodb_buf_flush_list_now = 1; -- debug builds only
SET GLOBAL innodb_buffer_pool_dump_now = 1;
SET GLOBAL innodb_buffer_pool_load_now = 1;
SET GLOBAL innodb_buffer_pool_load_abort = 1;
SET GLOBAL innodb_status_output = …;
SET GLOBAL innodb_status_output_locks = …;
SET GLOBAL innodb_encryption_threads = …;
SET GLOBAL innodb_encryption_rotate_key_age = …;
SET GLOBAL innodb_encryption_rotation_iops = …;
SET GLOBAL innodb_encrypt_tables = …;
SET GLOBAL innodb_disallow_writes = …;

buf_LRU_old_ratio_update(): Correct the return type.
2019-05-28 10:54:30 +03:00