Commit graph

179732 commits

Author SHA1 Message Date
Marko Mäkelä
15051ab14a Disable a failing test 2018-03-21 08:13:43 +02:00
Marko Mäkelä
613be24b7a Merge 10.0 into 10.1 2018-03-20 19:25:08 +02:00
Marko Mäkelä
0492100059 Merge 5.5 into 10.0 2018-03-20 18:36:03 +02:00
Marko Mäkelä
69bc3c1976 PR #666: MDEV-15030 Add ASAN instrumentation
mem_heap_create_block(): Poison the payload area until
mem_heap_alloc() unpoisons it.
2018-03-20 18:18:57 +02:00
Marko Mäkelä
e0a0fe7d81 MDEV-12396 IMPORT TABLESPACE: Do not retry partial reads
fil_iterate(), fil_tablespace_iterate(): Replace os_file_read()
with os_file_read_no_error_handling().

os_file_read_func(), os_file_read_no_error_handling_func():
Do not retry partial reads. There used to be an infinite amount
of retries. Because InnoDB extends both data and log files upfront,
partial reads should be impossible during normal operation.
2018-03-20 15:31:39 +02:00
Marko Mäkelä
a80af35a85 MDEV-12396 IMPORT cleanup: ROW_FORMAT=COMPRESSED
Initialize block.page.zip only once.

PageConverter::update(): Initialize m_page_zip_ptr
as late as possible.
(We should really remove it at some point.)

PageConverter::operator(): Refer to block->page.zip instead of
m_page_zip_ptr.

AbstractCallback::get_frame(): Define static. Refer
to block->page.zip.data directly.

fil_iterate(): Refer to block->page.zip.data directly.

fil_tablespace_iterate(): Initialize block.page.zip.data as soon
as possible.
2018-03-20 15:31:39 +02:00
Marko Mäkelä
eaa7bfb59f MDEV-12396 IMPORT TABLESPACE: Simplify validation
fil_iterate(): Validate the pages directly.

import_page_status_t, PageConverter::validate(): Remove.

AbstractCallback::filename(): New accessor.

AbstractCallback::is_interrupted(): Replaces periodic_check().

PageConverter::trigger_corruption(): Remove.
2018-03-20 15:31:39 +02:00
Marko Mäkelä
6247c64c2a MDEV-12396 IMPORT TABLESPACE cleanup
Reduce unnecessary inter-module calls for IMPORT TABLESPACE.
Move some IMPORT-related code from fil0fil.cc to row0import.cc.

PageCallback: Remove. Make AbstractCallback the base class.

PageConverter: Define some member functions inline.
2018-03-20 15:31:39 +02:00
Thirunarayanan Balathandayuthapani
eee73ddfbb MDEV-12255 innodb_prefix_index_cluster_optimization hits debug build
assert on UTF-8 columns

Problem:
=======
(1) Multi-byte character cases are not considered during prefix index
cluster optimization check. It leads to fetch of improper results during
read operation.
(2) Strict assert in row_sel_field_store_in_mysql_format_func and it asserts
for prefix index record to mysql conversion.

Solution:
========
(1) Consider the case of multi-byte character during prefix index
cluster optimization check.
(2) Relax the assert in row_sel_field_store_in_mysql_format_func to allow
prefix index record to mysql format conversion.

The patch is taken from
1eee538087
2018-03-20 17:53:33 +05:30
Jan Lindström
bc2e7d7889 Fix test case MW-329. 2018-03-20 12:10:41 +02:00
Philip Stoev
33028f7c4b Refs: MW-245 - Adjust tests to account for the new behavior. 2018-03-20 12:10:41 +02:00
sjaakola
9a89614857 Refs: MW-245 - changed logic so that in non primary node it is possible to do SET + SHOW + SELECT from information and pfs schema, when dirty reads are not enabled - however, non table selects are not allowed (e.g. SELECT 1) 2018-03-20 12:10:41 +02:00
sjaakola
c5dd2abf4c Refs MW-245 - logic was wrong in detecting if queries are allowed in non primary node. it allowed select with no table list to execute even if dirty reads was not specified 2018-03-20 12:10:41 +02:00
Philip Stoev
84d4ab5be1 refs MW-245: Galera MTR Tests: additional tests for wsrep_reject_queries, wsrep_dirty_reads 2018-03-20 12:10:41 +02:00
sjaakola
8f717ed360 refs MW-245 - allowing USE <database> with dirty reads configuration - fix for logic of setting wsrep ready status 2018-03-20 12:10:41 +02:00
sjaakola
2a729b5f4b refs MW-245 - merged wsrep_dirty_reads and wsrep_reject_queries from PXC 2018-03-20 12:10:41 +02:00
Eugene Kosov
5a8f8f89d6 honor alignment rules and xtradb too 2018-03-20 10:46:57 +03:00
Varun Gupta
e390f7b675 MDEV-12737: tokudb_mariadb.mdev6657 fails in buildbot with different plan, and outside with valgrind warnings
Fixing the test by adding replace column for the rows column in the explain.
2018-03-20 11:05:28 +05:30
Jacob Mathew
7cf2428db3 MDEV-10991: Server crashes in spider_udf_direct_sql_create_conn - tests in spider/oracle* suites crash the server
The crash occurs due to code that is #ifdef'd out with HAVE_ORACLE_OCI that
pertains to the use of Spider with an Oracle data tier. Enabling this code
eliminates the crash.

The reason that MariaDB needs to support Oracle storage at the data tier is
to help customers migrate from Oracle. It is necessary to build Spider with
the additional build flag -DHAVE_ORACLE_OCI, and install and start Oracle
before running the Oracle test suite or any tests within it. Nevertheless,
if Spider is built normally and Oracle has not been started, these tests
should not cause the MariaDB server to crash. The bug fix replaces the
crash with the following error:
  ERROR 12501 (HY000) at line 4: The connect info 'ORACLE' is invalid

Author:
  Jacob Mathew.

Reviewer:
  Kentoku Shiba.
2018-03-19 12:49:22 -07:00
Vicențiu Ciorbaru
24b353162f Merge branch '10.0-galera' into 10.1 2018-03-19 15:21:01 +02:00
Eugene Kosov
75c76dbb06 MDEV-15030 Add ASAN instrumentation
Learn both valgrind and asan to catch this bug:

  mem_heap_t* heap = mem_heap_create(1024);
  byte* p = reinterpret_cast<byte*>(heap) + sizeof(mem_heap_t);
  *p = 123;

Overflows of the last allocation in a block will be catched too.

mem_heap_create_block(): poison newly allocated memory
2018-03-19 16:18:53 +03:00
Alexander Barkov
f538a64817 MDEV-15005 ASAN: stack-buffer-overflow in my_strnncollsp_simple
cmp_item_sort_string::store_value() did not cache the string returned
from item->val_str(), whose result can point to various private members
such as Item_char_typecast::tmp_value.

- cmp_item_sort_string::store_value() remembered the pointer returned
  from item->val_str() poiting to tmp_value into cmp_item_string::value_res.
- Later, cmp_item_real::store_value() was called, which called
  Item_str_func::val_real(), which called Item_char_typecast::val_str(&tmp)
  using a local stack variable "String tmp". Item_char_typecast::tmp_value
  was overwritten and become a link to "tmp":
  tmp_value.Ptr freed its own buffer and set to point to the buffer
  owned by "tmp".
- On return from Item_str_func::val_real(), "String tmp" was destructed,
  but "tmp_value" still pointed to the buffer owned by "tmp",
  So tmp_value.Ptr became invalid.
- Then cmp_item_sort_string() passed cmp_item_string::value_res to sortcmp().
  At this point, value_res still pointed to an invalid value of
  Item_char_typecast::tmp_value.

Fix:
changing cmp_item_sort_string::store_value() to force copying
to cmp_item_string::value if item->val_str(&value) returned
a different pointer (instead of &value).
2018-03-19 13:07:41 +04:00
Jan Lindström
31e2ab513d MDEV-13549: Galera test failures
Fix test failure on galera_flush_local.
2018-03-19 10:01:40 +02:00
Jan Lindström
f46155a31b MDEV-13549: Galera test failures
Fix test failure on galera_concurrent_ctas
2018-03-19 09:09:02 +02:00
Jan Lindström
e5e83249c1 MDEV-14875: galera_new_cluster crashes mysqld when existing server contains databases
Fortify wsrep_hton so that wsrep calls are not done to NULL-pointers.
2018-03-19 08:48:14 +02:00
Vicențiu Ciorbaru
34b03da211 Update Connector/C 2018-03-18 15:11:48 +02:00
Vicențiu Ciorbaru
a0f9cbc931 Merge remote-tracking branch 'connect/10.2' into 10.2 2018-03-18 15:05:27 +02:00
Varun Gupta
e3dd9a95e5 MDEV-6736: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SQ in WHERE and
HAVING, ORDER BY, materialization+semijoin

During cleanup a pointer to the materialised table that was freed was not set to NULL
2018-03-17 10:51:19 +05:30
Thirunarayanan Balathandayuthapani
6d1d5c3aeb MDEV-14545 Backup fails due to MLOG_INDEX_LOAD record
- Fixed the asan failure of the unsupported_redo test case
2018-03-16 20:55:55 +05:30
Marko Mäkelä
27c54b77c1 Make some locking primitives inline
lock_rec_trx_wait(): Merge to the only caller lock_prdt_rec_move().

lock_rec_reset_nth_bit(), lock_set_lock_and_trx_wait(),
lock_reset_lock_and_trx_wait(): Define in lock0priv.h.
2018-03-16 15:50:05 +02:00
Marko Mäkelä
d2a15092c1 lock_table_create(), lock_rec_create(): Clean up the WSREP code
By definition, c_lock->trx->lock.wait_lock==c_lock cannot hold.
That is, the owner transaction of a lock cannot be waiting for that
particular lock. It must have been waiting for some other lock.
Remove the dead code related to that. Also, test c_lock for NULLness
only once.
2018-03-16 15:50:05 +02:00
Marko Mäkelä
61e192fa40 lock_reset_lock_and_trx_wait(): Remove diagnostics 2018-03-16 15:50:05 +02:00
Marko Mäkelä
27d4333cb9 MDEV-13935 INSERT stuck at state Unlocking tables
Refactor lock_grant(). With innodb_lock_schedule_algorithm=VATS
some callers were passing an incorrect parameter owns_trx_mutex
to lock_grant().

lock_grant_after_reset(): Refactored from lock_grant(), without
the call to lock_reset_lock_and_trx_wait().

lock_grant_have_trx_mutex(): A variant of lock_grant() where the
caller already holds the lock->trx->mutex. The normal lock_grant()
will acquire and release lock->trx->mutex.

lock_grant(): Define as a wrapper that will acquire lock->trx->mutex.
2018-03-16 15:50:04 +02:00
Marko Mäkelä
f93a219c72 MDEV-13935 INSERT stuck at state Unlocking tables
lock_rec_queue_validate(): Restore some assertions.

DeadlockChecker::select_victim(): Reduce the WSREP-related diff.
2018-03-16 15:50:04 +02:00
Marko Mäkelä
cac373f533 Add missing #ifdef WITH_WSREP
lock_table_create(): Move the WSREP parameter c_lock last,
and make it NULL by default, to avoid the need for a wrapper
function.

lock_table_enqueue_waiting(): Move the WSREP parameter c_lock last.
2018-03-16 15:50:04 +02:00
Marko Mäkelä
788b3ee86d Reduce the diff from 5.7 in DeadlockChecker::search()
This is a non-functional change.
2018-03-16 15:50:04 +02:00
Marko Mäkelä
bd7ed1b923 MDEV-13935 INSERT stuck at state Unlocking tables
Revert the dead code for MySQL 5.7 multi-master replication (GCS),
also known as
WL#6835: InnoDB: GCS Replication: Deterministic Deadlock Handling
(High Prio Transactions in InnoDB).

Also, make innodb_lock_schedule_algorithm=vats skip SPATIAL INDEX,
because the code does not seem to be compatible with them.

Add FIXME comments to some SPATIAL INDEX locking code. It looks
like Galera write-set replication might not work with SPATIAL INDEX.
2018-03-16 15:50:04 +02:00
Marko Mäkelä
e15e879fae Remove the unreachable error DB_QUE_THR_SUSPENDED 2018-03-16 15:50:03 +02:00
Marko Mäkelä
84129fb1b5 After-merge fix for commit 98eb9518db
The merge only covered 10.1 up to
commit 4d248974e0.

Actually merge the changes up to
commit 0a534348c7.

Also, remove the unused InnoDB field trx_t::abort_type.
2018-03-16 15:49:53 +02:00
Varun Gupta
a0c722d853 MDEV-15321:different results when using value of optimizer_use_condition_selectivity=4 and =1
To disallow equality propagation for DATETIME with non-zero YYYYMMDD part we were setting null_value to true.
This caused issues when we were calculating selectivity for a condition as this returned IMPOSSIBLE WHERE.

The issue is resolved by not setting null_value to true for DATETIME with non-zero YYYYMMDD.
2018-03-16 18:35:41 +05:30
Vicențiu Ciorbaru
98eb9518db Merge remote-tracking branch 'origin/10.1' into 10.2 2018-03-16 14:12:00 +02:00
Sergey Vojtovich
0a534348c7 MDEV-14265 - RPMLint warning: shared-lib-calls-exit
Eliminated last exit() call from libmysqld.
2018-03-16 13:26:52 +04:00
Thirunarayanan Balathandayuthapani
b0c43d0c38 MDEV-15384 buf_flush_LRU_list_batch() always reports n->flushed=0, n->evicted=0
MDEV-14545 Backup fails due to MLOG_INDEX_LOAD record

- Changed the unsupported_redo test case to avoid checkpoint
- Inserting more rows in purge_secondary test case to display evict monitor.
2018-03-16 12:30:36 +05:30
Marko Mäkelä
7033af9e81 Conditionally define TRX_WSREP_ABORT 2018-03-16 08:38:48 +02:00
Marko Mäkelä
ca40330d1d Fix a deadlock in thd_report_wait_for()
Unlike commit a54abf0175 claimed,
the caller of THD::awake() may actually hold the InnoDB lock_sys->mutex.
That commit introduced a deadlock of threads in the replication slave
when running the test rpl.rpl_parallel_optimistic_nobinlog.

lock_trx_handle_wait(): Expect the callers to acquire and release
lock_sys->mutex and trx->mutex.

innobase_kill_query(): Restore the logic for conditionally acquiring
and releasing the mutexes. THD::awake() can be called from inside
InnoDB while holding one or both mutexes, via thd_report_wait_for() and
via wsrep_innobase_kill_one_trx().
2018-03-16 08:23:56 +02:00
Galina Shalygina
d251cedd8d MDEV-15478: Lost name of a explicitly named CTE column used in
the non-recursive CTE defined with UNION

The problem appears as the columns of the non-recursive CTE weren't renamed.
The renaming procedure was called for recursive CTEs only.

To fix it in the procedure st_select_lex_unit::prepare
With_element::rename_columns_of_derived_unit is called now for both CTEs:
recursive and non-recursive.
2018-03-16 00:35:52 +02:00
Marko Mäkelä
dbb3960ad8 Follow-up to MDEV-11236/MDEV-14846 debug assertion
ha_innobase::unlock_row(): Use a relaxed version of the
trx_state_eq() debug assertion, because rr_unlock_row()
may be invoked after an error has been already reported
and the transaction has been rolled back.
2018-03-15 19:48:29 +02:00
Marko Mäkelä
723f87e9d3 lock_table_create(), lock_rec_create(): Clean up the WSREP code
By definition, c_lock->trx->lock.wait_lock==c_lock cannot hold.
That is, the owner transaction of a lock cannot be waiting for that
particular lock. It must have been waiting for some other lock.
Remove the dead code related to that. Also, test c_lock for NULLness
only once.
2018-03-15 19:44:24 +02:00
Marko Mäkelä
a54abf0175 innobase_kill_query(): Use lock_trx_handle_wait()
The caller of THD::awake() should never hold any InnoDB mutexes,
so we can always acquire lock_sys->mutex and trx->mutex.
2018-03-15 19:44:24 +02:00
Jan Lindström
4d248974e0
Merge pull request #663 from codership/MDEV-13549-fixes-for-galera_var_slave_threads
MDEV-13549 Fix and re-enable test galera.galera_var_slave_threads
2018-03-15 17:28:08 +02:00