Commit graph

179838 commits

Author SHA1 Message Date
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
Daniele Sciascia
ba6cf25396 MDEV-13549 Fix and re-enable test galera.galera_var_slave_threads
Two changes were made to the test:

1) Suppress warning "Refusing exit for the last slave thread."
   This warning was already suppressed, but on the wrong node.

2) The test occasionally fails because it expects that the
   number of applier threads changes immediately after
   changing the value of ```variable wsrep_slave_threads```.
   Which is not true. This patch turns snippets like this:

   ```
   SET GLOBAL wsrep_slave_threads = x;
   SELECT COUNT(*) = x FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
   ```

   Into proper wait_conditions:

   ```
   SET GLOBAL wsrep_slave_threads = x;
   let $wait_condition = SELECT COUNT(*) = x FROM ...;
   --source include/wait_condition.inc
   ```
2018-03-15 16:03:25 +01:00
Thirunarayanan Balathandayuthapani
8c8028ca68 MDEV-15384 buf_flush_LRU_list_batch() always reports n->flushed=0, n->evicted=0
- Work around for MDEV-13942: Drop spatial index to avoid possible hang
2018-03-15 19:15:09 +05:30
Jan Lindström
be3651b700
Merge pull request #649 from codership/10.2-MDEV-15540
MDEV-15540 fix for MTR tests using wsrep_recover.inc
2018-03-15 13:59:22 +02:00
Jan Lindström
1bec0c4595
Merge pull request #650 from codership/MDEV-14144
MDEV-14144 Fix for MTR tests complaining "Query didn't return a result set"
2018-03-15 13:58:46 +02:00
Jan Lindström
c7c52ef1e8
Merge branch '10.1' into MDEV-14144 2018-03-15 13:58:14 +02:00
Jan Lindström
de3725a7db
Merge pull request #654 from codership/MDEV-13549-fixes-for-galera_var_max_ws_rows
MDEV-13549 Fix for test galera.galera_var_max_ws_rows
2018-03-15 13:57:31 +02:00
Jan Lindström
59c313c698
Merge branch '10.1' into MDEV-13549-fixes-for-galera_var_max_ws_rows 2018-03-15 13:57:01 +02:00
Jan Lindström
866ddbec25
Merge pull request #656 from codership/MDEV-13549-fixes-for-MW-366
MDEV-13549 Fix and re-enable MTR test galera.MW-366
2018-03-15 13:54:50 +02:00
Jan Lindström
ff172467ec
Merge pull request #659 from codership/MDEV-13549-fixes-for-galera_bf_abort_for_update
MDEV-13549 Fix and re-enable test galera.galera_bf_abort_for_update
2018-03-15 12:55:03 +02:00
Jan Lindström
047abdac3e
Merge pull request #653 from codership/MDEV-13549-fixes-for-MW-286
MDEV-13549 Fix and re-enable test galera.MW-286
2018-03-15 12:52:41 +02:00
Daniele Sciascia
0368e75a55 MDEV-13549 Re-enable tests MW-328A, MW-328B, MW-328C and MW-329
These tests were also subject to error "Wrong usage of mutex
'LOCK_wsrep_thd' and 'LOCK_thd_kill'".
2018-03-15 11:36:36 +01:00
Daniel Black
8b54c31486 MDEV-8743: where O_CLOEXEC is available, use for innodb buf_dump
As this is the only moderately critical fopened for writing file,
create an alternate path to use open and fdopen for non-glibc platforms
that support O_CLOEXEC (BSDs).

Tested on Linux (by modifing the GLIBC defination) to take this
alternate path:

$ cd /proc/23874
$ more fdinfo/71
pos:    0
flags:  02100001
mnt_id: 24
$ ls -la fd/71
l-wx------. 1 dan dan 64 Mar 14 13:30 fd/71 -> /dev/shm/var_auto_i7rl/mysqld.1/data/ib_buffer_pool.incomplete
2018-03-15 12:07:43 +02:00
Alexander Barkov
efb9dec2b9 A 32bit cleanup for MDEV-14452 Precision in INTERVAL xxx DAY_MICROSECOND parsed wrong?
"mtr func_date_add" failed on 32-bit platforms. Removing a wrong case to "long".
Both values[] and log_10_int[] are arrays of "ulonglong", no cast is needed.
2018-03-15 10:23:42 +04:00
Vicențiu Ciorbaru
8152c52e1a Merge remote-tracking branch '10.0' into 10.1 2018-03-15 03:45:28 +02:00
Vladislav Vaintroub
0943b33de3 MDEV-12190 YASSL isn't able to negotiate TLS version correctly
Backport from 10.2
2018-03-14 14:35:27 +00:00
Sergei Golubchik
27d94b7e03 cleanup: remove get_datetime_value() 2018-03-14 12:45:46 +01:00
Sergei Golubchik
42529c4341 MDEV-15141 Check constraint validation on a datetime field crashes the process
add the test case (the bug was fixed in d390e501eb)
2018-03-14 12:45:41 +01:00
Sergei Golubchik
d390e501eb MDEV-11839 move value caching from get_datetime_value to fix_fields time
Refactor get_datetime_value() not to create Item_cache_temporal(),
but do it always in ::fix_fields() or ::fix_length_and_dec().

Creating items at the execution time doesn't work very well with
virtual columns and check constraints that are fixed and executed
in different THDs.
2018-03-14 12:45:28 +01:00
Sergei Golubchik
1c6f6dc892 bugfix: Item_cache_temporal::convert_to_basic_const_item assumed DATETIME
while it should look at the actual field_type() and use get_date()
or get_time() as appropriate.

test case is in the following commit.
2018-03-14 12:40:01 +01:00
Sergei Golubchik
885edc4fa5 bugfix: Item_cache_temporal::get_date() didn't set null_value 2018-03-14 12:40:01 +01:00
Sergei Golubchik
622115ee07 cleanup: extend Item_cache::get_cache() to accept f_type
Do not assume that it's always item->field_type() - this is not the case
in temporal comparisons (e.g. when comparing DATETIME column with a TIME
literal).
2018-03-14 12:40:00 +01:00
Sergei Golubchik
24d6cd7d62 cleanup: Arg_comparator::cache_converted_constant()
It's a generic function, not using anything from Arg_comparator.
Make it a static function, not a class method, to be able to use
it later without Arg_comparator
2018-03-14 12:40:00 +01:00
Sergei Golubchik
c2671e97a3 cleanup: make find_date_time_item() static 2018-03-14 12:40:00 +01:00
Sergei Golubchik
e0d3d4059f cleanup: add Item::convert_time_to_datetime() helper
will be used in following commits
2018-03-14 12:40:00 +01:00
Sergei Golubchik
75ac5789b4 cleanup: typos, comments, whitespace 2018-03-14 12:40:00 +01:00
Sergei Golubchik
bf1ca14ff3 cleanup: Item_func_case
reorder items in args[] array. Instead of

  when1,then1,when2,then2,...[,case][,else]

sort them as

  [case,]when1,when2,...,then1,then2,...[,else]

in this case all items used for comparison take a continuous part
of the array and can be aggregated directly. and all items that
can be returned take a continuous part of the array and can be
aggregated directly. Old code had to copy them to a temporary
array before aggreation, and then copy back (thd->change_item_tree)
everything that was changed.
2018-03-14 12:40:00 +01:00
Timo Teräs
782fb1e016 fix ucontext configure check
musl ships the header for other purposes, but makecontext is not
implemented. fix the check to detect if makecontext is implemented
before enabling code using it.
2018-03-14 15:16:03 +04:00
Alexander Barkov
38579cefa9 MDEV-14452 Precision in INTERVAL xxx DAY_MICROSECOND parsed wrong? 2018-03-14 14:46:23 +04:00
Vicențiu Ciorbaru
3d5dff6cae Merge branch '5.5' into 10.0 2018-03-14 12:10:31 +02:00
Daniele Sciascia
9a21fd34af MDEV-13549 Re-enable test galera.galera_bf_abort_for_update
Test passes reliably after applying missing commit from upstream.
2018-03-14 10:27:31 +01:00
Vasil Dimov
fe66f766bb Fix and enable galera.galera_bf_abort_for_update
The test was not deterministic as it would not wait for the second
INSERT to be applied (and thus the victim transaction rolled back).
2018-03-14 10:26:02 +01:00
Jan Lindström
930682c487
Merge pull request #636 from grooverdan/10.0-galera-MDEV-8743-linux-aio-ib_logfile0
MDEV-8743: ib_logfile0 Use O_CLOEXEC so galera SST scripts don't get fd
2018-03-14 09:38:04 +02:00
Thirunarayanan Balathandayuthapani
c14733f64e MDEV-14545 Backup fails due to MLOG_INDEX_LOAD record
- Fixing the windows failure of unsupported_redo test case.
mariabackup --tables-exclude option only restricts ibd file.
2018-03-14 11:57:45 +05:30
Jacob Mathew
e452546c45 Merge branch 'bb-10.2-MDEV-14019' into 10.2 2018-03-13 16:40:14 -07:00
Jacob Mathew
1b82bec3c9 Merge branch '10.2' into bb-10.2-MDEV-14019 2018-03-13 16:15:37 -07:00
Daniele Sciascia
9953588ac4 MDEV-13549 Fix and re-enable MTR test galera.MW-366
Test galera.MW-366 is not deterministic and depends on timing assumptions.
The test occasionally fails after checking the number of 'system user'
processes in processlist after changing the value of variable global
wsrep_slave_threads, like this:
```
SET GLOBAL wsrep_slave_threads = x;
--sleep 0.5
SELECT COUNT(*) = x FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
```

The problem is that the number of slave threads is internally adjusted
'asynchronously', and it may take some time to spawn/kill new threads,
especially in a heavily loaded system.

This patch removes the '--sleep 0.5' statements from the test and replaces
those with appropriate wait conditions, like this:
```
SET GLOBAL wsrep_slave_threads = x;
let $wait_condition = SLECT COUNT(*) = x FROM ...;
--source include/wait_condition.inc
```
2018-03-13 14:27:44 +01:00
Sergey Vojtovich
649b7a64ef MDEV-9592 - New 'Normal shutdown' log format can be confusing
Elaborate shutdown message.
2018-03-13 15:53:19 +04:00
Andrei Elkin
30019a48bf MDEV-12746 rpl.rpl_parallel_optimistic_nobinlog fails committing
out of order at retry

The test failures were of two sorts. One is that the number of retries
what the slave thought as a temporary error exceeded
the default value of the slave retry option.
The 2nd issue was an out of order commit by transactions that
were supposed to error out instead.
Both issues are caused by the same reason that the post-temporary-error
retry did not check possibly already existing error status.

This is mended with refining conditions to retry. Specifically, a retrying
worker checks `rpl_parallel_entry::stop_on_error_sub_id` that
a potential failing predecessor could set to its own sub id.
Now should the member be set the retrying follower errors out with
ER_PRIOR_COMMIT_FAILED.
2018-03-13 12:46:07 +02:00
Daniele Sciascia
9ee39d2b9b MDEV-13549 Fix for test galera.galera_var_max_ws_rows
This patch re-enables test galera.galera_var_max_ws_rows.
The test did not work because there were two distinct places where
the server was incrementing member THD::wsrep_affected_rows before
enforcing wsrep_max_ws_rows. Essentially, the test would fail because
every inserted row was counted twice.
The patch removes the extra code.
2018-03-13 11:21:28 +01:00
Thirunarayanan Balathandayuthapani
76ae6e725d MDEV-15384 buf_flush_LRU_list_batch() always reports n->flushed=0, n->evicted=0
- buf_flush_LRU_list_batch() initializes the count to zero and updates them
correctly.
2018-03-13 15:25:38 +05:30
Thirunarayanan Balathandayuthapani
ff909acfa4 MDEV-14545 Backup fails due to MLOG_INDEX_LOAD record
Problem:
=======
  Mariabackup exits during prepare phase if it encounters
MLOG_INDEX_LOAD redo log record. MLOG_INDEX_LOAD record
informs Mariabackup that the backup cannot be completed based
on the redo log scan, because some information is purposely
omitted due to bulk index creation in ALTER TABLE.

Solution:
========
Detect the MLOG_INDEX_LOAD redo record during backup phase and
exit the mariabackup with the proper error message.
2018-03-13 15:25:38 +05:30
Alexander Barkov
48c11d407b MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime 2018-03-13 12:42:41 +04:00
Marko Mäkelä
94e00da9f1 Merge 10.1 into 10.2 2018-03-13 09:43:13 +02:00
Marko Mäkelä
71f9cc1221 MDEV-15554 InnoDB page_cleaner shutdown sometimes hangs
buf_flush_page_cleaner_coordinator(): Signal the worker threads
to exit while waiting for them to exit. Apparently, signals are
sometimes lost, causing shutdown to occasionally hang when
multiple page cleaners (and buffer pool instances) are used,
that is, when innodb_buffer_pool_size is at least 1 GiB.

buf_flush_page_cleaner_close(): Merge with the only caller.
2018-03-13 09:41:42 +02:00