Commit graph

175351 commits

Author SHA1 Message Date
Sergei Golubchik
e74f2e2b86 Merge branch '10.0' 10.1 2017-04-28 20:19:32 +02:00
Marko Mäkelä
b82c602db5 MDEV-12602 InnoDB: Failing assertion: space->n_pending_ops == 0
This fixes a regression caused by MDEV-12428.
When we introduced a variant of fil_space_acquire() that could
increment space->n_pending_ops after space->stop_new_ops was set,
the logic of fil_check_pending_operations() was broken.

fil_space_t::n_pending_ios: A new field to track read or write
access from the buffer pool routines immediately before a block
write or after a block read in the file system.

fil_space_acquire_for_io(), fil_space_release_for_io(): Similar
to fil_space_acquire_silent() and fil_space_release(), but
modify fil_space_t::n_pending_ios instead of fil_space_t::n_pending_ops.

Adjust a number of places accordingly, and remove some redundant
tablespace lookups.

The following parts of this fix differ from the 10.2 version of this fix:

buf_page_get_corrupt(): Add a tablespace parameter.

In 10.2, we already had a two-phase process of freeing fil_space objects
(first, fil_space_detach(), then release fil_system->mutex, and finally
free the fil_space and fil_node objects).

fil_space_free_and_mutex_exit(): Renamed from fil_space_free().
Detach the tablespace from the fil_system cache, release the
fil_system->mutex, and then wait for space->n_pending_ios to reach 0,
to avoid accessing freed data in a concurrent thread.
During the wait, future calls to fil_space_acquire_for_io() will
not find this tablespace, and the count can only be decremented to 0,
at which point it is safe to free the objects.

fil_node_free_part1(), fil_node_free_part2(): Refactored from
fil_node_free().
2017-04-28 14:12:52 +03:00
Sergei Golubchik
6935d66053 MDEV-12591 MariaDB embedded server refuses start with innodb_plugin
innodb calls sd_notify(), it must be linked with libsystemd
2017-04-27 19:12:45 +02:00
Sergei Golubchik
1b27c25473 MDEV-10594 SSL hostname verification fails for SubjectAltNames
use X509_check_host for OpenSSL 1.0.2+
This adds:
* support for subjectAltNames
* wildcards
* sub-domain matching
2017-04-27 19:12:44 +02:00
Sergei Golubchik
b8c8405008 cleanup: simplify setting of ssl* options in my.cnf templates
magic--
2017-04-27 19:12:44 +02:00
Sergei Golubchik
0636637e37 regenerate SSL certificates again
and make sure that private ca key is not deleted at the end of
the procedure, so that we could generate additional certificates
any time without regenerating everything
2017-04-27 19:12:44 +02:00
Sergei Golubchik
c0e24cd0e8 compiler warnings 2017-04-27 19:12:43 +02:00
Sergei Golubchik
f21dcd9933 .gitignore mariabackup 2017-04-27 19:12:43 +02:00
Sergei Golubchik
4e07fc0ab5 test failure
use --defaults-file to avoid reading ~/.my.cnf
and don't crash if some ibdata file couldn't be opened
2017-04-27 19:12:43 +02:00
Vladislav Vaintroub
e8bc838eb9 mariabackup - do not extend innodb tablespaces in prepare, unless
incremental prepare is running.
2017-04-27 19:12:43 +02:00
Vladislav Vaintroub
ecb25df21b Xtrabackup 2.3.8 2017-04-27 19:12:42 +02:00
Vladislav Vaintroub
c8ac0244a8 add mariabackup to default suites 2017-04-27 19:12:42 +02:00
Vladislav Vaintroub
f344d7ec61 Make Ninja generator happy with BUILD_BYPRODUCTS. 2017-04-27 19:12:42 +02:00
Vladislav Vaintroub
7228b9985f MDEV-9566 build mariabackup with libarchive for release 2017-04-27 19:12:41 +02:00
Vladislav Vaintroub
d894f7ceed update gitignore with commonly used (by me) out-of-source builddir names 2017-04-27 19:12:41 +02:00
Vladislav Vaintroub
64b3427b89 Run mariabackup test on Windows on buildbot 2017-04-27 19:12:41 +02:00
Nirbhay Choubey
3d8aacba86 SST script for mariabackup.
Execute mariabackup in innobackupex mode to avoid "unknown argument" error.
2017-04-27 19:12:41 +02:00
Vladislav Vaintroub
ca24f35b67 MDEV-9566 MariaBackup test suite 2017-04-27 19:12:40 +02:00
Vladislav Vaintroub
1991411f16 MDEV-9566 MariaBackup packaging 2017-04-27 19:12:40 +02:00
Vladislav Vaintroub
ce4c56db0c MDEV-9566 Port Percona Xtrabackup to MariaDB as mariabackup
- Modify  backup code to work with MariaDB's 10.1 xtradb
- Remove  crypt encryption, version_check.pl, "compact backup"
- Add encryption plugin
2017-04-27 19:12:40 +02:00
Vladislav Vaintroub
d7714308e0 MDEV-9566 Add Percona Xtrabackup 2.3.7 2017-04-27 19:12:39 +02:00
Vladislav Vaintroub
9c4b7cad27 MDEV-9566 Prepare xtradb for xtrabackup
These changes are comparable to Percona's modifications in innodb in the
Percona Xtrabackup repository.

- If functions are used in backup as well as in innodb, make them non-static.

- Define IS_XTRABACKUP() macro for special handling of innodb running
  inside backup.

- Extend some functions for backup.
  fil_space_for_table_exists_in_mem() gets additional parameter
  'remove_from_data_dict_if_does_not_exist', for partial backups

  fil_load_single_table_tablespaces() gets an optional parameter predicate
  which tells whether to load tablespace based on database or table name,
  also for partial backups.

  srv_undo_tablespaces_init() gets an optional parameter 'backup_mode'

- Allow single redo log file (for backup "prepare")

- Do not read doublewrite buffer pages in backup, they are outdated

- Add function fil_remove_invalid_table_from_data_dict(), to remove non-existing
   tables from data dictionary in case of partial backups.

- On Windows, fix file share modes when opening tablespaces,
to allow mariabackup to read tablespaces while server is online.

- Avoid access to THDVARs in backup, because innodb plugin is not loaded,
and THDVAR would crash in this case.
2017-04-27 19:12:39 +02:00
Vladislav Vaintroub
f06ab0fc99 MDEV-9566 Server code changes in preparation for mariabackup
- Backup will  load encryption plugins outside of mysqld. Thus, do not
force loading MyISAM plugin in plugin_load.

- init_signals() will be used in backup,  make it global, not static.
2017-04-27 19:12:39 +02:00
Vladislav Vaintroub
ec68f764f6 MDEV-9566 prepare mysqltest for mariabackup
- Do not throw output of exec command, if disable_result_log is set
save and dump it if exec fails. Need tha to meaningfully analyze
errors from mariabackup.

- rmdir now removes the entire tree. need that because xtrabackup tests
clean the whole directory.

- all filesystem modifying commands now require the argument to
  be under MYSQLTEST_VARDIR or MYSQL_TMP_DIR.
2017-04-27 19:12:38 +02:00
Vladislav Vaintroub
7bf409593e MDEV-11660 Make encryption plugins "pure"
Do not exporting mysqld entry points directly.
This is needed for mariabackup, to load encryption plugins on Windows.

All plugins are "pure" by default. To mark plugin "impure"
it should use RECOMPILE_FOR_EMBEDDED or STORAGE_ENGINE keyword.
2017-04-27 19:12:38 +02:00
Vladislav Vaintroub
db39107413 MDEV-11663 Create services for functionality used by plugins
Added service for
- encryption (AES)
- error reporting, e.g my_printf_error()
2017-04-27 19:12:38 +02:00
Sergei Golubchik
175dd3ad59 cleanup: don't include *.h files into SQL_SOURCES 2017-04-27 19:12:37 +02:00
Sergei Golubchik
99e1294c1e bugfix: federated/replication did not increment bytes_received status variable
because mysql->net.thd was reset to NULL in mysql_real_connect()
and thd_increment_bytes_received() didn't do anything.

Fix:
* set mysql->net.thd to current_thd instread.
* remove the test for non-null THD from a very often used
  function thd_increment_bytes_received().
2017-04-27 19:12:37 +02:00
Sergei Golubchik
2c3f578789 don't generate wsrep_sst_common in-place
rename the source to wsrep_sst_common.sh
2017-04-27 19:12:37 +02:00
Jan Lindström
765a43605a MDEV-12253: Buffer pool blocks are accessed after they have been freed
Problem was that bpage was referenced after it was already freed
from LRU. Fixed by adding a new variable encrypted that is
passed down to buf_page_check_corrupt() and used in
buf_page_get_gen() to stop processing page read.

This patch should also address following test failures and
bugs:

MDEV-12419: IMPORT should not look up tablespace in
PageConverter::validate(). This is now removed.

MDEV-10099: encryption.innodb_onlinealter_encryption fails
sporadically in buildbot

MDEV-11420: encryption.innodb_encryption-page-compression
failed in buildbot

MDEV-11222: encryption.encrypt_and_grep failed in buildbot on P8

Removed dict_table_t::is_encrypted and dict_table_t::ibd_file_missing
and replaced these with dict_table_t::file_unreadable. Table
ibd file is missing if fil_get_space(space_id) returns NULL
and encrypted if not. Removed dict_table_t::is_corrupted field.

Ported FilSpace class from 10.2 and using that on buf_page_check_corrupt(),
buf_page_decrypt_after_read(), buf_page_encrypt_before_write(),
buf_dblwr_process(), buf_read_page(), dict_stats_save_defrag_stats().

Added test cases when enrypted page could be read while doing
redo log crash recovery. Also added test case for row compressed
blobs.

btr_cur_open_at_index_side_func(),
btr_cur_open_at_rnd_pos_func(): Avoid referencing block that is
NULL.

buf_page_get_zip(): Issue error if page read fails.

buf_page_get_gen(): Use dberr_t for error detection and
do not reference bpage after we hare freed it.

buf_mark_space_corrupt(): remove bpage from LRU also when
it is encrypted.

buf_page_check_corrupt(): @return DB_SUCCESS if page has
been read and is not corrupted,
DB_PAGE_CORRUPTED if page based on checksum check is corrupted,
DB_DECRYPTION_FAILED if page post encryption checksum matches but
after decryption normal page checksum does not match. In read
case only DB_SUCCESS is possible.

buf_page_io_complete(): use dberr_t for error handling.

buf_flush_write_block_low(),
buf_read_ahead_random(),
buf_read_page_async(),
buf_read_ahead_linear(),
buf_read_ibuf_merge_pages(),
buf_read_recv_pages(),
fil_aio_wait():
        Issue error if page read fails.

btr_pcur_move_to_next_page(): Do not reference page if it is
NULL.

Introduced dict_table_t::is_readable() and dict_index_t::is_readable()
that will return true if tablespace exists and pages read from
tablespace are not corrupted or page decryption failed.
Removed buf_page_t::key_version. After page decryption the
key version is not removed from page frame. For unencrypted
pages, old key_version is removed at buf_page_encrypt_before_write()

dict_stats_update_transient_for_index(),
dict_stats_update_transient()
        Do not continue if table decryption failed or table
        is corrupted.

dict0stats.cc: Introduced a dict_stats_report_error function
to avoid code duplication.

fil_parse_write_crypt_data():
        Check that key read from redo log entry is found from
        encryption plugin and if it is not, refuse to start.

PageConverter::validate(): Removed access to fil_space_t as
tablespace is not available during import.

Fixed error code on innodb.innodb test.

Merged test cased innodb-bad-key-change5 and innodb-bad-key-shutdown
to innodb-bad-key-change2.  Removed innodb-bad-key-change5 test.
Decreased unnecessary complexity on some long lasting tests.

Removed fil_inc_pending_ops(), fil_decr_pending_ops(),
fil_get_first_space(), fil_get_next_space(),
fil_get_first_space_safe(), fil_get_next_space_safe()
functions.

fil_space_verify_crypt_checksum(): Fixed bug found using ASAN
where FIL_PAGE_END_LSN_OLD_CHECKSUM field was incorrectly
accessed from row compressed tables. Fixed out of page frame
bug for row compressed tables in
fil_space_verify_crypt_checksum() found using ASAN. Incorrect
function was called for compressed table.

Added new tests for discard, rename table and drop (we should allow them
even when page decryption fails). Alter table rename is not allowed.
Added test for restart with innodb-force-recovery=1 when page read on
redo-recovery cant be decrypted. Added test for corrupted table where
both page data and FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION is corrupted.

Adjusted the test case innodb_bug14147491 so that it does not anymore
expect crash. Instead table is just mostly not usable.

fil0fil.h: fil_space_acquire_low is not visible function
and fil_space_acquire and fil_space_acquire_silent are
inline functions. FilSpace class uses fil_space_acquire_low
directly.

recv_apply_hashed_log_recs() does not return anything.
2017-04-26 15:19:16 +03:00
Oleksandr Byelkin
49552cf1f7 Merge branch '5.5' into bb-10.0-merge-5.5 2017-04-25 16:30:39 +02:00
Sachin Setiya
97e0c260dc Fix Galera tests failures on 10.1 and 10.2
When we build server out of git directory , we did not copy
wsrep_sst_common into build-dir. This causes galera/wsrep tests
to fail
2017-04-25 15:28:29 +05:30
Igor Babaev
2e7ba70a94 Fixed the bug mdev-10693.
The code that chooses between materialization of a non-correlated
IN subquery and its transformation into an EXISTS correlated
subquery assumes that the execution plan for the outer select
has been already built. However it was not always so if subqueries
occurred in the expressions used for ref access to tables of
the outer select. A call of the function create_ref_for_key() in
get_best_combination() could trigger a premature execution of
the above mentioned code when the execution plan structures for
the outer select were not fully built. This could cause a crash
of the server.

The fix postpones the calls of create_ref_for_key() until the
structures for the execution plan is fully built.
2017-04-24 11:46:01 -07:00
Marko Mäkelä
57fea99eeb Add and adjust a test from MySQL:
commit 1198267c331b045b9cad26be72b1a5b4f8930a79
Author: Thirunarayanan Balathandayuthapani <thirunarayanan.balathandayuth@oracle.com>
Date:   Fri Aug 26 11:00:44 2016 +0530

    Bug #20989615   INNODB AUTO_INCREMENT PRODUCES SAME VALUE TWICE

The code fix is already present.
2017-04-24 16:45:40 +03:00
Marko Mäkelä
864548c4ec Add and adjust a test from MySQL:
commit 12343617922cfd9c48ee84ad6ecf53068d822010
Author: Thirunarayanan Balathandayuthapani <thirunarayanan.balathandayuth@oracle.com>
Date:   Fri Jul 15 14:39:37 2016 +0530

    Bug #23475211   COMBINING ALTER OPERATIONS TRIGGERS TABLE REBUILD

The code fix is already present.
2017-04-24 13:40:36 +03:00
Marko Mäkelä
340af4ebc3 Merge pull request #363 from grooverdan/10.1-MDEV-12488-xtradb-os_thread_pf
MDEV-12488: Remove type mismatch in InnoDB printf-like calls
2017-04-24 08:31:59 +03:00
Daniel Black
7d0ac3ade7 MDEV-12488: Remove type mismatch in InnoDB printf-like calls
To fix OSX error:

/Users/travis/build/grooverdan/mariadb-server/storage/xtradb/sync/sync0arr.cc:530:5: warning: format specifies type 'unsigned long' but the argument has type 'os_thread_id_t' (aka '_opaque_pthread_t *') [-Wformat]
                                mutex->thread_id,

                                ^~~~~~~~~~~~~~~~

Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
2017-04-24 13:02:08 +10:00
Alexander Barkov
fac2a7a85d MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression 2017-04-22 22:51:43 +04:00
Igor Babaev
97fb1f2679 Fixed bug mdev-10053.
The implementation of the walk method for the class Item_in_subselect
was missing. As a result the method never traversed the left operand
of any IN subquery predicate.

Item_exists_subselect::exists2in_processor() that performs the
Exist-To-In transformation calls the walk method to collect info
on outer references. As the walk method did not traverse the
left operands of the IN subqueries the outer references there
were not taken into account and some subqueries that were actually
correlated were marked as uncorrelated. It could lead to an
attempt of the materialization of such a subquery.

Also added a cleanup for some test cases merged from 5.5.
2017-04-21 14:34:24 -07:00
Sergei Golubchik
26ed68dcae fix "cmake -DWITH_PCRE=bundled"
after building with system
2017-04-21 18:34:30 +02:00
Sergei Golubchik
8d75a7533e Merge branch '5.5' into 10.0 2017-04-21 18:34:06 +02:00
Marko Mäkelä
200ef51344 Fix a compilation error 2017-04-21 18:29:50 +03:00
Marko Mäkelä
996c7d5cb5 MDEV-12545 Reduce the amount of fil_space_t lookups
buf_flush_write_block_low(): Acquire the tablespace reference once,
and pass it to lower-level functions. This is only a start; further
calls may be removed later.
2017-04-21 17:47:23 +03:00
Marko Mäkelä
555e52f3bc MDEV-12467 encryption.create_or_replace hangs during DROP TABLE
fil_crypt_thread(): Do invoke fil_crypt_complete_rotate_space()
when the tablespace is about to be dropped. Also, remove a redundant
check whether rotate_thread_t::space is NULL. It can only become
NULL when fil_crypt_find_space_to_rotate() returns false, and in
that case we would already have terminated the loop.

fil_crypt_find_page_to_rotate(): Remove a redundant check for
space->crypt_data == NULL. Once encryption metadata has been
created for a tablespace, it cannot be removed without dropping
the entire tablespace.
2017-04-21 17:47:15 +03:00
Marko Mäkelä
d23eb8e6d2 Follow-up to MDEV-12488: Fix some type mismatch in header files
This reduces the number of compilation warnings on Windows.
2017-04-21 17:47:05 +03:00
Marko Mäkelä
aafaf05a47 Fix some InnoDB type mismatch introduced in 10.1
On 64-bit Windows, sizeof(ulint)!=sizeof(ulong).
2017-04-21 17:43:35 +03:00
Marko Mäkelä
7445ff84f4 Merge 10.0 into 10.1 2017-04-21 17:41:40 +03:00
Marko Mäkelä
e056d1f1ca Fix some InnoDB type mismatch
On 64-bit Windows, sizeof(ulint)!=sizeof(ulong).
2017-04-21 17:39:12 +03:00
Marko Mäkelä
e48ae21b0e Follow-up to MDEV-12534: Fix warnings on 32-bit systems 2017-04-21 16:22:46 +03:00
Marko Mäkelä
3a6af51a8a Do not crash XtraDB when fil_space_acquire() fails
This reverts part of commit 50eb40a2a8
which backported the code from MariaDB 10.2. The XtraDB version of
the code included a ut_error statement (aborting the process) when
a tablespace is not found. Luckily this change was not part of a
release; MariaDB 10.1.22 had been released some days earlier.
2017-04-21 13:10:28 +03:00