Commit graph

180383 commits

Author SHA1 Message Date
Marko Mäkelä
3945049809 Remove space_name_list_t
fil_get_space_names(): Remove.

fts_drop_orphaned_tables(): Iterate fil_system->space_list directly.
2017-12-08 16:00:25 +02:00
Marko Mäkelä
094b0f869b Merge 10.2 into bb-10.2-ext 2017-12-08 16:00:10 +02:00
Sergey Vojtovich
c60095a818 Faster atomic loads and stores on windows 2017-12-08 17:55:41 +04:00
Sergey Vojtovich
b04f2a0f01 MDEV-14529 - InnoDB rw-locks: optimize memory barriers
Relax memory barrier for lock_word.

rw_lock_lock_word_decr() - used to acquire rw-lock, thus we only need to issue
ACQUIRE when we succeed locking.

rw_lock_x_lock_func_nowait() - same as above, but used to attempt to acquire
X-lock.

rw_lock_s_unlock_func() - used to release S-lock, RELEASE is what we need here.

rw_lock_x_unlock_func() - used to release X-lock. Ideally we'd need only RELEASE
here, but due to mess with waiters (they must be loaded after lock_word is
stored) we have to issue both ACQUIRE and RELEASE.

rw_lock_sx_unlock_func() - same as above, but used to release SX-lock.

rw_lock_s_lock_spin(), rw_lock_x_lock_func(), rw_lock_sx_lock_func() -
fetch-and-store to waiters has to issue only ACQUIRE memory barrier, so that
waiters are stored before lock_word is loaded.

Note that there is violation of RELEASE-ACQUIRE protocol here, because we do
on lock:

  my_atomic_fas32_explicit((int32*) &lock->waiters, 1, MY_MEMORY_ORDER_ACQUIRE);
  my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED);

on unlock

  my_atomic_add32_explicit(&lock->lock_word, X_LOCK_DECR, MY_MEMORY_ORDER_ACQ_REL);
  my_atomic_load32_explicit((int32*) &lock->waiters, MY_MEMORY_ORDER_RELAXED);

That is we kind of synchronize ACQUIRE on lock_word with ACQUIRE on waiters.
It was there before this patch. Simple fix may have negative performance impact.
Proper fix requires refactoring of lock_word.
2017-12-08 17:55:41 +04:00
Sergey Vojtovich
51bb18f989 MDEV-14529 - InnoDB rw-locks: optimize memory barriers
Relax memory barrier for waiters: these 2 stores must be completed before
os_event_set() finishes. This is guaranteed by RELEASE barrier issued by
mutex.exit() of os_event_set().
2017-12-08 17:55:41 +04:00
Sergey Vojtovich
5b624f00fc MDEV-14529 - InnoDB rw-locks: optimize memory barriers
Remove volatile modifier from waiters: it's not supposed for inter-thread
communication, use appropriate atomic operations instead.

Changed waiters to int32_t, my_atomic friendly type.
2017-12-08 17:55:41 +04:00
Sergey Vojtovich
57d20f1132 MDEV-14529 - InnoDB rw-locks: optimize memory barriers
Remove volatile modifier from lock_word: it's not supposed for inter-thread
communication, use appropriate atomic operations instead.
2017-12-08 17:55:41 +04:00
Sergey Vojtovich
c73e77da0f MDEV-14529 - InnoDB rw-locks: optimize memory barriers
Change lock_word from lint to int32_t: the latter is my_atomic_* friendly type.
2017-12-08 17:55:41 +04:00
Aleksey Midenkov
37adb4c066 SQL: vers_update_user_fields() mem_root fix [#365 bug 12]
Related to #365 bug 3.
2017-12-08 16:26:18 +03:00
Aleksey Midenkov
ad51d77f79 SQL: WHERE top level item [#365 bug 11]
Tests affected (forced mode):

main.range main.range_mrr_icp
2017-12-08 16:26:18 +03:00
Eugene Kosov
8c9c302016 SQL: fix implicit sys fields for implicit engine of partitioned table [#366] 2017-12-08 16:26:18 +03:00
Eugene Kosov
03b54a6b8a SQL: table with duplicate ROW START/END columns [fixes #369] 2017-12-08 16:26:17 +03:00
Aleksey Midenkov
84b718ae70 SQL: derived SYSTEM_TIME clash detection [closes #371] 2017-12-08 16:26:17 +03:00
Sergei Golubchik
d04063c5b9 SQL: revert unnecessary change
Related to VIEW fix #4 (8e12edbcc74685175d20729958c5f6a5d09e4f9c)
2017-12-08 16:26:17 +03:00
Sergei Golubchik
b3fe45bcd4 rephrase error messages, fix quoting 2017-12-08 16:26:17 +03:00
Sergei Golubchik
903be4e6be remove my_error_as and one unnecessary error message 2017-12-08 16:26:16 +03:00
Sergei Golubchik
f4270fc544 s/Delete_versioning_rows_priv/Truncate_versioning_priv/
because the statement is TRUNCATE, not DELETE
2017-12-08 16:26:16 +03:00
Sergei Golubchik
ea1ccfa500 SQL: regression fix: make NOW a valid identifier again [#363]
* again, as in 10.2, NOW is a keyword only if followed by parentheses
* use AS OF CURRENT_TIMESTAMP or AS OF NOW()
* AS OF CURRENT_TIMESTAMP and AS OF NOW() mean AS OF NOW(6),
  not AS OF NOW(0), (same behavior as in a DEFAULT clause)
2017-12-08 16:24:56 +03:00
Vladislav Vaintroub
bf96310657 Fix warnings 2017-12-08 13:10:41 +00:00
Monty
38908aaf81 Fix failing mtr tests
- Changed rocksdb.2pcgroup_commit.test to print information on error
- Updated myisam_views-big.result
2017-12-08 13:46:23 +02:00
Monty
c2118a08b1 Move all kill mutex protection to LOCK_thd_kill
LOCK_thd_data was used to protect both THD data and
ensure that the THD is not deleted while it was in use

This patch moves the THD delete protection to LOCK_thd_kill,
which already protects the THD for kill.

The benefits are:
- More well defined what LOCK_thd_data protects
- LOCK_thd_data usage is now much simpler and easier to verify
- Less chance of deadlocks in SHOW PROCESS LIST as there is less
  chance of interactions between mutexes
- Remove not needed LOCK_thread_count from
  thd_get_error_context_description()
- Fewer mutex taken for thd->awake()

Other things:
- Don't take mysys->var mutex in show processlist to check if thread
  is kill marked
- thd->awake() now automatically takes the LOCK_thd_kill mutex
  (Simplifies code)
- Apc uses LOCK_thd_kill instead of LOCK_thd_data
2017-12-08 13:46:23 +02:00
Monty
3574f9c7bc Updated MW-388.result file 2017-12-08 13:46:23 +02:00
Monty
7891a713da Don't wait too long in SHOW PROCESSLIST
This will allow show processlist to continue, without blocking
all new connections, if some threads gets stuck while holding
LOCK_thd_data or mysys_var->mutex

Connections that has mutex 'stuck' are marked as 'Busy' in 'Command'

Todo:
Make F_BACKOFF to do 'pause' instead of just (1)
2017-12-08 13:44:46 +02:00
Sergey Vojtovich
b3346c2f41 Restore LF_BACKOFF
Moved InnoDB UT_RELAX_CPU() to server. Restored cross-platform LF_BACKOFF
implementation basing on UT_RELAX_CPU().
2017-12-08 13:44:45 +02:00
Jan Lindström
2662228d18 Fix test failures. 2017-12-08 13:34:20 +02:00
Monty
db715ff392 Add extra mutex check to wsrep_aborting_thd_enqueue 2017-12-08 11:38:22 +02:00
Monty
68cd543539 Search for galera libraries also in /usr/lib64/galera-3
This is where Codership's offical rpm's puts them
2017-12-08 11:38:22 +02:00
Monty
c4581735d0 Cleanups
- Remove not used thd_rpl_is_parallel()
- Remove not used mysql_notify_thread_having_shared_lock()
- Remove not needed LOCK_thread_count from MYSQL_BIN_LOG::reset_logs()
  - LOCK_thread_count is not protecting against rollback, so this
    code and comment is not needed
- Remove mutex_locks in slave.cc that are not needed.
  Added THD::assert_not_linked() to ensure that it was safe to remove
- Fixed not repeatable test load_data_stmt_view
- Updated binlog_killed to test removal of mutex
  (thanks to Andrei Elkin for test)
- More code comments
2017-12-08 11:38:22 +02:00
Alexander Barkov
0e5eef886a MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results 2017-12-08 13:19:19 +04:00
Marko Mäkelä
07e9ff1fe1 MDEV-14378 In ALGORITHM=INPLACE, use a common name for the intermediate tables or partitions
Allow DROP TABLE `#mysql50##sql-...._.` to drop tables that were
being rebuilt by ALGORITHM=INPLACE

NOTE: If the server is killed after the table-rebuilding ALGORITHM=INPLACE
commits inside InnoDB but before the .frm file has been replaced, then
the recovery will involve something else than DROP TABLE.

NOTE: If the server is killed in a true inplace ALTER TABLE commits
inside InnoDB but before the .frm file has been replaced, then we
are really out of luck. To properly handle that situation, we would
need a transactional mysql.ddl_fixup table that directs recovery to
rename or remove files.

prepare_inplace_alter_table_dict(): Use the altered_table->s->table_name
for generating the new_table_name.

table_name_t::part_suffix: The start of the partition name suffix.

table_name_t::dbend(): Return the end of the schema name.

table_name_t::dblen(): Return the length of the schema name, in bytes.

table_name_t::basename(): Return the name without the schema name.

table_name_t::part(): Return the partition name, or NULL if none.

row_drop_table_for_mysql(): Assert for #sql, not #sql-ib.
2017-12-08 10:07:51 +02:00
Marko Mäkelä
0a02c1a667 Merge 10.2 into bb-10.2-ext 2017-12-08 10:02:28 +02:00
Marko Mäkelä
dfafe15abb MDEV-14606 Assertion failure on IMPORT TABLESPACE
fseg_alloc_free_page_low(): Remove a bogus and redundant assertion about
fil_space_t::purpose. The debug function fsp_space_modify_check()
is asserting something similar, but more accurately.
2017-12-08 09:53:11 +02:00
Varun Gupta
6d63a03490 MDEV-11297: Add support for LIMIT clause in GROUP_CONCAT() 2017-12-08 12:21:26 +05:30
Alexander Barkov
a61fbf87ed Adding the -Wnon-virtual-dtor GCC/CLang flag in maintainer mode 2017-12-08 09:44:53 +04:00
Sergei Petrunia
578b26598a MDEV-14607: storage_engine-rocksdb.type_bit_indexes fails after latest pushes
Update the .result file. Old EXPLAIN output was incorrect due to
hitting MDEV-14563.
2017-12-08 01:17:01 +03:00
Monty
1374f958c1 Fixed failing tokudb tests
This was caused by my earlier fix for rpl.rpl_row_log_innodb :(
2017-12-07 17:22:24 +02:00
Marko Mäkelä
3aa618a969 MDEV-13820 trx_id_check() fails during row_log_table_apply()
When logging ROW_T_INSERT or ROW_T_UPDATE records, we did not normalize
the DB_TRX_ID of the current transaction into 0 if the current transaction
had started (modifying other tables) before the ALTER TABLE started.

MDEV-13654 introduced this normalization for ROW_T_DELETE
and for all operations with ADD PRIMARY KEY, in row_log_table_get_pk().
2017-12-07 14:35:32 +02:00
Alexander Barkov
08dae44711 MDEV-14228 MariaDB crashes with function 2017-12-07 15:54:27 +04:00
Jan Lindström
4d016e6ed2 Add Galera test cases that fail to disabled. 2017-12-07 13:08:41 +02:00
Jan Lindström
ba576c5b78 MDEV-14401: Stored procedure that declares a handler that catches ER_LOCK_DEADLOCK error causes thd->is_error() assertion
This was missing bug fix from MySQL wsrep i.e. Galera.
Problem was that if stored procedure declares a handler that
catches deadlock error, then the error may have been
cleared in method sp_rcontext::handle_sql_condition().
Use wsrep_conflict_state correctly to determine is the
error already sent to client.

Add test case for both this bug and MDEV-12837: WSREP: BF
lock wait long. Test requires both fixes to pass.
2017-12-07 13:08:41 +02:00
Jan Lindström
da3a3a68df MDEV-12837: WSREP: BF lock wait long
Problem was a merge error from MySQL wsrep i.e. Galera.

wsrep_on_check
	New check function. Galera can't be enabled
	if innodb-lock-schedule-algorithm=VATS.

innobase_kill_query
	In Galera async kill we could own lock mutex.

innobase_init
	If Variance-Aware-Transaction-Sheduling Algorithm (VATS) is
	used on Galera we fall back to First-Come-First-Served (FCFS)
	with notice to user.

Changed innodb-lock-schedule-algorithm as read-only parameter
as it was designed to be.

lock_reset_lock_and_trx_wait
	Use ib::hex() to print out transaction ID.

lock_rec_other_has_expl_req,
lock_rec_other_has_conflicting,
RecLock::add_to_waitq
lock_rec_lock_slow
lock_table_other_has_incompatible
lock_rec_insert_check_and_lock
lock_prdt_other_has_conflicting

	Change pointer to conflicting lock to normal pointer as this
	pointer contents could be changed later.

RecLock::create
	Conclicting lock pointer is moved to last parameter with
	default value NULL. This conflicting transaction could
	be selected as victim in Galera if requesting transaction
	is BF (brute force) transaction. In this case contents
	of conflicting lock pointer will be changed. Use ib::hex() to print
	transaction ids.
2017-12-07 13:08:41 +02:00
Monty
6d4b0958dc Fix failing test mysql_client_test
Backported patch from 10.3 that allows one to remove short .frm files
2017-12-07 11:41:52 +02:00
Monty
3eaca005ff Ensure that mysqladmin also works with MariaDB 10.3 + more
Increase the number of status variabels that can be handled
2017-12-07 10:32:23 +02:00
Marko Mäkelä
4ea5b126c5 Merge bb-10.2-ext into 10.3 2017-12-07 08:21:00 +02:00
Marko Mäkelä
bce4065129 Merge 10.2 into bb-10.2-ext 2017-12-07 08:18:43 +02:00
Marko Mäkelä
51c73a431f Merge 10.1 into 10.2 2017-12-07 08:17:50 +02:00
Marko Mäkelä
447931c6ab Post-fix for MDEV-14587
dict_stats_process_entry_from_defrag_pool(): Release the mutex
2017-12-07 08:14:49 +02:00
Marko Mäkelä
976f6fb1b6 Merge bb-10.2-ext into 10.3 2017-12-06 19:36:33 +02:00
Marko Mäkelä
ce07676502 Merge 10.2 into bb-10.2-ext 2017-12-06 19:34:03 +02:00
Marko Mäkelä
77fb7ccba4 Follow-up fix to MDEV-13201 Assertion srv_undo_sources || ... failed on shutdown during DDL operation
Introduce the debug flag trx_t::persistent_stats to suppress the
assertion for the updates of persistent statistics during fast
shutdown.

dict_stats_exec_sql(): Do execute the statement even though shutdown
has been initiated.
2017-12-06 18:52:28 +02:00