Commit graph

21974 commits

Author SHA1 Message Date
Marko Mäkelä
2cd45add27 MDEV-6275: Fix signed/unsigned comparison 2019-06-14 07:34:25 +03:00
Marko Mäkelä
991d5140c3 Merge 10.3 into 10.4 2019-06-14 07:29:20 +03:00
Marko Mäkelä
d9fe615ef6 spider_db_init(): Do not return uninitialized error_num
If the allocation of spider_table_sts_threads failed,
we would DBUG_RETURN(error_num) without having initialized
it earlier.

Pre-initialize error_num to HA_ERR_OUT_OF_MEM and remove
a lot of assignments that thus became redundant.

This error was introduced in 207594afac
(Spider 3.3.13).
2019-06-14 07:26:51 +03:00
Marko Mäkelä
984d7100cd Merge 10.4 into 10.5 2019-06-13 18:36:09 +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ä
d46db415ce MDEV-19738: Skip doublewrite on MLOG_ZIP_PAGE_COMPRESS
page_zip_compress(), page_zip_compress_write_log(),
page_zip_copy_recs(): Replace the parameters page,page_zip with block,
and set buf_page_t::init_on_flush on success
if innodb_log_optimize_ddl=OFF.

page_zip_parse_compress_no_data(): Merge with the only caller
recv_parse_or_apply_log_rec_body().
2019-06-12 20:29:30 +03:00
Marko Mäkelä
8bb4ea2e6f MDEV-19738: Doublewrite buffer is unnecessarily used for newly (re)initialized pages
Thanks to MDEV-12699, the doublewrite buffer will only be needed in
those cases when a page is being updated in the data file. If the page
had never been written to the data file since it was initialized,
then recovery will be able to reconstruct the page based solely on
the contents of the redo log files.

The doublewrite buffer is only really needed when recovery needs to read
the page in order to apply redo log.

Note: As noted in MDEV-19739, we cannot safely disable the doublewrite
buffer if any MLOG_INDEX_LOAD records were written in the past or will
be written in the future. These records denote that redo logging was
disabled for some pages in a tablespace. Ideally, we would have
the setting innodb_log_optimize_ddl=OFF by default, and would not allow
it to be set while the server is running. If we wanted to make this
safe, assignments with SET GLOBAL innodb_log_optimize_ddl=...
should not only issue a redo log checkpoint (including a write of all
dirty pages from the entire buffer pool), but it should also wait for
all pending ALTER TABLE activity to complete. We elect not to do this.

Avoiding unnecessary use of the doublewrite buffer should improve the
write performance of InnoDB.

buf_page_t::init_on_flush: A new flag to indicate whether it is safe to
skip doublewrite buffering when writing the page.

fsp_init_file_page(): When writing a MLOG_INIT_FILE_PAGE2 record,
set the init_on_flush flag if innodb_log_optimize_ddl=OFF.
This is the only function that writes that log record.

buf_flush_write_block_low(): Skip doublewrite if init_on_flush is set.

fil_aio_wait(): Clear init_on_flush.
2019-06-12 20:18:01 +03:00
Marko Mäkelä
38018f48b6 MDEV-19586: Remove unnecessary iteration
recv_apply_hashed_log_recs(): Refer directly to recs.last->end_lsn
instead of iterating the entire list starting from recs.log.
2019-06-12 19:36:30 +03: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
Kentoku SHIBA
8e3a4be45c
MDEV-6275 spider_same_server_link not enforced (#1330) 2019-06-12 19:30:50 +09: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ä
2fd82471ab Merge 10.3 into 10.4 2019-06-12 08:37:27 +03:00
Sergei Golubchik
27fcdb161c MDEV-16249 CHECKSUM TABLE for a spider table is not parallel and saves all data in memory in the spider head by default (#1328)
followup for be5c432a42

ha_partition::calculate_checksum() has to invoke calculate_checksum()
for partitions unconditionally, not under (HA_HAS_OLD_CHECKSUM | HA_HAS_NEW_CHECKSUM).
Because the server uses ::info() to ask for a live checksum, while
calculate_checksum() must, precisely, calculate it the slow way,
also for tables that don't have the live checksum at all.

Also, fix the compilation on Windows (ha_checksum/ulonglong type mix).
2019-06-11 18:42:45 +02:00
Marko Mäkelä
b42dbdbccd Merge 10.2 into 10.3 2019-06-11 13:00:18 +03:00
Marko Mäkelä
177a571e01 MDEV-19586 Replace recv_sys_t::addr_hash with a std::map
InnoDB crash recovery buffers redo log records in a hash table.
The function recv_read_in_area() would pick a random hash bucket
and then try to submit read requests for a few nearby pages.
Let us replace the recv_sys.addr_hash with a std::map, which will
automatically be iterated in sorted order.

recv_sys_t::pages: Replaces recv_sys_t::addr_hash, recv_sys_t::n_addrs.

recv_sys_t::recs: Replaces most of recv_addr_t.

recv_t: Encapsulate a raw singly-linked list of records. This reduces
overhead compared to std::forward_list. Storage and cache overhead,
because the next-element pointer also points to the data payload.
Processing overhead, because recv_sys_t::recs_t::last will point to
the last record, so that recv_sys_t::add() can append straight to the
end of the list.

RECV_PROCESSED, RECV_DISCARDED: Remove. When a page is fully processed,
it will be deleted from recv_sys.pages.

recv_sys_t::trim(): Replaces recv_addr_trim().

recv_sys_t::add(): Use page_id_t for identifying pages.

recv_fold(), recv_hash(), recv_get_fil_addr_struct(): Remove.

recv_read_in_area(): Simplify the iteration.
2019-06-11 11:08:39 +03:00
Marko Mäkelä
992d2494e7 Define page_id_t in buf0types.h 2019-06-11 11:08:39 +03:00
Kentoku SHIBA
be5c432a42
MDEV-16249 CHECKSUM TABLE for a spider table is not parallel and saves all data in memory in the spider head by default (#1328)
add checksum_null for setting null value of checksum
2019-06-11 00:25:08 +09:00
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
Alexander Barkov
b685109596 MDEV-19710 Split the server side code in rpl_utility.cc into virtual methods in Type_handler 2019-06-07 12:47:24 +04:00
Robert Bindar
bf70430ead MDEV-17709 Remove handlerton::state 2019-06-06 22:09:31 +04: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
Monty
c51f615bf5 Added options --s3-protocol-version and --s3-host-name 2019-06-01 15:21:50 +03:00
Monty
f2d608dd49 Update to latest libmarias3
This removes dependency of libhmash
2019-06-01 15:21:50 +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
Marko Mäkelä
28fad39de7 Merge 10.4 into 10.5 2019-05-29 22:29:05 +03:00
Marko Mäkelä
f98bb23168 Merge 10.3 into 10.4 2019-05-29 22:17:00 +03: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ä
90a9193685 Merge 10.2 into 10.3 2019-05-29 11:32:46 +03:00
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
Marko Mäkelä
242a28c320 MDEV-6812: Remove the wrapper my_log2f() 2019-05-28 10:54:30 +03:00
Marko Mäkelä
24773bf380 MDEV-19606: dict_v_col_t: Encapsulate v_indexes
Remove the separate allocation and pointer indirection of
dict_v_col_t::v_indexes.
2019-05-28 08:01:50 +03:00
Marko Mäkelä
0274ab1de3 MDEV-19606: Replace most std::list with std::forward_list
C++11 defines the singly-linked std::forward_list. Prefer it to
the doubly-linked std::list in cases where we dot really need it.
Also, clean up some code.

dict_index_remove_from_v_col_list(): Remove.
Obsoleted by dict_index_t::detach_columns().

There is no std::forward_list::push_back(). Use push_front() instead.
The ordering does not really matter.

dict_v_col_t::n_v_indexes: Added. There is no std::forward_list::size(),
and trx_undo_log_v_idx() needs to know the size.

rtr_info_track_t::rtr_active: Encapsulate. There really was no justification
for the pointer indirection.
2019-05-28 08:01:50 +03:00
Marko Mäkelä
50e79f604e MDEV-19606: Make recv_dblwr_t::list a forward_list 2019-05-28 08:01:49 +03:00
Thirunarayanan Balathandayuthapani
b8b74e141d MDEV-19027 create_table_def fails when virtual column is present between stored columns
- create_table_def() misconstructs the dict_table_t by ignoring the stored
columns of the table if virtual column is present between stored columns.
2019-05-27 21:35:16 +05:30
Daniel Black
35522455e0 RocksDB: use crc32c optimised version for POWER 2019-05-27 16:47:51 +03:00
Marko Mäkelä
c0cd662b98 Merge 10.4 to 10.5 2019-05-27 11:08:51 +03:00
Marko Mäkelä
e32212c63c MDEV-19582 Out-of-bounds memory accesses by WolfSSL
Fix errors caught by clang-7 in the encrypted variants of the tests
innodb.innodb-table-online innodb.innodb-index-online
2019-05-27 10:16:23 +03:00
Alexander Barkov
9f23f8e598 MDEV-19599 Change db_name, table_name to LEX_CSTRING in Item_ident and Send_field 2019-05-26 09:49:13 +04:00
Vladislav Vaintroub
88b7926ff8 MDEV-19582 WolfSSL decyption function can read memory out-of-bounds.
MDEV-19581 Valgrind error with WolfSSL and encrypted binlog

WolfSSL can read  memory out of bounds in EVP_CipherUpdate()
in decrypt/NOPAD mode, when the input length is not multiple of AES block
size.

The workaround ensures that input will have some padding at the end
by having slightly larger allocated buffer, or padding the structures
with 16 more bytes.
2019-05-25 22:59:33 +02:00
Yuqi
0928596a8b Armv8 CRC32 optimization (#772)
ARMv8 (AArch64) CPUs implement the CRC32 extension which is implemented by inline assembly ,
so they can also benefit from hardware acceleration in IO-intensive workloads.

The patch optimizes crc32c calculate with the armv8 crypto instruction(Intrinsics) when available
rather than original linear crc instructions.

Change-Id: I05d36a64c726d910c47befad93390108f4e6567f
Signed-off-by: Yuqi Gu <yuqi.gu@arm.com>
2019-05-24 18:20:27 +04:00
Marko Mäkelä
5d2619b693 MDEV-19584 Allocate recv_sys statically
There is only one InnoDB crash recovery subsystem.
Allocating recv_sys statically removes one level of pointer indirection
and makes code more readable, and removes the awkward initialization of
recv_sys->dblwr.

recv_sys_t::create(): Replaces recv_sys_init().

recv_sys_t::debug_free(): Replaces recv_sys_debug_free().

recv_sys_t::close(): Replaces recv_sys_close().

recv_sys_t::add(): Replaces recv_add_to_hash_table().

recv_sys_t::empty(): Replaces recv_sys_empty_hash().
2019-05-24 16:19:38 +03:00
Sergey Vojtovich
a74b01ea0e MDEV-16548 - Innodb fails to start on older kernels that don't support F_DUPFD_CLOEXEC
InnoDB duplicates file descriptor returned by create_temp_file() to
workaround further inconsistent use of this descriptor.

Use mysys file descriptors consistently for innobase_mysql_tmpfile(path).
Mostly close it by appropriate mysys wrappers.
2019-05-24 13:21:14 +04:00
Sergey Vojtovich
5f5a0b3bb6 MDEV-16548 - Innodb fails to start on older kernels that don't support F_DUPFD_CLOEXEC
InnoDB duplicates file descriptor returned by create_temp_file() to
workaround further inconsistent use of this descriptor.

Use mysys file descriptors consistently for innobase_mysql_tmpfile(NULL).
Mostly close it by appropriate mysys wrappers.
2019-05-24 13:21:09 +04:00
Marko Mäkelä
c874040729 Declare INFORMATION_SCHEMA.INNODB_SYS_VIRTUAL stable
The INFORMATION_SCHEMA plugin INNODB_SYS_VIRTUAL, which was introduced
in MariaDB 10.2.2 along with the dictionary table SYS_VIRTUAL,
is similar to other, much older and already stable plugins that
provide access to InnoDB dictionary tables.
2019-05-24 10:22:34 +03:00
Marko Mäkelä
893472d005 MDEV-19570 Deprecate and ignore innodb_undo_logs, remove innodb_rollback_segments
The option innodb_rollback_segments was deprecated already in
MariaDB Server 10.0. Its misleadingly named replacement innodb_undo_logs
is of very limited use. It makes sense to always create and use the
maximum number of rollback segments.

Let us remove the deprecated parameter innodb_rollback_segments and
deprecate&ignore the parameter innodb_undo_logs (to be removed in a
later major release).

This work involves some cleanup of InnoDB startup. Similar to other
write operations, DROP TABLE will no longer be allowed if
innodb_force_recovery is set to a value larger than 3.
2019-05-23 17:34:47 +03:00
Marko Mäkelä
826f9d4f7e Merge 10.4 into 10.5 2019-05-23 10:32:21 +03:00
Marko Mäkelä
e5d71e0b3d MDEV-19551 Remove alias innodb_stats_sample_pages
The parameter innodb_stats_sample_pages became an alias for
innodb_stats_transient_sample_pages and was deprecated in
MariaDB Server 10.0. Let us finally remove that alias.
2019-05-23 10:25:12 +03:00
Marko Mäkelä
1a6f470464 MDEV-19544 Remove innodb_locks_unsafe_for_binlog
The transaction isolation levels READ COMMITTED and READ UNCOMMITTED
should behave similarly to the old deprecated setting
innodb_locks_unsafe_for_binlog=1, that is, avoid acquiring gap locks.

row_search_mvcc(): Reduce the scope of some variables, and clean up
the initialization and use of the variable set_also_gap_locks.
2019-05-23 10:25:12 +03:00
Marko Mäkelä
47cede646b MDEV-19543 Deprecate and ignore innodb_log_checksums
The parameter innodb_log_checksums that was introduced in MariaDB 10.2.2
via mysql/mysql-server@af0acedd88
does not make much sense. The original motivation of introducing this
parameter (initially called innodb_log_checksum_algorithm in
mysql/mysql-server@22ba38218e)
was that the InnoDB redo log used the slow and insecure innodb algorithm.
With hardware or SIMD accelerated CRC-32C, there should be no reason to
allow checksums to be disabled on the redo log.

The parameter innodb_encrypt_log already implies innodb_log_checksums=ON.

Let us deprecate the parameter innodb_log_checksums and always compute
redo log checksums, even if innodb_log_checksums=OFF is specified.

An upgrade from MariaDB 10.2.2 or later will only be possible after
using the default value innodb_log_checksums=ON. If the non-default
value innodb_log_checksums=OFF was in effect when the server was shut down,
a log block checksum mismatch will be reported and the upgraded server
will fail to start up.
2019-05-23 10:25:11 +03:00
Marko Mäkelä
3eef9f213f MDEV-17841: Fix -Wsometimes-uninitialized
maria_open(): Initialize share->mode=0 for S3
2019-05-23 10:18:55 +03:00
Monty
ebfe8c4e0e Make it trivial to get stack traces from external programs.
To get a stacktrace in a program like aria_chk, one only have to do:

#include <my_stacktrace.h>

call my_init_stacktrace(1) in main().
2019-05-23 02:28:23 +03:00
Monty
ab38b7511b MDEV-17841 S3 storage engine
A read-only storage engine that stores it's data in (aws) S3

To store data in S3 one could use ALTER TABLE:
ALTER TABLE table_name ENGINE=S3

libmarias3 integration done by Sergei Golubchik
libmarias3 created by Andrew Hutchings
2019-05-23 02:28:23 +03:00
Sergei Golubchik
2ca2dcac6a aria is mandatory now, so don't bother with CMAKE_DEPENDENT_OPTION 2019-05-23 01:20:18 +03:00
Monty
007f68c37f Replace ha_notify_table_changed() with notify_tabledef_changed()
Reason for the change was that ha_notify_table_changed() was done
after table open when .frm had been replaced, which caused failure
in engines that checks on open if .frm matches the engines table
definition.

Other changes:
- Remove not needed open/close call at end of inline alter table.
  Some test that depended on the table beeing in the table cache after
  ALTER TABLE had to be updated.
2019-05-23 01:20:18 +03:00
Monty
0b9f7f86f8 Removed not used function maria_clone() 2019-05-23 01:20:17 +03:00
Marko Mäkelä
437da7bc54 MDEV-19534 Make innodb_checksum_algorithm=full_crc32 by default, and remove innodb_checksums 2019-05-22 08:53:28 +03:00
Marko Mäkelä
b40c99a82c MDEV-17458: Clear more of the TRX_SYS page
trx_rseg_array_init(): Using the 10.4 specific MLOG_MEMSET record,
clear the entire TRX_SYS_WSREP_XID_INFO field.
2019-05-22 08:42:41 +03:00
Marko Mäkelä
cf77951fb6 Merge 10.3 into 10.4 2019-05-22 08:42:31 +03:00
Sergey Vojtovich
ec926b0f40 Fixed RocksDB to follow THD ha_data protocol
Use thd_get_ha_data()/thd_set_ha_data() which protect against plugin
removal until it has THD ha_data.

Do not reset THD ha_data in rocksdb_close_connection(), cleaner approach
is to let ha_close_connection() do it.

Removed transaction objects cleanup from rocksdb_done_func(). As we lock
plugin properly, there must be no transaction objects during RocksDB
shutdown.

Part of MDEV-19515 - Improve connect speed
2019-05-21 17:55:09 +04:00
Sergey Vojtovich
8c8d584f06 Fixed InnoDB to not use broken thd_ha_data()
Part of MDEV-19515 - Improve connect speed
2019-05-21 17:55:09 +04:00
Sergey Vojtovich
5e1b3cc8dc Fixed Aria to follow THD ha_data protocol
Use thd_get_ha_data()/thd_set_ha_data() which protect against plugin
removal until it has THD ha_data.

Part of MDEV-19515 - Improve connect speed
2019-05-21 17:55:09 +04:00
Sergey Vojtovich
ba59cc0f37 Fixed Sphinx to follow THD ha_data protocol
Use thd_get_ha_data()/thd_set_ha_data() which protect against plugin
removal until it has THD ha_data.

Do not reset THD ha_data in sphinx_close_connection(), cleaner approach
is to let ha_close_connection() do it.

Part of MDEV-19515 - Improve connect speed
2019-05-21 17:55:09 +04:00
Sergey Vojtovich
00e533c78b Fixed Mroonga to follow THD ha_data protocol
Use thd_get_ha_data()/thd_set_ha_data() which protect against plugin
removal until it has THD ha_data.

Do not reset THD ha_data in mrn_close_connection(), cleaner approach
is to let ha_close_connection() do it.

Part of MDEV-19515 - Improve connect speed
2019-05-21 17:55:09 +04:00
Sergey Vojtovich
5c18ba6c88 Fixed Spider to follow THD ha_data protocol
Do not reset THD ha_data in spider_close_connection(), cleaner approach
is to let ha_close_connection() do it.

Part of MDEV-19515 - Improve connect speed
2019-05-21 17:55:09 +04:00
Sergey Vojtovich
762d2b96fa Fixed FederatedX to follow THD ha_data protocol
Use thd_get_ha_data()/thd_set_ha_data() which protect against plugin
removal until it has THD ha_data.

Do not reset THD ha_data in ha_federatedx::disconnect(), cleaner approach
is to let ha_close_connection() do it.

Part of MDEV-19515 - Improve connect speed
2019-05-21 17:55:09 +04:00
Daniele Sciascia
592dc59d7a MDEV-17458 Unable to start galera node
Bootstrapping a new cluster from a backup created from a MariaDB
version prior to 10.3.5 may result in error "SST position can't be
set in past" when attempting to join additional nodes.
The problem stems from the fact that when reading the wsrep position
from InnoDB, the position is looked up in two places:
the TRX_SYS page, where versions prior to 10.3.5 used to store
WSREP's position; and rollback segments, this is where newer versions
store the position.
When starting a new cluster, the starting seqno is 0 and a new cluster
UUID is generated. This is persisted in rollback segments, but the old
UUID and seqno are not cleared from TRX_SYS page.
Subsequently, when reading back the position,
trx_rseg_read_wsrep_checkpoint() is going to return the maximum seqno
found in both TRX_SYS page and rollback segments. So in the case of a
newly bootstrapped cluster, it's always going to return the old
cluster information.
The fix consists of changing trx_rseg_read_wsrep_checkpoint() so that
only rollback segments are looked up. On startup, position is read
from the TRX_SYS page, and if present, it is copied to rollback
segments (unless a newer position is already present in the rollback
segments).
Finally the position stored in TRX_SYS page is cleared.
2019-05-21 15:06:44 +03:00
Marko Mäkelä
d0ef948d70 Non-functional change: Remove #ifdef UNIV_DEBUG 2019-05-20 16:52:26 +03:00
Marko Mäkelä
74904a667e Remove UT_NOT_USED
btr_pcur_move_to_last_on_page(): Merge with the only caller.
2019-05-20 17:09:50 +03:00
Marko Mäkelä
b77460508e MDEV-19486: Fix -Wsign-compare 2019-05-20 13:02:22 +03:00
Eugene Kosov
48a662dae5 MDEV-19486 Server crashes in row_upd or row_upd_del_mark_clust_rec on REPLACE into a versioned table
row_insert_for_mysql(): InnoDB sets values for row_start and row_end.
And this function used to return those values to server in
ha_innobase::write_row().  This buggy behavior was removed. Also,
a piece of code in this function was reformatted.

upd_node_t::make_versioned_helper(): Assert that the preallocated size
of the update vector is not exceeded.
2019-05-20 10:23:17 +03:00
Oleksandr Byelkin
c07325f932 Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
Sergei Golubchik
2400e06946 remove -fno-rtti 2019-05-18 20:34:03 +02:00
Marko Mäkelä
b86175747d MDEV-19513: Fix the non-debug build
Always initialize dict_sys.m_initialised.
2019-05-17 19:30:29 +03:00
Sergei Golubchik
c1fd027115 Merge branch '10.2' into 10.3 2019-05-17 17:23:01 +02:00
Marko Mäkelä
198ed24cac MDEV-19513: Rename dict_operation_lock to dict_sys.latch
dict_sys.lock(), dict_sys_lock(): Acquire both mutex and latch.

dict_sys.unlock(), dict_sys_unlock(): Release both mutex and latch.

dict_sys.assert_locked(): Assert that both mutex and latch are held.
2019-05-17 15:26:33 +03:00
Marko Mäkelä
b390447e71 MDEV-19513: Remove rw_lock_t::magic_n
The magic_n only complicated object destruction and did not serve
any useful purpose.
2019-05-17 15:25:31 +03:00
Sergei Golubchik
43623f04a9 MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING
handler::write_row() should not destroy the state of the running
index_search/index_next/... or rnd_init/rnd_next/... scan
2019-05-17 13:53:22 +02:00
Marko Mäkelä
5fd7502e77 MDEV-19513: Allocate dict_sys statically
dict_sys_t::create(): Renamed from dict_init().

dict_sys_t::close(): Renamed from dict_close().

dict_sys_t::add(): Sliced from dict_table_t::add_to_cache().

dict_sys_t::remove(): Renamed from dict_table_remove_from_cache().

dict_sys_t::prevent_eviction(): Renamed from
dict_table_move_from_lru_to_non_lru().

dict_sys_t::acquire(): Replaces dict_move_to_mru() and some more logic.

dict_sys_t::resize(): Renamed from dict_resize().

dict_sys_t::find(): Replaces dict_lru_find_table() and
dict_non_lru_find_table().
2019-05-17 14:32:53 +03:00
Sergey Vojtovich
b546e92a6b Fixed rocksdb.mariadb_plugin on Windows 2019-05-16 20:28:49 +04:00
Sergei Petrunia
5f66c58f6d Issue #904: Crash in rocksdb::IOStatsContext::Reset, this=NULL
Fix both code paths:
- Change the test source code so it doesn't cause the "Unused variable"
  warning (which -Werror converted into error and caused CMake not to set
  HAVE_THREAD_LOCAL)

- If the system doesn't seem to support HAVE_THREAD_LOCAL, refuse to
  compile (rather than producing a binary that crashes for some tests)

Originally submitted at https://github.com/facebook/mysql-5.6/pull/905
2019-05-16 18:27:28 +04:00
Sergey Vojtovich
76a94a03db MDEV-19090 - Split rocksdb.locking_issues
This test takes ~6 minutes, split it for better parallelism.
2019-05-16 17:49:34 +04:00
Sergey Vojtovich
a24dffdba3 Fixed RocksDB to follow THD ha_data protocol
Use thd_get_ha_data()/thd_set_ha_data() which protect against plugin
removal until it has THD ha_data.

Do not reset THD ha_data in rocksdb_close_connection(), cleaner approach
is to let ha_close_connection() do it.

Removed transaction objects cleanup from rocksdb_done_func(). As we lock
plugin properly, there must be no transaction objects during RocksDB
shutdown.
2019-05-16 16:28:16 +04:00