Commit graph

19018 commits

Author SHA1 Message Date
Marko Mäkelä
4bf087986f Fix the WSREP build 2017-09-18 11:10:06 +03:00
Jan Lindström
3894fdd47a MDEV-13678: DELETE with CASCADE takes a long time when Galera is enabled
Ported fix from mysql-wsrep-bugs with some refactoring.

Test case is MW-402 where MariaDB needs record as there is
extra connection <con_name> lines.
2017-09-18 10:26:29 +03:00
sjaakola
d186b99251 MW-402 cascading FK issue (5.7 version)
Optimizing cascade node list traversal, which could turn out as
performance bottleneck
Even this current cascade node check could be skipped, but a dedicated
mtr test is needed to confirm that
2017-09-18 10:25:05 +03:00
Jan Lindström
16b374b978 MDEV-13678: DELETE with CASCADE takes a long time when Galera is enabled
Use wsrep_must_process_fk function to check if foreign key
constraint needs to be processed in case of Galera is enabled.
2017-09-18 09:29:35 +03:00
sjaakola
6a524ca56b MW-402 cascading FK issue (5.7 version)
Optimizing cascade node list traversal, which could turn out as
performance bottleneck
Even this current cascade node check could be skipped, but a dedicated
mtr test is needed to confirm that
2017-09-18 09:29:35 +03:00
sjaakola
efb673fe5f MW-402 cascading FK issues
* created tests focusing in multi-master conflicts during cascading foreign key
  processing
* in row0upd.cc, calling wsrep_row_ups_check_foreign_constraints only when
  running in cluster
* in row0ins.cc fixed regression from MW-369, which caused crash with MW-402.test
2017-09-18 09:29:35 +03:00
Marko Mäkelä
d9277732d7 Merge 10.1 into 10.2
This should also fix the MariaDB 10.2.2 bug
MDEV-13826 CREATE FULLTEXT INDEX on encrypted table fails.

MDEV-12634 FIXME: Modify innodb-index-online, innodb-table-online
so that they will write and read merge sort files. InnoDB 5.7
introduced some optimizations to avoid using the files for small tables.

Many collation test results have been adjusted for MDEV-10191.
2017-09-17 11:05:33 +03:00
Marko Mäkelä
836d4e74d9 Write proper tests for MDEV-12634: Uninitialised ROW_MERGE_RESERVE_SIZE bytes
Introduce innodb_encrypt_log.combinations and prove that
the encryption and decryption take place during both
online ADD INDEX (WL#5266) and online table-rebuilding ALTER (WL#6625).
2017-09-16 21:15:38 +03:00
Marko Mäkelä
75dd3bcb4c Clean up after commit 93087d5fe7
Apply the same changes to both InnoDB and XtraDB.
2017-09-16 15:05:22 +03:00
Vladislav Vaintroub
1d7bc3b582 Innodb : do not call fflush() in os_get_last_error_low(), if no error
message was written.
2017-09-16 09:45:38 +00:00
Vladislav Vaintroub
ad17e8e518 MDEV-13821 : mariabackup sometimes could lose ib_logf(FATAL) messages,
The messages are getting lost because they are written with fprintf()
but without fflush(), so abort() would lose buffered text.

Applied fix from 10.2, which makes in_logf() use
sql_print_information(), which in turn does proper flush after each message
2017-09-16 09:45:38 +00:00
Vladislav Vaintroub
93087d5fe7 Fix some warnings 2017-09-16 09:45:38 +00:00
Marko Mäkelä
8c4df595b8 MDEV-13807 mariabackup --apply-log-only does generate redo log by performing rollback and possibly other tasks
Skip rollback and other redo-log-generating tasks if
srv_apply_log_only is set.

Instead of assigning the debug variable recv_no_log_write = FALSE,
assign it to srv_apply_log_only, so that any unwanted writes are caught.
2017-09-16 09:55:49 +03:00
Marko Mäkelä
a449f72a4c Remove the redundant function row_table_got_default_clust_index()
Use dict_index_is_auto_gen_clust() instead.
2017-09-15 20:06:26 +03:00
Jan Lindström
fa2701c6f7 MDEV-12634: Uninitialised ROW_MERGE_RESERVE_SIZE bytes written to tem…
…porary file

Fixed by removing writing key version to start of every block that
was encrypted. Instead we will use single key version from log_sys
crypt info.

After this MDEV also blocks writen to row log are encrypted and blocks
read from row log aren decrypted if encryption is configured for the
table.

innodb_status_variables[], struct srv_stats_t
	Added status variables for merge block and row log block
	encryption and decryption amounts.

Removed ROW_MERGE_RESERVE_SIZE define.

row_merge_fts_doc_tokenize
	Remove ROW_MERGE_RESERVE_SIZE

row_log_t
	Add index, crypt_tail, crypt_head to be used in case of
	encryption.

row_log_online_op, row_log_table_close_func
	Before writing a block encrypt it if encryption is enabled

row_log_table_apply_ops, row_log_apply_ops
	After reading a block decrypt it if encryption is enabled

row_log_allocate
	Allocate temporary buffers crypt_head and crypt_tail
	if needed.

row_log_free
	Free temporary buffers crypt_head and crypt_tail if they
	exist.

row_merge_encrypt_buf, row_merge_decrypt_buf
	Removed.

row_merge_buf_create, row_merge_buf_write
	Remove ROW_MERGE_RESERVE_SIZE

row_merge_build_indexes
	Allocate temporary buffer used in decryption and encryption
	if needed.

log_tmp_blocks_crypt, log_tmp_block_encrypt, log_temp_block_decrypt
	New functions used in block encryption and decryption

log_tmp_is_encrypted
	New function to check is encryption enabled.

Added test case innodb-rowlog to force creating a row log and
verify that operations are done using introduced status
variables.
2017-09-14 09:23:20 +03:00
Marko Mäkelä
cfd51c01e1 Fix one more warning for page_header_get_field() 2017-09-14 08:06:40 +03:00
Marko Mäkelä
126a581b45 Fix warnings for page_header_get_field() comparisons
The type uint16_t is apparently promoted to int in a comparison,
causing a sign mismatch when comparing to ulint. Convert to ulint
before comparison.
2017-09-14 08:00:28 +03:00
Marko Mäkelä
88106ef352 Fix a warning for a debug assertion
The type uint16_t is apparently promoted to int in a comparison,
causing a sign mismatch when comparing to ulint.
Convert both operands to uint16_t.
2017-09-14 07:52:32 +03:00
Marko Mäkelä
f5a833c3e0 Clean up the logging of virtual column values in table-rebuilding online ALTER
In online table-rebuilding ALTER TABLE (LOCK=NONE), virtual column values
are being written to the online_log. WL#8149 in MySQL 5.7 changed some
low-level functions that are also being used outside row0log.cc, causing
performance penalty to other code.

We revert those changes, and introduce separate functions for writing
the virtual column values.

The only functional change should be the one that is mentioned in
MDEV-13795: row_log_table_low_redundant() will no longer write
virtual column values along with old_pk, just like row_log_table_low().

As noted in MDEV-13795, some forms of table-rebuilding ALTER with
virtual columns is broken. At least DROP PRIMARY KEY, ADD PRIMARY KEY
is broken.

rec_get_converted_size_temp(), rec_convert_dtuple_to_temp():
Remove the parameter for passing virtual column values.

rec_get_converted_size_temp_v(), rec_convert_dtuple_to_temp_v():
New functions for appending virtual column values to the online_log.

rec_get_converted_size_comp_prefix_low(),
rec_convert_dtuple_to_rec_comp(): Remove the v_entry parameter,
and do not allow n_fields=0.
2017-09-13 16:14:37 +03:00
Marko Mäkelä
24062fed70 Remove the debug variables innodb_purge_stop_now, innodb_purge_run_now
The InnoDB purge subsystem can be best stopped by opening a read view,
for example by START TRANSACTION WITH CONSISTENT SNAPSHOT.

To ensure that everything is purged, use wait_all_purged.inc,
which waits for the History list length in SHOW ENGINE INNODB STATUS
to reach 0. Setting innodb_purge_run_now never guaranteed this.
2017-09-13 16:02:32 +03:00
Marko Mäkelä
dd35fb35fa Return uint16_t instead of ulint 2017-09-13 16:02:31 +03:00
Sergei Petrunia
49878be331 MDEV-13602: rocksdb.index_merge_rocksdb2 failed in buildbot
Part#2: stabilize the test output
2017-09-12 13:32:09 +03:00
Marko Mäkelä
66a09bd6ab MDEV-13318 Crash recovery failure after the server is killed during innodb_encrypt_log startup
This fixes several InnoDB bugs related to innodb_encrypt_log and
two Mariabackup --backup bugs.

log_crypt(): Properly derive the initialization vector from the
start LSN of each block. Add a debug assertion.

log_crypt_init(): Note that the function should only be used when
creating redo log files and that the information is persisted in
the checkpoint pages.

xtrabackup_copy_log(): Validate data_len.

xtrabackup_backup_func(): Always use the chosen checkpoint buffer.

log_group_write_buf(), log_write_up_to(): Only log_crypt() the redo
log payload, not the padding bytes.

innobase_start_or_create_for_mysql(): Do not invoke log_crypt_init()
or initiate a redo log checkpoint.

recv_find_max_checkpoint(): Return the contents of LOG_CHECKPOINT_NO
to xtrabackup_backup_func() in log_sys->next_checkpoint_no.
2017-09-12 11:32:49 +03:00
Marko Mäkelä
8ee4b414ae Relax a too strict debug assertion for Mariabackup --prepare 2017-09-12 11:30:50 +03:00
Marko Mäkelä
672590afaf Adjust the imported innodb.alter_crash test for MariaDB
trx_undo_assign_undo(): Restore the fault injection.
2017-09-08 15:34:42 +03:00
Vladislav Vaintroub
d471469bd2 MDEV-13466 Implement --export option for MariaDB Backup
full server recovery is performed .
We start "mysqld" with  --bootstrap
and pass bootstrap script consisting of several FLUSH TABLES FOR export/
UNLOCK TABLES
2017-09-07 22:54:06 +00:00
Marko Mäkelä
d26fb96a9f Merge 10.1 into 10.2 2017-09-07 12:12:31 +03:00
Marko Mäkelä
112d721a74 Merge 10.0 into 10.1 2017-09-07 12:08:34 +03:00
Marko Mäkelä
d861822c4f MDEV-13253 After rebuilding redo logs, InnoDB can leak data from redo log buffer
recv_reset_logs(): Initialize the redo log buffer, so that no data
from the old redo log can be written to the new redo log.

This bug has very little impact before MariaDB 10.2. The
innodb_log_encrypt option that was introduced in MariaDB 10.1
increases the impact. If the redo log used to be encrypted, and
it is being resized and encryption disabled, then previously
encrypted data could end up being written to the new redo log
in clear text. This resulted in encryption.innodb_encrypt_log
test failures in MariaDB 10.2.
2017-09-07 12:01:07 +03:00
Marko Mäkelä
3ec8268b4a Follow-up to MDEV-13103: Do not add __attribute__((nonnull))
In XtraDB, buf_block_get_frame() can return NULL, and this value
can be passed to buf_page_print(). Do not declare the parameter
as nonnull.
2017-09-07 11:58:21 +03:00
Marko Mäkelä
70db1e3b8a Merge 10.1 into 10.2 2017-09-06 19:28:51 +03:00
Marko Mäkelä
cd694d76ce Merge 10.0 into 10.1 2017-09-06 15:32:56 +03:00
Marko Mäkelä
6b45355e6b MDEV-13103 Assertion `flags & BUF_PAGE_PRINT_NO_CRASH' failed in buf_page_print
buf_page_print(): Remove the parameter 'flags',
and when a server abort is intended, perform that in the caller.

In this way, page corruption reports due to different reasons
can be distinguished better.

This is non-functional code refactoring that does not fix any
page corruption issues. The change is only made to avoid falsely
grouping together unrelated causes of page corruption.
2017-09-06 14:01:15 +03:00
Varun Gupta
80c90887fe MDEV-13585: RocksDB plugin fails to build on macOS because of unknown type timer_t etc.
Rdb_io_watchdog can not be built on  OS X. Disable it.
2017-09-05 23:00:59 +05:30
Sergei Petrunia
4ae200a97a Update test results for rocksdb.bulk_load_rev_cf_and_data 2017-09-05 18:28:05 +03:00
Marko Mäkelä
0500899904 MDEV-13705 10.0.32 does not compile on architectures without 64-bit atomics
This is a backport of the following:

MDEV-13009 10.1.24 does not compile on architectures without 64-bit atomics

Add a missing #include "sync0types.h" that was removed in MDEV-12674.
2017-09-04 09:46:47 +03:00
Marko Mäkelä
1136c8d366 Follow-up to MDEV-13570 Assertion failure !srv_read_only_mode in --innodb-read-only shutdown when buf_resize_thread is active
logs_empty_and_mark_files_at_shutdown(): Actually skip the debug assertion
when the buf_resize_thread is active. The previous fix skipped the
debug assertion failure when buf_dump_thread is active. Both these
threads are created also in innodb_read_only mode. Depending on how
fast these threads react to the shutdown signal, the debug assertion
could be triggered.

There is no impact on non-debug servers, and very little impact on
debug servers either, because in innodb_read_only shutdown, no InnoDB
files will need to be written.
2017-09-01 22:07:43 +03:00
Marko Mäkelä
7f99381288 Fix compiler warnings
metadata_lock_info_duration[]: Remove the unused variable.

Add some comments /* fall through */ to silence -Wimplicit-fallthrough
2017-09-01 15:40:49 +03:00
Jan Lindström
e23de9f2e0 MDEV-13674: Deprecate innodb_use_mtflush and innodb_mtflush_threads
These parameters and associated code is to be removed in 10.3.
Users can use innodb-page-cleaners > 1 instead.
2017-08-31 13:36:36 +03:00
Jan Lindström
aa22981dd2 MDEV-12741: innodb.ibuf_not_empty failed in buildbot with "InnoDB: Trying to do I/O to a tablespace which does not exist"
Background thread is doing ibuf merge, in buf0rea.cc buf_read_ibuf_merge_pages().
It first tries to get page_size and if space is not found it deletes them, but
as we do not hold any mutexes, space can be marked as stopped between that
and buf_read_page_low() for same space. This naturally leads seen error
message on log.

buf_read_page_low(): Add parameter ignore_missing_space = false that
is passed to fil_io()

buf_read_ibuf_merge_pages(): call buf_read_page_low with
ignore_missing_space = true, this function will handle missing
space error code after buf_read_page_low returns.

fil_io(): if ignore_missing_space = true do not print error
message about trying to do I/0 for missing space, just return
correct error code that is handled later.
2017-08-31 12:34:05 +03:00
Sergei Petrunia
0e45edf350 MDEV-13669: Some MyRocks test take a long time
Make rocksdb.bloomfilter* tests 1.8x faster by doing loading in bulk
2017-08-31 11:42:41 +03:00
Marko Mäkelä
2000a9009b Merge 10.1 into 10.2 2017-08-31 11:14:28 +03:00
Marko Mäkelä
38ca9be4de MDEV-13684 InnoDB race condition between fil_crypt_thread and btr_scrub_init
There is a race condition in InnoDB startup. A number of
fil_crypt_thread are created by fil_crypt_threads_init(). These threads
may call btr_scrub_complete_space() before btr_scrub_init() was called.
Those too early calls would be accessing an uninitialized scrub_stat_mutex.

innobase_start_or_create_for_mysql(): Invoke btr_scrub_init() before
fil_crypt_threads_init().

fil_crypt_complete_rotate_space(): Only invoke btr_scrub_complete_space()
if scrubbing is enabled. There is no need to update the statistics if
it is not enabled.
2017-08-31 11:08:43 +03:00
Marko Mäkelä
4386ee8ccc Add ATTRIBUTE_NORETURN and ATTRIBUTE_COLD
ATTRIBUTE_NORETURN is supported on all platforms (MSVS and GCC-like).
It declares that a function will not return; instead, the thread or
the whole process will terminate.

ATTRIBUTE_COLD is supported starting with GCC 4.3. It declares that
a function is supposed to be executed rarely. Rarely used error-handling
functions and functions that emit messages to the error log should be
tagged such.
2017-08-31 09:30:55 +03:00
Marko Mäkelä
a36c369bda Merge 10.1 into 10.2
For running the Galera tests, the variable my_disable_leak_check
was set to true in order to avoid assertions due to memory leaks
at shutdown.

Some adjustments due to MDEV-13625 (merge InnoDB tests from MySQL 5.6)
were performed. The most notable behaviour changes from 10.0 and 10.1
are the following:

* innodb.innodb-table-online: adjustments for the DROP COLUMN
behaviour change (MDEV-11114, MDEV-13613)

* innodb.innodb-index-online-fk: the removal of a (1,NULL) record
from the result; originally removed in MySQL 5.7 in the
Oracle Bug #16244691 fix
377774689b

* innodb.create-index-debug: disabled due to MDEV-13680
(the MySQL Bug #77497 fix was not merged from 5.6 to 5.7.10)

* innodb.innodb-alter-autoinc: MariaDB 10.2 behaves like MySQL 5.6/5.7,
while MariaDB 10.0 and 10.1 assign different values when
auto_increment_increment or auto_increment_offset are used.
Also MySQL 5.6/5.7 exhibit different behaviour between
LGORITHM=INPLACE and ALGORITHM=COPY, so something needs to be tested
and fixed in both MariaDB 10.0 and 10.2.

* innodb.innodb-wl5980-alter: disabled because it would trigger an
InnoDB assertion failure (MDEV-13668 may need additional effort in 10.2)
2017-08-31 09:30:40 +03:00
Jan Lindström
b29f26d774 Fix test failures on embedded server.
Problem was incorrect definition of wsrep_recovery,
trx_sys_update_wsrep_checkpoint and
trx_sys_read_wsrep_checkpoint functions causing
innodb_plugin not to load as there was undefined symbols.
2017-08-31 08:38:26 +03:00
Jan Lindström
eca238aea7 MDEV-13557: Startup failure, unable to decrypt ibdata1
Fixes also MDEV-13488: InnoDB writes CRYPT_INFO even though
encryption is not enabled.

Fixes also MDEV-13093: Leak of Datafile::m_crypt_info on
shutdown after failed startup.

Problem was that we created encryption metadata (crypt_data) for
system tablespace even when no encryption was enabled and too early.
System tablespace can be encrypted only using key rotation.

Test innodb-key-rotation-disable, innodb_encryption, innodb_lotoftables
require adjustment because INFORMATION_SCHEMA INNODB_TABLESPACES_ENCRYPTION
contain row only if tablespace really has encryption metadata.

xb_load_single_table_tablespace(): Do not call
fil_space_destroy_crypt_data() any more, because Datafile::m_crypt_data
has been removed.

fil_crypt_realloc_iops(): Avoid divide by zero.

fil_crypt_set_thread_cnt(): Set fil_crypt_threads_event if
encryption threads exist. This is required to find tablespaces
requiring key rotation if no other changes happen.

fil_crypt_find_space_to_rotate(): Decrease the amount of time waiting
when nothing happens to better enable key rotation on startup.

fil_ibd_open(), fil_ibd_load(): Load possible crypt_data from first
page.

class Datafile, class SysTablespace : remove m_crypt_info field.

Datafile::get_first_page(): Return a pointer to first page buffer.

fsp_header_init(): Write encryption metadata to page 0 only if
tablespace is encrypted or encryption is disabled by table option.

i_s_dict_fill_tablespaces_encryption(): Skip tablespaces that do not
contain encryption metadata. This is required to avoid too early
wait condition trigger in encrypted -> unencrypted state transfer.
2017-08-31 08:36:56 +03:00
Vladislav Vaintroub
49f3fb8feb small refactoring o innobase/CMakeLists.txt
allow to build with -DPLUGIN_INNOBASE=NO
2017-08-30 14:43:58 +00:00
Marko Mäkelä
829752973b Merge branch '10.0' into 10.1 2017-08-30 13:06:13 +03:00
Marko Mäkelä
4c91fd4cd6 Galera after-merge fixes
wsrep_drop_table_query(): Remove the definition of this ununsed function.

row_upd_sec_index_entry(), row_upd_clust_rec_by_insert():
Evaluate the simplest conditions first. The merge could have slightly
hurt performance by causing extra calls to wsrep_on().
2017-08-30 12:29:47 +03:00