Commit graph

20567 commits

Author SHA1 Message Date
Sergei Golubchik
6b84fdb2f3 5.6.39-83.1 2018-04-24 16:17:43 +02:00
sjaakola
2f0b8f3e02 MDEV-16005 sporadic failures with galera tests MW-328B and MW-328C
These test can sporadically show mutex deadlock warnings between LOCK_wsrep_thd
and LOCK_thd_data mutexes. This means that these mutexes can be locked in opposite
order by different threads, and thus result in deadlock situation.
To fix such issue, the locking policy of these mutexes should be revised and
enforced to be uniform. However, a quick code review shows that the number of
lock/unlock operations for these mutexes combined is between 100-200, and all these
mutex invocations should be checked/fixed.

On the other hand, it turns out that LOCK_wsrep_thd is used for protecting access to
wsrep variables of THD (wsrep_conflict_state, wsrep_query_state), whereas LOCK_thd_data
protects query, db and mysys_var variables in THD. Extending LOCK_thd_data to protect
also wsrep variables looks like a viable solution, as there should not be a use case
where separate threads need simultaneous access to wsrep variables and THD data variables.

In this commit LOCK_wsrep_thd mutex is refactored to be replaced by LOCK_thd_data.
By bluntly replacing LOCK_wsrep_thd by LOCK_thd_data, will result in double locking
of LOCK_thd_data, and some adjustements have been performed to fix such situations.
2018-04-24 16:57:39 +03:00
Marko Mäkelä
39a4985520 Remove most 'register' use in C++
Modern compilers (such as GCC 8) emit warnings that the
'register' keyword is deprecated and not valid C++17.

Let us remove most use of the 'register' keyword.
Code in 'extra/' is not touched.
2018-04-24 12:48:27 +03:00
Marko Mäkelä
2a00bdeb4a Remove unused function FixNull() 2018-04-24 12:06:28 +03:00
Marko Mäkelä
36d28f210a MDEV-15865 Crash in dict_index_set_merge_threshold() on CREATE TABLE
Apply the contributed patch from
MySQL Bug #89126 create table panic on innobase_parse_hint_from_comment
by Yan Huang.
2018-04-24 11:53:04 +03:00
Thirunarayanan Balathandayuthapani
4f9977d8d3 MDEV-14168 Unconditionally allow ALGORITHM=INPLACE for setting a column NOT NULL
- Allow NOT NULL constraint to replace the NULL value in the row with
explicit or implicit default value.

- If the default value is non-const value then inplace alter won't
support it.

- ALTER IGNORE will ignore the error if the concurrent DML contains
NULL value.
2018-04-24 13:15:35 +05:30
Marko Mäkelä
4cd7979c56 Merge 10.1 into 10.2 2018-04-24 09:39:45 +03:00
Marko Mäkelä
9c34a4124d Merge 10.0 into 10.1 2018-04-24 09:26:40 +03:00
Jacob Mathew
6ee6933a37 MDEV-15712: If remote server used by Spider table is unavailable, some operations hang for a long time
When an attempt to connect to the remote server fails, Spider retries to
connect to the remote server 1000 times or until the connection attempt
succeeds.  This is perceived as a hang if the remote server remains
unavailable.

I have introduced changes in Spider's table status handler to fix this problem.

Author:
  Jacob Mathew.

Reviewer:
  Kentoku Shiba.
2018-04-23 22:00:27 -07:00
Marko Mäkelä
c7bb337248 MDEV-15723 Crash in INFORMATION_SCHEMA.INNODB_SYS_TABLES when accessing corrupted record
dict_load_table_low(): When flagging an error, assign *table = NULL.
Failure to do so could cause a crash if an error was flagged when
accessing INFORMATION_SCHEMA.INNODB_SYS_TABLES.
2018-04-23 16:19:50 +03:00
Marko Mäkelä
de942c9f61 MDEV-15983 Reduce fil_system.mutex contention further
fil_space_t::n_pending_ops, n_pending_ios: Use a combination of
fil_system.mutex and atomic memory access for protection.

fil_space_t::release(): Replaces fil_space_release().
Does not acquire fil_system.mutex.

fil_space_t::release_for_io(): Replaces fil_space_release_for_io().
Does not acquire fil_system.mutex.
2018-04-23 13:15:54 +03:00
Marko Mäkelä
fcaf619400 Remove the "register" keyword 2018-04-23 13:04:58 +03:00
Marko Mäkelä
88b1905eda Fix -Wimplicit-fallthrough 2018-04-23 13:04:58 +03:00
Marko Mäkelä
01b2e773ef MDEV-15937 Assertion failure 'key->flags & 1' on ALTER TABLE
While the test case crashes a MariaDB 10.2 debug build only,
let us apply the fix to the earliest applicable MariaDB series (10.0)
to avoid any data corruption on a table-rebuilding ALTER TABLE
using ALGORITHM=INPLACE.

innobase_create_key_defs(): Use altered_table->s->primary_key
when a new primary key is being created.
2018-04-23 13:04:58 +03:00
Marko Mäkelä
c6ba758d1d Merge 10.2 into 10.3 2018-04-23 09:49:58 +03:00
Thirunarayanan Balathandayuthapani
211842dd86 MDEV-15374 Server hangs and aborts with long semaphore wait or assertion `len < ((ulint) srv_page_size)' fails in trx_undo_rec_copy upon ROLLBACK on temporary table
Problem:
=======
InnoDB cleans all temporary undo logs during commit. During rollback
of secondary index entry, InnoDB tries to build the previous version
of clustered index. It leads to access of freed undo page during
previous transaction commit and it leads to undo log corruption.

Solution:
=========
During rollback, temporary undo logs should not try to build
the previous version of the record.
2018-04-23 11:22:58 +05:30
Sergei Golubchik
5883c6905b 5.6.40 2018-04-21 17:37:24 +02:00
Marko Mäkelä
ea94717983 Merge 10.1 into 10.2 2018-04-21 11:58:32 +03:00
Sergei Golubchik
587568b72a Merge branch '5.5' into 10.0 2018-04-20 14:33:24 +02:00
Sergei Golubchik
86718fda4e compiler warning
bad merge
2018-04-20 09:40:29 +02:00
Sergei Golubchik
51c415d97d Merge branch 'merge/merge-xtradb-5.5' into 5.5 2018-04-20 01:04:43 +02:00
Sergei Golubchik
4fd1c7e453 5.5.59-38.11 2018-04-20 01:02:08 +02:00
Sergei Golubchik
149c993b2c BUG#27216817: INNODB: FAILING ASSERTION: PREBUILT->TABLE->N_MYSQL_HANDLES_OPENED == 1
disable online alter add primary key for innodb, if the
table is opened/locked more than once in the current connection

(see assert in ha_innobase::add_index())
2018-04-19 22:37:37 +02:00
Sergei Golubchik
1a019d0801 Merge branch 'mysql/5.5' into 5.5 2018-04-19 22:31:26 +02:00
Sergei Petrunia
39fbafbcc2 Post-merge fixes: make rocksdb.allow_to_start_after_corruption pass 2018-04-19 16:28:05 +03:00
Sergei Petrunia
955233256e MyRocks: fix rocksdb.information_schema testcase.
"The Store binlog position inside RocksDB" feature is only needed for
obtaining binlog position after having restored a MyRocks backup.

This is not yet supported in MariaDB, so properly disable it in both
places where it is done.
2018-04-19 15:41:13 +03:00
Marko Mäkelä
d71a8855ee Merge 10.2 to 10.3
Temporarily disable main.cte_recursive due to hang in
an added test related to MDEV-15575.
2018-04-19 15:23:21 +03:00
Sergei Petrunia
0c02c91bc1 MyRocks: MDEV-15911: Reduce debug logging on default levels in error log
MyRocks internally will print non-critical messages to
sql_print_verbose_info() which will do what InnoDB does in similar cases:
check if (global_system_variables.log_warnings > 2).
2018-04-19 14:13:28 +03:00
Sachin Setiya
efae12680e MDEV-15611 Due to the failure of foreign key detection, Galera...
slave node killed himself.

Problem:- If we try to delete table with foreign key and table whom it is
referring with wsrep_slave_threads>1 then galera tries to execute both
Delete_rows_log-event in parallel, which should not happen.

Solution:- This is happening because we do not have foreign key info in
write set. Upto version 10.2.7 it used to work fine. Actually it happening
because of issue in commit 2f342c4. wsrep_must_process_fk has changed to
make it similar to original condition.
2018-04-19 16:33:49 +05:30
Thirunarayanan Balathandayuthapani
fa68b88b5d MDEV-15828 Server crash or assertion `num_fts_index <= 1' failure up on ALTER TABLE adding two fulltext indexes
- Inplace alter shouldn't support if the number of newly added fts index
exceeds 1 even though the table undergoes rebuild. It is a regression of
MDEV-14016
2018-04-18 13:39:03 +05:30
Thirunarayanan Balathandayuthapani
341edddc3d MDEV-15826 Purge attempts to free BLOB page after BEGIN;INSERT;UPDATE;ROLLBACK
- During rollback, redo segments priorities over no-redo rollback
segments and it leads to failure of redo rollback segment undo
logs truncation.
2018-04-18 12:39:39 +05:30
Sergei Petrunia
6bea5e9e0f MyRocks: Post-merge fixes in bulk_load_error.test 2018-04-17 15:04:15 +03:00
Sergei Petrunia
a7e5049fec MyRocks: Fix link error on Windows
rocksdb_aux_lib.lib(rdb_sst_info.obj) : error LNK2001: unresolved
external symbol PSI_server
[D:\winx64-packages\build\storage\rocksdb\rocksdb.vcxproj]

rocksdb_aux_lib is an utility library used by standalone tools. These
won't have PSI_server.

FIxed by moving rdb_sst_info.* out of the library (as they do not seem
to be used by these standalone tools)
2018-04-17 11:10:11 +03:00
Vladislav Vaintroub
321771f89f MDEV-15895 : make Innodb merge temp tables use pfs_os_file_t for
file IO, rather than int.

On Windows, it is suboptimal to depend on C runtime, as it has limited
number of file descriptors. This change eliminates
os_file_read_no_error_handling_int_fd(), os_file_write_int_fd(),
OS_FILE_FROM_FD() macro.
2018-04-17 09:07:38 +01:00
Michael Widenius
ddc5764303 Remove compiler warnings
- Remove unused variables
- Mark variables unused
- Fix wrong types
- Add no-strict-aliasing to BUILD scripts
2018-04-16 20:16:43 +03:00
Igor Babaev
224f7af911 MDEV-15575 different results when using CTE and big_tables=1.
This bug happened due to a defect of the implementation of the handler
function ha_delete_all_rows() for the ARIA engine.
The function maria_delete_all_rows() truncated the table, but it didn't
touch the write cache, so the cache's write offset was not reset.
In the scenario like in the function st_select_lex_unit::exec_recursive
when first all records were deleted from the table and then several new
records were added some metadata became inconsistent with the state of
the cache. As a result the table scan function could not read records
at the end of the table.
The same defect could be found in the implementation of ha_delete_all_rows()
for the MYISAM engine mi_delete_all_rows().

Additionally made late instantiation for the temporary table used to store
rows that were used for each new iteration when executing a recursive CTE.
2018-04-16 07:22:26 -07:00
Sergei Golubchik
87af52d7dd MDEV-15866 Mysql CRASH : Json connect + MariaDB 10.3.4
revert incorrect change
2018-04-16 14:45:47 +02:00
Jan Lindström
3d1ad2a5e8 MDEV-13516: encryption.create_or_replace test fails in buildbot with InnoDB assertion failure
fil_crypt_rotate_pages
	If tablespace is marked as stopping stop also page rotation

fil_crypt_flush_space
	If tablespace is marked as stopping do not try to read
	page 0 and write it back.
2018-04-16 15:06:41 +03:00
Sergei Petrunia
40bed2d39e MyRocks: Add files lost during the merge
Include files that upstream has in mysql-test/include and so they were
not picked up by the merge process
2018-04-16 11:06:43 +03:00
Sergei Petrunia
ce4149fc9b Post-merge fixes: make rocksdb.use_direct_reads_writes pass 2018-04-15 21:15:21 +03:00
Marko Mäkelä
f0e4f94c23 MDEV-15871 Crash in btr_search_build_page_hash_index()
When skipping the MDEV-11369 'default row' record, check again
for an empty page.
2018-04-15 18:23:19 +03:00
Sergei Petrunia
0fad97a9ec Post-merge fixes: add a suppression for rocksdb.skip_validate_tmP_table 2018-04-15 15:34:06 +03:00
Marko Mäkelä
97e51d24cb MDEV-13697 DB_TRX_ID is not always reset
The rollback of the modification of a pre-existing record
should involve a purge-like operation. Before MDEV-12288
the only purge-like operation was the removal of a
delete-marked record.

After MDEV-12288, any rollback of updating an existing record
must reset the DB_TRX_ID column when it is no longer visible
in the purge read view.

row_vers_must_preserve_del_marked(): Remove. It is cleaner to
perform the check directly in row0umod.cc.

row_trx_id_offset(): Auxiliary function to retrieve the byte
offset of DB_TRX_ID in a clustered index leaf page record.

row_undo_mod_must_purge(): Determine if a record should be purged.

row_undo_mod_clust(): For temporary tables, skip the purge checks.
When rolling back an update so that the original record was not
delete-marked, reset DB_TRX_ID if the history is no longer visible.
2018-04-15 14:51:26 +03:00
Sergei Petrunia
261d4755f4 Post-merge fixes: rocksdb.check_ignore_unknown_options 2018-04-15 14:34:56 +03:00
Sergei Petrunia
8496e84f05 Trivial post-merge fixes 2018-04-15 12:52:27 +03:00
Vladislav Vaintroub
47ea2227e5 fix typo, amend last commit 2018-04-14 23:59:59 +01:00
Vladislav Vaintroub
043a9b4e1b Windows, innodb : reduce noise from os_file_get_block_size()
if volume can't be opened due to permissions, or
IOCTL_STORAGE_QUERY_PROPERTY fails with not implemented, do not report it.
Those errors happen, there is nothing user can do.

This patch amends fix for MDEV-12948.
2018-04-14 23:53:11 +01:00
Sergei Petrunia
78e42153b5 Fix compile on windows: O_SYNC is not available, use a my_sync() call instead. 2018-04-13 20:26:40 +03:00
Jan Lindström
71ceed7523 MDEV-12632: Source and destination overlap in memcpy, encryption.innodb-discard-import-change fails in buildbot with valgrind
Use block->page.offset for checking page number.
2018-04-13 09:45:29 +03:00
Jan Lindström
f638c37abe MDEV-12632: Source and destination overlap in memcpy, encryption.innodb-discard-import-change fails in buildbot with valgrind
Use block->page.offset for checking page number.
2018-04-13 09:44:28 +03:00