Commit graph

177534 commits

Author SHA1 Message Date
Vladislav Vaintroub
ed66acb291 Silence LeakSanitizer by default in mariabackup, so that phanthom "leaks"
would not hide more interesting information, like invalid memory accesses.


some "leaks" are expected
- partly this is due to weird options parsing, that runs twice, and
does not free memory after the first run.
- also we do not mind to exit()  whenever it makes sense, without full
cleanup.
2018-12-29 02:06:19 +01:00
Eugene Kosov
c5a5eaa9a9 MDEV-17470 Orphan temporary files after interrupted ALTER cause InnoDB: Operating system error number 17 and eventual fatal error 71
Orphan #sql* tables may remain after ALTER TABLE
was interrupted by timeout or KILL or client disconnect.

This is a regression caused by MDEV-16515.

Similar to temporary tables (MDEV-16647), we had better ignore the
KILL when dropping the original table in the final part of ALTER TABLE.

Closes #1020
2018-12-28 17:05:48 +02:00
Marko Mäkelä
b74eb5a5fe row_drop_table_for_mysql(): Correct a parameter to innobase_format_name()
This fixes a regression that was introduced in MySQL 5.6.6
in an error handling code path, in the following change:

commit 024f363d6b5f09b20d1bba411af55be95c7398d3
Author: kevin.lewis@oracle.com <>
Date:   Fri Jun 15 09:01:42 2012 -0500

    Bug #14169459 INNODB; DROP TABLE DOES NOT DELETE THE IBD FILE
    FOR A TEMPORARY TABLE.
2018-12-28 12:28:16 +02:00
Rakshit Kumar
9ad1663f78 Grammatical errors of README-wsrep fixed. (#915)
Docs grammar fixed
2018-12-22 13:34:50 +04:00
Marko Mäkelä
40a094e4a8 Relax a too tight suppression
When using a wrong key, all encrypted pages will look corrupted,
and occasionally the test may access other pages than
the clustered index root page.
2018-12-21 09:40:36 +02:00
Vladislav Vaintroub
9f4a4cb401 Cleanup recent mariabackup validation patches.
- Refactor code to isolate page validation in page_is_corrupted() function.

- Introduce --extended-validation parameter(default OFF) for mariabackup
--backup to enable decryption of encrypted uncompressed pages during
backup.

- mariabackup would still always check checksum on encrypted data,
it is needed to detect  partially written pages.
2018-12-20 14:31:18 +01:00
Marko Mäkelä
ed36fc353f MDEV-18025: Detect corrupted innodb_page_compression=zlib pages
In MDEV-13103, I made a mistake in the error handling of
page_compressed=1 decryption when the default
innodb_compression_algorithm=zlib is used.
Due to this mistake, with certain versions of zlib,
MariaDB would fail to detect a corrupted page.

The problem was uncovered by the following tests:
mariabackup.unencrypted_page_compressed
mariabackup.encrypted_page_compressed
2018-12-20 13:33:09 +02:00
Sergei Golubchik
8634f7e528 Merge branch '5.5' into 10.0 2018-12-20 09:15:01 +01:00
Sergei Golubchik
8ede9b3ae5 MDEV-17975 Assertion ! is_set()' or !is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE
open_grant_tables() returns -1/0/1, where -1 is an error, while 1 is not.
Don't store it's return value in bool
2018-12-20 08:39:54 +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
Marko Mäkelä
dd72d7d561 MDEV-18025: Improve test case and consistency checks
Write a test case that computes valid crc32 checksums for
an encrypted page, but zeroes out the payload area, so
that the checksum after decryption fails.

xb_fil_cur_read(): Validate the page number before trying
any checksum calculation or decrypting or decompression.
Also, skip zero-filled pages. For page_compressed pages,
ensure that the FIL_PAGE_TYPE was changed. Also, reject
FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED if no decryption was attempted.
2018-12-19 15:45:35 +02:00
Varun Gupta
7e606a2d5c MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field
Create a new constant MAX_DATA_LENGTH_FOR_KEY.
Replace the value of MAX_KEY_LENGTH to also include the LENGTH and NULL BYTES
of a field.
2018-12-19 10:38:46 +05:30
Varun Gupta
da4efd56aa Backported MDEV-11196(e4d10e09cf) and MDEV-10360(8a8ba1949b) to 10.0 2018-12-19 10:38:29 +05:30
Marko Mäkelä
1b471face8 MDEV-18025: Apply the fix to XtraDB and adjust tests
The fix was accidentally only applied to InnoDB, and encryption tests
were not adjusted.
2018-12-18 16:24:52 +02:00
Sergey Vojtovich
b0fd06a6f2 MDEV-15670 - unit.my_atomic failed in buildbot with Signal 11 thrown
Workaround glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20116
by making unittest threads joinable. It makes code better anyway.
2018-12-18 17:20:15 +04:00
Thirunarayanan Balathandayuthapani
171271edf8 MDEV-18025 Mariabackup fails to detect corrupted page_compressed=1 tables
Problem:
=======
Mariabackup seems to fail to verify the pages of compressed tables.
The reason is that both fil_space_verify_crypt_checksum() and
buf_page_is_corrupted() will skip the validation for compressed pages.

Fix:
====
Mariabackup should call fil_page_decompress() for compressed and encrypted
compressed page. After that, call buf_page_is_corrupted() to
check the page corruption.
2018-12-18 18:07:17 +05:30
Marko Mäkelä
84f119f25c MDEV-12112/MDEV-12114: Relax strict_innodb, strict_none
Starting with commit 6b6987154a
the encrypted page checksum is only computed with crc32.
Encrypted data pages that were written earlier can contain
other checksums, but new ones will only contain crc32.

Because of this, it does not make sense to implement strict
checks of innodb_checksum_algorithm for other than strict_crc32.

fil_space_verify_crypt_checksum(): Treat strict_innodb as innodb
and strict_none as none. That is, allow a match from any of the
algorithms none, innodb, crc32. (This is how it worked before the
second MDEV-12112 fix.)

Thanks to Thirunarayanan Balathandayuthapani for pointing this out.
2018-12-18 09:52:28 +02:00
Sergei Golubchik
65525550ab Don't default to bundled zlib
This reverts part of c54271723c
2018-12-17 21:47:14 +01:00
Marko Mäkelä
51a1fc737c Fix a compiler warning
fil_space_verify_crypt_checksum(): Add a dummy return statement
in case memory is corrupted and innodb_checksum_algorithm has
an invalid value.
2018-12-17 22:35:22 +02:00
Marko Mäkelä
8c43f96388 Follow-up to MDEV-12112: corruption in encrypted table may be overlooked
The initial fix only covered a part of Mariabackup.
This fix hardens InnoDB and XtraDB in a similar way, in order
to reduce the probability of mistaking a corrupted encrypted page
for a valid unencrypted one.

This is based on work by Thirunarayanan Balathandayuthapani.

fil_space_verify_crypt_checksum(): Assert that key_version!=0.
Let the callers guarantee that. Now that we have this assertion,
we also know that buf_page_is_zeroes() cannot hold.
Also, remove all diagnostic output and related parameters,
and let the relevant callers emit such messages.
Last but not least, validate the post-encryption checksum
according to the innodb_checksum_algorithm (only accepting
one checksum for the strict variants), and no longer
try to validate the page as if it was unencrypted.

buf_page_is_zeroes(): Move to the compilation unit of the only callers,
and declare static.

xb_fil_cur_read(), buf_page_check_corrupt(): Add a condition before
calling fil_space_verify_crypt_checksum(). This is a non-functional
change.

buf_dblwr_process(): Validate the page only as encrypted or unencrypted,
but not both.
2018-12-17 19:33:44 +02:00
Jan Lindström
517c59c540
Merge pull request #1026 from codership/10.1-galera-defaults
Remove provider defaults check from 'galera_defaults' MTR test
2018-12-17 07:45:14 +02:00
Jan Lindström
ee543beabf MDEV-18021: Galera test galera_sst_mariabackup_table_options fails if AES_CTR is not available
Problem is that if you use bundled yassl AES_CTR is not supported. There is a way to detect that but as we really want to keep this test enabled did not add
skip for missing support. Changed method to AES_CBC as there is no need to
use AES_CTR.
2018-12-17 07:05:27 +02:00
Jan Lindström
8a46b9fe3b MDEV-17771: Add Galera ist and sst tests using mariabackup
Add check that file key management plugin is found.
2018-12-17 05:53:18 +02:00
Varun Gupta
d1f399408d MDEV-6453: Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init(bool)
with InnoDB, joins, AND/OR conditions

The inited parameter handler is not initialised when we do a quick_select after a table scan.
2018-12-16 21:50:49 +02:00
Alexey Yurchenko
6b81883170 Remove provider defaults check from 'galera_defaults' MTR test
From time to time Galera adds new parameters or changes defaults to
existing ones. Every time this happens galera_defaults test needs a
fix (and a commit) because it insists on checking these defaults.
This is making life hard because any Galera update may require a fix
to MariaDB code even though it is totally unrelated and defeats the
whole idea of a provider living its own life.
This commit removes checking for provider defaults to avoid false
positive failures on MariaDB side.
2018-12-14 21:29:17 +02:00
Marko Mäkelä
fb252f70c1 MDEV-12112 corruption in encrypted table may be overlooked
After validating the post-encryption checksum on an encrypted page,
Mariabackup should decrypt the page and validate the pre-encryption
checksum as well. This should reduce the probability of accepting
invalid pages as valid ones.

This is a backport and refactoring of a patch that was
originally written by Thirunarayanan Balathandayuthapani
for the 10.2 branch.
2018-12-14 15:44:51 +02:00
Sergei Golubchik
1a7158b88a remove unsed variable 2018-12-13 19:51:40 +01:00
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
Marko Mäkelä
621041b676 Merge 10.0 into 10.1
Also, apply the MDEV-17957 changes to encrypted page checksums,
and remove error message output from the checksum function,
because these messages would be useless noise when mariabackup
is retrying reads of corrupted-looking pages, and not that
useful during normal server operation either.

The error messages in fil_space_verify_crypt_checksum()
should be refactored separately.
2018-12-13 13:37:21 +02:00
Marko Mäkelä
8e613458e1 Fix cmake -DWITH_PARTITION_STORAGE_ENGINE:BOOL=OFF
This is a backport of a part of
commit 18455ec3f1
from 10.1.
2018-12-13 12:37:40 +02:00
Marko Mäkelä
5ab91f5914 Remove space before #ifdef 2018-12-13 12:15:27 +02:00
Thirunarayanan Balathandayuthapani
5f5e73f1fe MDEV-17957 Make Innodb_checksum_algorithm stricter for strict_* values
Problem:

  Innodb_checksum_algorithm checks for all checksum algorithm to
validate the page checksum even though the algorithm is specified as
strict_crc32, strict_innodb, strict_none.

Fix:

   Remove the checks for all checksum algorithm to validate the page
checksum if the algo is specified as strict_* values.
2018-12-13 12:06:14 +02:00
Varun Gupta
ce1669af12 Fix compile error when building without the partition engine 2018-12-13 10:03:09 +05:30
Sergei Golubchik
541500295a debian install/upgrade fixes
1. don't run full mysql_upgrade on every server restart,
   use --version-check to do it only once

2. fix syslog tag name in the postinst script, don't pretend
   mysqld_safe generated all these messages. Auto-detect the version
   to simplify maintenance
2018-12-12 20:19:56 +01:00
Sergei Golubchik
b58f28725b Merge branch '5.5' into 10.0 2018-12-12 20:19:06 +01:00
Jiaye Wu
9eadef013e Fix UNICODE issue of dlerror
Current implementation is conflicting. If UNICODE is defined, FormatMessage() will be FormatMessageW(), and variable win_errormsg with type char can not be passed to it, which should be changed to TCHAR instead. Since we don't use UNICODE here, we can use FormatMessageA() directly to avoid conversion error.
```
my_global.h(1092): error C2664: 'DWORD FormatMessageW(D
WORD,LPCVOID,DWORD,DWORD,LPWSTR,DWORD,va_list *)' : cannot convert argument 5 from 'char [2048]' to 'LPWSTR'
```
2018-12-12 12:36:28 +01:00
Marko Mäkelä
f77f8f6d1a Merge 10.0 into 10.1 2018-12-12 10:48:53 +02:00
Eugene Kosov
d956709b4b MDEV-17833 ALTER TABLE is not enforcing prefix index size limit
ha_innobase::prepare_inplace_alter_table(): check max column length for every
index in a table, not just added in this particular ALTER TABLE with ADD INDEX ones.
2018-12-11 22:03:44 +03:00
Varun Gupta
4886d14827 MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY
The problem here is EITS statistics does not calculate statistics for the partitions of the table.
So a temporary solution would be to not read EITS statistics for partitioned tables.

Also disabling reading of EITS for columns that participate in the partition list of a table.
2018-12-07 19:59:45 +05:30
Marko Mäkelä
ecd3a7e00d Merge 10.0 into 10.1 2018-12-07 13:17:32 +02:00
Marko Mäkelä
12b1ba195c MDEV-17904 Crash in fts_is_sync_needed() after failed ALTER or CREATE TABLE
create_table_def(), ha_innobase::create(): Defer fts_optimize_add_table()
until after the table has been successfully created.
2018-12-07 13:12:39 +02:00
Vladislav Vaintroub
2a2e8ea8fe MDEV-17917 MTR: fixed race conditions in perfschema.socket_connect, main.connect 2018-12-06 21:46:14 +01:00
Sergei Golubchik
6491c591b2 Merge branch '10.0' into 10.1 2018-12-06 15:08:42 +01:00
Sergei Golubchik
daca7e70d7 MDEV-17898 FLUSH PRIVILEGES crashes server with segfault
merge_role_db_privileges() was remembering pointers into Dynamic_array
acl_dbs, and later was using them, while pushing more elements into the
array. But pushing can cause realloc, and it can invalidate all pointers.

Fix: remember and use indexes of elements, not pointers.
2018-12-06 14:22:07 +01:00
Sergei Golubchik
eed0013bed correct order of arguments for Dynamic_array<>::CMP_FUNC2 2018-12-06 14:22:07 +01:00
Sergei Golubchik
8a37ce0767 cleanup: DYNAMIC_ARRAY -> Dynamic_array<ACL_DB> acl_dbs 2018-12-06 14:22:07 +01:00
Varun Gupta
17e8570285 Added a testcase for mdev-17734 2018-12-05 19:31:25 +05:30
Eugene Kosov
e8bb94ccc8 MDEV-16499 [10.1] ER_NO_SUCH_TABLE_IN_ENGINE followed by "Please drop the table and recreate" upon adding FULLTEXT key to table with virtual column
There was an incorrect check for MariaDB and InnoDB
tables fields count. Corruption was reported when there was no corruption.
Also, a warning message had incorrect field numbers for both MariaDB and InnoDB
tables.

ha_innobase::open(): fixed check and message
2018-11-30 01:15:30 +03:00
Sergei Golubchik
32b7d456d5 mysqltest: use a dynamically growing command buffer 2018-11-28 20:18:49 +01:00
Jan Lindström
328d7779bc Fortify galera_sst_mariabackup_table_options test. 2018-11-26 08:58:38 +02:00