Commit graph

4189 commits

Author SHA1 Message Date
Marko Mäkelä
c1bcb2055e Remove the unused field tablespace_version.
The field should have been removed when merging MySQL 5.7.9
to MariaDB 10.2.2 in commit 2e814d4702.
2017-02-27 13:44:53 +02:00
Marko Mäkelä
78153cf641 MDEV-11927 InnoDB change buffer is not being merged
to tables in the system tablespace

This is a regression caused by MDEV-11585, which accidentally
changed Tablespace::is_undo_tablespace() in an incorrect way,
causing the InnoDB system tablespace to be reported as a dedicated
undo tablespace, for which the change buffer is not applicable.

Tablespace::is_undo_tablespace(): Remove. There were only 2
calls from the function buf_page_io_complete(). Replace those
calls as appropriate.

Also, merge changes to tablespace import/export tests from
MySQL 5.7, and clean up the tests a little further, allowing
them to be run with any innodb_page_size.

Remove duplicated error injection instrumentation for the
import/export tests.  In MySQL 5.7, the error injection label
buf_page_is_corrupt_failure was renamed to
buf_page_import_corrupt_failure.

fil_space_extend_must_retry(): Correct a debug assertion
(tablespaces can be extended during IMPORT), and remove a
TODO comment about compressed temporary tables that was
already addressed in MDEV-11816.

dict_build_tablespace_for_table(): Correct a comment that
no longer holds after MDEV-11816, and assert that
ROW_FORMAT=COMPRESSED can only be used in .ibd files.
2017-02-24 22:16:33 +02:00
Marko Mäkelä
51af19851a MDEV-11454 post-merge fix:
buf_dump(): Correct the printf format passed to buf_dump_status()
to match the argument types.

Revert the changes to storage/xtradb. XtraDB is not being compiled
for 10.2. The unused copy that we have in the 10.2 branch is only
getting merges from 10.1.

Disable the test sys_vars.innodb_buffer_pool_dump_pct_function
because it is unstable on buildbot.
2017-02-24 22:12:01 +02:00
Marko Mäkelä
342b48b7b1 Merge pull request #264 from grooverdan/10.2-MDEV-11454-innodb_buffer_pool_dump_pct-entire-pool
MDEV-11454: Make innodb_buffer_pool_dump_pct refer to the entire buffer pool size
2017-02-24 15:12:09 +02:00
Marko Mäkelä
a13a636c74 MDEV-11802 innodb.innodb_bug14676111 fails
The function trx_purge_stop() was calling os_event_reset(purge_sys->event)
before calling rw_lock_x_lock(&purge_sys->latch). The os_event_set()
call in srv_purge_coordinator_suspend() is protected by that X-latch.

It would seem a good idea to consistently protect both os_event_set()
and os_event_reset() calls with a common mutex or rw-lock in those
cases where os_event_set() and os_event_reset() are used
like condition variables, tied to changes of shared state.

For each os_event_t, we try to document the mutex or rw-lock that is
being used. For some events, frequent calls to os_event_set() seem to
try to avoid hangs. Some events are never waited for infinitely, only
timed waits, and os_event_set() is used for early termination of these
waits.

os_aio_simulated_put_read_threads_to_sleep(): Define as a null macro
on other systems than Windows. TODO: remove this altogether and disable
innodb_use_native_aio on Windows.

os_aio_segment_wait_events[]: Initialize only if innodb_use_native_aio=0.

log_write_flush_to_disk_low(): Invoke log_mutex_enter() at the end, to
avoid race conditions when changing the system state. (No potential
race condition existed before MySQL 5.7.)
2017-02-20 12:32:43 +02:00
Marko Mäkelä
34bbc76f1c Simplify a WL#6494/WL#7142 test.
The test innodb.log_file_size_checkpoint was originally added to
MySQL 5.7 by me in a bug fix, to fix the interaction of WL#6494
(redo log resizing, introduced in MySQL 5.6) and WL#7142
(data file discovery based on MLOG_FILE_NAME records,
introduced in MySQL 5.7):

commit 70f9ef4e1220827132b50275ca7272f2bcca1864
Author: Marko Mäkelä <marko.makela@oracle.com>
Date:   Wed May 21 13:31:29 2014 +0300

    Bug#18755095 REDO LOG SIZE CHANGE AFTER CRASH RESULTS IN CHECKPOINT AGE
    ERROR MESSAGE

    This is a regression from fixing
    Bug#18730524 REPEATED KILL+RESTART FAILS DUE TO MISSING MLOG_FILE_NAME
    RECORD

    innobase_start_or_create_for_mysql(): Invoke fil_names_clear() before
    creating the "checkpoint" when changing redo log files.

    Approved by Jimmy Yang on IM.

The relevant part of the test is that fil_names_clear() is invoked to
emit an MLOG_CHECKPOINT record before the redo log files are deleted.
In case the server is killed before ib_logfile0 has been deleted,
the old (not-yet-resized) redo log will be treated as valid. We do not
need to create a large number of tables for that.
2017-02-16 09:18:46 +02:00
Marko Mäkelä
7a5288015c MDEV-12072 Do not unnecessarily construct rec_printer objects
I introduced the rec_printer object in MySQL to pretty-print raw InnoDB
records and index tuples in diagnostic messages. These objects are being
constructed unconditionally, even though the DBUG_PRINT is not enabled.

The unnecessary work is avoided by simply passing rec_printer(…).str()
to the DBUG_LOG macro that was introduced in MDEV-11713.
2017-02-16 09:16:11 +02:00
Marko Mäkelä
a90066b1c7 MDEV-11641 innobase_get_stmt_safe() does not copy the last byte of thd->query_string
innobase_get_stmt_safe(): Copy also the last byte.
2017-02-15 13:45:14 +02:00
Marko Mäkelä
703d0985ee Fix some InnoDB memory leaks.
dict_init_free(): Make global, and move the call from
dict_close() to srv_free(), because this is initialized
earlier than dict_sys.

innobase_space_shutdown(): Do not leak srv_allow_writes_event.
2017-02-15 08:57:43 +02:00
Marko Mäkelä
2af28a363c MDEV-11782: Redefine the innodb_encrypt_log format
Write only one encryption key to the checkpoint page.
Use 4 bytes of nonce. Encrypt more of each redo log block,
only skipping the 4-byte field LOG_BLOCK_HDR_NO which the
initialization vector is derived from.

Issue notes, not warning messages for rewriting the redo log files.

recv_recovery_from_checkpoint_finish(): Do not generate any redo log,
because we must avoid that before rewriting the redo log files, or
otherwise a crash during a redo log rewrite (removing or adding
encryption) may end up making the database unrecoverable.
Instead, do these tasks in innobase_start_or_create_for_mysql().

Issue a firm "Missing MLOG_CHECKPOINT" error message. Remove some
unreachable code and duplicated error messages for log corruption.

LOG_HEADER_FORMAT_ENCRYPTED: A flag for identifying an encrypted redo
log format.

log_group_t::is_encrypted(), log_t::is_encrypted(): Determine
if the redo log is in encrypted format.

recv_find_max_checkpoint(): Interpret LOG_HEADER_FORMAT_ENCRYPTED.

srv_prepare_to_delete_redo_log_files(): Display NOTE messages about
adding or removing encryption. Do not issue warnings for redo log
resizing any more.

innobase_start_or_create_for_mysql(): Rebuild the redo logs also when
the encryption changes.

innodb_log_checksums_func_update(): Always use the CRC-32C checksum
if innodb_encrypt_log. If needed, issue a warning
that innodb_encrypt_log implies innodb_log_checksums.

log_group_write_buf(): Compute the checksum on the encrypted
block contents, so that transmission errors or incomplete blocks can be
detected without decrypting.

Rewrite most of the redo log encryption code. Only remember one
encryption key at a time (but remember up to 5 when upgrading from the
MariaDB 10.1 format.)
2017-02-15 08:07:20 +02:00
Marko Mäkelä
743ac7c2d0 MDEV-12061 Allow innodb_log_files_in_group=1
The InnoDB redo log consists of a list of files that logically form
a bigger file, as if the individual files were concatenated together.

The first file will always be written on redo log checkpoint, because
the two checkpoint pages are at the start of the single logical
redo log file.

There is no technical reason why InnoDB requires at least 2 files
to exist. Let us reduce the minimum number to 1. In that way,
restoring from backups will become easier, since InnoDB can directly
deal with a single backed-up redo log file.
2017-02-15 08:07:20 +02:00
Marko Mäkelä
1b4b4f6887 MDEV-12057 Embedded server shutdown hangs in InnoDB
Ever since MDEV-5800 enabled indexed virtual columns for InnoDB,
the InnoDB shutdown relied on close_connections() that would set
thd->killed for the InnoDB purge threads. Alas, the embedded server
shutdown is not invoking close_connections(), and thus InnoDB purge
threads fail to initiate shutdown, causing a hang.

innodb_inited: Remove. Use srv_was_started instead.

innobase_fast_shutdown: Remove. Use srv_fast_shutdown instead.

srv_running: Renamed from thd_destructor_myvar, and made global.
The value NULL means that shutdown was requested or the purge threads
should not be running because of innodb_read_only_mode=1.

innobase_init(): Set srv_was_started after ensuring that srv_running
was initialized. (In innodb_read_only mode, the purge threads are not
started and we do not care if srv_running==NULL.)

innobase_start_or_create_for_mysql(): Do not set srv_was_started.
Let it be set by the only caller innobase_init().

srv_purge_should_exit(): Check also srv_was_started and srv_running
when evaluating thd->killed.
2017-02-14 10:12:38 +02:00
Sergei Golubchik
87075e7f87 MDEV-11704 InnoDB: Failing assertion: dfield_is_null(dfield2) || dfield2->data
relax innodb assertion, because Field_blob::store() clearly says
that a data pointer can be zero if the length is zero.
2017-02-13 18:12:16 +01:00
Sergei Golubchik
1913daf42c bugfix: disable ICP in InnoDB for indexes on virtual columns
because it doesn't work, vcols are never calculated for ICP
2017-02-13 18:12:05 +01:00
Sergei Golubchik
6c4144a468 InnoDB: suppress posix_fallocate() failure errors when EINVAL
EINVAL means that the filesystem doesn't support posix_fallocate().

There were two places where this error was issued, one checked for
EINVAL, the other did not. This commit fixed the other place
to also check for EINVAL.

Also, remove the space after the REFMAN to get the valid url
with no space in the middle.

Also don't say "Make sure the file system supports this function."
when posix_fallocate() fails, because this message is only shown
when the filesystem does support this function.
2017-02-13 18:12:04 +01:00
Sergei Golubchik
29ed440d44 MDEV-11836 vcol.vcol_keys_myisam fails in buildbot and outside
move TABLE::key_read into handler. Because in index merge and DS-MRR
there can be many handlers per table, and some of them use
key read while others don't. "keyread" is really per handler,
not per TABLE property.
2017-02-13 18:12:04 +01:00
Marko Mäkelä
588eca31e3 Post-fix for MDEV-12050 Remove unused InnoDB Memcached hooks
Remove also the field trx_t::read_write that was only used by
the Memcached hooks.
2017-02-13 11:40:19 +02:00
Marko Mäkelä
a45866c6db MDEV-12050 Remove unused InnoDB Memcached hooks
Oracle introduced a Memcached plugin interface to the InnoDB
storage engine in MySQL 5.6. That interface is essentially a
fork of Memcached development snapshot 1.6.0-beta1 of an old
development branch 'engine-pu'.

To my knowledge, there have not been any updates to the Memcached code
between MySQL 5.6 and 5.7; only bug fixes and extensions related to
the Oracle modifications.

The Memcached plugin is not part of the MariaDB Server. Therefore it
does not make sense to include the InnoDB interfaces for the Memcached
plugin, or to have any related configuration parameters:

    innodb_api_bk_commit_interval
    innodb_api_disable_rowlock
    innodb_api_enable_binlog
    innodb_api_enable_mdl
    innodb_api_trx_level

Removing this code in one commit makes it possible to easily restore
it, in case it turns out to be needed later.
2017-02-13 11:24:02 +02:00
Marko Mäkelä
3272a19741 MDEV-11782 preparation: Add separate code for validating the 10.1 redo log.
log_crypt_101_read_checkpoint(): Read the encryption information
from a MariaDB 10.1 checkpoint page.

log_crypt_101_read_block(): Attempt to decrypt a MariaDB 10.1
redo log page.

recv_log_format_0_recover(): Only attempt decryption on checksum
mismatch. NOTE: With the MariaDB 10.1 innodb_encrypt_log format,
we can actually determine from the cleartext portion of the redo log
whether the redo log is empty. We do not really have to decrypt the
redo log here, if we did not want to determine if the checksum is valid.
2017-02-13 11:12:58 +02:00
Marko Mäkelä
96c4b9d49f MDEV-11782 preparation: Remove recv_sys_t::last_block.
We can use log_sys->buf instead of recv_sys->last_block during
crash recovery. Remove the redundant buffer.
2017-02-13 11:12:46 +02:00
Marko Mäkelä
412ee0330c Fix a memory leak on aborted InnoDB startup.
innodb_shutdown(), trx_sys_close(): Startup may be aborted between
purge_sys and trx_sys creation. Therefore, purge_sys must be freed
independently of trx_sys.

innobase_start_or_create_for_mysql(): Remember to free purge_queue if
it was not yet attached to purge_sys.
2017-02-13 11:12:27 +02:00
Sergei Golubchik
f3914d10b6 Merge branch 'bb-10.2-serg-merge' into 10.2 2017-02-11 09:45:34 +01:00
Sergei Golubchik
2195bb4e41 Merge branch '10.1' into 10.2 2017-02-10 17:01:45 +01:00
Nirbhay Choubey
3435e8a515 MDEV-7635: Part 1
innodb_autoinc_lock_mode            = 2
innodb_buffer_pool_dump_at_shutdown = ON
innodb_buffer_pool_dump_pct         = 25
innodb_buffer_pool_load_at_startup  = ON
innodb_checksum_algorithm           = CRC32
innodb_file_format                  = Barracuda
innodb_large_prefix                 = ON
innodb_log_compressed_pages         = ON
innodb_purge_threads                = 4
innodb_strict_mode                  = ON
binlog_annotate_row_events          = ON
binlog_format                       = MIXED
binlog-row-event-max-size           = 8192
group_concat_max_len                = 1M
lock_wait_timeout                   = 86400
log_slow_admin_statements           = ON
log_slow_slave_statements           = ON
log_warnings                        = 2
max_allowed_packet                  = 16M
replicate_annotate_row_events       = ON
slave_net_timeout                   = 60
sync_binlog                         = 1
aria_recover                        = BACKUP,QUICK
myisam_recover_options              = BACKUP,QUICK
2017-02-10 06:30:42 -05:00
Marko Mäkelä
66c6188a4b Relax assertions on shutdown after aborted startup.
A proper InnoDB shutdown after aborted startup was introduced
in commit 81b7fe9d38.

Also related to this is MDEV-11985, making read-only shutdown more robust.

If startup was aborted, there may exist recovered transactions that were
not rolled back. Relax the assertions accordingly.
2017-02-09 10:18:46 +02:00
Marko Mäkelä
070a8754c4 MDEV-12024 InnoDB startup fails to wait for recv_writer_thread to finish
recv_writer_thread(): Do not assign recv_writer_thread_active=true
in order to avoid a race condition with
recv_recovery_from_checkpoint_finish().

recv_init_crash_recovery_spaces(): Assign recv_writer_thread_active=true
before creating recv_writer_thread.
2017-02-08 15:42:15 +02:00
Jan Lindström
7b27465e10 MDEV-11974: MariaDB 10.2 encryption does not support spatial indexes
Encryption stores used key_version to
FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION (offset 26)
field. Spatial indexes store RTREE Split Sequence Number
(FIL_RTREE_SPLIT_SEQ_NUM) in the same field. Both values
can't be stored in same field. Thus, current encryption
implementation does not support encrypting spatial indexes.

fil_space_encrypt(): Do not encrypt page if page type is
FIL_PAGE_RTREE (this is required for background
encryption innodb-encrypt-tables=ON).

create_table_info_t::check_table_options() Do not allow creating
table with ENCRYPTED=YES if table contains spatial index.
2017-02-08 09:05:15 +02:00
Marko Mäkelä
92bbf4ad04 MDEV-11782 WIP: Support upgrade from MariaDB 10.1.
recv_log_format_0_recover(): Invoke log_decrypt_after_read() after
reading the old-format redo log buffer.

With this change, we will upgrade to an encrypted redo log that
is misleadingly carrying a MySQL 5.7.9 compatible format tag while
the log blocks (other than the header and the checkpoint blocks)
are in an incompatible, encrypted format.
That needs to be fixed by introducing a new redo log format tag that
indicates that the entire redo log is encrypted.
2017-02-07 11:55:16 +02:00
Marko Mäkelä
b40a1fbc93 MDEV-11782 WIP: Clean up the code, and add a test.
LOG_CHECKPOINT_ARRAY_END, LOG_CHECKPOINT_SIZE: Remove.

Change some error messages to refer to MariaDB 10.2.2 instead of
MySQL 5.7.9.

recv_find_max_checkpoint_0(): Do not abort when decrypting one of the
checkpoint pages fails.
2017-02-07 11:55:16 +02:00
Marko Mäkelä
c5fc3a903c MDEV-12004 InnoDB wrongly thinks that a column is indexed
after failed ADD UNIQUE INDEX

check_col_exists_in_indexes(): Add the parameter only_committed.
When considering committed indexes, evaluate index->is_committed().
Else, evaluate index->to_be_dropped.

rollback_inplace_alter_table(): Invoke check_col_exists_in_indexes()
with only_committed=true.
2017-02-07 11:55:16 +02:00
Jan Lindström
2aa47d9849 MDEV-11035: Restore removed disallow-writes for Galera
Galera disallow-writes feature was lost in InnoDB 5.7 merge
to 10.2. This patch restores this feature and fixes test
failure on test galera.galera_var_innodb_disallow_writes.
2017-02-07 11:36:36 +02:00
Marko Mäkelä
2f00b73a4b MDEV-11985 Make innodb_read_only shutdown more robust
If InnoDB is started in innodb_read_only mode such that
recovered incomplete transactions exist at startup
(but the redo logs are clean), an assertion will fail at shutdown,
because there would exist some non-prepared transactions.

logs_empty_and_mark_files_at_shutdown(): Do not wait for incomplete
transactions to finish if innodb_read_only or innodb_force_recovery>=3.
Wait for purge to finish in only one place.

trx_sys_close(): Relax the assertion that would fail first.

trx_free_prepared(): Also free recovered TRX_STATE_ACTIVE transactions
if innodb_read_only or innodb_force_recovery>=3.

Also, revert my earlier fix to MySQL 5.7 because this fix is more generic:

Bug#20874411 INNODB SHUTDOWN HANGS IF INNODB_FORCE_RECOVERY>=3
SKIPPED ANY ROLLBACK

trx_undo_fake_prepared(): Remove.

trx_sys_any_active_transactions(): Revert the changes.
2017-02-06 10:45:18 +02:00
Marko Mäkelä
3534500b87 Test recovery when a .ibd file is a directory.
Datafile::validate_for_recovery(): Remove a redundant error message.
An error is already reported by Datafile::open_read_write() if the
file cannot be opened.

Also, do not assign SEARCH_ABORT, so that the full test will be executed
even if one step fails.
2017-02-06 10:45:18 +02:00
Marko Mäkelä
bc12d993d7 MDEV-11947 InnoDB purge workers fail to shut down
srv_release_threads(): Actually wait for the threads to resume
from suspension. On CentOS 5 and possibly other platforms,
os_event_set() may be lost.

srv_resume_thread(): A counterpart of srv_suspend_thread().
Optionally wait for the event to be set, optionally with a timeout,
and then release the thread from suspension.

srv_free_slot(): Unconditionally suspend the thread. It is always
in resumed state when this function is entered.

srv_active_wake_master_thread_low(): Only call os_event_set().

srv_purge_coordinator_suspend(): Use srv_resume_thread() instead
of the complicated logic.
2017-02-03 12:52:37 +02:00
Marko Mäkelä
650ffcd3a0 Extend the innodb.log_corruption test.
Remove the dependency on unzip. Instead, generate the InnoDB files
with perl.

log_block_checksum_is_ok(): Correct the error message.

recv_scan_log_recs(): Remove the duplicated error message for
log block checksum mismatch.

innobase_start_or_create_for_mysql(): If the server is in read-only
mode or if innodb_force_recovery>=3, do not try to modify the system
tablespace. (If the doublewrite buffer or the non-core system tables
do not exist, do not try to create them.)

innodb_shutdown(): Relax a debug assertion. If the system tablespace
did not contain a doublewrite buffer and if we started up in
innodb_read_only mode or with innodb_force_recovery>=3, it will not
be created.

dict_create_or_check_sys_tablespace(): Set the flag
srv_sys_tablespaces_open when the tables exist.
2017-02-02 10:20:22 +02:00
Marko Mäkelä
81b7fe9d38 Shut down InnoDB after aborted startup.
This fixes memory leaks in tests that cause InnoDB startup to fail.

buf_pool_free_instance(): Also free buf_pool->flush_rbt, which would
normally be freed when crash recovery finishes.

fil_node_close_file(), fil_space_free_low(), fil_close_all_files():
Relax some debug assertions to tolerate !srv_was_started.

innodb_shutdown(): Renamed from innobase_shutdown_for_mysql().
Changed the return type to void. Do not assume that all subsystems
were started.

que_init(), que_close(): Remove (empty functions).

srv_init(), srv_general_init(): Remove as global functions.

srv_free(): Allow srv_sys=NULL.

srv_get_active_thread_type(): Only return SRV_PURGE if purge really
is running.

srv_shutdown_all_bg_threads(): Do not reset srv_start_state. It will
be needed by innodb_shutdown().

innobase_start_or_create_for_mysql(): Always call srv_boot() so that
innodb_shutdown() can assume that it was called. Make more subsystems
dependent on SRV_START_STATE_STAT.

srv_shutdown_bg_undo_sources(): Require SRV_START_STATE_STAT.

trx_sys_close(): Do not assume purge_sys!=NULL. Do not call
buf_dblwr_free(), because the doublewrite buffer can exist while
the transaction system does not.

logs_empty_and_mark_files_at_shutdown(): Do a faster shutdown if
!srv_was_started.

recv_sys_close(): Invoke dblwr.pages.clear() which would normally
be invoked by buf_dblwr_process().

recv_recovery_from_checkpoint_start(): Always release log_sys->mutex.

row_mysql_close(): Allow the subsystem not to exist.
2017-02-01 09:30:55 +02:00
Marko Mäkelä
774056c825 MDEV-11671 Duplicated message for innodb_page_size
Display a NOTE, not a WARNING for non-default page size.
2017-02-01 09:30:55 +02:00
Marko Mäkelä
16bc16f9ba Actually invoke free() in ut_allocator::deallocate().
The necessary call was inadvertently commented out in a
merge of MySQL 5.7.14 to MariaDB 10.2.1
(commit fec844aca8).
2017-02-01 09:30:55 +02:00
Jan Lindström
17cc619847 MDEV-11671: Duplicated [NOTE] output for changed innodb_page_size
Remove duplicated output and change output level to info.
2017-01-31 15:42:52 +02:00
Marko Mäkelä
642077ea5a srv_get_active_thread_type(): Remove a potential race condition.
Call trx_purge_state() only once, to avoid a race condition if the
value changes while the conditions are being evaluated.
2017-01-31 10:23:22 +02:00
Marko Mäkelä
1293e5e59b Rewrite the innodb.log_file_size test with DBUG_EXECUTE_IF.
Remove the debug parameter innodb_force_recovery_crash that was
introduced into MySQL 5.6 by me in WL#6494 which allowed InnoDB
to resize the redo log on startup.

Let innodb.log_file_size actually start up the server, but ensure
that the InnoDB storage engine refuses to start up in each of the
scenarios.
2017-01-31 10:23:20 +02:00
Sergei Golubchik
2a4881800c InnoDB: don't pthread_join() a thread that wasn't created
this fixes the crash in innodb.101_compatibility test
2017-01-30 10:12:18 +01:00
Sergei Golubchik
9189284ba3 remove a race-condition prone assertion
on shutdown it might happen that
1. the server starts killing THDs
2. it sets thd->killed in srv_purge_coordinator
3. srv_purge_coordinator notices that and tells srv_workers to exit
4. srv_worker will notice that and will start exiting,
    ... assert here ...
5. server sets thd->killed in worker threads

that is, it might happen that the assert is tested before
srv_worker's THD got the kill signal.

this fixes various random crashes (on this assertion) on shutdown
in tests
2017-01-30 10:11:26 +01:00
Sergei Golubchik
30ba310057 cleanup: thd_destructor_proxy
1. wait for thd_destructor_proxy thread to start after creating it.
   this ensures that the thread is ready to receive a shutdown signal
   whenever we want to send it.
2. join it at shutdown, this guarantees that no innodb THD will exist
   after innobase_end().

this fixes crashes and memory leaks in main.mysqld_option_err
(were innodb was started and then immediately shut down).
2017-01-28 18:03:28 +01:00
Marko Mäkelä
2de0e42af5 Import and adjust the InnoDB redo log tests from MySQL 5.7. 2017-01-27 17:53:02 +02:00
Marko Mäkelä
406e113e9a MDEV-11915 Detect InnoDB system tablespace size mismatch early
InnoDB would refuse to start up if there is a mismatch on
the size of the system tablespace files. However, before this
check is conducted, the system tablespace may already have been
heavily modified.

InnoDB should perform the size check as early as possible.

recv_recovery_from_checkpoint_finish():
Move the recv_apply_hashed_log_recs() call to
innobase_start_or_create_for_mysql().

innobase_start_or_create_for_mysql(): Test the mutex functionality
before doing anything else. Use a compile_time_assert() for a
sizeof() constraint. Check the size of the system tablespace as
early as possible.
2017-01-27 13:05:07 +02:00
Marko Mäkelä
3271da11c4 MDEV-11814 Refuse innodb_read_only startup if crash recovery is needed
recv_scan_log_recs(): Remember if redo log apply is needed,
even if starting up in innodb_read_only mode.

recv_recovery_from_checkpoint_start_func(): Refuse
innodb_read_only startup if redo log apply is needed.
2017-01-27 13:01:56 +02:00
Marko Mäkelä
f1f8ebc325 Merge 10.0 into 10.1 2017-01-26 23:40:11 +02:00
Marko Mäkelä
afb461587c MDEV-11915 Detect InnoDB system tablespace size mismatch early
InnoDB would refuse to start up if there is a mismatch on
the size of the system tablespace files. However, before this
check is conducted, the system tablespace may already have been
heavily modified.

InnoDB should perform the size check as early as possible.

recv_recovery_from_checkpoint_finish():
Move the recv_apply_hashed_log_recs() call to
innobase_start_or_create_for_mysql().

innobase_start_or_create_for_mysql(): Test the mutex functionality
before doing anything else. Use a compile_time_assert() for a
sizeof() constraint. Check the size of the system tablespace as
early as possible.
2017-01-26 23:10:36 +02:00
Vladislav Vaintroub
a5f6b4f9fd Fix the code to determine sector size on Windows volume.
DeviceIoControl(IOCTL_STORAGE_QUERY_PROPERTY) needs volume handle,
not the handle to ordinary file.
2017-01-26 17:39:36 +00:00