Commit graph

5339 commits

Author SHA1 Message Date
Marko Mäkelä
eb6364619f Remove the redundant variable fil_n_file_opened 2018-11-27 14:30:39 +02:00
Marko Mäkelä
b9824074a6 MDEV-17851 Assertion failure srv_undo_tablespaces > 1
trx_assign_rseg_low(): Skip dedicated undo tablespaces if
innodb_undo_tablespaces=0 has been set after the database was created.
2018-11-27 14:02:24 +02:00
Marko Mäkelä
861038f2e8 MDEV-17816: Follow-up fix
When dropping a partially created table due to failure,
use SQLCOM_TRUNCATE instead of SQLCOM_DROP_DB, so that
no foreign key constraints will be touched. If any
constraints were added as part of the creation, they would
be reverted as part of the transaction rollback.

We need an explicit call to row_drop_table_for_mysql(),
because InnoDB does not do proper undo logging for CREATE TABLE,
but would only drop the table at the end of the rollback.
This would not work if the transaction combines both
RENAME and CREATE, like TRUNCATE now does.
2018-11-26 17:32:57 +02:00
Jan Lindström
9669536c23 MDEV-17811: Add deprecation information for xtrabackup 2018-11-26 12:58:42 +02:00
Marko Mäkelä
2a31b82831 MDEV-17816 Crash in TRUNCATE TABLE when table creation fails
The error handling in the MDEV-13564 TRUNCATE TABLE was broken
when an error occurred during table creation.

row_create_index_for_mysql(): Do not drop the table on error.

fts_create_one_common_table(), fts_create_one_index_table():
Do drop the table on error.

create_index(), create_table_info_t::create_table():
Let the caller handle the index creation errors.

ha_innobase::create(): If create_table_info_t::create_table()
fails, drop the incomplete table, roll back the transaction,
and finally return an error to the caller.
2018-11-26 12:50:27 +02:00
Marko Mäkelä
a81fceafb1 MDEV-14409 Assertion `page_rec_is_leaf(rec)' failed in lock_rec_validate_page
lock_rec_queue_validate(): Assert page_rec_is_leaf(rec), except when
the record is a page infimum or supremum.

lock_rec_validate_page(): Relax the assertion that failed.
The assertion was reachable when the record lock bitmap was empty.

lock_rec_insert_check_and_lock(): Assert page_is_leaf().
2018-11-26 10:10:49 +02:00
Marko Mäkelä
b86e18cb44 MDEV-17780 innodb.truncate_recover crashes in recovery due to out-of-bounds page read
recv_addr_trim(): Do not try to detach the hash bucket, because
the code for doing that does not always work.

recv_apply_hashed_log_recs(): Do not attempt to read pages for which
there exist no redo log records.
2018-11-20 14:55:44 +02:00
Marko Mäkelä
e669e705a1 Fix the Windows build
Commit ff88e4bb8a broke the Windows build.
Clean up one more redundant #include to fix it.
2018-11-19 13:13:39 +02:00
Marko Mäkelä
ff88e4bb8a Remove many redundant #include from InnoDB 2018-11-19 11:42:14 +02:00
Marko Mäkelä
cb5bca721b MDEV-17765 lock_discard_page() may fail to discard locks for SPATIAL INDEX
lock_discard_page(): Traverse and discard the B-tree record locks
only if they exist. Else, discard the R-tree (spatial) index locks.
2018-11-19 11:40:10 +02:00
Marko Mäkelä
f037b91098 MDEV-17726: Fix compiler warning
Compare against the correct constant 0. NOT_KILLED belongs to
enum killed_state, while THD_IS_NOT_KILLED is what we want.
2018-11-19 11:11:53 +02:00
Marko Mäkelä
ab812c1089 MDEV-17726: A better fix
THD::close_temporary_tables(): Revert the change.

ha_innobase::delete_table(): Move the work-around inside
a debug assertion, and check thd_kill_level() instead of thd_killed(),
because the latter would not hold for KILL_CONNECTION.
2018-11-16 10:42:45 +02:00
Marko Mäkelä
59b87e75d0 Fix a comment 2018-11-12 18:06:41 +02:00
Marko Mäkelä
4b773ca298 MDEV-13564 clean-up: Replace memset() with init() 2018-11-12 10:16:28 +02:00
Marko Mäkelä
89f948c766 Merge 10.1 into 10.2 2018-11-07 08:17:47 +02:00
Marko Mäkelä
59c82dde09 Merge 10.0 into 10.1 2018-11-07 08:08:45 +02:00
Anel Husakovic
9c026273a9 Add implementation in .h and delete unneccessery printing 2018-11-06 12:07:26 +00:00
Jan Lindström
ef40018535 MDEV-17230: encryption_key_id from alter is ignored by encryption threads
Background: Used encryption key_id is stored to encryption metadata
i.e. crypt_data that is stored on page 0 of the tablespace of the
table. crypt_data is created only if implicit encryption/not encryption
is requested i.e. ENCRYPTED=[YES|NO] table option is used
fil_create_new_single_table_tablespace on fil0fil.cc.

Later if encryption is enabled all tables that use default encryption
mode (i.e. no encryption table option is set) are encrypted with
default encryption key_id that is 1. See fil_crypt_start_encrypting_space on
fil0crypt.cc.

ha_innobase::check_table_options()
	If default encryption is used and encryption is disabled, you may
        not use nondefault encryption_key_id as it is not stored anywhere.
2018-11-06 10:22:25 +02:00
Marko Mäkelä
32062cc61c Merge 10.1 into 10.2 2018-11-06 08:41:48 +02:00
Marko Mäkelä
bae21bfb5d Merge 10.0 into 10.1 2018-11-05 17:50:41 +02:00
Marko Mäkelä
db55b39fb2 Revert some InnoDB/XtraDB changes
The relevant InnoDB/XtraDB fixes up to 5.6.42 had already
been applied to MariaDB in commit 30c3d6db32.

Revert some changes that appeared in
the merge commit 87d852f102.
2018-11-05 16:47:14 +02:00
Marko Mäkelä
d63e198061 Merge 10.0 into 10.1 2018-11-05 12:15:17 +02:00
Eugene Kosov
03977e8273 MDEV-13671 InnoDB should use case-insensitive column name comparisons like the rest of the server
Problem affects INPLACE ALTER rename columns.

innobase_rename_column_try(): some strcmp() was replaced with my_strcasecmp(),
queries to update data dictionary was updated to not match column name case.
2018-11-05 11:59:59 +02:00
Marko Mäkelä
8a346f31b9 MDEV-17073 INSERT…ON DUPLICATE KEY UPDATE became more deadlock-prone
thd_rpl_stmt_based(): A new predicate to check if statement-based
replication is active. (This can also hold when replication is not
in use, but binlog is.)

que_thr_stop(), row_ins_duplicate_error_in_clust(),
row_ins_sec_index_entry_low(), row_ins(): On a duplicate key error,
only lock all index records when statement-based replication is in use.
2018-11-02 18:52:39 +02:00
Marko Mäkelä
cfa047069e Remove an unused declaration 2018-11-02 14:30:08 +02:00
Marko Mäkelä
abcd09c95a mtr_t::start(): Remove unused parameters
The parameters bool sync=true, bool read_only=false of mtr_t::start()
were added in
eca5b0fc17
(MySQL 5.7.3).

The parameter read_only was never used anywhere.
The parameter sync was only copied around, and would be returned
by the unused function mtr_t::is_async().

We do not need this dead code in MariaDB.
2018-11-01 10:48:56 +02:00
Marko Mäkelä
d355be8877 Remove dead code in dict_build_table_def_step()
At the start of the function, we already dereferenced node,
so the checks for NULL are unnecessary and redundant.
2018-11-01 10:40:14 +02:00
Marko Mäkelä
a5cbdd63bc Fix innodb.table_flags,debug 2018-10-31 12:09:08 +02:00
Sergei Golubchik
a6e0000494 Merge branch '10.0' into 10.1 2018-10-31 10:53:22 +01:00
Sergei Golubchik
44f6f44593 Merge branch '10.0' into 10.1 2018-10-30 15:10:01 +01:00
Marko Mäkelä
dc91ea5bb7 MDEV-12023 Assertion failure sym_node->table != NULL on startup
row_drop_table_for_mysql(): Avoid accessing non-existing dictionary tables.

dict_create_or_check_foreign_constraint_tables(): Add debug instrumentation
for creating and dropping a table before the creation of any non-core
dictionary tables.

trx_purge_add_update_undo_to_history(): Adjust a debug assertion, so that
it will not fail due to the test instrumentation.
2018-10-30 15:53:55 +02:00
Marko Mäkelä
6ced789186 MDEV-12023 Assertion failure sym_node->table != NULL on startup
row_drop_table_for_mysql(): Avoid accessing non-existing dictionary tables.

dict_create_or_check_foreign_constraint_tables(): Add debug instrumentation
for creating and dropping a table before the creation of any non-core
dictionary tables.

trx_purge_add_update_undo_to_history(): Adjust a debug assertion, so that
it will not fail due to the test instrumentation.
2018-10-30 13:29:19 +02:00
Marko Mäkelä
a6ffeeeaa9 MDEV-17491 micro optimize page_id_t #892 2018-10-29 12:05:50 +02:00
Marko Mäkelä
b3009059d0 Minor cleanup 2018-10-29 12:05:39 +02:00
Sergei Golubchik
87d852f102 Merge branch 'merge/merge-innodb-5.6' into 10.0 2018-10-28 01:22:18 +02:00
Sergei Golubchik
da34c7de5d 5.6.42 2018-10-27 21:05:16 +02:00
Sergei Golubchik
37ab7e4596 Merge branch '5.5' into 10.0 2018-10-27 20:46:38 +02:00
Eugene Kosov
14be814380 MDEV-17491 micro optimize page_id_t
page_id_t: remove m_fold member

various places: pass page_id_t by value instead of by reference
2018-10-25 18:46:27 +03:00
Marko Mäkelä
2abf2648a6 MDEV-17536 Merge new release of InnoDB 5.7.24 to 10.2
Update the InnoDB version number to 5.7.24.
2018-10-25 17:09:54 +03:00
Marko Mäkelä
31366c6c93 MDEV-17548 Incorrect access to off-page column for indexed virtual column
row_build_index_entry_low(): ext does not contain virtual columns.

row_upd_store_v_row(): Copy virtual column values

This is based on the following fix in MySQL 5.7.24:

commit 4ec2158bec73f1582501c4b3e3de250fed9edc9a
Author: Sachin Agarwal <sachin.z.agarwal@oracle.com>
Date:   Fri Aug 24 14:44:13 2018 +0530

    Bug #27968952 INNODB CRASH/CORRUPTION WITH TEXT PREFIX INDEXES

    Problem:
    There are two problems:
      1. If there is one secondary index on extenally
    stored column and another seconday index on virtual column (whose
    base column is not externally stored). then while updating seconday
    index on vitrual column, virtual column data is replaced by
    externally stoared column.
      2. In row update operation, node->row contains
    shallow copy of virtual data fields. While building an update vector
    containing all the fields to be modified, compute virtual column.
    which may causes change in virtual data fields in node->row.

    In both the above cases, while updating seconday index on virtual
    column, couldn't find the row and hit an explicite assert inside
    ROW_NOT_FOUND.

    Fix:
    1. Added check if column is virtual then its ext flag should be ZERO
    and virtual column data will not be replaced by offset column data.
    2. Deep copy of virtual data fields for node->row.

    RB: #20382
    Reviewed by : Jimmy.Yang@oracle.com
2018-10-25 17:08:36 +03:00
Marko Mäkelä
e548d92b23 MDEV-17546 SPATIAL INDEX should not be allowed for FOREIGN KEY
dict_foreign_qualify_index(): Reject both FULLTEXT and SPATIAL
indexes. Remove these checks from the callers.

It is unclear whether this bug affected MariaDB Server.
FOREIGN KEY constraints on geometry column types could have
been rejected due to column type restrictions.
2018-10-25 16:11:52 +03:00
Marko Mäkelä
7e9728a913 MDEV-17545 Predicate lock for SPATIAL INDEX should lock non-matching record
rtr_pcur_getnext_from_path(): Remove a bogus condition.
The predicate lock should be acquired also on no match,
to ensure that the locking read will be repeatable.

This is based on the following fix in MySQL 5.7.24:

commit 365111c590082984dbae42e1d1da28ac3f7fb5bd
Author: Jimmy Yang <jimmy.yang@oracle.com>
Date:   Wed Jun 6 16:23:00 2018 -0700

    Fix Bug 27577612 - CONCURRENT SERIALIZABLE TRANSACTIONS CAN INSERT INTO
    AN AREA SELECTED FOR UPDATE
    Backport fix to mysql-5.7

    Reviewed-by: Allen Lai <allen.lai@oracle.com>

No test case is added, because the MySQL 5.7 test case would pass
even when the fix is not present. We would need a test case that
only causes a locking conflict on the spatial index.
2018-10-25 15:18:09 +03:00
Marko Mäkelä
30c3d6db32 MDEV-17533 Merge new release of InnoDB 5.6.42 to 10.0
Also, add a test for a bug that does not seem to affect MariaDB.
2018-10-25 13:05:23 +03:00
Marko Mäkelä
2549f98289 MDEV-17532 Performance_schema reports wrong directory for the temporary files of ALTER TABLE…ALGORITHM=INPLACE
row_merge_file_create_low(): Pass the directory of the temporary file
to the PSI_FILE_CALL.
2018-10-25 13:04:41 +03:00
Marko Mäkelä
5dd3b52f95 MDEV-17531 Crash in RENAME TABLE with FOREIGN KEY and FULLTEXT INDEX
In RENAME TABLE, when an error occurs while renaming FOREIGN KEY
constraint, that error would be overwritten when renaming the
InnoDB internal tables related to FULLTEXT INDEX.

row_rename_table_for_mysql(): Do not attempt to rename the internal
tables if an error already occurred.

This problem was originally reported as Oracle Bug#27545888.
2018-10-25 13:03:29 +03:00
Marko Mäkelä
a21e01a53d MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check causes hang
row_ins_check_foreign_constraint(): Do not overwrite hard errors
with the soft error DB_LOCK_WAIT. This prevents an infinite
wait loop when DB_INTERRUPTED was returned. For DB_LOCK_WAIT,
row_insert_for_mysql() would keep invoking row_ins_step() and the
transaction would remain active until the server shutdown is initiated.
2018-10-25 10:35:46 +03:00
Marko Mäkelä
ab1ce2204e MDEV-17466: Remove the debug assertion
This reverts commit 2d4075e1d9
where the debug assertion was added. There seems to be a potential
problem in the purge of indexes that depend on virtual columns.

Ultimately, we should change the InnoDB undo log format so that
all actual secondary index keys are stored there, also for
virtual or spatial indexes. In that way, purge and rollback would
be more straightforward.
2018-10-19 09:31:33 +03:00
Marko Mäkelä
abbf169f52 Remove unused TIMETPF 2018-10-19 09:28:21 +03:00
Marko Mäkelä
64d26ec52a Fix the Windows build
On Windows, a mismatch between TIMETPF ("%ld") and time_t would be reported.
Use "%ld" and long, like the code used to be.
2018-10-18 12:15:07 +03:00
Marko Mäkelä
56de291978 Fix a merge error in commit 28f08d3753 2018-10-18 10:10:11 +03:00