Commit graph

2125 commits

Author SHA1 Message Date
Marko Mäkelä
058c385e03 Merge 10.1 into 10.2 2019-07-23 16:34:04 +03:00
Marko Mäkelä
1f498f901b 5.6.44-86.0 2019-07-23 15:47:22 +03:00
Marko Mäkelä
d653db32f2 MDEV-14154: Make ut_time_ms(), ut_time_us() monotonic
This is motivated by PS-5221 in
percona/percona-server@2817c561fc

The coarser-precision ut_time() will still refer to the
system clock, meaning that bad things can happen if the
real time clock is adjusted backwards.
2019-07-23 15:23:27 +03:00
Laurynas Biveinis
c385d80abd Fix PS-5388 (Enable hardware CRC32 under Valgrind)
Valgrind started supporting CRC32 instruction starting with version
3.6.1, released in 2011. Thus remove the fallback to software
implementation in case running under Valgrind.
2019-07-23 15:23:27 +03:00
Marko Mäkelä
60c790d6f4 Merge 10.1 into 10.2 2019-07-22 15:28:05 +03:00
Marko Mäkelä
a5e268a293 MDEV-20102 Phantom InnoDB table remains after interrupted CREATE...SELECT
This is a regression due to MDEV-16515 that affects some versions in
the MariaDB 10.1 server series starting with 10.1.35, and possibly
all versions starting with 10.2.17, 10.3.8, and 10.4.0.

The idea of MDEV-16515 is to allow DROP TABLE to be interrupted,
in case it was stuck due to some concurrent activity. We already
made some cases of internal DROP TABLE immune to kill in MDEV-18237,
MDEV-16647, MDEV-17470. We must include the cleanup of
CREATE TABLE...SELECT in the list of such internal DROP TABLE.

ha_innobase::delete_table(): Pass create_failed=true if the current
SQL statement is CREATE, so that the table will be dropped.

row_drop_table_for_mysql(): If create_failed=true, do not allow
the operation to be interrupted.
2019-07-22 14:55:46 +03:00
Marko Mäkelä
6a55aeb2af Merge 10.1 into 10.2 2019-07-18 23:38:48 +03:00
Marko Mäkelä
a24e824cc4 MDEV-20097: Also fix XtraDB 2019-07-18 23:24:13 +03:00
Marko Mäkelä
e55cc2d8cc Merge 10.1 into 10.2
MDEV-20094 was filed for the unexpected result differences for the test
innodb.check_ibd_filesize.
2019-07-18 18:01:04 +03:00
Marko Mäkelä
adbab0d4cd MDEV-13625: Add the test innodb.innodb-wl5980-debug 2019-07-18 17:01:59 +03:00
Marko Mäkelä
6962855185 Merge 10.1 into 10.2 2019-07-18 13:10:09 +03:00
Thirunarayanan Balathandayuthapani
aba2b41e9e MDEV-19978 Page read from tablespace is corrupted
Problem:
=======
  Checksum fields can have value as zero. In that case, InnoDB falsely
consider that page should be all zeroes. It leads to wrong detection of page
corruption.

Solution:
========
	Remove the condition that checks if checksum fields are zero then
page should be all zeroes.
2019-07-11 18:25:25 +05:30
Eugene Kosov
26c389b7b7 Merge 10.1 into 10.2 2019-07-09 13:22:22 +03:00
Jan Lindström
b105427745 MDEV-19660: wsrep_rec_get_foreign_key() is dereferencing a stale pointer to a page that was previously latched
In row_ins_foreign_check_on_constraint(), clustered index record is being passed to wsrep_append_foreign_key() after releasing the latch. If a record has been changed by other thread in the meantime then it could lead to a crash when
wsrep_rec_get_foreign_key () tries to access the record.

row_ins_foreign_check_on_constraint
	Use cascade->pcur->old_rec instead of clust_rec.

row_ins_check_foreign_constraint
	Add missing error printout.
2019-07-02 10:06:13 +03:00
Marko Mäkelä
4bbd8be482 Merge 10.1 into 10.2 2019-06-12 10:30:01 +03:00
Thirunarayanan Balathandayuthapani
b2f76bac03 MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB: Redo log crypto: failed to decrypt log block"
- Post-push fix to change the copyright of both xtradb and innodb file.
2019-06-12 12:25:00 +05:30
Thirunarayanan Balathandayuthapani
c5fe1b8fc1 MDEV-16866 InnoDB fails to start upon crash recovery with "[ERROR] InnoDB: Redo log crypto: failed to decrypt log block"
- If InnoDB encounters garbage or incomplete written log block during
recovery then don't throw the error. Treat it as end of the log.
- This kind of incomplete or empty block can be result of killing
InnoDB when writing the redo log.
2019-06-12 12:17:13 +05:30
Marko Mäkelä
d59e15bdb9 Merge 10.1 into 10.2 2019-05-28 15:56:24 +03:00
Marko Mäkelä
626f2a1c17 MDEV-19614 SET GLOBAL innodb_ deadlock due to LOCK_global_system_variables
The update callback functions for several settable global InnoDB variables
are acquiring InnoDB latches while holding LOCK_global_system_variables.

On the other hand, some InnoDB code is invoking THDVAR() while holding
InnoDB latches. An example of this is thd_lock_wait_timeout() that is
called by lock_rec_enqueue_waiting(). In some cases, the
intern_sys_var_ptr() that is invoked by THDVAR() may acquire
LOCK_global_system_variables, via sync_dynamic_session_variables().

In lock_rec_enqueue_waiting(), we really must be holding some InnoDB
latch while invoking THDVAR(). This implies that
LOCK_global_system_variables must conceptually reside below any InnoDB
latch in the latching order. That in turns implies that the various
update callback functions must release LOCK_global_system_variables
before acquiring any InnoDB mutexes or rw-locks, and reacquire
LOCK_global_system_variables later. The validate functions are being
invoked while not holding LOCK_global_system_variables and thus they
do not need any changes.

The following statements are affected by this:

SET GLOBAL innodb_adaptive_hash_index = …;
SET GLOBAL innodb_cmp_per_index_enabled = 1;
SET GLOBAL innodb_old_blocks_pct = …;
SET GLOBAL innodb_fil_make_page_dirty_debug = …; -- debug builds only
SET GLOBAL innodb_buffer_pool_evict = uncompressed; -- debug builds only
SET GLOBAL innodb_purge_run_now = 1; -- debug builds only
SET GLOBAL innodb_purge_stop_now = 1; -- debug builds only
SET GLOBAL innodb_log_checkpoint_now = 1; -- debug builds only
SET GLOBAL innodb_buf_flush_list_now = 1; -- debug builds only
SET GLOBAL innodb_buffer_pool_dump_now = 1;
SET GLOBAL innodb_buffer_pool_load_now = 1;
SET GLOBAL innodb_buffer_pool_load_abort = 1;
SET GLOBAL innodb_status_output = …;
SET GLOBAL innodb_status_output_locks = …;
SET GLOBAL innodb_encryption_threads = …;
SET GLOBAL innodb_encryption_rotate_key_age = …;
SET GLOBAL innodb_encryption_rotation_iops = …;
SET GLOBAL innodb_encrypt_tables = …;
SET GLOBAL innodb_disallow_writes = …;

buf_LRU_old_ratio_update(): Correct the return type.
2019-05-28 10:54:30 +03:00
Marko Mäkelä
242a28c320 MDEV-6812: Remove the wrapper my_log2f() 2019-05-28 10:54:30 +03:00
Marko Mäkelä
50999738ea Merge 10.1 into 10.2 2019-05-13 18:48:28 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Marko Mäkelä
2647fd101d MDEV-19445 heap-use-after-free related to innodb_ft_aux_table
Try to fix the race conditions between
SET GLOBAL innodb_ft_aux_table = ...;
and access to the INFORMATION_SCHEMA tables that depend on
this variable.

innodb_ft_aux_table: Replaces
fts_internal_tbl_name,fts_internal_tbl_name2. Just store the
user-specified parameter as is.

innodb_ft_aux_table_id: The table_id corresponding to
SET GLOBAL innodb_ft_aux_table, or 0 if the table does not exist
or does not contain FULLTEXT INDEX. If the table is renamed later,
the INFORMATION_SCHEMA tables will continue to refer to the table.
If the table is dropped or rebuilt, the INFORMATION_SCHEMA tables
will not find the table.
2019-05-13 17:16:42 +03:00
Marko Mäkelä
1c97e07f8f fts_optimize_words(): Remove stray output
With SET GLOBAL innodb_optimize_fulltext_only=1
in effect, OPTIMIZE TABLE would output words from the fulltext index
to the server error log, even in non-debug builds.

fts_optimize_words(): Remove the unwanted output.
2019-05-13 17:14:47 +03:00
Marko Mäkelä
c7c54ce606 fts_doc_ids_free(): Define inline 2019-05-13 11:32:20 +03:00
Marko Mäkelä
7f7211073c MDEV-19441 Typo in error message "InnoDB: FTS Doc ID must be large than"
row_insert_for_mysql(): Correct the grammar error, and
display the table name in both messages.
2019-05-13 08:54:43 +03:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
Vicențiu Ciorbaru
5543b75550 Update FSF Address
* Update wrong zip-code
2019-05-11 21:29:06 +03:00
Vicențiu Ciorbaru
c0ac0b8860 Update FSF address 2019-05-11 19:25:02 +03:00
Vicențiu Ciorbaru
f177f125d4 Merge branch '5.5' into 10.1 2019-05-11 19:15:57 +03:00
Vicențiu Ciorbaru
15f1e03d46 Follow-up to changing FSF address
Some places didn't match the previous rules, making the Floor
address wrong.

Additional sed rules:

sed -i -e 's/Place.*Suite .*, Boston/Street, Fifth Floor, Boston/g'
sed -i -e 's/Suite .*, Boston/Fifth Floor, Boston/g'
2019-05-11 18:30:45 +03:00
Marko Mäkelä
b2f3755c8e Merge 10.1 into 10.2 2019-05-10 08:02:21 +03:00
Thirunarayanan Balathandayuthapani
3e8cab51cb MDEV-13893 encryption.innodb-redo-badkey failed in buildbot with page cannot be decrypted
buf_dblwr_process(): Remove the useless warning that a copy of a page
in the doublewrite buffer is corrupted. We already report an error if a
corrupted page cannot be recovered from the doublewrite buffer.

Note: In MariaDB 10.1, the original bug reported in MDEV-13893 could
still be easily repeatable. In MariaDB 10.2.24, MDEV-12699 should
have reduced the probability considerably.
2019-05-10 07:57:01 +03:00
Marko Mäkelä
542f32649b MDEV-18220: race condition in fts_get_table_name()
fts_get_table_name(): Add the parameter bool dict_locked=false.
2019-05-10 07:57:01 +03:00
Marko Mäkelä
f3718a112a MDEV-18220: Backport some code from MariaDB 10.2
fts_get_table_name(): Output to a caller-allocated buffer.

fts_get_table_name_prefix(): Use the lower-overhead allocation
ut_malloc() instead of mem_alloc().

This is based on mysql/mysql-server@d1584b9f38
in MySQL 5.7.4.
2019-05-10 07:57:01 +03:00
Marko Mäkelä
f92749ed36 MDEV-18220: heap-use-after-free in fts_get_table_name_prefix()
fts_table_t::parent: Remove the redundant field. Refer to
table->name.m_name instead.

fts_update_sync_doc_id(), fts_update_next_doc_id(): Remove
the redundant parameter table_name.

fts_get_table_name_prefix(): Access the dict_table_t::name.
FIXME: Ensure that this access is always covered by
dict_sys->mutex.
2019-05-10 07:57:01 +03:00
Marko Mäkelä
5b3f7c0c33 MDEV-18220: Remove some redundant data structures
fts_state_t, fts_slot_t::state: Remove. Replaced by fts_slot_t::running
and fts_slot_t::table_id as follows.

FTS_STATE_SUSPENDED: Removed (unused).

FTS_STATE_EMPTY: Removed. table_id=0 will denote empty slots.

FTS_STATE_RUNNING: Equivalent to running=true.

FTS_STATE_LOADED, FTS_STATE_DONE: Equivalent to running=false.

fts_slot_t::table: Remove. Tables will be identified by table_id.
After opening a table, we will check fil_table_accessible() before
accessing the data.

fts_optimize_new_table(), fts_optimize_del_table(),
fts_optimize_how_many(), fts_is_sync_needed():
Remove the parameter tables, and use the static variable fts_slots
(which was introduced in MariaDB 10.2) instead.
2019-05-10 07:56:55 +03:00
Eugene Kosov
06442e3e9f MDEV-19399 do not call slow my_timer_init() several times
No functional change.

Call my_timer_init() only once and then reuse it from InnoDB and
perfschema storage engines.

This patch speeds up empty test for me like this:
./mtr -mem innodb.kevg,xtradb  1.21s user 0.84s system 34% cpu 5.999 total
./mtr -mem innodb.kevg,xtradb  1.12s user 0.60s system 31% cpu 5.385 total
2019-05-10 07:56:55 +03:00
Sergey Vojtovich
410585ca63 Removed dead code 2019-05-09 11:13:44 +04:00
Sergey Vojtovich
d0b73fb8d3 MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
A sequel to 9180e86 and 149b754.

ALTER TABLE ... ADD FOREIGN KEY may crash if parent table is updated
concurrently.

Block FK parent table updates even earlier, before intermediate child
table is created.

Use proper charset info for my_casedn_str() and don't update original
identifiers so that lower_cast_table_names == 2 is honoured.
2019-05-09 11:13:44 +04:00
Oleksandr Byelkin
633946fb63 Merge branch '10.1' into 10.2 2019-05-06 18:07:40 +02:00
Marko Mäkelä
0573744a83 Revert "MDEV-19399 do not call slow my_timer_init() several times"
This reverts commit 8dc670a5e8.

The symbol sys_timer_info was not being exported correctly,
which caused linking failures on some platforms.
2019-05-06 17:15:32 +03:00
Eugene Kosov
c83f837053 MDEV-18214 remove some duplicated MONITOR counters
MONITOR_PENDING_LOG_WRITE
MONITOR_PENDING_CHECKPOINT_WRITE
MONITOR_LOG_IO: read values from log_t members instead of updating own
monitor variables
2019-05-06 16:00:15 +03:00
Eugene Kosov
8dc670a5e8 MDEV-19399 do not call slow my_timer_init() several times
No functional change.

Call my_timer_init() only once and then reuse it from InnoDB and
perfschema storage engines.

This patch speeds up empty test for me like this:
./mtr -mem innodb.kevg,xtradb  1.21s user 0.84s system 34% cpu 5.999 total
./mtr -mem innodb.kevg,xtradb  1.12s user 0.60s system 31% cpu 5.385 total
2019-05-06 15:38:02 +03:00
Oleksandr Byelkin
8cbb14ef5d Merge branch '10.1' into 10.2 2019-05-04 17:04:55 +02:00
Marko Mäkelä
1cd31bc132 Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT DEPENDING ON ALGORITHM
For partitioned table, ensure that the AUTO_INCREMENT values will
be assigned from the same sequence. This is based on the following
change in MySQL 5.6.44:

commit aaba359c13d9200747a609730dafafc3b63cd4d6
Author: Rahul Malik <rahul.m.malik@oracle.com>
Date:   Mon Feb 4 13:31:41 2019 +0530

    Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT DEPENDING ON ALGORITHM

    Problem:
    When a partition table is in-place altered to add an auto-increment column,
    then its values are starting over for each partition.

    Analysis:
    In the case of in-place alter, InnoDB is creating a new sequence object
    for each partition. It is default initialized. So auto-increment columns
    start over for each partition.

    Fix:
    Assign old sequence of the partition to the sequence of next partition
    so it won't start over.

    RB#21148
    Reviewed by Bin Su <bin.x.su@oracle.com>
2019-04-25 14:12:45 +03:00
Marko Mäkelä
9e7bcb05d4 Clean up ib_sequence::m_max_value
Correctly document the usage of m_max_value. Remove the const
qualifier, so that the implicit assignment operator can be used.
Make all members of ib_sequence private, and add an accessor
member function max_value().
2019-04-25 14:12:45 +03:00
Aakanksha Verma
3ae2198483 Bug #19811005 ALTER TABLE ADD INDEX DOES NOT UPDATE INDEX_LENGTH IN I_S TABLES
PROBLEM
 =======
An add index doesn't update index length stats in information schema
TABLES table.

FIX
 ===
Update the dict_table_t variable with index length stats that is
actually calculated post alter . As this variable is used to populated
the information schema index length statistics.

Reviewed by: Bin su<bin.x.su@oracle.com>
RB: 21277
2019-04-25 14:12:45 +03:00
Marko Mäkelä
ecea90871e 5.6.43-84.3 2019-04-25 10:43:55 +03:00
Zsolt Parragi
83d8c38dd7 PS-4989: Fixing innodb_track_changed_pages debug validation
In debug builds, this setting is allowed to be turned off temporarily after it was
turned on during startup. Howewer memory garbage also caused it to be accidentally
turned on when it was disabled at startup.
2019-04-25 10:43:13 +03:00