Commit graph

757 commits

Author SHA1 Message Date
Marko Mäkelä
d831e4c22a 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(): Assign recv_writer_thread_active=true
before creating recv_writer_thread.
2017-02-08 17:23:13 +02:00
Marko Mäkelä
f162704570 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-02-05 17:07:16 +02:00
Marko Mäkelä
20e8347447 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.
2017-02-04 17:33:19 +02:00
Marko Mäkelä
9f0dbb3120 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-04 17:33:01 +02:00
Marko Mäkelä
732672c304 MDEV-11233 CREATE FULLTEXT INDEX with a token longer than 127 bytes
crashes server

This bug is the result of merging the Oracle MySQL follow-up fix
BUG#22963169 MYSQL CRASHES ON CREATE FULLTEXT INDEX
without merging the base bug fix:
Bug#79475 Insert a token of 84 4-bytes chars into fts index causes
server crash.

Unlike the above mentioned fixes in MySQL, our fix will not change
the storage format of fulltext indexes in InnoDB or XtraDB
when a character encoding with mbmaxlen=2 or mbmaxlen=3
and the length of a word is between 128 and 84*mbmaxlen bytes.
The Oracle fix would allocate 2 length bytes for these cases.

Compatibility with other MySQL and MariaDB releases is ensured by
persisting the used maximum length in the SYS_COLUMNS table in the
InnoDB data dictionary.

This fix also removes some unnecessary strcmp() calls when checking
for the legacy default collation my_charset_latin1
(my_charset_latin1.name=="latin1_swedish_ci").

fts_create_one_index_table(): Store the actual length in bytes.
This metadata will be written to the SYS_COLUMNS table.

fts_zip_initialize(): Initialize only the first byte of the buffer.
Actually the code should not even care about this first byte, because
the length is set as 0.

FTX_MAX_WORD_LEN: Define as HA_FT_MAXCHARLEN * 4 aka 336 bytes,
not as 254 bytes.

row_merge_create_fts_sort_index(): Set the actual maximum length of the
column in bytes, similar to fts_create_one_index_table().

row_merge_fts_doc_tokenize(): Remove the redundant parameter word_dtype.
Use the actual maximum length of the column. Calculate the extra_size
in the same way as row_merge_buf_encode() does.
2017-01-27 10:19:39 +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
Marko Mäkelä
49fe9bad01 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-26 13:58:58 +02:00
Marko Mäkelä
833fda8f1a InnoDB: Enable UNIV_DEBUG_VALGRIND for cmake -DWITH_VALGRIND
The symbol HAVE_VALGRIND_MEMCHECK_H was never defined.
Instead, the symbol HAVE_VALGRIND should have been used.
2017-01-11 14:13:30 +02:00
Marko Mäkelä
f0c19b6a57 MDEV-11730 Memory leak in innodb.innodb_corrupt_bit
Memory was leaked when ALTER TABLE is attempted on a table
that contains corrupted indexes.
The memory leak was reported by AddressSanitizer for the test
innodb.innodb_corrupt_bit. The leak was introduced into
MariaDB Server 10.0.26, 10.1.15, 10.2.1 by the following:

commit c081c978a2
Merge: 1d21b22155 a482e76e65
Author: Sergei Golubchik <serg@mariadb.org>
Date:   Tue Jun 21 14:11:02 2016 +0200

   Merge branch '5.5' into bb-10.0
2017-01-05 20:30:51 +02:00
Marko Mäkelä
80d5d1452a MDEV-11694 InnoDB tries to create unused table SYS_ZIP_DICT
MariaDB Server 10.0.28 and 10.1.19 merged code from Percona XtraDB
that introduced support for compressed columns. Much but not all
of this code was disabled by placing #ifdef HAVE_PERCONA_COMPRESSED_COLUMNS
around it.

Among the unused but not disabled code is code to access
some new system tables related to compressed columns.

The creation of these system tables SYS_ZIP_DICT and SYS_ZIP_DICT_COLS
would cause a crash in --innodb-read-only mode when upgrading
from an earlier version to 10.0.28 or 10.1.19.

Let us remove all the dead code related to compressed columns.
Users who already upgraded to 10.0.28 and 10.1.19 will have the two
above mentioned empty tables in their InnoDB system tablespace.
Subsequent versions of MariaDB Server will completely ignore those tables.
2017-01-03 19:32:47 +02:00
Marko Mäkelä
9f863a15b0 MDEV-11602 InnoDB leaks foreign key metadata on DDL operations
Essentially revert MDEV-6759, which addressed a double free of memory
by removing the freeing altogether, introducing the memory leaks.
No double free was observed when running the test suite -DWITH_ASAN.

Replace some mem_heap_free(foreign->heap) with dict_foreign_free(foreign)
so that the calls can be located and instrumented more easily when needed.
2016-12-19 15:57:41 +02:00
Sergei Golubchik
f35b0d8ef8 Merge branch 'merge/merge-xtradb-5.6' into 10.0 2016-12-04 01:37:55 +01:00
Sergei Golubchik
7436c3d6ab 5.6.34-79.1 2016-12-02 10:22:18 +01:00
Jan Lindström
03ddc19ab2 MDEV-6424: MariaDB server crashes with assertion failure in file ha_innodb.c line 11652
This is not a fix, this is instrumentation to find out is MySQL frm dictionary
and InnoDB data dictionary really out-of-sync when this assertion is fired,
or is there some other reason (bug).
2016-11-17 15:15:20 +02:00
Jan Lindström
9741e0ea72 Initialize zip_dict_ids table and avoid referencing array items
as currently MariaDB does not support compressed columns.
2016-11-01 07:52:28 +02:00
Jan Lindström
923a7f8675 MDEV-11188: rpl.rpl_parallel_partition fails with valgrind warnings in buildbot and outside 2016-10-31 12:16:53 +02:00
Vladislav Vaintroub
ad5b88a892 Fix build error in XtraDB on Windows.
coming from Percona's workaround for glibc bug
http://bugs.mysql.com/bug.php?id=82886
2016-10-26 09:26:34 +00:00
Sergei Golubchik
675f27b382 Merge branch 'merge/merge-xtradb-5.6' into 10.0
commented out the "compressed columns" feature
2016-10-25 18:28:31 +02:00
Sergei Golubchik
d7dc03a267 5.6.33-79.0 2016-10-25 17:01:37 +02:00
Sergei Golubchik
12c3e16dfa Merge branch '5.5' into 10.0 2016-10-25 16:41:43 +02:00
Sergei Golubchik
eac8d95ffc compilation warning after xtradb merge 2016-10-14 12:51:53 +02:00
Sergei Golubchik
e4957de4fd Merge branch 'merge-xtradb-5.5' into 5.5 2016-10-13 12:40:24 +02:00
Sergei Golubchik
6010a27c87 5.5.52-38.3 2016-10-13 12:23:16 +02:00
Sergei Petrunia
23af6f5942 Merge branch '10.0' of github.com:MariaDB/server into 10.0 2016-09-28 16:19:58 +03:00
Sergei Petrunia
a53f3c6d3c MDEV-10649: Optimizer sometimes use "index" instead of "range" access for UPDATE
(Fixing both InnoDB and XtraDB)

Re-opening a TABLE object (after e.g. FLUSH TABLES or open table cache
eviction) causes ha_innobase to call
dict_stats_update(DICT_STATS_FETCH_ONLY_IF_NOT_IN_MEMORY).

Inside this call, the following is done:
  dict_stats_empty_table(table);
  dict_stats_copy(table, t);

On the other hand, commands like UPDATE make this call to get the "rows in
table" statistics in table->stats.records:

  ha_innobase->info(HA_STATUS_VARIABLE|HA_STATUS_NO_LOCK)

note the HA_STATUS_NO_LOCK parameter. It means, no locks are taken by
::info() If the ::info() call happens between dict_stats_empty_table
and dict_stats_copy calls, the UPDATE's optimizer will get an estimate
of table->stats.records=1, which causes it to pick a full table scan,
which in turn will take a lot of row locks and cause other bad
consequences.
2016-09-28 16:12:58 +03:00
Sergei Golubchik
bb8b658954 Merge branch 'merge/merge-xtradb-5.6' into 10.0 2016-09-27 18:58:57 +02:00
Sergei Golubchik
93ab3093cb 5.6.32-78.1 2016-09-27 18:00:59 +02:00
Vicențiu Ciorbaru
ed99e2cdd3 MDEV-10341: InnoDB: Failing assertion: mutex_own(mutex) - mutex_exit_func
Followup from 5.5 patch. Removing memory barriers on intel is wrong as
this doesn't prevent the compiler and/or processor from reorganizing reads
before the mutex release. Forcing a memory barrier before reading the waiters will
guarantee that no speculative reading takes place.
2016-08-23 21:24:36 +03:00
Sergei Golubchik
47a1087ff6 Merge branch 'bb-10.0-serg' into 10.0 2016-08-14 09:16:07 +02:00
Jan Lindström
9b23f8054d MDEV-10535: ALTER TABLE causes standalone/wsrep cluster crash
When checking is any of the renamed columns part of the
columns for new indexes we accessed NULL pointer if checked
column used on index was added on same statement. Additionally,
we tried to check too many indexes, added_index_count
is enough here.
2016-08-13 09:27:50 +03:00
Jan Lindström
b3df257cfd MDEV-10469: innodb.innodb-alter-tempfile fails in buildbot: InnoDB: Warning: database page corruption or a failed
Test case intentionally crashes the server and that could lead partially
written pages that are then restored from doublewrite buffer.
2016-08-13 09:27:50 +03:00
Sergei Golubchik
3863e72380 Merge branch 'merge/merge-xtradb-5.6' into 10.0
5.6.31-77.0
2016-08-10 19:55:45 +02:00
Sergei Golubchik
64752acf72 5.6.31-77.0 2016-08-10 19:24:58 +02:00
Sergei Golubchik
309c08c17c Merge branch '5.5' into 10.0 2016-08-10 19:19:05 +02:00
Vicențiu Ciorbaru
5ad02062d9 MDEV-10341: InnoDB: Failing assertion: mutex_own(mutex) - mutex_exit_func
Fix memory barrier issues on releasing mutexes. We must have a full
memory barrier between releasing a mutex lock and reading its waiters.
This prevents us from missing to release waiters due to reading the
number of waiters speculatively before releasing the lock. If threads
try and wait between us reading the waiters count and releasing the
lock, those threads might stall indefinitely.

Also, we must use proper ACQUIRE/RELEASE semantics for atomic
operations, not ACQUIRE/ACQUIRE.
2016-08-09 23:34:44 +03:00
Sergei Golubchik
5265243cc4 Merge branch 'merge/merge-xtradb-5.5' into 5.5 2016-08-03 20:44:08 +02:00
Sergei Golubchik
e316c46f43 5.5.50-38.0 2016-08-03 20:43:29 +02:00
Jan Lindström
35c9c85634 MDEV-10217: innodb.innodb_bug59641 fails sporadically in buildbot: InnoDB: Failing assertion: current_rec != insert_rec in file page0cur.c line 1052
Added record printout when current_rec == insert_rec with lengths for
debug builds.
2016-08-03 13:46:01 +03:00
Jan Lindström
406fe77763 Add more diagnostic to find out the problem on
innodb_shutdown_for_mysql in ppc64el on test
case innodb_fts.innodb_fts_stopword_charset.
2016-07-04 17:38:47 +03:00
Jan Lindström
26de9061e8 Merge following commit from 5.5:
commit ef92aaf9ec
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date:   Wed Jun 22 22:37:28 2016 +0300

    MDEV-10083: Orphan ibd file when playing with foreign keys

    Analysis: row_drop_table_for_mysql did not allow dropping
    referenced table even in case when actual creating of the
    referenced table was not successfull if foreign_key_checks=1.

    Fix: Allow dropping referenced table even if foreign_key_checks=1
    if actual table create returned error.
2016-06-23 07:42:40 +03:00
Jan Lindström
ef92aaf9ec MDEV-10083: Orphan ibd file when playing with foreign keys
Analysis: row_drop_table_for_mysql did not allow dropping
referenced table even in case when actual creating of the
referenced table was not successfull if foreign_key_checks=1.

Fix: Allow dropping referenced table even if foreign_key_checks=1
if actual table create returned error.
2016-06-23 06:46:05 +03:00
Sergei Golubchik
805703fa8e Fixed for failures in buildbot: Windows
fix constants to stay 64-bit instead of being truncated by VS.
this fixes a hang on startup.
2016-06-22 10:40:28 +02:00
Sergei Golubchik
b3f4cf7c13 Merge branch 'merge-xtradb-5.6' into 0.0 2016-06-21 15:27:09 +02:00
Sergei Golubchik
b42664e85e 5.6.30-76.3 2016-06-21 14:20:09 +02:00
Sergei Golubchik
c081c978a2 Merge branch '5.5' into bb-10.0 2016-06-21 14:11:02 +02:00
Sergei Golubchik
260699e91b Merge branch 'merge-xtradb-5.5' into 5.5 2016-06-14 13:59:41 +02:00
Sergei Golubchik
f54dcf1e87 5.5.49-37.9 2016-06-14 12:38:47 +02:00
Jan Lindström
0f252702b1 MDEV-7139: Sporadic failure in innodb.innodb_corrupt_bit on P8
Use direct persistent index corruption set on InnoDB dictionary
for this test. Do not allow creating new indexes if one of the
existing indexes is already marked as corrupted.
2016-06-08 08:40:10 +03:00
Sergei Golubchik
cfad394776 Merge branch 'merge-xtradb-5.6' into 10.0
5.6.29-76.2
2016-04-26 23:43:48 +02:00
Sergei Golubchik
5b8ac23030 5.6.29-76.2 2016-04-26 19:07:11 +02:00